diff options
author | bunnei <bunneidev@gmail.com> | 2019-05-29 18:21:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-29 18:21:17 +0200 |
commit | e3608578e40065779965af483db69941ef0e29e1 (patch) | |
tree | 97df50ae021302f1e16deb82e5cb2f38ee6042b3 /src/video_core/shader | |
parent | Merge pull request #2518 from ReinUsesLisp/sdl2-window (diff) | |
parent | shader: Implement S2R Tid{XYZ} and CtaId{XYZ} (diff) | |
download | yuzu-e3608578e40065779965af483db69941ef0e29e1.tar yuzu-e3608578e40065779965af483db69941ef0e29e1.tar.gz yuzu-e3608578e40065779965af483db69941ef0e29e1.tar.bz2 yuzu-e3608578e40065779965af483db69941ef0e29e1.tar.lz yuzu-e3608578e40065779965af483db69941ef0e29e1.tar.xz yuzu-e3608578e40065779965af483db69941ef0e29e1.tar.zst yuzu-e3608578e40065779965af483db69941ef0e29e1.zip |
Diffstat (limited to 'src/video_core/shader')
-rw-r--r-- | src/video_core/shader/decode/other.cpp | 42 | ||||
-rw-r--r-- | src/video_core/shader/shader_ir.h | 8 |
2 files changed, 35 insertions, 15 deletions
diff --git a/src/video_core/shader/decode/other.cpp b/src/video_core/shader/decode/other.cpp index ca7af72e1..a6c123573 100644 --- a/src/video_core/shader/decode/other.cpp +++ b/src/video_core/shader/decode/other.cpp @@ -14,6 +14,7 @@ using Tegra::Shader::ConditionCode; using Tegra::Shader::Instruction; using Tegra::Shader::OpCode; using Tegra::Shader::Register; +using Tegra::Shader::SystemVariable; u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { const Instruction instr = {program_code[pc]}; @@ -59,20 +60,33 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { break; } case OpCode::Id::MOV_SYS: { - switch (instr.sys20) { - case Tegra::Shader::SystemVariable::InvocationInfo: { - LOG_WARNING(HW_GPU, "MOV_SYS instruction with InvocationInfo is incomplete"); - SetRegister(bb, instr.gpr0, Immediate(0u)); - break; - } - case Tegra::Shader::SystemVariable::Ydirection: { - // Config pack's third value is Y_NEGATE's state. - SetRegister(bb, instr.gpr0, Operation(OperationCode::YNegate)); - break; - } - default: - UNIMPLEMENTED_MSG("Unhandled system move: {}", static_cast<u32>(instr.sys20.Value())); - } + const Node value = [&]() { + switch (instr.sys20) { + case SystemVariable::Ydirection: + return Operation(OperationCode::YNegate); + case SystemVariable::InvocationInfo: + LOG_WARNING(HW_GPU, "MOV_SYS instruction with InvocationInfo is incomplete"); + return Immediate(0u); + case SystemVariable::TidX: + return Operation(OperationCode::LocalInvocationIdX); + case SystemVariable::TidY: + return Operation(OperationCode::LocalInvocationIdY); + case SystemVariable::TidZ: + return Operation(OperationCode::LocalInvocationIdZ); + case SystemVariable::CtaIdX: + return Operation(OperationCode::WorkGroupIdX); + case SystemVariable::CtaIdY: + return Operation(OperationCode::WorkGroupIdY); + case SystemVariable::CtaIdZ: + return Operation(OperationCode::WorkGroupIdZ); + default: + UNIMPLEMENTED_MSG("Unhandled system move: {}", + static_cast<u32>(instr.sys20.Value())); + return Immediate(0u); + } + }(); + SetRegister(bb, instr.gpr0, value); + break; } case OpCode::Id::BRA: { diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index 35f72bddb..ff7472e30 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h @@ -181,7 +181,13 @@ enum class OperationCode { EmitVertex, /// () -> void EndPrimitive, /// () -> void - YNegate, /// () -> float + YNegate, /// () -> float + LocalInvocationIdX, /// () -> uint + LocalInvocationIdY, /// () -> uint + LocalInvocationIdZ, /// () -> uint + WorkGroupIdX, /// () -> uint + WorkGroupIdY, /// () -> uint + WorkGroupIdZ, /// () -> uint Amount, }; |