diff options
| author | 2021-03-21 00:42:56 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:24 -0400 | |
| commit | a77e764726938a26803fa90a9c69ccdd32ab09cd (patch) | |
| tree | dbc22cd8ba43dbb8f6458dca40ad078e317eb755 /src/shader_recompiler/frontend/ir/ir_emitter.cpp | |
| parent | shader: Fix floating point comparison for FP16 (diff) | |
| download | yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.tar.gz yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.tar.xz yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.zip | |
shader: Add support for fp16 comparisons and misc fixes
Diffstat (limited to 'src/shader_recompiler/frontend/ir/ir_emitter.cpp')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index 652f6949e..1eda95071 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -895,15 +895,30 @@ U1 IREmitter::FPGreaterThanEqual(const F16F32F64& lhs, const F16F32F64& rhs, FpC | |||
| 895 | } | 895 | } |
| 896 | } | 896 | } |
| 897 | 897 | ||
| 898 | U1 IREmitter::FPIsNan(const F32& value) { | 898 | U1 IREmitter::FPIsNan(const F16F32F64& value) { |
| 899 | return Inst<U1>(Opcode::FPIsNan32, value); | 899 | switch (value.Type()) { |
| 900 | case Type::F16: | ||
| 901 | return Inst<U1>(Opcode::FPIsNan16, value); | ||
| 902 | case Type::F32: | ||
| 903 | return Inst<U1>(Opcode::FPIsNan32, value); | ||
| 904 | case Type::F64: | ||
| 905 | return Inst<U1>(Opcode::FPIsNan64, value); | ||
| 906 | default: | ||
| 907 | ThrowInvalidType(value.Type()); | ||
| 908 | } | ||
| 900 | } | 909 | } |
| 901 | 910 | ||
| 902 | U1 IREmitter::FPOrdered(const F32& lhs, const F32& rhs) { | 911 | U1 IREmitter::FPOrdered(const F16F32F64& lhs, const F16F32F64& rhs) { |
| 912 | if (lhs.Type() != rhs.Type()) { | ||
| 913 | throw InvalidArgument("Mismatching types {} and {}", lhs.Type(), rhs.Type()); | ||
| 914 | } | ||
| 903 | return LogicalAnd(LogicalNot(FPIsNan(lhs)), LogicalNot(FPIsNan(rhs))); | 915 | return LogicalAnd(LogicalNot(FPIsNan(lhs)), LogicalNot(FPIsNan(rhs))); |
| 904 | } | 916 | } |
| 905 | 917 | ||
| 906 | U1 IREmitter::FPUnordered(const F32& lhs, const F32& rhs) { | 918 | U1 IREmitter::FPUnordered(const F16F32F64& lhs, const F16F32F64& rhs) { |
| 919 | if (lhs.Type() != rhs.Type()) { | ||
| 920 | throw InvalidArgument("Mismatching types {} and {}", lhs.Type(), rhs.Type()); | ||
| 921 | } | ||
| 907 | return LogicalOr(FPIsNan(lhs), FPIsNan(rhs)); | 922 | return LogicalOr(FPIsNan(lhs), FPIsNan(rhs)); |
| 908 | } | 923 | } |
| 909 | 924 | ||