From af1b13550b8b775f5ccbbcad7b7d303097a4ff75 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Wed, 21 Feb 2018 21:31:08 +0300 Subject: [PATCH] rsx/vk: More optimizations - Do not bother rechecking the dirty sampler pool for hits. Its faster to create new sampler than to search the pool - Reserve some memory on vertex layout struct to reduce reallocation penalty --- rpcs3/Emu/RSX/RSXThread.cpp | 3 +++ rpcs3/Emu/RSX/VK/VKGSRender.cpp | 19 ++----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 8220af19bf..08623b5577 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1264,6 +1264,7 @@ namespace rsx if (state.current_draw_clause.command == rsx::draw_command::inlined_array) { vertex_input_layout result = {}; + result.interleaved_blocks.reserve(8); interleaved_range_info info = {}; info.interleaved = true; @@ -1288,6 +1289,8 @@ namespace rsx const u32 frequency_divider_mask = rsx::method_registers.frequency_divider_operation_mask(); vertex_input_layout result = {}; + result.interleaved_blocks.reserve(8); + result.referenced_registers.reserve(4); for (u8 index = 0; index < rsx::limits::vertex_count; ++index) { diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 5488974718..ea153b694d 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -1129,22 +1129,8 @@ void VKGSRender::end() if (replace) { - for (auto &sampler : m_current_frame->samplers_to_clean) - { - if (sampler->matches(wrap_s, wrap_t, wrap_r, false, lod_bias, af_level, min_lod, max_lod, - min_filter, mag_filter, mip_mode, border_color, compare_enabled, depth_compare_mode)) - { - fs_sampler_handles[i] = std::move(sampler); - replace = false; - break; - } - } - - if (replace) - { - fs_sampler_handles[i] = std::make_unique(*m_device, wrap_s, wrap_t, wrap_r, false, lod_bias, af_level, min_lod, max_lod, - min_filter, mag_filter, mip_mode, border_color, compare_enabled, depth_compare_mode); - } + fs_sampler_handles[i] = std::make_unique(*m_device, wrap_s, wrap_t, wrap_r, false, lod_bias, af_level, min_lod, max_lod, + min_filter, mag_filter, mip_mode, border_color, compare_enabled, depth_compare_mode); } } else @@ -1188,7 +1174,6 @@ void VKGSRender::end() if (replace) { - //This is unlikely, there is no need to check the dirty pool vs_sampler_handles[i] = std::make_unique( *m_device, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT,