summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2018-12-23 17:24:18 -0300
committerGravatar ReinUsesLisp2019-01-15 17:54:53 -0300
commit8332482c24136091c3fa2c95d7efdd3dd1fa9adf (patch)
tree64457e14c20481ee3981bee17ed0e005a0139f3f /src
parentshader_decode: Implement CSETP (diff)
downloadyuzu-8332482c24136091c3fa2c95d7efdd3dd1fa9adf.tar.gz
yuzu-8332482c24136091c3fa2c95d7efdd3dd1fa9adf.tar.xz
yuzu-8332482c24136091c3fa2c95d7efdd3dd1fa9adf.zip
shader_decode: Implement R2P
Diffstat (limited to 'src')
-rw-r--r--src/video_core/shader/decode/register_set_predicate.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/video_core/shader/decode/register_set_predicate.cpp b/src/video_core/shader/decode/register_set_predicate.cpp
index 29a348cf5..796039cd9 100644
--- a/src/video_core/shader/decode/register_set_predicate.cpp
+++ b/src/video_core/shader/decode/register_set_predicate.cpp
@@ -16,7 +16,34 @@ u32 ShaderIR::DecodeRegisterSetPredicate(BasicBlock& bb, u32 pc) {
16 const Instruction instr = {program_code[pc]}; 16 const Instruction instr = {program_code[pc]};
17 const auto opcode = OpCode::Decode(instr); 17 const auto opcode = OpCode::Decode(instr);
18 18
19 UNIMPLEMENTED(); 19 UNIMPLEMENTED_IF(instr.r2p.mode != Tegra::Shader::R2pMode::Pr);
20
21 const Node apply_mask = [&]() {
22 switch (opcode->get().GetId()) {
23 case OpCode::Id::R2P_IMM:
24 return Immediate(static_cast<u32>(instr.r2p.immediate_mask));
25 default:
26 UNREACHABLE();
27 return Immediate(static_cast<u32>(instr.r2p.immediate_mask));
28 }
29 }();
30 const Node mask =
31 Operation(OperationCode::ULogicalShiftRight, NO_PRECISE, GetRegister(instr.gpr8),
32 Immediate(static_cast<u32>(instr.r2p.byte)));
33
34 constexpr u32 programmable_preds = 7;
35 for (u64 pred = 0; pred < programmable_preds; ++pred) {
36 const Node shift = Immediate(1u << static_cast<u32>(pred));
37
38 const Node apply_compare = Operation(OperationCode::UBitwiseAnd, NO_PRECISE, apply_mask, shift);
39 const Node condition = Operation(OperationCode::LogicalUEqual, apply_compare, Immediate(0));
40
41 const Node value_compare = Operation(OperationCode::UBitwiseAnd, NO_PRECISE, mask, shift);
42 const Node value = Operation(OperationCode::LogicalUEqual, value_compare, Immediate(0));
43
44 const Node code = Operation(OperationCode::LogicalAssign, GetPredicate(pred), value);
45 bb.push_back(Conditional(condition, {code}));
46 }
20 47
21 return pc; 48 return pc;
22} 49}