?saturation discrepancies: fixed mostly on GCC, 100% (seemingly?) on Clang

This commit is contained in:
Kae 2024-12-31 14:49:51 +11:00
parent 9beadf3e2c
commit 874ab3dd48
6 changed files with 19 additions and 18 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ enc_temp_folder/
.cache/ .cache/
/attic/user/ /attic/user/
/attic/chucklefish/ /attic/chucklefish/
/attic/debug/
/tiled/ /tiled/
/assets/user/ /assets/user/
/assets/devel/ /assets/devel/

View File

@ -285,14 +285,14 @@ if(STAR_COMPILER_GNU)
set(CMAKE_C_FLAGS_DEBUG "-g -Og") set(CMAKE_C_FLAGS_DEBUG "-g -Og")
set(CMAKE_CXX_FLAGS_DEBUG "-g -Og") set(CMAKE_CXX_FLAGS_DEBUG "-g -Og")
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast") set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast") set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast") set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
set(CMAKE_SKIP_BUILD_RPATH TRUE) set(CMAKE_SKIP_BUILD_RPATH TRUE)
@ -316,14 +316,14 @@ elseif(STAR_COMPILER_CLANG)
set(CMAKE_C_FLAGS_DEBUG "-g") set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast") set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast") set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast") set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math")
set(CMAKE_SKIP_BUILD_RPATH TRUE) set(CMAKE_SKIP_BUILD_RPATH TRUE)

View File

@ -231,10 +231,6 @@ IF(STAR_PRECOMPILED_HEADERS)
TARGET_PRECOMPILE_HEADERS (star_core PUBLIC StarPch.hpp) TARGET_PRECOMPILE_HEADERS (star_core PUBLIC StarPch.hpp)
ENDIF() ENDIF()
IF(STAR_COMPILER STREQUAL "gnu")
SET_SOURCE_FILES_PROPERTIES(StarImageScaling.cpp PROPERTIES COMPILE_FLAGS "-O2 -fno-trapping-math -fno-unsafe-math-optimizations")
ENDIF()
IF(STAR_USE_JEMALLOC AND JEMALLOC_IS_PREFIXED) IF(STAR_USE_JEMALLOC AND JEMALLOC_IS_PREFIXED)
SET_SOURCE_FILES_PROPERTIES(StarMemory.cpp PROPERTIES SET_SOURCE_FILES_PROPERTIES(StarMemory.cpp PROPERTIES
COMPILE_DEFINITIONS STAR_JEMALLOC_IS_PREFIXED COMPILE_DEFINITIONS STAR_JEMALLOC_IS_PREFIXED

View File

@ -322,6 +322,8 @@ Vec3F Color::toRgbF() const {
return Vec3F(redF(), greenF(), blueF()); return Vec3F(redF(), greenF(), blueF());
} }
#pragma GCC push_options
#pragma GCC optimize("-fno-fast-math")
Vec4F Color::toHsva() const { Vec4F Color::toHsva() const {
float h, s, v; float h, s, v;
@ -365,6 +367,7 @@ Vec4F Color::toHsva() const {
return Vec4F(h, s, v, alphaF()); return Vec4F(h, s, v, alphaF());
} }
#pragma GCC pop_options
String Color::toHex() const { String Color::toHex() const {
auto rgba = toRgba(); auto rgba = toRgba();

View File

@ -33,8 +33,7 @@ Image scaleBilinear(Image const& srcImage, Vec2F const& scale) {
auto ipart = Vec2I::floor(pos); auto ipart = Vec2I::floor(pos);
auto fpart = pos - Vec2F(ipart); auto fpart = pos - Vec2F(ipart);
auto result = lerp(fpart[1], lerp(fpart[0], Vec4F(srcImage.clamp(ipart[0], ipart[1])), Vec4F(srcImage.clamp(ipart[0] + 1, ipart[1]))), lerp(fpart[0], auto result = lerp(fpart[1], lerp(fpart[0], Vec4F(srcImage.clamp(ipart[0], ipart[1])), Vec4F(srcImage.clamp(ipart[0] + 1, ipart[1]))), lerp(fpart[0], Vec4F(srcImage.clamp(ipart[0], ipart[1] + 1)), Vec4F(srcImage.clamp(ipart[0] + 1, ipart[1] + 1))));
Vec4F(srcImage.clamp(ipart[0], ipart[1] + 1)), Vec4F(srcImage.clamp(ipart[0] + 1, ipart[1] + 1))));
destImage.set({x, y}, Vec4B(result)); destImage.set({x, y}, Vec4B(result));
} }

View File

@ -1,3 +1,5 @@
#pragma once
namespace Star { namespace Star {
STAR_CLASS(Image); STAR_CLASS(Image);