private 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: " + VKUtil.translateVulkanResult(err)); } return new VkCommandBuffer(commandBuffer, device); }
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); }
private static VkCommandBuffer createCommandBuffer(VkDevice device, long commandPool) { VkCommandBufferAllocateInfo cmdBufAllocateInfo = VkCommandBufferAllocateInfo.callocStack() .sType(VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO) .commandPool(commandPool) .level(VK_COMMAND_BUFFER_LEVEL_PRIMARY) .commandBufferCount(1); PointerBuffer pCommandBuffer = stackMallocPointer(1); int err = vkAllocateCommandBuffers(device, cmdBufAllocateInfo, pCommandBuffer); long commandBuffer = pCommandBuffer.get(0); if (err != VK_SUCCESS) { throw new AssertionError("Failed to allocate command buffer: " + translateVulkanResult(err)); } return new VkCommandBuffer(commandBuffer, device); }