diff options
| author | 2021-07-25 11:39:04 -0700 | |
|---|---|---|
| committer | 2021-07-25 11:39:04 -0700 | |
| commit | 98b26b6e126d4775fdf3f773fe8a8ac808a8ff8f (patch) | |
| tree | 816faa96c2c4d291825063433331a8ea4b3d08f1 /src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp | |
| parent | Merge pull request #6699 from lat9nq/common-threads (diff) | |
| parent | shader: Support out of bound local memory reads and immediate writes (diff) | |
| download | yuzu-98b26b6e126d4775fdf3f773fe8a8ac808a8ff8f.tar.gz yuzu-98b26b6e126d4775fdf3f773fe8a8ac808a8ff8f.tar.xz yuzu-98b26b6e126d4775fdf3f773fe8a8ac808a8ff8f.zip | |
Merge pull request #6585 from ameerj/hades
Shader Decompiler Rewrite
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp')
| -rw-r--r-- | src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp new file mode 100644 index 000000000..7ce370f09 --- /dev/null +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/bit_field.h" | ||
| 6 | #include "common/common_types.h" | ||
| 7 | #include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" | ||
| 8 | |||
| 9 | namespace Shader::Maxwell { | ||
| 10 | namespace { | ||
| 11 | enum class VoteOp : u64 { | ||
| 12 | ALL, | ||
| 13 | ANY, | ||
| 14 | EQ, | ||
| 15 | }; | ||
| 16 | |||
| 17 | [[nodiscard]] IR::U1 VoteOperation(IR::IREmitter& ir, const IR::U1& pred, VoteOp vote_op) { | ||
| 18 | switch (vote_op) { | ||
| 19 | case VoteOp::ALL: | ||
| 20 | return ir.VoteAll(pred); | ||
| 21 | case VoteOp::ANY: | ||
| 22 | return ir.VoteAny(pred); | ||
| 23 | case VoteOp::EQ: | ||
| 24 | return ir.VoteEqual(pred); | ||
| 25 | default: | ||
| 26 | throw NotImplementedException("Invalid VOTE op {}", vote_op); | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | void Vote(TranslatorVisitor& v, u64 insn) { | ||
| 31 | union { | ||
| 32 | u64 insn; | ||
| 33 | BitField<0, 8, IR::Reg> dest_reg; | ||
| 34 | BitField<39, 3, IR::Pred> pred_a; | ||
| 35 | BitField<42, 1, u64> neg_pred_a; | ||
| 36 | BitField<45, 3, IR::Pred> pred_b; | ||
| 37 | BitField<48, 2, VoteOp> vote_op; | ||
| 38 | } const vote{insn}; | ||
| 39 | |||
| 40 | const IR::U1 vote_pred{v.ir.GetPred(vote.pred_a, vote.neg_pred_a != 0)}; | ||
| 41 | v.ir.SetPred(vote.pred_b, VoteOperation(v.ir, vote_pred, vote.vote_op)); | ||
| 42 | v.X(vote.dest_reg, v.ir.SubgroupBallot(vote_pred)); | ||
| 43 | } | ||
| 44 | } // Anonymous namespace | ||
| 45 | |||
| 46 | void TranslatorVisitor::VOTE(u64 insn) { | ||
| 47 | Vote(*this, insn); | ||
| 48 | } | ||
| 49 | |||
| 50 | void TranslatorVisitor::VOTE_vtg(u64) { | ||
| 51 | LOG_WARNING(Shader, "(STUBBED) called"); | ||
| 52 | } | ||
| 53 | |||
| 54 | } // namespace Shader::Maxwell | ||