I am trying to render a gltf model with ash (vulkan) in rust.
I sent all my data to the gpu and I am seeing this:
Naturally my suspicion is that the normal data is wrong. So I checked with renderdoc:
Those seem ok, maybe the attributes are wrong?
All those normals seem like they add to 1, should be fine. Maybe my pipeline is wrong?
Seems like the correct format and binding (I am sending 3 buffers and binding one to binding 0, one to 1 and the last to 2, binding 1 has the normals).
The only thing I find that is weird is, if I go to the vertex input pipeline stage see the buffers:
This is what the buffer at index 1 shows:
This does not happen for the buffer at index 0 (positions) which also render properly. So Whatever is causing the normals to show up as hex codes here is likely the cause of the bug. But i have no idea why this is happening. As far as I can see the pipeline and buffer were all set properly.






You presumably want to use one separate buffer for each vertex attribute (aka non-interleaved vertex buffer, SoA),
but your
VkVertexInputAttributeDescription::offsetvalues[0, 12, 24]is what you would use for one vertex buffer interleaving all attributes (provided that theirbindingvalues point to one and the sameVkVertexInputBindingDescription).e.g.
Your
VkVertexInputBindingDescription[1].stride==12tells Vulkan that your vertex buffer1uses12bytes for each vertex, and yourVkVertexInputAttributeDescription[1].offset==12says the normal value is at offset 12, which is out of bounds. Same deal with yourVkVertexInputAttributeDescription[2].offset==24overstepping (by a large amount)VkVertexInputBindingDescription[2].stride==12.For using one tightly-packed buffer for each vertex attribute, you need to correctly set your
VkVertexInputAttributeDescription[n].offsetvalues to0, which looks something like:Worth noting is the comment line
// vertex stride 12 less than total data fetched 24generated by RenderDoc in the Buffer Format section, and how it does so.It detects when your vertex attribute description oversteps its binding description's stride: