diff options
| author | 2021-05-24 00:55:39 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:36 -0400 | |
| commit | df793fc0493a67ca2838ba816232da8409d03c8a (patch) | |
| tree | 826775d0642001231c28c0233674ee2cc5ee817a /src/shader_recompiler/backend/glsl/reg_alloc.cpp | |
| parent | glsl: Add a more robust fp formatter (diff) | |
| download | yuzu-df793fc0493a67ca2838ba816232da8409d03c8a.tar.gz yuzu-df793fc0493a67ca2838ba816232da8409d03c8a.tar.xz yuzu-df793fc0493a67ca2838ba816232da8409d03c8a.zip | |
glsl: Implement FCMP
Diffstat (limited to 'src/shader_recompiler/backend/glsl/reg_alloc.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/reg_alloc.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/reg_alloc.cpp b/src/shader_recompiler/backend/glsl/reg_alloc.cpp index 007f8c89d..9f529c358 100644 --- a/src/shader_recompiler/backend/glsl/reg_alloc.cpp +++ b/src/shader_recompiler/backend/glsl/reg_alloc.cpp | |||
| @@ -25,6 +25,18 @@ std::string Representation(Id id) { | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | std::string FormatFloat(std::string_view value, IR::Type type) { | 27 | std::string FormatFloat(std::string_view value, IR::Type type) { |
| 28 | // TODO: Confirm FP64 nan/inf | ||
| 29 | if (type == IR::Type::F32) { | ||
| 30 | if (value == "nan") { | ||
| 31 | return "uintBitsToFloat(0x7fc00000)"; | ||
| 32 | } | ||
| 33 | if (value == "inf") { | ||
| 34 | return "uintBitsToFloat(0x7f800000)"; | ||
| 35 | } | ||
| 36 | if (value == "-inf") { | ||
| 37 | return "uintBitsToFloat(0xff800000)"; | ||
| 38 | } | ||
| 39 | } | ||
| 28 | const bool needs_dot = value.find_first_of('.') == std::string_view::npos; | 40 | const bool needs_dot = value.find_first_of('.') == std::string_view::npos; |
| 29 | const bool needs_suffix = !value.ends_with('f'); | 41 | const bool needs_suffix = !value.ends_with('f'); |
| 30 | const auto suffix = type == IR::Type::F32 ? "f" : "lf"; | 42 | const auto suffix = type == IR::Type::F32 ? "f" : "lf"; |