Search in sources :

Example 21 with VkCommandBuffer

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);
}
Also used : VkCommandBufferAllocateInfo(org.lwjgl.vulkan.VkCommandBufferAllocateInfo) VkCommandBuffer(org.lwjgl.vulkan.VkCommandBuffer) PointerBuffer(org.lwjgl.PointerBuffer)

Aggregations

PointerBuffer (org.lwjgl.PointerBuffer)21 VkCommandBuffer (org.lwjgl.vulkan.VkCommandBuffer)21 VkCommandBufferAllocateInfo (org.lwjgl.vulkan.VkCommandBufferAllocateInfo)14 VkCommandBufferBeginInfo (org.lwjgl.vulkan.VkCommandBufferBeginInfo)14 LongBuffer (java.nio.LongBuffer)13 IntBuffer (java.nio.IntBuffer)7 GLFWKeyCallback (org.lwjgl.glfw.GLFWKeyCallback)7 VkClearValue (org.lwjgl.vulkan.VkClearValue)7 VkDebugReportCallbackEXT (org.lwjgl.vulkan.VkDebugReportCallbackEXT)7 VkDevice (org.lwjgl.vulkan.VkDevice)7 VkImageMemoryBarrier (org.lwjgl.vulkan.VkImageMemoryBarrier)7 VkInstance (org.lwjgl.vulkan.VkInstance)7 VkPhysicalDevice (org.lwjgl.vulkan.VkPhysicalDevice)7 VkPresentInfoKHR (org.lwjgl.vulkan.VkPresentInfoKHR)7 VkQueue (org.lwjgl.vulkan.VkQueue)7 VkRect2D (org.lwjgl.vulkan.VkRect2D)7 VkRenderPassBeginInfo (org.lwjgl.vulkan.VkRenderPassBeginInfo)7 VkSemaphoreCreateInfo (org.lwjgl.vulkan.VkSemaphoreCreateInfo)7 VkSubmitInfo (org.lwjgl.vulkan.VkSubmitInfo)7 VkViewport (org.lwjgl.vulkan.VkViewport)7