Skip to content

Commit

Permalink
VideoCommon: Explicitly disable fp_contract for CPUCull
Browse files Browse the repository at this point in the history
  • Loading branch information
TellowKrinkle committed Nov 29, 2022
1 parent 035a8f5 commit 699157d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Source/Core/VideoCommon/CPUCull.cpp
Expand Up @@ -13,6 +13,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)
Expand Down

0 comments on commit 699157d

Please sign in to comment.