From a248f3a50c79b65cbebde03219a5e6e61558b66f Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Thu, 3 Nov 2022 20:24:38 +0000 Subject: [PATCH] Faster inversion --- CMakeLists.txt | 2 +- GL/platforms/sh4.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b613495..b8eb325 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ if(NOT PLATFORM_DREAMCAST) set(FIND_LIBRARY_USE_LIB64_PATHS false) endif() -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 --fast-math -fexpensive-optimizations -funroll-all-loops") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -mfsrra -ffp-contract=fast -mfsca -ffast-math -fexpensive-optimizations -funroll-all-loops") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -Wall -Wextra") set( diff --git a/GL/platforms/sh4.c b/GL/platforms/sh4.c index 6fb3093..156adf3 100644 --- a/GL/platforms/sh4.c +++ b/GL/platforms/sh4.c @@ -49,7 +49,7 @@ void SceneListBegin(GPUList list) { GL_FORCE_INLINE float _glFastInvert(float x) { const float sgn = (x > 0) - (x < 0); - return sgn * MATH_fsrra(x * x); + return sgn * (1.f / __builtin_sqrtf(x * x)); } GL_FORCE_INLINE void _glPerspectiveDivideVertex(Vertex* vertex, const float h) {