LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: How do you use cmdExecuteCommands PointerBuffer argument?  (Read 63 times)

bcbradle

  • Newbie
  • *
  • Offline Offline
  • Posts: 14

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?
Logged

darkyellow

  • Newbie
  • *
  • Offline Offline
  • Posts: 11
Logged

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1786
Re: How do you use cmdExecuteCommands PointerBuffer argument?
« Reply #2 on: May 19, 2017, 07:18:55 »

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:

Code: [Select]
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);
}
Logged