Nikolay Sivov (@nsivov) commented about dlls/d2d1/hwnd_render_target.c:
- pixel_format = ID2D1RenderTarget_GetPixelFormat(render_target->dxgi_target);
- if (!(pixel_format.format == desc->pixelFormat.format
|| (pixel_format.format == DXGI_FORMAT_UNKNOWN
&& desc->pixelFormat.format == DXGI_FORMAT_B8G8R8A8_UNORM)
|| (pixel_format.format == DXGI_FORMAT_B8G8R8A8_UNORM
&& desc->pixelFormat.format == DXGI_FORMAT_UNKNOWN)
|| (pixel_format.format == DXGI_FORMAT_R8G8B8A8_UNORM
&& desc->pixelFormat.format == DXGI_FORMAT_UNKNOWN)))
return FALSE;
- if (!(pixel_format.alphaMode == desc->pixelFormat.alphaMode
|| desc->pixelFormat.alphaMode == D2D1_ALPHA_MODE_UNKNOWN
|| (pixel_format.alphaMode == D2D1_ALPHA_MODE_UNKNOWN
&& desc->pixelFormat.alphaMode == D2D1_ALPHA_MODE_IGNORE)))
return FALSE;
This does not look good. Are original description fields important after target is created? I think we should store modified values, after _UNKNOWN values are resolved. Then pass input desc argument of IsSupported() through same resolution process, and then compare with a simple equality.
Regarding target type, I think HW/SW are treated as hard requirements on Windows, is that right? E.g. if there is no hardware device, asking for TYPE_HARDWARE will fail. Default type means try hw, then sw if failed. So does it make a difference if target was created with DEFAULT that resolved to HW, or if it was created with HW type directly?