diff options
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell')
| -rw-r--r-- | src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp index ae2d37405..4d82a0009 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp | |||
| @@ -81,17 +81,28 @@ void TranslateF2I(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a) { | |||
| 81 | // F2I is used to convert from a floating point value to an integer | 81 | // F2I is used to convert from a floating point value to an integer |
| 82 | const F2I f2i{insn}; | 82 | const F2I f2i{insn}; |
| 83 | 83 | ||
| 84 | const bool denorm_cares{f2i.src_format != SrcFormat::F16 && f2i.src_format != SrcFormat::F64 && | ||
| 85 | f2i.dest_format != DestFormat::I64}; | ||
| 86 | IR::FmzMode fmz_mode{IR::FmzMode::DontCare}; | ||
| 87 | if (denorm_cares) { | ||
| 88 | fmz_mode = f2i.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None; | ||
| 89 | } | ||
| 90 | const IR::FpControl fp_control{ | ||
| 91 | .no_contraction{true}, | ||
| 92 | .rounding{IR::FpRounding::DontCare}, | ||
| 93 | .fmz_mode{fmz_mode}, | ||
| 94 | }; | ||
| 84 | const IR::F16F32F64 op_a{v.ir.FPAbsNeg(src_a, f2i.abs != 0, f2i.neg != 0)}; | 95 | const IR::F16F32F64 op_a{v.ir.FPAbsNeg(src_a, f2i.abs != 0, f2i.neg != 0)}; |
| 85 | const IR::F16F32F64 rounded_value{[&] { | 96 | const IR::F16F32F64 rounded_value{[&] { |
| 86 | switch (f2i.rounding) { | 97 | switch (f2i.rounding) { |
| 87 | case Rounding::Round: | 98 | case Rounding::Round: |
| 88 | return v.ir.FPRoundEven(op_a); | 99 | return v.ir.FPRoundEven(op_a, fp_control); |
| 89 | case Rounding::Floor: | 100 | case Rounding::Floor: |
| 90 | return v.ir.FPFloor(op_a); | 101 | return v.ir.FPFloor(op_a, fp_control); |
| 91 | case Rounding::Ceil: | 102 | case Rounding::Ceil: |
| 92 | return v.ir.FPCeil(op_a); | 103 | return v.ir.FPCeil(op_a, fp_control); |
| 93 | case Rounding::Trunc: | 104 | case Rounding::Trunc: |
| 94 | return v.ir.FPTrunc(op_a); | 105 | return v.ir.FPTrunc(op_a, fp_control); |
| 95 | default: | 106 | default: |
| 96 | throw NotImplementedException("Invalid F2I rounding {}", f2i.rounding.Value()); | 107 | throw NotImplementedException("Invalid F2I rounding {}", f2i.rounding.Value()); |
| 97 | } | 108 | } |