diff options
author | bunnei <bunneidev@gmail.com> | 2019-08-29 18:58:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-29 18:58:10 +0200 |
commit | 680ab6132726946435081df6c4f2ef01ec2f1691 (patch) | |
tree | 230bc98a8bdd67a95c5abde32294655469845b3b /src/video_core/shader/decode | |
parent | Merge pull request #2748 from FernandoS27/align-memory (diff) | |
parent | shader_ir: Implement VOTE (diff) | |
download | yuzu-680ab6132726946435081df6c4f2ef01ec2f1691.tar yuzu-680ab6132726946435081df6c4f2ef01ec2f1691.tar.gz yuzu-680ab6132726946435081df6c4f2ef01ec2f1691.tar.bz2 yuzu-680ab6132726946435081df6c4f2ef01ec2f1691.tar.lz yuzu-680ab6132726946435081df6c4f2ef01ec2f1691.tar.xz yuzu-680ab6132726946435081df6c4f2ef01ec2f1691.tar.zst yuzu-680ab6132726946435081df6c4f2ef01ec2f1691.zip |
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r-- | src/video_core/shader/decode/warp.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/video_core/shader/decode/warp.cpp b/src/video_core/shader/decode/warp.cpp new file mode 100644 index 000000000..04ca74f46 --- /dev/null +++ b/src/video_core/shader/decode/warp.cpp @@ -0,0 +1,55 @@ +// Copyright 2019 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/assert.h" +#include "common/common_types.h" +#include "video_core/engines/shader_bytecode.h" +#include "video_core/shader/node_helper.h" +#include "video_core/shader/shader_ir.h" + +namespace VideoCommon::Shader { + +using Tegra::Shader::Instruction; +using Tegra::Shader::OpCode; +using Tegra::Shader::Pred; +using Tegra::Shader::VoteOperation; + +namespace { +OperationCode GetOperationCode(VoteOperation vote_op) { + switch (vote_op) { + case VoteOperation::All: + return OperationCode::VoteAll; + case VoteOperation::Any: + return OperationCode::VoteAny; + case VoteOperation::Eq: + return OperationCode::VoteEqual; + default: + UNREACHABLE_MSG("Invalid vote operation={}", static_cast<u64>(vote_op)); + return OperationCode::VoteAll; + } +} +} // Anonymous namespace + +u32 ShaderIR::DecodeWarp(NodeBlock& bb, u32 pc) { + const Instruction instr = {program_code[pc]}; + const auto opcode = OpCode::Decode(instr); + + switch (opcode->get().GetId()) { + case OpCode::Id::VOTE: { + const Node value = GetPredicate(instr.vote.value, instr.vote.negate_value != 0); + const Node active = Operation(OperationCode::BallotThread, value); + const Node vote = Operation(GetOperationCode(instr.vote.operation), value); + SetRegister(bb, instr.gpr0, active); + SetPredicate(bb, instr.vote.dest_pred, vote); + break; + } + default: + UNIMPLEMENTED_MSG("Unhandled warp instruction: {}", opcode->get().GetName()); + break; + } + + return pc; +} + +} // namespace VideoCommon::Shader |