diff options
author | bunnei <bunneidev@gmail.com> | 2018-05-21 05:44:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-21 05:44:07 +0200 |
commit | 898f0fa0299524236007cddbec83209790f05aae (patch) | |
tree | 4122d83721fb0eb7bc137db6cc35fc0a86bd405a /src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |
parent | Merge pull request #445 from greggameplayer/patch-2 (diff) | |
parent | Shaders: Implemented the FMNMX shader instruction. (diff) | |
download | yuzu-898f0fa0299524236007cddbec83209790f05aae.tar yuzu-898f0fa0299524236007cddbec83209790f05aae.tar.gz yuzu-898f0fa0299524236007cddbec83209790f05aae.tar.bz2 yuzu-898f0fa0299524236007cddbec83209790f05aae.tar.lz yuzu-898f0fa0299524236007cddbec83209790f05aae.tar.xz yuzu-898f0fa0299524236007cddbec83209790f05aae.tar.zst yuzu-898f0fa0299524236007cddbec83209790f05aae.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_decompiler.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 27 |
1 files changed, 21 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 abbf0893d..1aa24da46 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -580,14 +580,17 @@ private: * @param instr Instruction to generate the if condition for. * @returns string containing the predicate condition. */ - std::string GetPredicateCondition(Instruction instr) const { + std::string GetPredicateCondition(u64 index, bool negate) const { using Tegra::Shader::Pred; - ASSERT(instr.pred.pred_index != static_cast<u64>(Pred::UnusedIndex)); + std::string variable; - std::string variable = - 'p' + std::to_string(static_cast<u64>(instr.pred.pred_index.Value())); + // Index 7 is used as an 'Always True' condition. + if (index == static_cast<u64>(Pred::UnusedIndex)) + variable = "true"; + else + variable = 'p' + std::to_string(index); - if (instr.negate_pred) { + if (negate) { return "!(" + variable + ')'; } @@ -634,7 +637,9 @@ private: "NeverExecute predicate not implemented"); if (instr.pred.pred_index != static_cast<u64>(Pred::UnusedIndex)) { - shader.AddLine("if (" + GetPredicateCondition(instr) + ')'); + shader.AddLine("if (" + + GetPredicateCondition(instr.pred.pred_index, instr.negate_pred != 0) + + ')'); shader.AddLine('{'); ++shader.scope; } @@ -730,6 +735,16 @@ private: } break; } + case OpCode::Id::FMNMX: { + std::string condition = + GetPredicateCondition(instr.alu.fmnmx.pred, instr.alu.fmnmx.negate_pred != 0); + std::string parameters = op_a + ',' + op_b; + regs.SetRegisterToFloat(instr.gpr0, 0, + '(' + condition + ") ? min(" + parameters + ") : max(" + + parameters + ')', + 1, 1); + break; + } case OpCode::Id::RRO: { NGLOG_DEBUG(HW_GPU, "Skipping RRO instruction"); break; |