1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 12:00:06 +00:00

/analyze warning cleanup

This commit is contained in:
Chuck Walbourn 2020-06-05 15:01:02 -07:00
parent 5999f34c11
commit 759caf730e
2 changed files with 21 additions and 11 deletions

View File

@ -18,6 +18,8 @@ option(BUILD_DX12 "Build with DirectX12 Runtime support" ON)
# Enable the use of OpenMP for software BC6H/BC7 compression
option(BC_USE_OPENMP "Build with OpenMP support" ON)
option(ENABLE_CODE_ANALYSIS "Use Static Code Analysis on build" OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
@ -59,10 +61,10 @@ set(SHADER_SOURCES
DirectXTex/Shaders/BC6HEncode.hlsl
DirectXTex/Shaders/BC7Encode.hlsl)
if(BUILD_DX11 MATCHES ON)
if(BUILD_DX11)
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexD3D11.cpp)
endif()
if(BUILD_DX12 MATCHES ON)
if(BUILD_DX12)
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexD3D12.cpp)
endif()
@ -143,6 +145,14 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
target_compile_options(texconv PRIVATE /permissive- /Zc:__cplusplus)
target_compile_options(texdiag PRIVATE /permissive- /Zc:__cplusplus)
if(ENABLE_CODE_ANALYSIS)
target_compile_options(${PROJECT_NAME} PRIVATE /analyze)
target_compile_options(texassemble PRIVATE /analyze)
target_compile_options(texconv PRIVATE /analyze)
target_compile_options(texdiag PRIVATE /analyze)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105)
target_compile_options(texassemble PRIVATE /Zc:preprocessor /wd5105)
@ -150,7 +160,7 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
target_compile_options(texdiag PRIVATE /Zc:preprocessor /wd5105)
endif()
if(BC_USE_OPENMP MATCHES ON)
if(BC_USE_OPENMP)
target_compile_options(${PROJECT_NAME} PRIVATE /openmp /Zc:twoPhase-)
target_compile_options(texconv PRIVATE /openmp /Zc:twoPhase-)
endif()
@ -167,7 +177,7 @@ if(WIN32)
target_compile_definitions(texconv PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
target_compile_definitions(texdiag PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
if(BUILD_DX12 MATCHES ON)
if(BUILD_DX12)
target_compile_definitions(${PROJECT_NAME} PRIVATE _WIN32_WINNT=0x0A00)
else()
target_compile_definitions(${PROJECT_NAME} PRIVATE _WIN32_WINNT=0x0601)

View File

@ -1624,7 +1624,7 @@ namespace
wprintf(L"\tAlpha - E0: %0.3f E1: %0.3f (%u)\n\t Index: ",
(float(block->alpha[0]) / 255.f),
(float(block->alpha[1]) / 255.f), (block->alpha[0] > block->alpha[1]) ? 8 : 6);
(float(block->alpha[1]) / 255.f), (block->alpha[0] > block->alpha[1]) ? 8u : 6u);
PrintIndex3bpp(block->bitmap);
@ -1638,7 +1638,7 @@ namespace
wprintf(L"\t E0: %0.3f E1: %0.3f (%u)\n\tIndex: ",
(float(block->red_0) / 255.f),
(float(block->red_1) / 255.f), (block->red_0 > block->red_1) ? 8 : 6);
(float(block->red_1) / 255.f), (block->red_0 > block->red_1) ? 8u : 6u);
PrintIndex3bpp(block->indices);
@ -1652,7 +1652,7 @@ namespace
wprintf(L"\t E0: %0.3f E1: %0.3f (%u)\n\tIndex: ",
(float(block->red_0) / 127.f),
(float(block->red_1) / 127.f), (block->red_0 > block->red_1) ? 8 : 6);
(float(block->red_1) / 127.f), (block->red_0 > block->red_1) ? 8u : 6u);
PrintIndex3bpp(block->indices);
@ -1666,7 +1666,7 @@ namespace
wprintf(L"\tU - E0: %0.3f E1: %0.3f (%u)\n\t Index: ",
(float(block->u.red_0) / 255.f),
(float(block->u.red_1) / 255.f), (block->u.red_0 > block->u.red_1) ? 8 : 6);
(float(block->u.red_1) / 255.f), (block->u.red_0 > block->u.red_1) ? 8u : 6u);
PrintIndex3bpp(block->u.indices);
@ -1674,7 +1674,7 @@ namespace
wprintf(L"\tV - E0: %0.3f E1: %0.3f (%u)\n\t Index: ",
(float(block->v.red_0) / 255.f),
(float(block->v.red_1) / 255.f), (block->v.red_0 > block->v.red_1) ? 8 : 6);
(float(block->v.red_1) / 255.f), (block->v.red_0 > block->v.red_1) ? 8u : 6u);
PrintIndex3bpp(block->v.indices);
@ -1688,7 +1688,7 @@ namespace
wprintf(L"\tU - E0: %0.3f E1: %0.3f (%u)\n\t Index: ",
(float(block->u.red_0) / 127.f),
(float(block->u.red_1) / 127.f), (block->u.red_0 > block->u.red_1) ? 8 : 6);
(float(block->u.red_1) / 127.f), (block->u.red_0 > block->u.red_1) ? 8u : 6u);
PrintIndex3bpp(block->u.indices);
@ -1696,7 +1696,7 @@ namespace
wprintf(L"\tV - E0: %0.3f E1: %0.3f (%u)\n\t Index: ",
(float(block->v.red_0) / 127.f),
(float(block->v.red_1) / 127.f), (block->v.red_0 > block->v.red_1) ? 8 : 6);
(float(block->v.red_1) / 127.f), (block->v.red_0 > block->v.red_1) ? 8u : 6u);
PrintIndex3bpp(block->v.indices);