From baf96b3eb6b6a151a8d6164a29033b9c50fdc4c4 Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Thu, 3 Sep 2020 23:35:59 +1000 Subject: [PATCH] RSX: Update manual string creation -> std::string() Replace manual string creation with call to std::string() constructor passing in char* This appears to drastically reduce the cache impact here --- rpcs3/Emu/RSX/CgBinaryProgram.h | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/rpcs3/Emu/RSX/CgBinaryProgram.h b/rpcs3/Emu/RSX/CgBinaryProgram.h index b54b8c87cb..754b06252e 100644 --- a/rpcs3/Emu/RSX/CgBinaryProgram.h +++ b/rpcs3/Emu/RSX/CgBinaryProgram.h @@ -213,15 +213,7 @@ public: std::string GetCgParamName(u32 offset) const { - std::stringstream str_stream; - std::string name; - while (m_buffer[offset] != 0) - { - str_stream << m_buffer[offset]; - offset++; - } - name += str_stream.str(); - return name; + return std::string(reinterpret_cast(&m_buffer[offset])); } std::string GetCgParamRes(u32 /*offset*/) const @@ -233,15 +225,7 @@ public: std::string GetCgParamSemantic(u32 offset) const { - std::stringstream str_stream; - std::string semantic; - while (m_buffer[offset] != 0) - { - str_stream << m_buffer[offset]; - offset++; - } - semantic += str_stream.str(); - return semantic; + return std::string(reinterpret_cast(&m_buffer[offset])); } std::string GetCgParamValue(u32 offset, u32 end_offset) const