summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2018-04-19 19:59:20 -0400
committerGravatar Lioncash2018-04-19 19:59:25 -0400
commit4ef392906b4e91433587eab6a2654908081aea6a (patch)
tree8df3fdcab70adc2cf876cbdb668b758bbc187b53 /src
parentMerge pull request #348 from jlachniet/patch-1 (diff)
downloadyuzu-4ef392906b4e91433587eab6a2654908081aea6a.tar.gz
yuzu-4ef392906b4e91433587eab6a2654908081aea6a.tar.xz
yuzu-4ef392906b4e91433587eab6a2654908081aea6a.zip
glsl_shader_decompiler: Append indentation without constructing a separate std::string
The interface of std::string already lets us append N copies of a character to an existing string.
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp6
1 files changed, 5 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 6233ee358..389a23edb 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -112,7 +112,7 @@ public:
112 void AddLine(const std::string& text) { 112 void AddLine(const std::string& text) {
113 DEBUG_ASSERT(scope >= 0); 113 DEBUG_ASSERT(scope >= 0);
114 if (!text.empty()) { 114 if (!text.empty()) {
115 shader_source += std::string(static_cast<size_t>(scope) * 4, ' '); 115 AppendIndentation();
116 } 116 }
117 shader_source += text + '\n'; 117 shader_source += text + '\n';
118 } 118 }
@@ -124,6 +124,10 @@ public:
124 int scope = 0; 124 int scope = 0;
125 125
126private: 126private:
127 void AppendIndentation() {
128 shader_source.append(static_cast<size_t>(scope) * 4, ' ');
129 }
130
127 std::string shader_source; 131 std::string shader_source;
128}; 132};
129 133