create command pool
This commit is contained in:
parent
9526b75117
commit
3ab6e008cc
1 changed files with 22 additions and 0 deletions
22
main.cpp
22
main.cpp
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue