summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 15194d5a6..2d3706221 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -851,10 +851,11 @@ private:
851 851
852 void WriteLop3Instruction(Register dest, const std::string& op_a, const std::string& op_b, 852 void WriteLop3Instruction(Register dest, const std::string& op_a, const std::string& op_b,
853 const std::string& op_c, const std::string& imm_lut) { 853 const std::string& op_c, const std::string& imm_lut) {
854 if (dest == Tegra::Shader::Register::ZeroIndex) 854 if (dest == Tegra::Shader::Register::ZeroIndex) {
855 return; 855 return;
856 }
856 857
857 static constexpr std::array<const char*, 32> ix = { 858 static constexpr std::array<const char*, 32> shift_amounts = {
858 "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", 859 "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
859 "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", 860 "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21",
860 "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"}; 861 "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"};
@@ -862,12 +863,12 @@ private:
862 std::string result; 863 std::string result;
863 result += '('; 864 result += '(';
864 865
865 for (u32 i = 0; i < 32; ++i) { 866 for (size_t i = 0; i < shift_amounts.size(); ++i) {
866 if (i) 867 if (i)
867 result += '|'; 868 result += '|';
868 result += "(((" + imm_lut + " >> (((" + op_c + " >> " + ix[i] + ") & 1) | ((" + op_b + 869 result += "(((" + imm_lut + " >> (((" + op_c + " >> " + shift_amounts[i] +
869 " >> " + ix[i] + ") & 1) << 1 | ((" + op_a + " >> " + ix[i] + 870 ") & 1) | ((" + op_b + " >> " + shift_amounts[i] + ") & 1) << 1 | ((" + op_a +
870 ") & 1) << 2)) & 1) << " + ix[i] + ")"; 871 " >> " + shift_amounts[i] + ") & 1) << 2)) & 1) << " + shift_amounts[i] + ")";
871 } 872 }
872 873
873 result += ')'; 874 result += ')';