diff --git a/.gitignore b/.gitignore index 4613197..eec550c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ enc_temp_folder/ .cache/ /attic/user/ /attic/chucklefish/ +/attic/debug/ /tiled/ /assets/user/ /assets/devel/ diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 59fa0a6..ad3026b 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -285,14 +285,14 @@ if(STAR_COMPILER_GNU) set(CMAKE_C_FLAGS_DEBUG "-g -Og") set(CMAKE_CXX_FLAGS_DEBUG "-g -Og") - set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast") - set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast") + set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math") + set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math") - set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast") - set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast") + set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math") + set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math") set(CMAKE_SKIP_BUILD_RPATH TRUE) @@ -316,14 +316,14 @@ elseif(STAR_COMPILER_CLANG) set(CMAKE_C_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_DEBUG "-g") - set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast") - set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast") + set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math") + set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -O3 -ffast-math") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O3 -ffast-math") - set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast") - set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast") + set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math") + set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -ffast-math") set(CMAKE_SKIP_BUILD_RPATH TRUE) diff --git a/source/core/CMakeLists.txt b/source/core/CMakeLists.txt index 16cf576..3d00baf 100644 --- a/source/core/CMakeLists.txt +++ b/source/core/CMakeLists.txt @@ -231,10 +231,6 @@ IF(STAR_PRECOMPILED_HEADERS) TARGET_PRECOMPILE_HEADERS (star_core PUBLIC StarPch.hpp) 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) SET_SOURCE_FILES_PROPERTIES(StarMemory.cpp PROPERTIES COMPILE_DEFINITIONS STAR_JEMALLOC_IS_PREFIXED diff --git a/source/core/StarColor.cpp b/source/core/StarColor.cpp index 7da8dd4..4eb726c 100644 --- a/source/core/StarColor.cpp +++ b/source/core/StarColor.cpp @@ -322,6 +322,8 @@ Vec3F Color::toRgbF() const { return Vec3F(redF(), greenF(), blueF()); } +#pragma GCC push_options +#pragma GCC optimize("-fno-fast-math") Vec4F Color::toHsva() const { float h, s, v; @@ -365,6 +367,7 @@ Vec4F Color::toHsva() const { return Vec4F(h, s, v, alphaF()); } +#pragma GCC pop_options String Color::toHex() const { auto rgba = toRgba(); diff --git a/source/core/StarImageScaling.cpp b/source/core/StarImageScaling.cpp index 96837aa..aa94359 100644 --- a/source/core/StarImageScaling.cpp +++ b/source/core/StarImageScaling.cpp @@ -33,8 +33,7 @@ Image scaleBilinear(Image const& srcImage, Vec2F const& scale) { auto ipart = Vec2I::floor(pos); 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], - Vec4F(srcImage.clamp(ipart[0], ipart[1] + 1)), Vec4F(srcImage.clamp(ipart[0] + 1, ipart[1] + 1)))); + 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)))); destImage.set({x, y}, Vec4B(result)); } diff --git a/source/core/StarImageScaling.hpp b/source/core/StarImageScaling.hpp index 6a7271b..d758169 100644 --- a/source/core/StarImageScaling.hpp +++ b/source/core/StarImageScaling.hpp @@ -1,3 +1,5 @@ +#pragma once + namespace Star { STAR_CLASS(Image);