Check for DDS files having legacy header but no bitmask

This commit is contained in:
baldurk
2023-03-29 10:29:37 +01:00
parent e9708d909e
commit a0863b2aed
+8
View File
@@ -1134,6 +1134,14 @@ RDResult load_dds_from_file(StreamReader *reader, read_dds_data &ret)
if(bits[i] < bits[0] && bits[i] > 0)
bitWidth = bits[i];
if(bitWidth == 0)
{
RETURN_ERROR_RESULT(ResultCode::ImageUnsupported,
"Unsupported RGBA mask: %08x %08x %08x %08x", header.ddspf.dwRBitMask,
header.ddspf.dwGBitMask, header.ddspf.dwBBitMask,
header.ddspf.dwABitMask);
}
ret.format.compByteWidth = uint8_t(bitWidth / 8);
ret.format.compCount = uint8_t(header.ddspf.dwRGBBitCount / bitWidth);
ret.format.compType = CompType::UNorm;