Open Crauzer opened 1 year ago
Another reference to mip count being clamped to at least 1: https://learn.microsoft.com/en-us/windows/uwp/gaming/complete-code-for-ddstextureloader
size_t mipCount = header->mipMapCount;
if (0 == mipCount)
{
mipCount = 1;
}
This issue arises from the fact that mip count is handled differently in
DdsFile
and inDecodeInternal
.These are the relevent lines: https://github.com/Nominom/BCnEncoder.NET/blob/master/BCnEnc.Net/Decoder/BcDecoder.cs#L1161-L1164 https://github.com/Nominom/BCnEncoder.NET/blob/master/BCnEnc.Net/Shared/ImageFiles/DdsFile.cs#L57
I think the easiest way to fix this would to be assume that each file has at least 1 mipmap. Microsoft says that you shouldn't rely on the mipmap flag being set.