diff options
author | bunnei <bunneidev@gmail.com> | 2018-06-07 07:49:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-07 07:49:45 +0200 |
commit | 0639e030551c3cf669602cf5b15d039e71690da6 (patch) | |
tree | 6a5c8baf3233d2725688b9572bb7572fd5a56091 /src/video_core/renderer_opengl | |
parent | Merge pull request #541 from Subv/blittextures (diff) | |
parent | gl_shader_decompiler: Implement BFE_IMM instruction. (diff) | |
download | yuzu-0639e030551c3cf669602cf5b15d039e71690da6.tar yuzu-0639e030551c3cf669602cf5b15d039e71690da6.tar.gz yuzu-0639e030551c3cf669602cf5b15d039e71690da6.tar.bz2 yuzu-0639e030551c3cf669602cf5b15d039e71690da6.tar.lz yuzu-0639e030551c3cf669602cf5b15d039e71690da6.tar.xz yuzu-0639e030551c3cf669602cf5b15d039e71690da6.tar.zst yuzu-0639e030551c3cf669602cf5b15d039e71690da6.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-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; } |