diff options
author | bunnei <bunneidev@gmail.com> | 2018-11-26 04:38:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-26 04:38:42 +0100 |
commit | d7d1ab15b6b2d766c6744f120fc95d119f620cde (patch) | |
tree | 155d72981741b5b280709c0535c15a2dd232a15a /src/video_core/renderer_opengl | |
parent | Merge pull request #1782 from FernandoS27/dc (diff) | |
parent | gl_shader_decompiler: Implement R2P_IMM (diff) | |
download | yuzu-d7d1ab15b6b2d766c6744f120fc95d119f620cde.tar yuzu-d7d1ab15b6b2d766c6744f120fc95d119f620cde.tar.gz yuzu-d7d1ab15b6b2d766c6744f120fc95d119f620cde.tar.bz2 yuzu-d7d1ab15b6b2d766c6744f120fc95d119f620cde.tar.lz yuzu-d7d1ab15b6b2d766c6744f120fc95d119f620cde.tar.xz yuzu-d7d1ab15b6b2d766c6744f120fc95d119f620cde.tar.zst yuzu-d7d1ab15b6b2d766c6744f120fc95d119f620cde.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 28 |
1 files changed, 28 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 9dbaf26d4..3a75f9d16 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -3315,6 +3315,34 @@ private: } break; } + case OpCode::Type::RegisterSetPredicate: { + UNIMPLEMENTED_IF(instr.r2p.mode != Tegra::Shader::R2pMode::Pr); + + const std::string apply_mask = [&]() { + switch (opcode->get().GetId()) { + case OpCode::Id::R2P_IMM: + return std::to_string(instr.r2p.immediate_mask); + default: + UNREACHABLE(); + } + }(); + const std::string mask = '(' + regs.GetRegisterAsInteger(instr.gpr8, 0, false) + + " >> " + std::to_string(instr.r2p.byte) + ')'; + + constexpr u64 programmable_preds = 7; + for (u64 pred = 0; pred < programmable_preds; ++pred) { + const auto shift = std::to_string(1 << pred); + + shader.AddLine("if ((" + apply_mask + " & " + shift + ") != 0) {"); + ++shader.scope; + + SetPredicate(pred, '(' + mask + " & " + shift + ") != 0"); + + --shader.scope; + shader.AddLine('}'); + } + break; + } case OpCode::Type::FloatSet: { const std::string op_a = GetOperandAbsNeg(regs.GetRegisterAsFloat(instr.gpr8), instr.fset.abs_a != 0, instr.fset.neg_a != 0); |