diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-12-15 21:32:51 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-15 21:54:50 +0100 |
commit | c849b5b3201e8fda40727c3926b6389f609feafc (patch) | |
tree | a90ad69899374115d99711f5a65d479565c6bda6 /src/video_core/shader | |
parent | shader_decode: Stub DEPBAR (diff) | |
download | yuzu-c849b5b3201e8fda40727c3926b6389f609feafc.tar yuzu-c849b5b3201e8fda40727c3926b6389f609feafc.tar.gz yuzu-c849b5b3201e8fda40727c3926b6389f609feafc.tar.bz2 yuzu-c849b5b3201e8fda40727c3926b6389f609feafc.tar.lz yuzu-c849b5b3201e8fda40727c3926b6389f609feafc.tar.xz yuzu-c849b5b3201e8fda40727c3926b6389f609feafc.tar.zst yuzu-c849b5b3201e8fda40727c3926b6389f609feafc.zip |
Diffstat (limited to 'src/video_core/shader')
-rw-r--r-- | src/video_core/shader/decode/conversion.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/video_core/shader/decode/conversion.cpp b/src/video_core/shader/decode/conversion.cpp index c6eb2952c..465c63a9e 100644 --- a/src/video_core/shader/decode/conversion.cpp +++ b/src/video_core/shader/decode/conversion.cpp @@ -11,12 +11,48 @@ namespace VideoCommon::Shader { using Tegra::Shader::Instruction; using Tegra::Shader::OpCode; +using Tegra::Shader::Register; u32 ShaderIR::DecodeConversion(BasicBlock& bb, u32 pc) { const Instruction instr = {program_code[pc]}; const auto opcode = OpCode::Decode(instr); - UNIMPLEMENTED(); + switch (opcode->get().GetId()) { + case OpCode::Id::F2F_R: { + UNIMPLEMENTED_IF(instr.conversion.dest_size != Register::Size::Word); + UNIMPLEMENTED_IF(instr.conversion.src_size != Register::Size::Word); + UNIMPLEMENTED_IF_MSG(instr.generates_cc, + "Condition codes generation in F2F is not implemented"); + + Node value = GetRegister(instr.gpr20); + value = GetOperandAbsNegFloat(value, instr.conversion.abs_a, instr.conversion.negate_a); + + value = [&]() { + switch (instr.conversion.f2f.rounding) { + case Tegra::Shader::F2fRoundingOp::None: + return value; + case Tegra::Shader::F2fRoundingOp::Round: + return Operation(OperationCode::FRoundEven, PRECISE, value); + case Tegra::Shader::F2fRoundingOp::Floor: + return Operation(OperationCode::FFloor, PRECISE, value); + case Tegra::Shader::F2fRoundingOp::Ceil: + return Operation(OperationCode::FCeil, PRECISE, value); + case Tegra::Shader::F2fRoundingOp::Trunc: + return Operation(OperationCode::FTrunc, PRECISE, value); + default: + UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}", + static_cast<u32>(instr.conversion.f2f.rounding.Value())); + break; + } + }(); + value = GetSaturatedFloat(value, instr.alu.saturate_d); + + SetRegister(bb, instr.gpr0, value); + break; + } + default: + UNIMPLEMENTED_MSG("Unhandled conversion instruction: {}", opcode->get().GetName()); + } return pc; } |