summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/shader_interpreter.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-28 01:34:13 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-28 01:34:13 +0200
commitc5a4025b6581c1c64c2761d09510c5827eaada05 (patch)
treec7b7072b2ad53041127c454e7de0dcb0607d02e8 /src/video_core/shader/shader_interpreter.cpp
parentMerge pull request #1068 from bunnei/gl-hash-textures (diff)
parentfixup! Shaders: Fix multiplications between 0.0 and inf (diff)
downloadyuzu-c5a4025b6581c1c64c2761d09510c5827eaada05.tar
yuzu-c5a4025b6581c1c64c2761d09510c5827eaada05.tar.gz
yuzu-c5a4025b6581c1c64c2761d09510c5827eaada05.tar.bz2
yuzu-c5a4025b6581c1c64c2761d09510c5827eaada05.tar.lz
yuzu-c5a4025b6581c1c64c2761d09510c5827eaada05.tar.xz
yuzu-c5a4025b6581c1c64c2761d09510c5827eaada05.tar.zst
yuzu-c5a4025b6581c1c64c2761d09510c5827eaada05.zip
Diffstat (limited to 'src/video_core/shader/shader_interpreter.cpp')
-rw-r--r--src/video_core/shader/shader_interpreter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp
index ae5a30441..69e4efa68 100644
--- a/src/video_core/shader/shader_interpreter.cpp
+++ b/src/video_core/shader/shader_interpreter.cpp
@@ -177,7 +177,10 @@ void RunInterpreter(UnitState<Debug>& state) {
if (!swizzle.DestComponentEnabled(i))
continue;
- dest[i] = std::max(src1[i], src2[i]);
+ // NOTE: Exact form required to match NaN semantics to hardware:
+ // max(0, NaN) -> NaN
+ // max(NaN, 0) -> 0
+ dest[i] = (src1[i] > src2[i]) ? src1[i] : src2[i];
}
Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest);
break;
@@ -190,7 +193,10 @@ void RunInterpreter(UnitState<Debug>& state) {
if (!swizzle.DestComponentEnabled(i))
continue;
- dest[i] = std::min(src1[i], src2[i]);
+ // NOTE: Exact form required to match NaN semantics to hardware:
+ // min(0, NaN) -> NaN
+ // min(NaN, 0) -> 0
+ dest[i] = (src1[i] < src2[i]) ? src1[i] : src2[i];
}
Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest);
break;