mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-21 12:00:06 +00:00
Add bound on depth values to fix warnings in MinGW 13.2 (#434)
This commit is contained in:
parent
8c86e0e424
commit
dd6aef1505
@ -66,6 +66,14 @@ elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$")
|
||||
set(DIRECTX_ARCH arm)
|
||||
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$")
|
||||
set(DIRECTX_ARCH arm64)
|
||||
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Ww][Ii][Nn]32$")
|
||||
set(DIRECTX_ARCH x86)
|
||||
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Xx]64$")
|
||||
set(DIRECTX_ARCH x64)
|
||||
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]$")
|
||||
set(DIRECTX_ARCH arm)
|
||||
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64$")
|
||||
set(DIRECTX_ARCH arm64)
|
||||
endif()
|
||||
|
||||
if(WINDOWS_STORE OR (DEFINED XBOX_CONSOLE_TARGET))
|
||||
@ -560,7 +568,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
endforeach()
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE -Wno-ignored-attributes)
|
||||
target_compile_options(${t} PRIVATE "-Wno-ignored-attributes" "-Walloc-size-larger-than=4GB")
|
||||
endforeach()
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
|
@ -2692,7 +2692,14 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept
|
||||
|
||||
for (i = 0; i < uNumEndPts; i++)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#endif
|
||||
c[i] = Unquantize(c[i], RGBAPrecWithP);
|
||||
#ifdef __GNUC_
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t w1[NUM_PIXELS_PER_BLOCK], w2[NUM_PIXELS_PER_BLOCK];
|
||||
@ -3410,8 +3417,15 @@ float D3DX_BC7::Refine(const EncodeParams* pEP, size_t uShape, size_t uRotation,
|
||||
|
||||
for (size_t p = 0; p <= uPartitions; p++)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#endif
|
||||
aOrgEndPts[p].A = Quantize(aEndPts[p].A, ms_aInfo[pEP->uMode].RGBAPrecWithP);
|
||||
aOrgEndPts[p].B = Quantize(aEndPts[p].B, ms_aInfo[pEP->uMode].RGBAPrecWithP);
|
||||
#ifdef __GNUC_
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
LDREndPntPair newEndPts1[BC7_MAX_REGIONS];
|
||||
|
@ -455,6 +455,9 @@ HRESULT ScratchImage::Initialize3D(DXGI_FORMAT fmt, size_t width, size_t height,
|
||||
if (!IsValid(fmt) || !width || !height || !depth)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (IsPalettized(fmt))
|
||||
return HRESULT_E_NOT_SUPPORTED;
|
||||
|
||||
@ -643,6 +646,9 @@ HRESULT ScratchImage::Initialize3DFromImages(const Image* images, size_t depth,
|
||||
if (!images || !depth)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
const DXGI_FORMAT format = images[0].format;
|
||||
const size_t width = images[0].width;
|
||||
const size_t height = images[0].height;
|
||||
|
@ -1618,6 +1618,9 @@ namespace
|
||||
if (!baseImages || !depth)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
assert(levels > 1);
|
||||
|
||||
const size_t width = baseImages[0].width;
|
||||
@ -1669,6 +1672,9 @@ namespace
|
||||
if (!depth || !mipChain.GetImages())
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// This assumes that the base images are already placed into the mipChain at the top level... (see _Setup3DMips)
|
||||
|
||||
assert(levels > 1);
|
||||
@ -1817,6 +1823,9 @@ namespace
|
||||
if (!depth || !mipChain.GetImages())
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// This assumes that the base images are already placed into the mipChain at the top level... (see _Setup3DMips)
|
||||
|
||||
assert(levels > 1);
|
||||
@ -1991,6 +2000,9 @@ namespace
|
||||
if (!depth || !mipChain.GetImages())
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// This assumes that the base images are already placed into the mipChain at the top level... (see _Setup3DMips)
|
||||
|
||||
assert(levels > 1);
|
||||
@ -2186,6 +2198,9 @@ namespace
|
||||
if (!depth || !mipChain.GetImages())
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// This assumes that the base images are already placed into the mipChain at the top level... (see _Setup3DMips)
|
||||
|
||||
assert(levels > 1);
|
||||
@ -2567,6 +2582,9 @@ namespace
|
||||
if (!depth || !mipChain.GetImages())
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// This assumes that the base images are already placed into the mipChain at the top level... (see _Setup3DMips)
|
||||
|
||||
assert(levels > 1);
|
||||
@ -3247,6 +3265,9 @@ HRESULT DirectX::GenerateMipMaps3D(
|
||||
if (!baseImages || !depth)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (depth > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (filter & TEX_FILTER_FORCE_WIC)
|
||||
return HRESULT_E_NOT_SUPPORTED;
|
||||
|
||||
@ -3355,6 +3376,9 @@ HRESULT DirectX::GenerateMipMaps3D(
|
||||
if (!srcImages || !nimages || !IsValid(metadata.format))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (levels > INT16_MAX)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (filter & TEX_FILTER_FORCE_WIC)
|
||||
return HRESULT_E_NOT_SUPPORTED;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user