Fixed problem loading DDS files that use FOURCC but have extra irrelevant bits set

This commit is contained in:
Chuck Walbourn 2018-08-17 17:31:23 -07:00
parent 908869c96e
commit 43969ca15f

View File

@ -166,14 +166,15 @@ namespace
{
const LegacyDDS* entry = &g_LegacyDDSMap[index];
if (ddpfFlags == entry->ddpf.flags)
if ((ddpfFlags & DDS_FOURCC) && (entry->ddpf.flags & DDS_FOURCC))
{
if (entry->ddpf.flags & DDS_FOURCC)
{
if (ddpf.fourCC == entry->ddpf.fourCC)
break;
}
else if (entry->ddpf.flags & DDS_PAL8)
// In case of FourCC codes, ignore any other bits in ddpf.flags
if (ddpf.fourCC == entry->ddpf.fourCC)
break;
}
else if (ddpfFlags == entry->ddpf.flags)
{
if (entry->ddpf.flags & DDS_PAL8)
{
if (ddpf.RGBBitCount == entry->ddpf.RGBBitCount)
break;