diff --git a/WICTextureLoader/WICTextureLoader.cpp b/WICTextureLoader/WICTextureLoader.cpp index 9038b23..58f7ea9 100644 --- a/WICTextureLoader/WICTextureLoader.cpp +++ b/WICTextureLoader/WICTextureLoader.cpp @@ -353,12 +353,12 @@ namespace if (width > height) { twidth = static_cast(maxsize); - theight = static_cast(static_cast(maxsize) * ar); + theight = std::max(1, static_cast(static_cast(maxsize) * ar)); } else { theight = static_cast(maxsize); - twidth = static_cast(static_cast(maxsize) / ar); + twidth = std::max(1, static_cast(static_cast(maxsize) / ar)); } assert(twidth <= maxsize && theight <= maxsize); } @@ -389,12 +389,14 @@ namespace { memcpy(&convertGUID, &GUID_WICPixelFormat96bppRGBFloat, sizeof(WICPixelFormatGUID)); format = DXGI_FORMAT_R32G32B32_FLOAT; + bpp = 96; } else #endif { memcpy(&convertGUID, &GUID_WICPixelFormat128bppRGBAFloat, sizeof(WICPixelFormatGUID)); format = DXGI_FORMAT_R32G32B32A32_FLOAT; + bpp = 128; } } else @@ -472,7 +474,7 @@ namespace sRGB = true; } - PropVariantClear(&value); + (void)PropVariantClear(&value); if (sRGB) format = MakeSRGB(format); diff --git a/WICTextureLoader/WICTextureLoader12.cpp b/WICTextureLoader/WICTextureLoader12.cpp index 4ab9926..5c1a54e 100644 --- a/WICTextureLoader/WICTextureLoader12.cpp +++ b/WICTextureLoader/WICTextureLoader12.cpp @@ -296,12 +296,12 @@ namespace if (width > height) { twidth = static_cast(maxsize); - theight = static_cast(static_cast(maxsize) * ar); + theight = std::max(1, static_cast(static_cast(maxsize) * ar)); } else { theight = static_cast(maxsize); - twidth = static_cast(static_cast(maxsize) / ar); + twidth = std::max(1, static_cast(static_cast(maxsize) / ar)); } assert(twidth <= maxsize && theight <= maxsize); } @@ -381,7 +381,7 @@ namespace sRGB = true; } - PropVariantClear(&value); + (void)PropVariantClear(&value); if (sRGB) format = MakeSRGB(format); @@ -487,7 +487,7 @@ namespace } // Count the number of mips - uint32_t mipCount = (loadFlags & (WIC_LOADER_MIP_AUTOGEN | WIC_LOADER_MIP_RESERVE)) ? CountMips(twidth, theight) : 1; + uint32_t mipCount = (loadFlags & (WIC_LOADER_MIP_AUTOGEN|WIC_LOADER_MIP_RESERVE)) ? CountMips(twidth, theight) : 1; // Create texture D3D12_RESOURCE_DESC desc = {};