On Fri Nov 18 03:59:32 2022 +0000, Zhiyi Zhang wrote:
CheckFormatSupport() does check DXGI_FORMAT. But what about alpha mode? See what's in the first commit. Take GUID_WICPixelFormat8bppAlpha for example. GUID_WICPixelFormat8bppAlpha can be converted to DXGI_FORMAT_A8_UNORM. However, (DXGI_FORMAT_A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED), (DXGI_FORMAT_A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT) and (DXGI_FORMAT_A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN) are supported. (DXGI_FORMAT_A8_UNORM, D2D1_ALPHA_MODE_IGNORE) is unsupported. So a (wic_guid, dxgi_format, alpha mode) map is still needed, which makes CheckFormatSupport() seem redundant.
Are premultiplied and straight supported for all formats, and "ignore" is unsupported for all? I see we check for "ignore" case here and there, but I don't think it's a part of d3d format, that might be supported or not. "Unknown" is not a mode at all, it needs to be set to some default. Some WIC formats are explicitly premultiplied, how does this work?