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
Problem
The DXMT D3D10 wrapper appears to forward the wrong argument when mapping
MTLD3D10Device::DrawIndexedInstancedto the underlying D3D11 context.Current code passes
StartIndexLocationtwice:d3d11_context_->DrawIndexedInstanced( IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartIndexLocation );The final argument should be the D3D10 call's
StartInstanceLocationparameter.Impact
D3D10 indexed instanced draws with a non-zero
StartInstanceLocationcan 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
StartInstanceLocationas 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