Fix importing .dds files as-isif the compressed image is too small for the engine (block size validation)

#2057
This commit is contained in:
Wojtek Figat
2023-12-14 17:04:47 +01:00
parent df8418da25
commit a5e072da31

View File

@@ -625,7 +625,15 @@ bool TextureTool::ImportTextureDirectXTex(ImageType type, const StringView& path
}
bool keepAsIs = false;
if (!options.FlipY && !options.InvertGreenChannel && options.Compress && type == ImageType::DDS && mipLevels == sourceMipLevels && DirectX::IsCompressed(sourceDxgiFormat) && !DirectX::IsSRGB(sourceDxgiFormat))
if (!options.FlipY &&
!options.InvertGreenChannel &&
options.Compress &&
type == ImageType::DDS &&
mipLevels == sourceMipLevels &&
DirectX::IsCompressed(sourceDxgiFormat) &&
!DirectX::IsSRGB(sourceDxgiFormat) &&
width >= 4 &&
height >= 4)
{
// Keep image in the current compressed format (artist choice) so we don't have to run the slow mipmap generation
keepAsIs = true;