diff options
author | Laku <Laku@users.noreply.github.com> | 2018-08-22 09:02:18 +0200 |
---|---|---|
committer | Laku <Laku@users.noreply.github.com> | 2018-08-22 09:09:44 +0200 |
commit | 8e8326595f7ad5bf6b2d7ac1110504f97f7b3138 (patch) | |
tree | f966a703ff21cca2f7aeff583b683e685ec18d69 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |
parent | Merge pull request #1136 from tech4me/master (diff) | |
download | yuzu-8e8326595f7ad5bf6b2d7ac1110504f97f7b3138.tar yuzu-8e8326595f7ad5bf6b2d7ac1110504f97f7b3138.tar.gz yuzu-8e8326595f7ad5bf6b2d7ac1110504f97f7b3138.tar.bz2 yuzu-8e8326595f7ad5bf6b2d7ac1110504f97f7b3138.tar.lz yuzu-8e8326595f7ad5bf6b2d7ac1110504f97f7b3138.tar.xz yuzu-8e8326595f7ad5bf6b2d7ac1110504f97f7b3138.tar.zst yuzu-8e8326595f7ad5bf6b2d7ac1110504f97f7b3138.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 5b976b636..7926726a1 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -849,6 +849,28 @@ private: } } + void WriteLop3Instruction(Register dest, const std::string& op_a, const std::string& op_b, + const std::string& op_c, const std::string& imm_lut) { + std::string result; + result += '('; + + for (u32 i = 0; i < 32; ++i) { + std::string ix = std::to_string(i); + if (i) + result += '|'; + result += "(((" + imm_lut + ">>(((" + op_c + ">>" + ix + ")&1)|((" + op_b + ">>" + ix + + ")&1)<<1|((" + op_a + ">>" + ix + ")&1)<<2))&1)<<" + ix + ")"; + } + + result += ')'; + + LOG_DEBUG(HW_GPU, "LOP3 Shader code: {}", result); + + if (dest != Tegra::Shader::Register::ZeroIndex) { + regs.SetRegisterToInteger(dest, true, 0, result, 1, 1); + } + } + void WriteTexsInstruction(const Instruction& instr, const std::string& coord, const std::string& texture) { // Add an extra scope and declare the texture coords inside to prevent @@ -1297,6 +1319,20 @@ private: instr.alu.lop.pred_result_mode, instr.alu.lop.pred48); break; } + case OpCode::Id::LOP3_C: + case OpCode::Id::LOP3_R: + case OpCode::Id::LOP3_IMM: { + std::string op_c = regs.GetRegisterAsInteger(instr.gpr39); + std::string lut; + if (opcode->GetId() == OpCode::Id::LOP3_R) { + lut = '(' + std::to_string(instr.alu.lop3.GetImmLut28()) + ')'; + } else { + lut = '(' + std::to_string(instr.alu.lop3.GetImmLut48()) + ')'; + } + + WriteLop3Instruction(instr.gpr0, op_a, op_b, op_c, lut); + break; + } case OpCode::Id::IMNMX_C: case OpCode::Id::IMNMX_R: case OpCode::Id::IMNMX_IMM: { |