summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/CPUCull.cpp
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2022-11-13 23:26:09 -0600
committerTellowKrinkle <tellowkrinkle@gmail.com>2023-01-25 02:21:56 -0600
commita0e6d7c173f79b553c21d87abcccf40549113600 (patch)
treef39ecf67f45b5f41f3c659e7a96cc2b3de895c3b /Source/Core/VideoCommon/CPUCull.cpp
parent1be0149146b23d65a52b5d74c4c073c016878bc9 (diff)
VideoCommon: Explicitly disable fp_contract for CPUCull
Diffstat (limited to 'Source/Core/VideoCommon/CPUCull.cpp')
-rw-r--r--Source/Core/VideoCommon/CPUCull.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/CPUCull.cpp b/Source/Core/VideoCommon/CPUCull.cpp
index bb68376b09..92fdc81cc8 100644
--- a/Source/Core/VideoCommon/CPUCull.cpp
+++ b/Source/Core/VideoCommon/CPUCull.cpp
@@ -15,6 +15,20 @@
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/XFMemory.h"
+// We really want things like c.w * a.x - a.w * c.x to stay symmetric, so they cancel to zero on
+// degenerate triangles. Make sure the compiler doesn't optimize in fmas where not requested.
+#ifdef _MSC_VER
+#pragma fp_contract(off)
+#else
+// GCC doesn't support any in-file way to turn off fp contract yet
+// Not ideal, but worst case scenario its cpu cull is worse at detecting degenerate triangles
+// (Most likely to happen on arm, as we don't compile the cull code for x86 fma)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunknown-pragmas"
+#pragma STDC FP_CONTRACT OFF
+#pragma GCC diagnostic pop
+#endif
+
#if defined(_M_X86) || defined(_M_X86_64)
#define USE_SSE
#elif defined(_M_ARM_64)