summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-05-09 09:56:50 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-05-10 07:59:33 +0200
commit8b329ddcc9b39353b9545289b3bd653a77db0103 (patch)
tree6789cbf1016daecc6bdc373b4d8b79b92463d538
parentshader_ir: Separate float-point comparisons in ordered and unordered (diff)
downloadyuzu-8b329ddcc9b39353b9545289b3bd653a77db0103.tar
yuzu-8b329ddcc9b39353b9545289b3bd653a77db0103.tar.gz
yuzu-8b329ddcc9b39353b9545289b3bd653a77db0103.tar.bz2
yuzu-8b329ddcc9b39353b9545289b3bd653a77db0103.tar.lz
yuzu-8b329ddcc9b39353b9545289b3bd653a77db0103.tar.xz
yuzu-8b329ddcc9b39353b9545289b3bd653a77db0103.tar.zst
yuzu-8b329ddcc9b39353b9545289b3bd653a77db0103.zip
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index d071abd84..960ebf1a1 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1845,6 +1845,15 @@ private:
static_assert(!unordered || type == Type::Float);
const Expression expr = GenerateBinaryInfix(operation, op, Type::Bool, type, type);
+
+ if constexpr (op.compare("!=") == 0 && type == Type::Float && !unordered) {
+ // GLSL's operator!=(float, float) doesn't seem be ordered. This happens on both AMD's
+ // and Nvidia's proprietary stacks. Manually force an ordered comparison.
+ return {fmt::format("({} && !isnan({}) && !isnan({}))", expr.AsBool(),
+ VisitOperand(operation, 0).AsFloat(),
+ VisitOperand(operation, 1).AsFloat()),
+ Type::Bool};
+ }
if constexpr (!unordered) {
return expr;
}