src/core/VulkanDevice.cpp
VkCommandBuffer VulkanDevice::createCommandBuffer(VkCommandBufferLevel level, VkCommandPool pool, bool begin) {
    VkCommandBufferAllocateInfo cmdBufAllocateInfo = Populate::commandBufferAllocateInfo(pool, level, 1);
    VkCommandBuffer cmdBuffer;
    if (vkAllocateCommandBuffers(logicalDevice, &cmdBufAllocateInfo, &cmdBuffer) != VK_SUCCESS)
        throw std::runtime_error("Failed to allocate command buffers");
    // If requested, also start recording for the new command buffer
    if (begin) {
        VkCommandBufferBeginInfo cmdBufInfo = Populate::commandBufferBeginInfo();
        if (vkBeginCommandBuffer(cmdBuffer, &cmdBufInfo) != VK_SUCCESS)
            throw std::runtime_error("Failed to begin command buffer");
    }
    return cmdBuffer;
}
/**
* Allocate a command buffer from the command pool
*
* @param level Level of the new command buffer (primary or secondary)
* @param pool Command pool from which the command buffer will be allocated
* @param (Optional) begin If true, recording on the new command buffer will be started (vkBeginCommandBuffer) (Defaults to false)
*
* @return A handle to the allocated command buffer
*/
Allocate a command buffer from the command pool
Allocate a command buffer from the command pool
VkCommandBuffer VulkanDevice::createCommandBuffer(VkCommandBufferLevel level, VkCommandPool pool, bool begin) {
    VkCommandBufferAllocateInfo cmdBufAllocateInfo = Populate::commandBufferAllocateInfo(pool, level, 1);
    VkCommandBuffer cmdBuffer;
    if (vkAllocateCommandBuffers(logicalDevice, &cmdBufAllocateInfo, &cmdBuffer) != VK_SUCCESS)
        throw std::runtime_error("Failed to allocate command buffers");
    if (begin) {
        VkCommandBufferBeginInfo cmdBufInfo = Populate::commandBufferBeginInfo();
        if (vkBeginCommandBuffer(cmdBuffer, &cmdBufInfo) != VK_SUCCESS)
            throw std::runtime_error("Failed to begin command buffer");
    }
    return cmdBuffer;
}
VkCommandBuffer VulkanDevice :: createCommandBuffer ( VkCommandBufferLevel level , VkCommandPool pool , bool begin ) { VkCommandBufferAllocateInfo cmdBufAllocateInfo = Populate :: commandBufferAllocateInfo ( pool , level , 1 ) ; VkCommandBuffer cmdBuffer ; if ( vkAllocateCommandBuffers ( logicalDevice , & cmdBufAllocateInfo , & cmdBuffer ) != VK_SUCCESS ) throw std :: runtime_error ( " " ) ; if ( begin ) { VkCommandBufferBeginInfo cmdBufInfo = Populate :: commandBufferBeginInfo ( ) ; if ( vkBeginCommandBuffer ( cmdBuffer , & cmdBufInfo ) != VK_SUCCESS ) throw std :: runtime_error ( " " ) ; } return cmdBuffer ; }
Allocate a command buffer from the command pool
Allocate a command buffer from the command pool
// If requested, also start recording for the new command buffer