create command pool

This commit is contained in:
IlyaShurupov 2024-11-08 15:18:46 +03:00
parent 9526b75117
commit 3ab6e008cc

View file

@ -59,6 +59,8 @@ private:
createGraphicsPipeline();
createSwapChainFramebuffers();
createCommandPool();
}
void mainLoop() {
@ -656,7 +658,25 @@ private:
return buffer;
}
void createCommandPool() {
VkCommandPoolCreateInfo createInfo {
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
.queueFamilyIndex = mGraphicsQueueFamilyIndex,
};
if (vkCreateCommandPool(mDevice, &createInfo, nullptr, &mCommandPool) != VK_SUCCESS) {
throw std::runtime_error("failed to create command pool");
}
}
void destroyCommandPool() {
vkDestroyCommandPool(mDevice, mCommandPool, nullptr);
}
void cleanup() {
destroyCommandPool();
destroySwapChainFramebuffers();
vkDestroyRenderPass(mDevice, mGraphicsRenderPass, nullptr);
@ -698,6 +718,8 @@ private:
VkShaderModule mShaderModuleFrag = VK_NULL_HANDLE;
VkRenderPass mGraphicsRenderPass = VK_NULL_HANDLE;
VkPipelineLayout mGraphicsPipelineLayout {}; // no uniforms used in the shader
VkCommandPool mCommandPool = VK_NULL_HANDLE;
};
int main() {