summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-04-19 20:10:40 -0400
committerGravatar Lioncash2018-04-19 20:12:58 -0400
commite3b6f6c01699f15ee07f1caab6cd19cb5acc72a8 (patch)
treeb497fe468a4ca0d715ffcb0f33fb87dab2fb930d
parentglsl_shader_decompiler: Add AddNewLine() function to ShaderWriter (diff)
downloadyuzu-e3b6f6c01699f15ee07f1caab6cd19cb5acc72a8.tar.gz
yuzu-e3b6f6c01699f15ee07f1caab6cd19cb5acc72a8.tar.xz
yuzu-e3b6f6c01699f15ee07f1caab6cd19cb5acc72a8.zip
glsl_shader_decompiler: Use std::string_view instead of std::string for AddLine()
This function doesn't need to take ownership of the string data being given to it, considering all we do is append the characters to the internal string instance. Instead, use a string view to simply reference the string data without any potential heap allocation. Now anything that is a raw const char* won't need to be converted to a std::string before appending.
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index c55febbfa..22a413b73 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -5,6 +5,7 @@
5#include <map> 5#include <map>
6#include <set> 6#include <set>
7#include <string> 7#include <string>
8#include <string_view>
8#include "common/assert.h" 9#include "common/assert.h"
9#include "common/common_types.h" 10#include "common/common_types.h"
10#include "video_core/engines/shader_bytecode.h" 11#include "video_core/engines/shader_bytecode.h"
@@ -109,7 +110,7 @@ private:
109 110
110class ShaderWriter { 111class ShaderWriter {
111public: 112public:
112 void AddLine(const std::string& text) { 113 void AddLine(std::string_view text) {
113 DEBUG_ASSERT(scope >= 0); 114 DEBUG_ASSERT(scope >= 0);
114 if (!text.empty()) { 115 if (!text.empty()) {
115 AppendIndentation(); 116 AppendIndentation();