diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 569d7272b8..05f698d30f 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -422,22 +422,14 @@ VKGSRender::VKGSRender() : GSRender(frame_type::Vulkan) std::tie(pipeline_layout, descriptor_layouts) = get_shared_pipeline_layout(*m_device); - VkDescriptorPoolSize uniform_buffer_pool = { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER , 3 }; - VkDescriptorPoolSize uniform_texel_pool = { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER , 16 }; - VkDescriptorPoolSize texture_pool = { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER , 16 }; + VkDescriptorPoolSize uniform_buffer_pool = { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER , 3000 }; + VkDescriptorPoolSize uniform_texel_pool = { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER , 16000 }; + VkDescriptorPoolSize texture_pool = { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER , 16000 }; std::vector sizes{ uniform_buffer_pool, uniform_texel_pool, texture_pool }; descriptor_pool.create(*m_device, sizes.data(), sizes.size()); - VkDescriptorSetAllocateInfo alloc_info = {}; - alloc_info.descriptorPool = descriptor_pool; - alloc_info.descriptorSetCount = 1; - alloc_info.pSetLayouts = &descriptor_layouts; - alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; - - CHECK_RESULT(vkAllocateDescriptorSets(*m_device, &alloc_info, &descriptor_sets)); - null_buffer = std::make_unique(*m_device, 32, m_memory_type_mapping.host_visible_coherent, VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT, 0); null_buffer_view = std::make_unique(*m_device, null_buffer->value, VK_FORMAT_R32_SFLOAT, 0, 32); @@ -479,7 +471,6 @@ VKGSRender::~VKGSRender() m_rtts.destroy(); - vkFreeDescriptorSets(*m_device, descriptor_pool, 1, &descriptor_sets); vkDestroyPipelineLayout(*m_device, pipeline_layout, nullptr); vkDestroyDescriptorSetLayout(*m_device, descriptor_layouts, nullptr); @@ -511,6 +502,17 @@ void VKGSRender::begin() if (!recording) begin_command_buffer_recording(); + VkDescriptorSetAllocateInfo alloc_info = {}; + alloc_info.descriptorPool = descriptor_pool; + alloc_info.descriptorSetCount = 1; + alloc_info.pSetLayouts = &descriptor_layouts; + alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; + + VkDescriptorSet new_descriptor_set; + + CHECK_RESULT(vkAllocateDescriptorSets(*m_device, &alloc_info, &new_descriptor_set)); + + descriptor_sets = new_descriptor_set; init_buffers(); @@ -1251,6 +1253,8 @@ void VKGSRender::flip(int buffer) m_sampler_to_clean.clear(); m_framebuffer_to_clean.clear(); + vkResetDescriptorPool(*m_device, descriptor_pool, 0); + m_draw_calls = 0; dirty_frame = true; m_frame->flip(m_context); diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.h b/rpcs3/Emu/RSX/VK/VKHelpers.h index 974be13c2b..6aad024d7d 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.h +++ b/rpcs3/Emu/RSX/VK/VKHelpers.h @@ -1210,8 +1210,8 @@ namespace vk void create(vk::render_device &dev, VkDescriptorPoolSize *sizes, u32 size_descriptors_count) { VkDescriptorPoolCreateInfo infos = {}; - infos.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT; - infos.maxSets = 2; + infos.flags = 0; + infos.maxSets = 1000; infos.poolSizeCount = size_descriptors_count; infos.pPoolSizes = sizes; infos.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;