summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-04-20 02:02:24 +0200
committerLioncash <mathew1800@gmail.com>2018-04-20 02:04:09 +0200
commitaa26baa3dbfeb5f75202ec23730519d1815a995f (patch)
treeb516c509f193ce82d7fe6ba7812177b5f3c950f5 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp
parentglsl_shader_decompiler: Append indentation without constructing a separate std::string (diff)
downloadyuzu-aa26baa3dbfeb5f75202ec23730519d1815a995f.tar
yuzu-aa26baa3dbfeb5f75202ec23730519d1815a995f.tar.gz
yuzu-aa26baa3dbfeb5f75202ec23730519d1815a995f.tar.bz2
yuzu-aa26baa3dbfeb5f75202ec23730519d1815a995f.tar.lz
yuzu-aa26baa3dbfeb5f75202ec23730519d1815a995f.tar.xz
yuzu-aa26baa3dbfeb5f75202ec23730519d1815a995f.tar.zst
yuzu-aa26baa3dbfeb5f75202ec23730519d1815a995f.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_decompiler.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 389a23edb..9e60c911c 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -117,6 +117,13 @@ public:
shader_source += text + '\n';
}
+ void AddLine(char character) {
+ DEBUG_ASSERT(scope >= 0);
+ AppendIndentation();
+ shader_source += character;
+ shader_source += '\n';
+ }
+
std::string GetResult() {
return std::move(shader_source);
}
@@ -511,14 +518,14 @@ private:
}
--shader.scope;
- shader.AddLine("}");
+ shader.AddLine('}');
}
shader.AddLine("default: return false;");
- shader.AddLine("}");
+ shader.AddLine('}');
--shader.scope;
- shader.AddLine("}");
+ shader.AddLine('}');
shader.AddLine("return false;");
}
@@ -568,7 +575,7 @@ private:
unsigned const_buffer_layout = 0;
for (const auto& entry : GetConstBuffersDeclarations()) {
declarations.AddLine("layout(std430) buffer " + entry.GetName());
- declarations.AddLine("{");
+ declarations.AddLine('{');
declarations.AddLine(" float c" + std::to_string(entry.GetIndex()) + "[];");
declarations.AddLine("};");
declarations.AddLine("");