diff --git a/rpcs3/Emu/RSX/VK/VKCompute.cpp b/rpcs3/Emu/RSX/VK/VKCompute.cpp index e80906616c..13b2928c94 100644 --- a/rpcs3/Emu/RSX/VK/VKCompute.cpp +++ b/rpcs3/Emu/RSX/VK/VKCompute.cpp @@ -119,15 +119,6 @@ namespace vk } } - void compute_task::free_resources() - { - if (m_used_descriptors == 0) - return; - - m_descriptor_pool.reset(0); - m_used_descriptors = 0; - } - void compute_task::load_program(const vk::command_buffer& cmd) { if (!m_program) @@ -155,14 +146,7 @@ namespace vk ensure(m_used_descriptors < VK_MAX_COMPUTE_TASKS); - VkDescriptorSetAllocateInfo alloc_info = {}; - alloc_info.descriptorPool = m_descriptor_pool; - alloc_info.descriptorSetCount = 1; - alloc_info.pSetLayouts = &m_descriptor_layout; - alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; - - CHECK_RESULT(vkAllocateDescriptorSets(*g_render_device, &alloc_info, m_descriptor_set.ptr())); - m_used_descriptors++; + m_descriptor_set = m_descriptor_pool.allocate(m_descriptor_layout, VK_TRUE, m_used_descriptors++); bind_resources(); diff --git a/rpcs3/Emu/RSX/VK/VKCompute.h b/rpcs3/Emu/RSX/VK/VKCompute.h index ec1a9b5f5c..d79f809c57 100644 --- a/rpcs3/Emu/RSX/VK/VKCompute.h +++ b/rpcs3/Emu/RSX/VK/VKCompute.h @@ -44,8 +44,6 @@ namespace vk void create(); void destroy(); - void free_resources(); - virtual void bind_resources() {} virtual void declare_inputs() {} diff --git a/rpcs3/Emu/RSX/VK/VKDraw.cpp b/rpcs3/Emu/RSX/VK/VKDraw.cpp index 1c6a0b9b65..c92b41e609 100644 --- a/rpcs3/Emu/RSX/VK/VKDraw.cpp +++ b/rpcs3/Emu/RSX/VK/VKDraw.cpp @@ -966,11 +966,6 @@ void VKGSRender::end() m_aux_frame_context.grab_resources(*m_current_frame); m_current_frame = &m_aux_frame_context; } - else if (m_current_frame->used_descriptors) - { - m_current_frame->descriptor_pool.reset(0); - m_current_frame->used_descriptors = 0; - } ensure(!m_current_frame->swap_command_buffer); diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index ca9298ecc6..7be922985a 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -1322,13 +1322,10 @@ void VKGSRender::check_descriptors() { // Ease resource pressure if the number of draw calls becomes too high or we are running low on memory resources const auto required_descriptors = rsx::method_registers.current_draw_clause.pass_count(); - if (!m_current_frame->descriptor_pool.can_allocate(required_descriptors, m_current_frame->used_descriptors)) + if (!m_current_frame->descriptor_pool.can_allocate(required_descriptors, 0)) { // Should hard sync before resetting descriptors for spec compliance flush_command_queue(true); - - m_current_frame->descriptor_pool.reset(0); - m_current_frame->used_descriptors = 0; } } @@ -1336,7 +1333,7 @@ VkDescriptorSet VKGSRender::allocate_descriptor_set() { if (!m_shader_interpreter.is_interpreter(m_program)) [[likely]] { - return m_current_frame->descriptor_pool.allocate(descriptor_layouts, VK_TRUE, m_current_frame->used_descriptors++); + return m_current_frame->descriptor_pool.allocate(descriptor_layouts, VK_TRUE, 0); } else { diff --git a/rpcs3/Emu/RSX/VK/VKGSRenderTypes.hpp b/rpcs3/Emu/RSX/VK/VKGSRenderTypes.hpp index dbce50075a..299917e28f 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRenderTypes.hpp +++ b/rpcs3/Emu/RSX/VK/VKGSRenderTypes.hpp @@ -177,7 +177,6 @@ namespace vk vk::descriptor_set descriptor_set; vk::descriptor_pool descriptor_pool; - u32 used_descriptors = 0; rsx::flags32_t flags = 0; diff --git a/rpcs3/Emu/RSX/VK/VKOverlays.cpp b/rpcs3/Emu/RSX/VK/VKOverlays.cpp index 638b2138df..bba369e4f3 100644 --- a/rpcs3/Emu/RSX/VK/VKOverlays.cpp +++ b/rpcs3/Emu/RSX/VK/VKOverlays.cpp @@ -288,12 +288,6 @@ namespace vk void overlay_pass::free_resources() { - if (m_used_descriptors == 0) - return; - - m_descriptor_pool.reset(0); - m_used_descriptors = 0; - m_vao.reset_allocation_stats(); m_ubo.reset_allocation_stats(); } diff --git a/rpcs3/Emu/RSX/VK/VKOverlays.h b/rpcs3/Emu/RSX/VK/VKOverlays.h index 31eaebb84d..7b6efc7f68 100644 --- a/rpcs3/Emu/RSX/VK/VKOverlays.h +++ b/rpcs3/Emu/RSX/VK/VKOverlays.h @@ -48,7 +48,6 @@ namespace vk descriptor_set m_descriptor_set; VkDescriptorSetLayout m_descriptor_layout = nullptr; VkPipelineLayout m_pipeline_layout = nullptr; - u32 m_used_descriptors = 0; VkFilter m_sampler_filter = VK_FILTER_LINEAR; u32 m_num_usable_samplers = 1; diff --git a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp index ad3eb403c9..5c2726df67 100644 --- a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp +++ b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp @@ -518,23 +518,7 @@ namespace vk VkDescriptorSet shader_interpreter::allocate_descriptor_set() { - if (!m_descriptor_pool.can_allocate(1u, m_used_descriptors)) - { - m_descriptor_pool.reset(0); - m_used_descriptors = 0; - } - - VkDescriptorSetAllocateInfo alloc_info = {}; - alloc_info.descriptorPool = m_descriptor_pool; - alloc_info.descriptorSetCount = 1; - alloc_info.pSetLayouts = &m_shared_descriptor_layout; - alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; - - VkDescriptorSet new_descriptor_set; - CHECK_RESULT(vkAllocateDescriptorSets(m_device, &alloc_info, &new_descriptor_set)); - - m_used_descriptors++; - return new_descriptor_set; + return m_descriptor_pool.allocate(m_shared_descriptor_layout, VK_TRUE, 0); } glsl::program* shader_interpreter::get(const vk::pipeline_props& properties, const program_hash_util::fragment_program_utils::fragment_program_metadata& metadata) diff --git a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.h b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.h index 7789d0cde7..72f3b0ee3b 100644 --- a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.h +++ b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.h @@ -42,7 +42,6 @@ namespace vk std::unordered_map, key_hasher> m_program_cache; std::unordered_map> m_fs_cache; vk::descriptor_pool m_descriptor_pool; - u32 m_used_descriptors = 0; u32 m_vertex_instruction_start = 0; u32 m_fragment_instruction_start = 0; diff --git a/rpcs3/Emu/RSX/VK/VKTextOut.h b/rpcs3/Emu/RSX/VK/VKTextOut.h index bc53bd24c3..41e0ad037b 100644 --- a/rpcs3/Emu/RSX/VK/VKTextOut.h +++ b/rpcs3/Emu/RSX/VK/VKTextOut.h @@ -205,14 +205,7 @@ namespace vk { ensure(m_used_descriptors < 120); - VkDescriptorSetAllocateInfo alloc_info = {}; - alloc_info.descriptorPool = m_descriptor_pool; - alloc_info.descriptorSetCount = 1; - alloc_info.pSetLayouts = &m_descriptor_layout; - alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; - - CHECK_RESULT(vkAllocateDescriptorSets(device, &alloc_info, m_descriptor_set.ptr())); - m_used_descriptors++; + m_descriptor_set = m_descriptor_pool.allocate(m_descriptor_layout, VK_TRUE, m_used_descriptors++); float scale[] = { scale_x, scale_y }; float colors[] = { color[0], color[1], color[2], color[3] }; @@ -360,15 +353,6 @@ namespace vk } } - void reset_descriptors() - { - if (m_used_descriptors == 0) - return; - - m_descriptor_pool.reset(0); - m_used_descriptors = 0; - } - void set_scale(double scale) { // Restrict scale to 2. The dots are gonna be too sparse otherwise.