mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-26 10:41:53 -04:00
No FMA (#6811)
This commit is contained in:
+12
-8
@@ -127,19 +127,23 @@ endif()
|
||||
# Global configuration types
|
||||
################################################################################
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g -ffast-math -DDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -ffast-math -DDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
set(CMAKE_OBJCXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
endif()
|
||||
# IEEE 754 compliant floating-point rounding on arm64 macOS
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
add_compile_options(-Xarch_arm64 -ffp-contract=off)
|
||||
endif()
|
||||
|
||||
# Enforce strict, deterministic IEEE-754 floating-point to match N64 (MIPS) semantics.
|
||||
# Never enable fast-math, and disable FMA contraction: the R4300 CPU and RSP have no
|
||||
# fused multiply-add, so contracting mul+add into an FMA produces extra precision.
|
||||
add_compile_options($<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-fno-fast-math>)
|
||||
add_compile_options($<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-ffp-contract=off>)
|
||||
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/fp:precise>)
|
||||
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/fp:except->)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE )
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
|
||||
|
||||
@@ -399,16 +399,6 @@ s32 CollisionPoly_LineVsPoly(CollisionPoly* poly, Vec3s* vtxList, Vec3f* posA, V
|
||||
(poly->normal.x * posB->x + poly->normal.y * posB->y + poly->normal.z * posB->z) * COLPOLY_NORMAL_FRAC +
|
||||
plane.originDist;
|
||||
|
||||
#if defined(__SWITCH__) || defined(__WIIU__)
|
||||
// on some platforms this ends up as very small numbers due to rounding issues
|
||||
if (IS_ZERO(planeDistA)) {
|
||||
planeDistA = 0.0f;
|
||||
}
|
||||
if (IS_ZERO(planeDistB)) {
|
||||
planeDistB = 0.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
planeDistDelta = planeDistA - planeDistB;
|
||||
if ((planeDistA >= 0.0f && planeDistB >= 0.0f) || (planeDistA < 0.0f && planeDistB < 0.0f) ||
|
||||
(chkOneFace && planeDistA < 0.0f && planeDistB > 0.0f) || IS_ZERO(planeDistDelta)) {
|
||||
|
||||
Reference in New Issue
Block a user