weird instancing problem with directX11 under 64 bits

benualdo

Newcomer
Hi,
I'm having a very strange issue and I was wondering if anyone else already has experienced the same problem.

I'm using DrawIndexedInstanced to render multiples instances of a mesh. The code is running fine under DX11 32 bits but when running under 64 bits (on the same computer, just different exe) then instancing is not working : all instances use the values of the 1st instance, as if the instanceDataStepRate (=1) was simply ignored.

I checked what's happening using PIX and GPA and what makes me mad is that the API calls and buffer contents are EXACTLY the same.

- If I check the stream declaration, it is ok in both cases (32 and 64 bits exe)
- If I check the instance buffer content, the content is exactly the same (with different per-instance data)
- But when I check the "Post-VS" values, then it looks like all the instances have been using the instance data of the first instance!!!

I need to test it on other computers to check if it is a driver problem but anyone has already experienced such a problem???
 
I just found a workarounf but still does not understand this issue :

* If I set all VB at once with only one call to IASetVertexBuffer then it does not work ONLY if running the 64 bits version of the exe

for (int i = 0; i < 16; ++i)
{
buffer = ...
}
m_context->IASetVertexBuffers(0, 16, (ID3D11Buffer * const *)buffer, (const UINT *)&stride, (const UINT *)&offset);

* But if I set the VB "one by one" then it WORKS

for (int i = 0; i < 16; ++i)
{
m_context->IASetVertexBuffers(i, 1, (ID3D11Buffer * const *)buffer, (const UINT *)&stride, (const UINT *)&offset);
}

... weird ...
 
Actually I have found the origin of the bug : sizeof(UINT) == 4 but I was using a 64 bit type to build the offset and stride array, thus the VB stride was 0 instead of sizeof(instanceData)...
 
Back
Top