diff options
author | Lioncash <mathew1800@gmail.com> | 2019-05-15 00:12:29 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-05-20 20:14:48 +0200 |
commit | 58a0c13e34ff3a80bc9248705b8af8d7884406ea (patch) | |
tree | d451cc4448d2a775473168898e4096b21a2e8d92 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |
parent | gl_shader_decompiler: Replace individual overloads with the fmt-based one (diff) | |
download | yuzu-58a0c13e34ff3a80bc9248705b8af8d7884406ea.tar yuzu-58a0c13e34ff3a80bc9248705b8af8d7884406ea.tar.gz yuzu-58a0c13e34ff3a80bc9248705b8af8d7884406ea.tar.bz2 yuzu-58a0c13e34ff3a80bc9248705b8af8d7884406ea.tar.lz yuzu-58a0c13e34ff3a80bc9248705b8af8d7884406ea.tar.xz yuzu-58a0c13e34ff3a80bc9248705b8af8d7884406ea.tar.zst yuzu-58a0c13e34ff3a80bc9248705b8af8d7884406ea.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 233a8aca2..4c380677d 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -74,9 +74,7 @@ public: } std::string GenerateTemporary() { - std::string temporary = "tmp"; - temporary += std::to_string(temporary_index++); - return temporary; + return fmt::format("tmp{}", temporary_index++); } std::string GetResult() { @@ -1748,24 +1746,25 @@ private: } // Anonymous namespace std::string GetCommonDeclarations() { - const auto cbuf = std::to_string(MAX_CONSTBUFFER_ELEMENTS); - return "#define MAX_CONSTBUFFER_ELEMENTS " + cbuf + "\n" + - "#define ftoi floatBitsToInt\n" - "#define ftou floatBitsToUint\n" - "#define itof intBitsToFloat\n" - "#define utof uintBitsToFloat\n\n" - "float fromHalf2(vec2 pair) {\n" - " return utof(packHalf2x16(pair));\n" - "}\n\n" - "vec2 toHalf2(float value) {\n" - " return unpackHalf2x16(ftou(value));\n" - "}\n\n" - "bvec2 halfFloatNanComparison(bvec2 comparison, vec2 pair1, vec2 pair2) {\n" - " bvec2 is_nan1 = isnan(pair1);\n" - " bvec2 is_nan2 = isnan(pair2);\n" - " return bvec2(comparison.x || is_nan1.x || is_nan2.x, comparison.y || is_nan1.y || " - "is_nan2.y);\n" - "}\n"; + return fmt::format( + "#define MAX_CONSTBUFFER_ELEMENTS {}\n" + "#define ftoi floatBitsToInt\n" + "#define ftou floatBitsToUint\n" + "#define itof intBitsToFloat\n" + "#define utof uintBitsToFloat\n\n" + "float fromHalf2(vec2 pair) {{\n" + " return utof(packHalf2x16(pair));\n" + "}}\n\n" + "vec2 toHalf2(float value) {{\n" + " return unpackHalf2x16(ftou(value));\n" + "}}\n\n" + "bvec2 halfFloatNanComparison(bvec2 comparison, vec2 pair1, vec2 pair2) {{\n" + " bvec2 is_nan1 = isnan(pair1);\n" + " bvec2 is_nan2 = isnan(pair2);\n" + " return bvec2(comparison.x || is_nan1.x || is_nan2.x, comparison.y || is_nan1.y || " + "is_nan2.y);\n" + "}}\n", + MAX_CONSTBUFFER_ELEMENTS); } ProgramResult Decompile(const Device& device, const ShaderIR& ir, Maxwell::ShaderStage stage, |