diff options
author | bunnei <bunneidev@gmail.com> | 2018-06-07 06:58:12 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-06-07 06:58:12 +0200 |
commit | 92209f905fff33eaf4812c3d4a153ff9fffb1ed0 (patch) | |
tree | 53ef881e880ba5d728c31094f00ccd56e5d7e9c5 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |
parent | Merge pull request #539 from bunnei/f2f-rounding (diff) | |
download | yuzu-92209f905fff33eaf4812c3d4a153ff9fffb1ed0.tar yuzu-92209f905fff33eaf4812c3d4a153ff9fffb1ed0.tar.gz yuzu-92209f905fff33eaf4812c3d4a153ff9fffb1ed0.tar.bz2 yuzu-92209f905fff33eaf4812c3d4a153ff9fffb1ed0.tar.lz yuzu-92209f905fff33eaf4812c3d4a153ff9fffb1ed0.tar.xz yuzu-92209f905fff33eaf4812c3d4a153ff9fffb1ed0.tar.zst yuzu-92209f905fff33eaf4812c3d4a153ff9fffb1ed0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 33 |
1 files changed, 29 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 8e249584f..94c6bc4b2 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -888,8 +888,33 @@ private: } break; } + case OpCode::Type::Bfe: { + ASSERT_MSG(!instr.bfe.negate_b, "Unimplemented"); + + std::string op_a = instr.bfe.negate_a ? "-" : ""; + op_a += regs.GetRegisterAsInteger(instr.gpr8); + + switch (opcode->GetId()) { + case OpCode::Id::BFE_IMM: { + std::string inner_shift = + '(' + op_a + " << " + std::to_string(instr.bfe.GetLeftShiftValue()) + ')'; + std::string outer_shift = + '(' + inner_shift + " >> " + + std::to_string(instr.bfe.GetLeftShiftValue() + instr.bfe.shift_position) + ')'; + + regs.SetRegisterToInteger(instr.gpr0, true, 0, outer_shift, 1, 1); + break; + } + default: { + NGLOG_CRITICAL(HW_GPU, "Unhandled BFE instruction: {}", opcode->GetName()); + UNREACHABLE(); + } + } + + break; + } case OpCode::Type::Logic: { - std::string op_a = regs.GetRegisterAsInteger(instr.gpr8, 0, false); + std::string op_a = regs.GetRegisterAsInteger(instr.gpr8, 0, true); if (instr.alu.lop.invert_a) op_a = "~(" + op_a + ')'; @@ -903,17 +928,17 @@ private: switch (instr.alu.lop.operation) { case Tegra::Shader::LogicOperation::And: { - regs.SetRegisterToInteger(instr.gpr0, false, 0, + regs.SetRegisterToInteger(instr.gpr0, true, 0, '(' + op_a + " & " + std::to_string(imm) + ')', 1, 1); break; } case Tegra::Shader::LogicOperation::Or: { - regs.SetRegisterToInteger(instr.gpr0, false, 0, + regs.SetRegisterToInteger(instr.gpr0, true, 0, '(' + op_a + " | " + std::to_string(imm) + ')', 1, 1); break; } case Tegra::Shader::LogicOperation::Xor: { - regs.SetRegisterToInteger(instr.gpr0, false, 0, + regs.SetRegisterToInteger(instr.gpr0, true, 0, '(' + op_a + " ^ " + std::to_string(imm) + ')', 1, 1); break; } |