Faster inversion

This commit is contained in:
Luke Benstead 2022-11-03 20:24:38 +00:00
parent 6be3e6185d
commit a248f3a50c
2 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ if(NOT PLATFORM_DREAMCAST)
set(FIND_LIBRARY_USE_LIB64_PATHS false) set(FIND_LIBRARY_USE_LIB64_PATHS false)
endif() 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(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -Wall -Wextra")
set( set(

View File

@ -49,7 +49,7 @@ void SceneListBegin(GPUList list) {
GL_FORCE_INLINE float _glFastInvert(float x) { GL_FORCE_INLINE float _glFastInvert(float x) {
const float sgn = (x > 0) - (x < 0); 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) { GL_FORCE_INLINE void _glPerspectiveDivideVertex(Vertex* vertex, const float h) {