From 07e8b4ff1aefdf5108dc21d20d1f109f6eedc8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 26 Oct 2017 00:55:09 +0200 Subject: [PATCH] Bump descriptor set limits, which became insufficient with the addition of tesselation (should really use separate big desc layouts for them) --- GPU/Vulkan/DrawEngineVulkan.cpp | 10 ++++++---- ext/native/thin3d/VulkanRenderManager.cpp | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index 3d326d7556..80245e4282 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -126,7 +126,8 @@ void DrawEngineVulkan::InitDeviceObjects() { bindings[4].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; bindings[4].stageFlags = VK_SHADER_STAGE_VERTEX_BIT; bindings[4].binding = DRAW_BINDING_DYNUBO_BONE; - // Hardware tessellation + // Hardware tessellation. TODO: Don't allocate these unless actually drawing splines. + // Will require additional bindings[5].descriptorCount = 1; bindings[5].pImmutableSamplers = nullptr; bindings[5].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; @@ -152,9 +153,9 @@ void DrawEngineVulkan::InitDeviceObjects() { assert(VK_SUCCESS == res); VkDescriptorPoolSize dpTypes[2]; - dpTypes[0].descriptorCount = 4096; + dpTypes[0].descriptorCount = 8192; dpTypes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; - dpTypes[1].descriptorCount = 2048; + dpTypes[1].descriptorCount = 8192 + 4096; // Due to the tess stuff, we need a LOT of these. Most will be empty... dpTypes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; VkDescriptorPoolCreateInfo dp = { VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO }; @@ -536,7 +537,8 @@ VkDescriptorSet DrawEngineVulkan::GetOrCreateDescriptorSet(VkImageView imageView descAlloc.descriptorPool = frame->descPool; descAlloc.descriptorSetCount = 1; VkResult result = vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); - assert(result == VK_SUCCESS); + // Even in release mode, this is bad. + _assert_msg_(G3D, result == VK_SUCCESS, "Ran out of descriptors in pool. sz=%d", (int)frame->descSets.size()); // We just don't write to the slots we don't care about. VkWriteDescriptorSet writes[7]; diff --git a/ext/native/thin3d/VulkanRenderManager.cpp b/ext/native/thin3d/VulkanRenderManager.cpp index 90881a303e..a6930938b3 100644 --- a/ext/native/thin3d/VulkanRenderManager.cpp +++ b/ext/native/thin3d/VulkanRenderManager.cpp @@ -758,7 +758,11 @@ void VulkanRenderManager::Run(int frame) { res = vkQueuePresentKHR(vulkan_->GetGraphicsQueue(), &present); // TODO: Deal with the VK_SUBOPTIMAL_WSI and VK_ERROR_OUT_OF_DATE_WSI // return codes - assert(res == VK_SUCCESS); + if (res == VK_ERROR_OUT_OF_DATE_KHR) { + // ignore, it'll be fine. this happens sometimes during resizes, and we do make sure to recreate the swap chain. + } else { + assert(res == VK_SUCCESS); + } VLOG("PULL: Finished running frame %d", frame); }