summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-03-26 01:58:49 -0300
committerGravatar ReinUsesLisp2020-03-26 01:58:49 -0300
commit46791c464a100ff37ecaf813a024858afa8ad9ff (patch)
treea78afb72941c2204a3a2c08d24e750ea9d46f02a /src
parentMerge pull request #3544 from makigumo/myfork/patch-2 (diff)
downloadyuzu-46791c464a100ff37ecaf813a024858afa8ad9ff.tar.gz
yuzu-46791c464a100ff37ecaf813a024858afa8ad9ff.tar.xz
yuzu-46791c464a100ff37ecaf813a024858afa8ad9ff.zip
shader/conversion: Fix F2F rounding operations with different sizes
Rounding operations only matter when the conversion size of source and destination is the same, i.e. .F16.F16, .F32.F32 and .F64.F64. When there is a mismatch (.F16.F32), these bits are used for IEEE rounding, we don't emulate this because GLSL and SPIR-V don't support configuring it per operation.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/shader/decode/conversion.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/video_core/shader/decode/conversion.cpp b/src/video_core/shader/decode/conversion.cpp
index 6ead42070..c72690b2b 100644
--- a/src/video_core/shader/decode/conversion.cpp
+++ b/src/video_core/shader/decode/conversion.cpp
@@ -138,18 +138,23 @@ u32 ShaderIR::DecodeConversion(NodeBlock& bb, u32 pc) {
138 138
139 value = GetOperandAbsNegFloat(value, instr.conversion.abs_a, instr.conversion.negate_a); 139 value = GetOperandAbsNegFloat(value, instr.conversion.abs_a, instr.conversion.negate_a);
140 140
141 value = [&]() { 141 value = [&] {
142 if (instr.conversion.src_size != instr.conversion.dst_size) {
143 // Rounding operations only matter when the source and destination conversion size
144 // is the same.
145 return value;
146 }
142 switch (instr.conversion.f2f.GetRoundingMode()) { 147 switch (instr.conversion.f2f.GetRoundingMode()) {
143 case Tegra::Shader::F2fRoundingOp::None: 148 case Tegra::Shader::F2fRoundingOp::None:
144 return value; 149 return value;
145 case Tegra::Shader::F2fRoundingOp::Round: 150 case Tegra::Shader::F2fRoundingOp::Round:
146 return Operation(OperationCode::FRoundEven, PRECISE, value); 151 return Operation(OperationCode::FRoundEven, value);
147 case Tegra::Shader::F2fRoundingOp::Floor: 152 case Tegra::Shader::F2fRoundingOp::Floor:
148 return Operation(OperationCode::FFloor, PRECISE, value); 153 return Operation(OperationCode::FFloor, value);
149 case Tegra::Shader::F2fRoundingOp::Ceil: 154 case Tegra::Shader::F2fRoundingOp::Ceil:
150 return Operation(OperationCode::FCeil, PRECISE, value); 155 return Operation(OperationCode::FCeil, value);
151 case Tegra::Shader::F2fRoundingOp::Trunc: 156 case Tegra::Shader::F2fRoundingOp::Trunc:
152 return Operation(OperationCode::FTrunc, PRECISE, value); 157 return Operation(OperationCode::FTrunc, value);
153 default: 158 default:
154 UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}", 159 UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}",
155 static_cast<u32>(instr.conversion.f2f.rounding.Value())); 160 static_cast<u32>(instr.conversion.f2f.rounding.Value()));