Build: Only turn off floating-point contraction for CPU emulation

The vertex decoder's C++ steps may fuse, like the vertex JITs do; with
contraction off everywhere, RISC-V's VertexJit test found the JIT and
the steps disagreeing on morphed float UVs. The flag now applies to
Core/MIPS only, in CMake and the libretro Makefile. ndk-build has no
per-file flags, so the legacy Android.mk goes back to the default.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-24 12:59:04 -06:00
1 parent 9b4d4ee35b
commit e932d55f1c
4 files changed
+16 -6

No files matched your search

-3
View File
@@ -496,9 +496,6 @@ if(NOT MSVC)
add_compile_options(-fno-math-errno)
# No fused multiply-adds unless written explicitly, so float results are the same on every CPU.
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-ffp-contract=off>")
if(X86)
# enable sse2 code generation (enabled by default on X86_64)
if(NOT MACOSX)
+8
View File
@@ -823,3 +823,11 @@ set_source_files_properties(${CMAKE_BINARY_DIR}/git-version.cpp
PROPERTIES GENERATED TRUE
SKIP_AUTOMOC ON)
add_dependencies(Core GitVersion)
# No fused multiply-adds in CPU emulation unless written explicitly, so its float results are the
# same on every CPU. Elsewhere (the vertex decoder, say) they're fine. MSVC doesn't fuse by default.
if(NOT MSVC)
get_target_property(CoreCPUSources Core SOURCES)
list(FILTER CoreCPUSources INCLUDE REGEX "^MIPS/")
set_source_files_properties(${CoreCPUSources} PROPERTIES COMPILE_OPTIONS "-ffp-contract=off")
endif()
+1 -1
View File
@@ -4,7 +4,7 @@
LOCAL_CFLAGS := -DUSE_FFMPEG -DWITH_UPNP -DUSING_GLES2 -DZ7_CRC_NUM_TABLES=1 -DMOBILE_DEVICE -O3 -fsigned-char -Wall -Wno-multichar -Wno-unused-variable -fno-strict-aliasing -D__STDC_CONSTANT_MACROS -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
# yes, it's really CPPFLAGS for C++
# deprecated-register is generated by Android default code and causes noise.
LOCAL_CPPFLAGS := -fexceptions -std=c++17 -ffp-contract=off -frtti -Wno-reorder -Wno-deprecated-register -Wno-nullability-completeness
LOCAL_CPPFLAGS := -fexceptions -std=c++17 -frtti -Wno-reorder -Wno-deprecated-register -Wno-nullability-completeness
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../Common \
$(LOCAL_PATH)/../.. \
+7 -2
View File
@@ -448,8 +448,7 @@ else
endif
ifeq (,$(findstring msvc,$(platform)))
# No fused multiply-adds unless written explicitly, so float results are the same on every CPU.
CXXFLAGS += -std=c++17 -ffp-contract=off
CXXFLAGS += -std=c++17
else
CXXFLAGS += -std:c++17
endif
@@ -465,6 +464,12 @@ ifeq ($(GLEW_EGL),1)
endif
OBJECTS += $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o) $(ASMFILES:.S=.o)
ifeq (,$(findstring msvc,$(platform)))
# No fused multiply-adds in CPU emulation unless written explicitly, so its float results are the
# same on every CPU. Elsewhere (the vertex decoder, say) they're fine.
$(filter $(COREDIR)/MIPS/%,$(SOURCES_CXX:.cpp=.o)): CXXFLAGS += -ffp-contract=off
endif
CXXFLAGS += $(CPUOPTS) $(COREFLAGS) $(FFMPEGINCFLAGS) $(INCFLAGS) $(INCFLAGS_PLATFORM) $(PLATCFLAGS) $(fpic) $(PLATCFLAGS) $(CPUFLAGS) $(GLFLAGS) $(DYNAFLAGS)
CFLAGS += $(CPUOPTS) $(COREFLAGS) $(FFMPEGINCFLAGS) $(INCFLAGS) $(INCFLAGS_PLATFORM) $(PLATCFLAGS) $(fpic) $(PLATCFLAGS) $(CPUFLAGS) $(GLFLAGS) $(DYNAFLAGS)