Variable vertex count

Hi, I’m trying to adapt Google’s spinning cube.cpp to use drawIndirect instead of draw, so I can specify a variable number of triangles each frame.

Mirroring the uniform buffer code, I’ve:

[ul]
[li]Added a Buffer and DeviceMemory to SwapchainImageResources for the indirect draw params.[/li][li]Created a struct to represent VkDrawIndirectCommand containing four unsigned shorts.[/li][li]Mirrored prepare_cube_data_buffers, using eIndirectBuffer instead of eUniformBuffer.[/li][li]Mirrored update_data_buffer to set the draw params data.[/li][LIST]
[li]vertex_count = 12 * 3, instance_count = 1[/li][/ul]

[li]Replaced the call to draw with[/li][ul]
[li]commandBuffer.drawIndirect(mSwapchainImageResources[mCurrentImageIndex].draw_params_buffer, 0, 1, 0);[/li][/ul]
[/LIST]

I haven’t mirrored prepare_descriptor_set, because I don’t think the shader needs access (assuming that’s what it’s for).

The problem is, when I switch from calling draw to drawIndirect, nothing gets drawn. I see no error messages, although I’m not entirely sure where to look. I’ve included --validate in the debug params and checked the code goes into the VK_LAYER_LUNARG_standard_validation bit, but I’m not sure how to tell if it’s detecting a problem.

Any advice would be greatly appreciated as I’ve spent a long time struggling to find useful resources on this specific use case. This is for a planetary terrain hobby project, evolved from this old terrain project, which I hope to use in a game.

Oh I’m so sorry to have wasted anyone’s time, I didn’t need to make a struct to represent VkDrawIndirectCommand and in my embarassing C++ rustiness I shouldn’t have used shorts, but ints!
It’s drawing now.