Hello,
I am running into a bizarre issue. I am rendering a bunch of cubes by expanding points in the geometry shader. My input topology is POINT_LIST. I am using a dynamic usage vertex buffer which is updated every frame. The vertex shader is basically pass through. The geometry shader then expands the point into a cube. What I am observing is that everything is rendering properly except the FIRST point / cube in the list.
I have run the graphics debugger from VS2019 and examined a frame. Looking at the actual vertex buffer for a given frame, it does contain the proper data (including the missing point in the proper location). However, when I then debug the vertex shader, the first point I see is actually the second point in the list. And from my understanding, the shader debugger only shows the first invocation of each shader, so I should be seeing that first point instead.
I then went one step further and downloaded nvidia nsight. From there I am seeing the same thing: the vertex buffer has all the right data. The input assembler however, is skipping the first point! It is even reading beyond the end of the vertex buffer by 1, resulting in a single garbage vertex...
I have tried adding a dummy point as the first point, and everything renders fine... but I'm not happy with that hack.
So, my question is, is there anything other way I can go about debugging this? Anything specific I should look for?
For reference, here are my actual rendering calls:
uint stride = sizeof(VoxelVertex);
uint offset = 0;
context->VSSetShader(vs, NULL, 0);
context->GSSetShader(gs, NULL, 0);
context->PSSetShader(ps, NULL, 0);
context->IASetInputLayout(layout);
context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
context->IASetVertexBuffers(0, 1, &vb, &stride, &offset);
context->VSSetConstantBuffers(0, 2, constantBuffers);
context->GSSetConstantBuffers(0, 2, constantBuffers);
context->PSSetConstantBuffers(0, 2, constantBuffers);
context->Draw(vertexCount, 0);