How do you use cmdExecuteCommands PointerBuffer argument?

Started by bcbradle, May 19, 2017, 02:35:09

Previous topic - Next topic

bcbradle

Its a PointerBuffer, and yet the idiomatic way to use vulkan's VkCommandBuffer is with a VkCommandBuffer object. How do I derive a PointerBuffer from a collection of VkCommandBuffer objects?


spasi

First of all, vkCmdExecuteCommands is used to record secondary command buffers to execute as part of a primary command buffer. This is fairly advanced functionality, but if it's indeed what you want to do:

try (MemoryStack stack = stackPush()) {
    PointerBuffer secondaryCmdBuffers = stack.mallocPointer(count);

    // Fill secondaryCmdBuffers with command buffer handles.
    // You can simply use secondaryCmdBuffers.put(i, cmd_buffer_instance);

    vkCmdExecuteCommands(primaryCmdBuffer, secondaryCmdBuffers);
}