diff options
author | tylermurphy534 <tylermurphy534@gmail.com> | 2022-09-29 18:11:53 -0400 |
---|---|---|
committer | tylermurphy534 <tylermurphy534@gmail.com> | 2022-09-29 18:11:53 -0400 |
commit | 915469e0f3467022f7fd3541350b04b8668d20f7 (patch) | |
tree | 19faf29890e88b8f7b21b401d8e1c5ddad9b0259 /engine/xe_render_system.cpp | |
parent | temporray descriptor pool memory patch (diff) | |
download | minecraftvulkan-915469e0f3467022f7fd3541350b04b8668d20f7.tar.gz minecraftvulkan-915469e0f3467022f7fd3541350b04b8668d20f7.tar.bz2 minecraftvulkan-915469e0f3467022f7fd3541350b04b8668d20f7.zip |
descriptor pool final fix
Diffstat (limited to '')
-rw-r--r-- | engine/xe_render_system.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/engine/xe_render_system.cpp b/engine/xe_render_system.cpp index 1ceff78..770bfd5 100644 --- a/engine/xe_render_system.cpp +++ b/engine/xe_render_system.cpp @@ -15,11 +15,11 @@ RenderSystem::RenderSystem( uint32_t vertexSize ) : xeDevice{xeEngine.xeDevice}, xeRenderer{xeEngine.xeRenderer}, - xeDescriptorPool{xeEngine.xeDescriptorPool}, pushCunstantDataSize{pushCunstantDataSize}, uniformBindings{uniformBindings}, imageBindings{imageBindings}, imageArrayBindings{imageArrayBindings} { + createDescriptorPool(); createDescriptorSetLayout(); createUniformBuffers(); createDescriptorSets(); @@ -31,6 +31,18 @@ RenderSystem::~RenderSystem() { vkDestroyPipelineLayout(xeDevice.device(), pipelineLayout, nullptr); }; +void RenderSystem::createDescriptorPool() { + DescriptorPool::Builder builder{xeDevice}; + builder.setMaxSets(SwapChain::MAX_FRAMES_IN_FLIGHT); + builder.addPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, uniformBindings.size() * SwapChain::MAX_FRAMES_IN_FLIGHT); + uint32_t images = imageBindings.size(); + for ( const auto &[binding, size]: imageArrayBindings) { + images += size.size(); + } + builder.addPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, images * SwapChain::MAX_FRAMES_IN_FLIGHT); + xeDescriptorPool = builder.build(); +} + void RenderSystem::createDescriptorSetLayout() { DescriptorSetLayout::Builder builder{xeDevice}; |