summaryrefslogtreecommitdiffstats
path: root/src/video_core/pica.h
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/pica.h
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/pica.h')
-rw-r--r--src/video_core/pica.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 58b924f9e..bb689f2a9 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -1021,12 +1021,20 @@ struct float24 {
return ret;
}
+ static float24 Zero() {
+ return FromFloat32(0.f);
+ }
+
// Not recommended for anything but logging
float ToFloat32() const {
return value;
}
float24 operator * (const float24& flt) const {
+ if ((this->value == 0.f && !std::isnan(flt.value)) ||
+ (flt.value == 0.f && !std::isnan(this->value)))
+ // PICA gives 0 instead of NaN when multiplying by inf
+ return Zero();
return float24::FromFloat32(ToFloat32() * flt.ToFloat32());
}
@@ -1043,7 +1051,11 @@ struct float24 {
}
float24& operator *= (const float24& flt) {
- value *= flt.ToFloat32();
+ if ((this->value == 0.f && !std::isnan(flt.value)) ||
+ (flt.value == 0.f && !std::isnan(this->value)))
+ // PICA gives 0 instead of NaN when multiplying by inf
+ *this = Zero();
+ else value *= flt.ToFloat32();
return *this;
}