Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertex indices seem invalid when using indexed indirect draw with tessellation #2376

Open
tomaka opened this issue Oct 13, 2024 · 0 comments

Comments

@tomaka
Copy link

tomaka commented Oct 13, 2024

Here's my situation:
I have a draw call that uses tessellation shaders. Everything is working.
If I write the VkDrawIndirectCommand corresponding to my call to a buffer, and replace vkCmdDrawIndexed with vkCmdDrawIndexedIndirect pointing to this buffer, the object no longer renders.

Debugging with XCode shows that my indirect buffer indeed contains the correct data. The problem comes from the fact that all the elements in the geometry of the object (the tessellation evaluation shader input) are identical.

Digging a bit into what MoltenVK is doing, it seems that it's because the MVK-injected compute shader that executes cmdDrawIndexedCopyIndex32Buffer has a workgroup size of 0, and thus all the indices in the index buffer remain at their initial value of 0, and thus the MVK-injected compute shader that later generates the tessellation evaluation shader input repeatedly copies vertex element 0 over the entire vertex data.

I have the impression that this workgroup size is supposed to be written here. However, destVTX points to offset 12 of destBuf, while the shader that executes cmdDrawIndexedCopyIndex32Buffer later reads its indirect calls from offset 0 of that same buffer. Offset 0 is where destSI is located.
Maybe I'm misunderstanding what MoltenVK is doing here, but I suspect that there's a bug somewhere with these offsets and that the workgroup size is supposed to read from destVTX?

MoltenVK version: 1.2.11

@tomaka tomaka changed the title Vertex indices seem invalid when using indexed draw with tessellation Vertex indices seem invalid when using indexed indirect draw with tessellation Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant