Added WIC_LOADER_FORCE_RGBA32 to WICTextureLoader

This commit is contained in:
Chuck Walbourn 2020-04-20 23:35:43 -07:00
parent e169033b60
commit 90cc562f9c
4 changed files with 16 additions and 0 deletions

View File

@ -448,6 +448,13 @@ namespace
} }
#endif #endif
if (loadFlags & WIC_LOADER_FORCE_RGBA32)
{
memcpy_s(&convertGUID, sizeof(WICPixelFormatGUID), &GUID_WICPixelFormat32bppRGBA, sizeof(GUID));
format = DXGI_FORMAT_R8G8B8A8_UNORM;
bpp = 32;
}
if (!bpp) if (!bpp)
return E_FAIL; return E_FAIL;

View File

@ -36,6 +36,7 @@ namespace DirectX
WIC_LOADER_DEFAULT = 0, WIC_LOADER_DEFAULT = 0,
WIC_LOADER_FORCE_SRGB = 0x1, WIC_LOADER_FORCE_SRGB = 0x1,
WIC_LOADER_IGNORE_SRGB = 0x2, WIC_LOADER_IGNORE_SRGB = 0x2,
WIC_LOADER_FORCE_RGBA32 = 0x4,
}; };
#endif #endif

View File

@ -358,6 +358,13 @@ namespace
bpp = _WICBitsPerPixel(pixelFormat); bpp = _WICBitsPerPixel(pixelFormat);
} }
if (loadFlags & WIC_LOADER_FORCE_RGBA32)
{
memcpy_s(&convertGUID, sizeof(WICPixelFormatGUID), &GUID_WICPixelFormat32bppRGBA, sizeof(GUID));
format = DXGI_FORMAT_R8G8B8A8_UNORM;
bpp = 32;
}
if (!bpp) if (!bpp)
return E_FAIL; return E_FAIL;

View File

@ -37,6 +37,7 @@ namespace DirectX
WIC_LOADER_IGNORE_SRGB = 0x2, WIC_LOADER_IGNORE_SRGB = 0x2,
WIC_LOADER_MIP_AUTOGEN = 0x4, WIC_LOADER_MIP_AUTOGEN = 0x4,
WIC_LOADER_MIP_RESERVE = 0x8, WIC_LOADER_MIP_RESERVE = 0x8,
WIC_LOADER_FORCE_RGBA32 = 0x10,
}; };
#endif #endif