use of org.lwjgl.vulkan.VkCommandBuffer in project lwjgl3-demos by LWJGL.
the class ColoredTriangleDemo method createCommandBuffer.
private static VkCommandBuffer createCommandBuffer(VkDevice device, long commandPool) {
VkCommandBufferAllocateInfo cmdBufAllocateInfo = VkCommandBufferAllocateInfo.calloc().sType(VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO).commandPool(commandPool).level(VK_COMMAND_BUFFER_LEVEL_PRIMARY).commandBufferCount(1);
PointerBuffer pCommandBuffer = memAllocPointer(1);
int err = vkAllocateCommandBuffers(device, cmdBufAllocateInfo, pCommandBuffer);
cmdBufAllocateInfo.free();
long commandBuffer = pCommandBuffer.get(0);
memFree(pCommandBuffer);
if (err != VK_SUCCESS) {
throw new AssertionError("Failed to allocate command buffer: " + translateVulkanResult(err));
}
return new VkCommandBuffer(commandBuffer, device);
}
Aggregations