diff --git a/CMakeLists.txt b/CMakeLists.txt index b8e336f..2933899 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,8 @@ option(BC_USE_OPENMP "Build with OpenMP support" ON) # https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/ option(ENABLE_SPECTRE_MITIGATION "Build using /Qspectre for MSVC" OFF) +option(DISABLE_MSVC_ITERATOR_DEBUGGING "Disable iterator debugging in Debug configurations with the MSVC CRT" OFF) + option(ENABLE_CODE_ANALYSIS "Use Static Code Analysis on build" OFF) option(USE_PREBUILT_SHADERS "Use externally built HLSL shaders" OFF) @@ -415,6 +417,12 @@ if(WIN32) foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) target_compile_definitions(${t} PRIVATE _UNICODE UNICODE _WIN32_WINNT=${WINVER}) endforeach() + + if(DISABLE_MSVC_ITERATOR_DEBUGGING) + foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) + target_compile_definitions(${t} PRIVATE _ITERATOR_DEBUG_LEVEL=0) + endforeach() + endif() endif() if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE)) diff --git a/DirectXTex/BC6HBC7.cpp b/DirectXTex/BC6HBC7.cpp index 132f86e..ac33e9e 100644 --- a/DirectXTex/BC6HBC7.cpp +++ b/DirectXTex/BC6HBC7.cpp @@ -1696,7 +1696,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const noexcept case BZ: aEndPts[1].B.b |= 1 << uint32_t(desc[uCurBit].m_uBit); break; default: { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC6H: Invalid header bits encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -1740,7 +1740,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const noexcept const size_t uNumBits = IsFixUpOffset(info.uPartitions, uShape, i) ? info.uIndexPrec - 1u : info.uIndexPrec; if (uStartBit + uNumBits > 128) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC6H: Invalid block encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -1750,7 +1750,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const noexcept if (uIndex >= ((info.uPartitions > 0) ? 8 : 16)) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC6H: Invalid index encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -1785,7 +1785,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const noexcept } else { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) const char* warnstr = "BC6H: Invalid mode encountered during decoding\n"; switch (uMode) { @@ -2596,7 +2596,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept { if (uStartBit + RGBAPrec.r > 128) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC7: Invalid block encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -2611,7 +2611,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept { if (uStartBit + RGBAPrec.g > 128) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC7: Invalid block encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -2626,7 +2626,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept { if (uStartBit + RGBAPrec.b > 128) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC7: Invalid block encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -2641,7 +2641,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept { if (uStartBit + RGBAPrec.a > 128) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC7: Invalid block encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -2658,7 +2658,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept { if (uStartBit > 127) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC7: Invalid block encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -2696,7 +2696,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept const size_t uNumBits = IsFixUpOffset(ms_aInfo[uMode].uPartitions, uShape, i) ? uIndexPrec - 1u : uIndexPrec; if (uStartBit + uNumBits > 128) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC7: Invalid block encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -2713,7 +2713,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept const size_t uNumBits = i ? uIndexPrec2 : uIndexPrec2 - 1u; if (uStartBit + uNumBits > 128) { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC7: Invalid block encountered during decoding\n"); #endif FillWithErrorColors(pOut); @@ -2755,7 +2755,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept } else { - #ifdef _DEBUG + #if defined(_WIN32) && defined(_DEBUG) OutputDebugStringA("BC7: Reserved mode 8 encountered during decoding\n"); #endif // Per the BC7 format spec, we must return transparent black diff --git a/build/DirectXTex-GitHub-WSL-11.yml b/build/DirectXTex-GitHub-WSL-11.yml index 038450c..fddbf60 100644 --- a/build/DirectXTex-GitHub-WSL-11.yml +++ b/build/DirectXTex-GitHub-WSL-11.yml @@ -90,12 +90,22 @@ jobs: } - task: CMake@1 - displayName: CMake DirectXTex + displayName: CMake DirectXTex (Config) dbg inputs: cwd: '$(Build.SourcesDirectory)' - cmakeArgs: -B out -DCMAKE_PREFIX_PATH=$(DEST_DIR)usr/local/share;$(DEST_DIR)usr/local/cmake + cmakeArgs: -B out -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$(DEST_DIR)usr/local/share;$(DEST_DIR)usr/local/cmake - task: CMake@1 - displayName: CMake DirectXTex (Build) + displayName: CMake DirectXTex (Build) dbg inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: --build out -v + - task: CMake@1 + displayName: CMake DirectXTex (Config) rel + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: -B out2 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$(DEST_DIR)usr/local/share;$(DEST_DIR)usr/local/cmake + - task: CMake@1 + displayName: CMake DirectXTex (Build) rel + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out2 -v diff --git a/build/DirectXTex-GitHub-WSL.yml b/build/DirectXTex-GitHub-WSL.yml index e7bb558..35bea99 100644 --- a/build/DirectXTex-GitHub-WSL.yml +++ b/build/DirectXTex-GitHub-WSL.yml @@ -90,12 +90,22 @@ jobs: } - task: CMake@1 - displayName: CMake DirectXTex + displayName: CMake DirectXTex (Config) dbg inputs: cwd: '$(Build.SourcesDirectory)' - cmakeArgs: -B out -DCMAKE_PREFIX_PATH=$(DEST_DIR)usr/local/share;$(DEST_DIR)usr/local/cmake + cmakeArgs: -B out -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$(DEST_DIR)usr/local/share;$(DEST_DIR)usr/local/cmake - task: CMake@1 - displayName: CMake DirectXTex (Build) + displayName: CMake DirectXTex (Build) dbg inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: --build out -v + - task: CMake@1 + displayName: CMake DirectXTex (Config) rel + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: -B out2 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$(DEST_DIR)usr/local/share;$(DEST_DIR)usr/local/cmake + - task: CMake@1 + displayName: CMake DirectXTex (Build) rel + inputs: + cwd: '$(Build.SourcesDirectory)' + cmakeArgs: --build out2 -v