Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable FP contraction. #94655

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions platform/android/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ def configure(env: "SConsEnvironment"):
env.Append(CCFLAGS=["-mfix-cortex-a53-835769"])
env.Append(CPPDEFINES=["__ARM_ARCH_8A__"])

env.Append(CCFLAGS=["-ffp-contract=off"])

# Link flags

env.Append(LINKFLAGS="-Wl,--gc-sections -Wl,--no-undefined -Wl,-z,now".split())
Expand Down
2 changes: 2 additions & 0 deletions platform/linuxbsd/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ def configure(env: "SConsEnvironment"):
env.Append(CCFLAGS=["-fsanitize-recover=memory"])
env.Append(LINKFLAGS=["-fsanitize=memory"])

env.Append(CCFLAGS=["-ffp-contract=off"])

# LTO

if env["lto"] == "auto": # Full LTO for production.
Expand Down
2 changes: 2 additions & 0 deletions platform/macos/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def configure(env: "SConsEnvironment"):
env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])
env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])

env.Append(CCFLAGS=["-ffp-contract=off"])

cc_version = get_compiler_version(env)
cc_version_major = cc_version["apple_major"]
cc_version_minor = cc_version["apple_minor"]
Expand Down
4 changes: 4 additions & 0 deletions platform/windows/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ def spawn_capture(sh, escape, cmd, args, env):
if env["arch"] == "x86_32":
env["x86_libtheora_opt_vc"] = True

env.Append(CCFLAGS=["/fp:strict"])

env.AppendUnique(CCFLAGS=["/Gd", "/GR", "/nologo"])
env.AppendUnique(CCFLAGS=["/utf-8"]) # Force to use Unicode encoding.
env.AppendUnique(CXXFLAGS=["/TP"]) # assume all sources are C++
Expand Down Expand Up @@ -675,6 +677,8 @@ def configure_mingw(env: "SConsEnvironment"):
if env["arch"] in ["x86_32", "x86_64"]:
env["x86_libtheora_opt_gcc"] = True

env.Append(CCFLAGS=["-ffp-contract=off"])

mingw_bin_prefix = get_mingw_bin_prefix(env["mingw_prefix"], env["arch"])

if env["use_llvm"]:
Expand Down
18 changes: 18 additions & 0 deletions thirdparty/libwebp/patches/godot-msvc-arm64-fpstrict-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c b/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c
index 09028428ac..3184e2b80f 100644
--- a/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c
+++ b/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c
@@ -26,7 +26,13 @@ static uint32_t kGammaToLinearTabS[GAMMA_TO_LINEAR_TAB_SIZE + 2];
#define LINEAR_TO_GAMMA_TAB_SIZE (1 << LINEAR_TO_GAMMA_TAB_BITS)
static uint32_t kLinearToGammaTabS[LINEAR_TO_GAMMA_TAB_SIZE + 2];

+// -- GODOT start --
+#if defined(_MSC_VER)
+static const double kGammaF = 2.222222222222222;
+#else
static const double kGammaF = 1. / 0.45;
+#endif
+// -- GODOT end --
#define GAMMA_TO_LINEAR_BITS 16

static volatile int kGammaTablesSOk = 0;
6 changes: 6 additions & 0 deletions thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ static uint32_t kGammaToLinearTabS[GAMMA_TO_LINEAR_TAB_SIZE + 2];
#define LINEAR_TO_GAMMA_TAB_SIZE (1 << LINEAR_TO_GAMMA_TAB_BITS)
static uint32_t kLinearToGammaTabS[LINEAR_TO_GAMMA_TAB_SIZE + 2];

// -- GODOT start --
#if defined(_MSC_VER)
static const double kGammaF = 2.222222222222222;
#else
static const double kGammaF = 1. / 0.45;
#endif
// -- GODOT end --
#define GAMMA_TO_LINEAR_BITS 16

static volatile int kGammaTablesSOk = 0;
Expand Down
Loading