diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-04-09 23:41:41 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-04-16 02:16:10 +0200 |
commit | 64613db6052dfe0c056ce3d6ead21ae9a32f03ae (patch) | |
tree | 9fa4a632c8fc050b6176ebbca727c27757f95662 /src/video_core/renderer_opengl | |
parent | shader_ir/decode: Reduce severity of unimplemented half-float FTZ (diff) | |
download | yuzu-64613db6052dfe0c056ce3d6ead21ae9a32f03ae.tar yuzu-64613db6052dfe0c056ce3d6ead21ae9a32f03ae.tar.gz yuzu-64613db6052dfe0c056ce3d6ead21ae9a32f03ae.tar.bz2 yuzu-64613db6052dfe0c056ce3d6ead21ae9a32f03ae.tar.lz yuzu-64613db6052dfe0c056ce3d6ead21ae9a32f03ae.tar.xz yuzu-64613db6052dfe0c056ce3d6ead21ae9a32f03ae.tar.zst yuzu-64613db6052dfe0c056ce3d6ead21ae9a32f03ae.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index cbaa4dceb..9c972fd3a 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -617,13 +617,11 @@ private: } std::string VisitOperand(Operation operation, std::size_t operand_index, Type type) { - std::string value = VisitOperand(operation, operand_index); + const std::string value = VisitOperand(operation, operand_index); switch (type) { case Type::HalfFloat: { const auto half_meta = std::get_if<MetaHalfArithmetic>(&operation.GetMeta()); - if (!half_meta) { - value = "toHalf2(" + value + ')'; - } + ASSERT(half_meta); switch (half_meta->types.at(operand_index)) { case Tegra::Shader::HalfType::H0_H1: @@ -1067,6 +1065,14 @@ private: return BitwiseCastResult(value, Type::HalfFloat); } + std::string HClamp(Operation operation) { + const std::string value = VisitOperand(operation, 0, Type::HalfFloat); + const std::string min = VisitOperand(operation, 1, Type::Float); + const std::string max = VisitOperand(operation, 2, Type::Float); + const std::string clamped = "clamp(" + value + ", vec2(" + min + "), vec2(" + max + "))"; + return ApplyPrecise(operation, BitwiseCastResult(clamped, Type::HalfFloat)); + } + std::string HMergeF32(Operation operation) { return "float(toHalf2(" + Visit(operation[0]) + ")[0])"; } @@ -1501,6 +1507,7 @@ private: &GLSLDecompiler::Fma<Type::HalfFloat>, &GLSLDecompiler::Absolute<Type::HalfFloat>, &GLSLDecompiler::HNegate, + &GLSLDecompiler::HClamp, &GLSLDecompiler::HMergeF32, &GLSLDecompiler::HMergeH0, &GLSLDecompiler::HMergeH1, |