From e2ac0915bf7c80577054beedbcb829ad8c917c5f Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Mon, 5 Feb 2024 10:09:18 -0800 Subject: [PATCH] Workaround clang/LLVM bug with /fp:fast+SSE+float_control (#142) --- CMakeLists.txt | 4 ++-- UVAtlas/geodesics/ApproximateOneToAll.cpp | 3 +++ UVAtlas/isochart/UVAtlasRepacker.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b46bea1..682a40b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,7 +308,7 @@ endif() if(MSVC) foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) - target_compile_options(${t} PRIVATE /Wall /GR- /fp:fast "$<$>:/guard:cf>") + target_compile_options(${t} PRIVATE /Wall /GR- "$<$>:/guard:cf>") target_link_options(${t} PRIVATE /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO) endforeach() @@ -388,7 +388,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") endforeach() elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) - target_compile_options(${t} PRIVATE /sdl /permissive- /JMC- /Zc:__cplusplus /Zc:inline) + target_compile_options(${t} PRIVATE /sdl /permissive- /JMC- /Zc:__cplusplus /Zc:inline /fp:fast) endforeach() if(ENABLE_CODE_ANALYSIS) diff --git a/UVAtlas/geodesics/ApproximateOneToAll.cpp b/UVAtlas/geodesics/ApproximateOneToAll.cpp index 5abc731..a3a06fc 100644 --- a/UVAtlas/geodesics/ApproximateOneToAll.cpp +++ b/UVAtlas/geodesics/ApproximateOneToAll.cpp @@ -276,6 +276,9 @@ void CApproximateOneToAll::CutHeapTopData(EdgeWindow& EdgeWindowOut) tmpdif = fabs(sigma + SqrtMin0(SquredD2Dist(spie, tmpp)) - tmpDp); } break; + + default: + break; } if (tmpdif > diflargest) diff --git a/UVAtlas/isochart/UVAtlasRepacker.cpp b/UVAtlas/isochart/UVAtlasRepacker.cpp index 0e840d6..420c316 100644 --- a/UVAtlas/isochart/UVAtlasRepacker.cpp +++ b/UVAtlas/isochart/UVAtlasRepacker.cpp @@ -1560,6 +1560,8 @@ void CUVAtlasRepacker::GetChartPutPosition(uint32_t index) else m_chartFromX = m_fromX + m_triedOverlappedLen - pPosInfo->numY; break; + default: + break; } if (m_triedPutRotation == 0 || m_triedPutRotation == 180) { @@ -1638,6 +1640,8 @@ void CUVAtlasRepacker::PutChartInPosition(uint32_t index) m_PixelWidth * float(m_chartFromX) - pPosInfo->basePoint.x, m_PixelWidth * float(m_chartToY) - pPosInfo->basePoint.y, 0.0f); break; + default: + break; } XMStoreFloat4x4(&m_ResultMatrix[index], matrixRotate * transMatrix); @@ -1755,6 +1759,8 @@ void CUVAtlasRepacker::UpdateSpaceInfo(int direction) m_SpaceInfo[UV_DOWNSIDE][size_t(i)] = maxY - j - 1; } break; + default: + break; } m_fromX = minX;