Skip to content

DXMT D3D10 DrawIndexedInstanced forwards StartIndexLocation as StartInstanceLocation #760

Description

@moreaki

Problem

The DXMT D3D10 wrapper appears to forward the wrong argument when mapping MTLD3D10Device::DrawIndexedInstanced to the underlying D3D11 context.

Current code passes StartIndexLocation twice:

d3d11_context_->DrawIndexedInstanced(
    IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartIndexLocation
);

The final argument should be the D3D10 call's StartInstanceLocation parameter.

Impact

D3D10 indexed instanced draws with a non-zero StartInstanceLocation can use the start-index value as the instance-base value. That can make instance ID based shader inputs and per-instance vertex data selection incorrect.

Proposed fix

Forward StartInstanceLocation as the final argument:

d3d11_context_->DrawIndexedInstanced(
    IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation
);

I will submit a one-line pull request for this.

Upstream DXMT tracking

The same issue is also tracked in the upstream DXMT project:

The VirtualBox pull request remains the corresponding fix for VirtualBox's bundled DXMT copy.

Signed-off-by: Roberto Nibali rnibali@gmail.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions