Browse Source

Fix Vulkan descriptor pool count (#1422)

Allocates the correct amount of UBOs and Image Samplers ahead of time.
Wunk 7 months ago
parent
commit
9864e8719a
1 changed files with 8 additions and 5 deletions
  1. 8 5
      TestFramework/Renderer/VK/RendererVK.cpp

+ 8 - 5
TestFramework/Renderer/VK/RendererVK.cpp

@@ -377,13 +377,16 @@ void RendererVK::Initialize()
 	FatalErrorIfFailed(vkCreatePipelineLayout(mDevice, &pipeline_layout, nullptr, &mPipelineLayout));
 
 	// Create descriptor pool
-	VkDescriptorPoolSize descriptor_pool_size = {};
-	descriptor_pool_size.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
-	descriptor_pool_size.descriptorCount = cFrameCount;
+	VkDescriptorPoolSize descriptor_pool_sizes[] = {
+		// ubo_layout_binding * (Projection + Ortho)
+		VkDescriptorPoolSize{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, cFrameCount * (2 * 2)},
+		// texture_layout_binding * (Main Render Targets + DebugUI)
+		VkDescriptorPoolSize{VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, cFrameCount * (1 * 2)},
+	};
 	VkDescriptorPoolCreateInfo descriptor_info = {};
 	descriptor_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
-	descriptor_info.poolSizeCount = 1;
-	descriptor_info.pPoolSizes = &descriptor_pool_size;
+	descriptor_info.poolSizeCount = std::size(descriptor_pool_sizes);
+	descriptor_info.pPoolSizes = descriptor_pool_sizes;
 	descriptor_info.maxSets = 256;
 	FatalErrorIfFailed(vkCreateDescriptorPool(mDevice, &descriptor_info, nullptr, &mDescriptorPool));