summaryrefslogtreecommitdiffstats
path: root/src/video_core/pica.h
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-24 06:48:15 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-24 06:48:15 +0200
commit630a850d4d5a0509b16e96aaccc81e9384e1fba8 (patch)
tree01a553c46e23e4f5d2b92ec1faf1a4b72a8e1466 /src/video_core/pica.h
parentShaders: Explicitly conform to PICA semantics in MAX/MIN (diff)
downloadyuzu-630a850d4d5a0509b16e96aaccc81e9384e1fba8.tar
yuzu-630a850d4d5a0509b16e96aaccc81e9384e1fba8.tar.gz
yuzu-630a850d4d5a0509b16e96aaccc81e9384e1fba8.tar.bz2
yuzu-630a850d4d5a0509b16e96aaccc81e9384e1fba8.tar.lz
yuzu-630a850d4d5a0509b16e96aaccc81e9384e1fba8.tar.xz
yuzu-630a850d4d5a0509b16e96aaccc81e9384e1fba8.tar.zst
yuzu-630a850d4d5a0509b16e96aaccc81e9384e1fba8.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..cf148de50 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 && flt.value == flt.value) ||
+ (flt.value == 0.f && this->value == 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 && flt.value == flt.value) ||
+ (flt.value == 0.f && this->value == this->value))
+ // PICA gives 0 instead of NaN when multiplying by inf
+ *this = Zero();
+ else value *= flt.ToFloat32();
return *this;
}