summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp41
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:
74 } 74 }
75 75
76 std::string GenerateTemporary() { 76 std::string GenerateTemporary() {
77 std::string temporary = "tmp"; 77 return fmt::format("tmp{}", temporary_index++);
78 temporary += std::to_string(temporary_index++);
79 return temporary;
80 } 78 }
81 79
82 std::string GetResult() { 80 std::string GetResult() {
@@ -1748,24 +1746,25 @@ private:
1748} // Anonymous namespace 1746} // Anonymous namespace
1749 1747
1750std::string GetCommonDeclarations() { 1748std::string GetCommonDeclarations() {
1751 const auto cbuf = std::to_string(MAX_CONSTBUFFER_ELEMENTS); 1749 return fmt::format(
1752 return "#define MAX_CONSTBUFFER_ELEMENTS " + cbuf + "\n" + 1750 "#define MAX_CONSTBUFFER_ELEMENTS {}\n"
1753 "#define ftoi floatBitsToInt\n" 1751 "#define ftoi floatBitsToInt\n"
1754 "#define ftou floatBitsToUint\n" 1752 "#define ftou floatBitsToUint\n"
1755 "#define itof intBitsToFloat\n" 1753 "#define itof intBitsToFloat\n"
1756 "#define utof uintBitsToFloat\n\n" 1754 "#define utof uintBitsToFloat\n\n"
1757 "float fromHalf2(vec2 pair) {\n" 1755 "float fromHalf2(vec2 pair) {{\n"
1758 " return utof(packHalf2x16(pair));\n" 1756 " return utof(packHalf2x16(pair));\n"
1759 "}\n\n" 1757 "}}\n\n"
1760 "vec2 toHalf2(float value) {\n" 1758 "vec2 toHalf2(float value) {{\n"
1761 " return unpackHalf2x16(ftou(value));\n" 1759 " return unpackHalf2x16(ftou(value));\n"
1762 "}\n\n" 1760 "}}\n\n"
1763 "bvec2 halfFloatNanComparison(bvec2 comparison, vec2 pair1, vec2 pair2) {\n" 1761 "bvec2 halfFloatNanComparison(bvec2 comparison, vec2 pair1, vec2 pair2) {{\n"
1764 " bvec2 is_nan1 = isnan(pair1);\n" 1762 " bvec2 is_nan1 = isnan(pair1);\n"
1765 " bvec2 is_nan2 = isnan(pair2);\n" 1763 " bvec2 is_nan2 = isnan(pair2);\n"
1766 " return bvec2(comparison.x || is_nan1.x || is_nan2.x, comparison.y || is_nan1.y || " 1764 " return bvec2(comparison.x || is_nan1.x || is_nan2.x, comparison.y || is_nan1.y || "
1767 "is_nan2.y);\n" 1765 "is_nan2.y);\n"
1768 "}\n"; 1766 "}}\n",
1767 MAX_CONSTBUFFER_ELEMENTS);
1769} 1768}
1770 1769
1771ProgramResult Decompile(const Device& device, const ShaderIR& ir, Maxwell::ShaderStage stage, 1770ProgramResult Decompile(const Device& device, const ShaderIR& ir, Maxwell::ShaderStage stage,