From db926ee671e11ecfb0e8f0849edf28d91432fc20 Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 8 Jun 2019 07:58:04 +0200 Subject: [PATCH] rsx: Apply Clang-Tidy fix "performance-unnecessary-value-param" --- rpcs3/Emu/RSX/CgBinaryProgram.h | 2 +- rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp | 2 +- rpcs3/Emu/RSX/Common/BufferUtils.cpp | 4 ++-- rpcs3/Emu/RSX/Common/BufferUtils.h | 2 +- rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp | 2 +- rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h | 2 +- rpcs3/Emu/RSX/Common/GLSLCommon.h | 2 +- rpcs3/Emu/RSX/GL/GLHelpers.cpp | 6 +++--- rpcs3/Emu/RSX/GL/GLHelpers.h | 8 ++++---- rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp | 2 +- rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp | 2 +- rpcs3/Emu/RSX/RSXThread.cpp | 2 +- rpcs3/Emu/RSX/RSXThread.h | 4 ++-- rpcs3/Emu/RSX/VK/VKOverlays.h | 2 +- rpcs3/Emu/RSX/rsx_cache.h | 4 ++-- 15 files changed, 23 insertions(+), 23 deletions(-) diff --git a/rpcs3/Emu/RSX/CgBinaryProgram.h b/rpcs3/Emu/RSX/CgBinaryProgram.h index aa5578e92d..6184667769 100644 --- a/rpcs3/Emu/RSX/CgBinaryProgram.h +++ b/rpcs3/Emu/RSX/CgBinaryProgram.h @@ -173,7 +173,7 @@ public: void AddVecCodeDisasm(const std::string& code = ""); void AddCodeCondDisasm(const std::string& dst, const std::string& src); void AddCodeDisasm(const std::string& code); - void SetDSTDisasm(bool is_sca, std::string value); + void SetDSTDisasm(bool is_sca, const std::string& value); void SetDSTVecDisasm(const std::string& code); void SetDSTScaDisasm(const std::string& code); diff --git a/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp b/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp index e37c1bd313..468bd02eff 100644 --- a/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp +++ b/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp @@ -134,7 +134,7 @@ std::string CgBinaryDisasm::GetSRCDisasm(const u32 n) return ret; } -void CgBinaryDisasm::SetDSTDisasm(bool is_sca, std::string value) +void CgBinaryDisasm::SetDSTDisasm(bool is_sca, const std::string& value) { is_sca ? AddScaCodeDisasm() : AddVecCodeDisasm(); diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index 0d4df42225..639d9c5a2f 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -845,7 +845,7 @@ namespace std::tuple write_index_array_data_to_buffer_impl(gsl::span dst, gsl::span> src, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, - std::function expands) + const std::function& expands) { if (LIKELY(!expands(draw_mode))) { @@ -879,7 +879,7 @@ namespace std::tuple write_index_array_data_to_buffer(gsl::span dst_ptr, gsl::span src_ptr, rsx::index_array_type type, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, - std::function expands) + const std::function& expands) { switch (type) { diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.h b/rpcs3/Emu/RSX/Common/BufferUtils.h index 0c65b7c019..e3061dfd0c 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.h +++ b/rpcs3/Emu/RSX/Common/BufferUtils.h @@ -39,7 +39,7 @@ u32 get_index_type_size(rsx::index_array_type type); */ std::tuple write_index_array_data_to_buffer(gsl::span dst, gsl::span src, rsx::index_array_type, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, - std::function expands); + const std::function& expands); /** * Write index data needed to emulate non indexed non native primitive mode. diff --git a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp index 31710fd744..4325bde663 100644 --- a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp @@ -140,7 +140,7 @@ void FragmentProgramDecompiler::SetDst(std::string code, u32 flags) temp_registers[reg_index].tag(dst.dest_reg, !!dst.fp16, dst.mask_x, dst.mask_y, dst.mask_z, dst.mask_w); } -void FragmentProgramDecompiler::AddFlowOp(std::string code) +void FragmentProgramDecompiler::AddFlowOp(const std::string& code) { //Flow operations can only consider conditionals and have no dst diff --git a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h index 992da2edba..7233c8ef92 100644 --- a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h +++ b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h @@ -166,7 +166,7 @@ class FragmentProgramDecompiler std::string AddCond(); std::string AddConst(); std::string AddTex(); - void AddFlowOp(std::string code); + void AddFlowOp(const std::string& code); std::string Format(const std::string& code, bool ignore_redirects = false); //Technically a temporary workaround until we know what type3 is diff --git a/rpcs3/Emu/RSX/Common/GLSLCommon.h b/rpcs3/Emu/RSX/Common/GLSLCommon.h index ae37fdbe49..5a595980dc 100644 --- a/rpcs3/Emu/RSX/Common/GLSLCommon.h +++ b/rpcs3/Emu/RSX/Common/GLSLCommon.h @@ -77,7 +77,7 @@ namespace program_common "}\n\n"; } - static void insert_fog_declaration(std::ostream& OS, const std::string wide_vector_type, const std::string input_coord, bool declare = false) + static void insert_fog_declaration(std::ostream& OS, const std::string& wide_vector_type, const std::string& input_coord, bool declare = false) { std::string template_body; diff --git a/rpcs3/Emu/RSX/GL/GLHelpers.cpp b/rpcs3/Emu/RSX/GL/GLHelpers.cpp index a0a838952e..c7ae7c255a 100644 --- a/rpcs3/Emu/RSX/GL/GLHelpers.cpp +++ b/rpcs3/Emu/RSX/GL/GLHelpers.cpp @@ -237,14 +237,14 @@ namespace gl clear(buffers_); } - void fbo::copy_from(const void* pixels, sizei size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings) const + void fbo::copy_from(const void* pixels, const sizei& size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings) const { save_binding_state save(*this); pixel_settings.apply(); glDrawPixels(size.width, size.height, (GLenum)format_, (GLenum)type_, pixels); } - void fbo::copy_from(const buffer& buf, sizei size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings) const + void fbo::copy_from(const buffer& buf, const sizei& size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings) const { save_binding_state save(*this); buffer::save_binding_state save_buffer(buffer::target::pixel_unpack, buf); @@ -301,7 +301,7 @@ namespace gl m_id = id; } - void fbo::set_extents(size2i extents) + void fbo::set_extents(const size2i& extents) { m_size = extents; } diff --git a/rpcs3/Emu/RSX/GL/GLHelpers.h b/rpcs3/Emu/RSX/GL/GLHelpers.h index cd10e895f4..aeda8d72eb 100644 --- a/rpcs3/Emu/RSX/GL/GLHelpers.h +++ b/rpcs3/Emu/RSX/GL/GLHelpers.h @@ -848,7 +848,7 @@ namespace gl return created(); } - void map(std::function impl, access access_) + void map(const std::function& impl, access access_) { target target_ = current_target(); save_binding_state save(target_, *this); @@ -2298,8 +2298,8 @@ public: void clear(buffers buffers_) const; void clear(buffers buffers_, color4f color_value, double depth_value, u8 stencil_value) const; - void copy_from(const void* pixels, sizei size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings = pixel_unpack_settings()) const; - void copy_from(const buffer& buf, sizei size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings = pixel_unpack_settings()) const; + void copy_from(const void* pixels, const sizei& size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings = pixel_unpack_settings()) const; + void copy_from(const buffer& buf, const sizei& size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings = pixel_unpack_settings()) const; void copy_to(void* pixels, coordi coord, gl::texture::format format_, gl::texture::type type_, class pixel_pack_settings pixel_settings = pixel_pack_settings()) const; void copy_to(const buffer& buf, coordi coord, gl::texture::format format_, gl::texture::type type_, class pixel_pack_settings pixel_settings = pixel_pack_settings()) const; @@ -2311,7 +2311,7 @@ public: GLuint id() const; void set_id(GLuint id); - void set_extents(size2i extents); + void set_extents(const size2i& extents); size2i get_extents() const; bool matches(const std::array& color_targets, GLuint depth_stencil_target) const; diff --git a/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp b/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp index 39d1855fc4..5215080247 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp @@ -204,7 +204,7 @@ namespace rsx case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO: interactive = true; break; } - this->on_close = on_close; + this->on_close = std::move(on_close); if (interactive) { thread_ctrl::spawn("dialog input thread", [&] { diff --git a/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp b/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp index e37974ba25..b3ebe157b7 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp @@ -165,7 +165,7 @@ namespace rsx void perf_metrics_overlay::set_font(std::string font) { - m_font = font; + m_font = std::move(font); if (m_is_initialised) { diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 75d69d8342..7c583b58b4 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1613,7 +1613,7 @@ namespace rsx } } - void thread::get_current_fragment_program_legacy(std::function(u32, fragment_texture&, bool)> get_surface_info) + void thread::get_current_fragment_program_legacy(const std::function(u32, fragment_texture&, bool)>& get_surface_info) { auto &result = current_fragment_program = {}; diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 1a1e6df7a1..c430df5ee2 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -566,7 +566,7 @@ namespace rsx * returns whether surface is a render target and surface pitch in native format */ void get_current_fragment_program(const std::array, rsx::limits::fragment_textures_count>& sampler_descriptors); - void get_current_fragment_program_legacy(std::function(u32, fragment_texture&, bool)> get_surface_info); + void get_current_fragment_program_legacy(const std::function(u32, fragment_texture&, bool)>& get_surface_info); public: double fps_limit = 59.94; @@ -688,7 +688,7 @@ namespace rsx std::function callback; //std::promise promise; - internal_task_entry(std::function callback) : callback(callback) + internal_task_entry(std::function callback) : callback(std::move(callback)) { } }; diff --git a/rpcs3/Emu/RSX/VK/VKOverlays.h b/rpcs3/Emu/RSX/VK/VKOverlays.h index 456c694ff7..118b32efd9 100644 --- a/rpcs3/Emu/RSX/VK/VKOverlays.h +++ b/rpcs3/Emu/RSX/VK/VKOverlays.h @@ -220,7 +220,7 @@ namespace vk return result; } - void load_program(vk::command_buffer cmd, VkRenderPass pass, const std::vector& src) + void load_program(const vk::command_buffer& cmd, VkRenderPass pass, const std::vector& src) { vk::glsl::program *program = nullptr; auto found = m_program_cache.find(pass); diff --git a/rpcs3/Emu/RSX/rsx_cache.h b/rpcs3/Emu/RSX/rsx_cache.h index 3c03017262..9f0205fba7 100644 --- a/rpcs3/Emu/RSX/rsx_cache.h +++ b/rpcs3/Emu/RSX/rsx_cache.h @@ -501,8 +501,8 @@ namespace rsx }; shaders_cache(backend_storage& storage, std::string pipeline_class, std::string version_prefix_str = "v1") - : version_prefix(version_prefix_str) - , pipeline_class_name(pipeline_class) + : version_prefix(std::move(version_prefix_str)) + , pipeline_class_name(std::move(pipeline_class)) , m_storage(storage) { if (!g_cfg.video.disable_on_disk_shader_cache)