d3d12: Change displayable format logic

Instead of not reporting support for the pixel format at all, just
disable swapchain creation.

Some apps want to create off-screen contexts targeting these formats,
but since WGL doesn't really have "off-screen," the pixel format
enumeration should return support for these.

Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18326>
This commit is contained in:
Jesse Natalie 2022-08-30 11:58:06 -07:00 committed by Marge Bot
parent ae57628dd5
commit dbb17f567a
2 changed files with 6 additions and 11 deletions

View file

@ -653,17 +653,6 @@ d3d12_is_format_supported(struct pipe_screen *pscreen,
} else
fmt_info_sv = fmt_info;
#ifdef _WIN32
if (bind & PIPE_BIND_DISPLAY_TARGET &&
(!(fmt_info.Support1 & D3D12_FORMAT_SUPPORT1_DISPLAY) ||
// Disable formats that don't support flip model
dxgi_format == DXGI_FORMAT_B8G8R8X8_UNORM ||
dxgi_format == DXGI_FORMAT_B5G5R5A1_UNORM ||
dxgi_format == DXGI_FORMAT_B5G6R5_UNORM ||
dxgi_format == DXGI_FORMAT_B4G4R4A4_UNORM))
return false;
#endif
if (bind & PIPE_BIND_DEPTH_STENCIL &&
!(fmt_info.Support1 & D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL))
return false;

View file

@ -227,6 +227,12 @@ d3d12_wgl_create_framebuffer(struct pipe_screen *screen,
(pfi->pfd.dwFlags & PFD_SUPPORT_GDI))
return NULL;
if (pfi->stvis.color_format != PIPE_FORMAT_B8G8R8A8_UNORM &&
pfi->stvis.color_format != PIPE_FORMAT_R8G8B8A8_UNORM &&
pfi->stvis.color_format != PIPE_FORMAT_R10G10B10A2_UNORM &&
pfi->stvis.color_format != PIPE_FORMAT_R16G16B16A16_FLOAT)
return NULL;
struct d3d12_wgl_framebuffer *fb = CALLOC_STRUCT(d3d12_wgl_framebuffer);
if (!fb)
return NULL;