From 7ec481d99b672feeb89acad6fe9c083c359f4714 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 26 May 2022 23:04:15 +0300 Subject: [PATCH] rsx: Allocate scratch memory using simple array with no default initialize - This cuts down processing time significantly by eliminating calls to memset_stosb --- rpcs3/Emu/RSX/Common/TextureUtils.cpp | 6 +++--- rpcs3/Emu/RSX/Common/simple_array.hpp | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index a04f31a0fa..729d2a7f82 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -164,7 +164,7 @@ struct convert_16_block_32_swizzled } u32 size = padded_width * padded_height * depth * 2; - std::vector tmp(size); + rsx::simple_array tmp(size); rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); @@ -243,7 +243,7 @@ struct copy_unmodified_block_swizzled } const u32 size_in_block = padded_width * padded_height * depth * 2; - std::vector tmp(size_in_block * words_per_block); + rsx::simple_array tmp(size_in_block * words_per_block); if (words_per_block == 1) [[likely]] { @@ -488,7 +488,7 @@ struct copy_rgb655_block_swizzled } u32 size = padded_width * padded_height * depth * 2; - std::vector tmp(size); + rsx::simple_array tmp(size); rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); diff --git a/rpcs3/Emu/RSX/Common/simple_array.hpp b/rpcs3/Emu/RSX/Common/simple_array.hpp index e39b7be264..6567454f96 100644 --- a/rpcs3/Emu/RSX/Common/simple_array.hpp +++ b/rpcs3/Emu/RSX/Common/simple_array.hpp @@ -25,7 +25,13 @@ namespace rsx public: simple_array() = default; - simple_array(u32 initial_size, const Ty val = {}) + simple_array(u32 initial_size) + { + reserve(initial_size); + _size = initial_size; + } + + simple_array(u32 initial_size, const Ty val) { reserve(initial_size); _size = initial_size;