Commit d2c56a60 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

wined3d: Improve CheckDeviceType() support for windowed mode.

For windowed mode: * It doesn't matter if there are no adapter modes for the display format. * A backbuffer format is valid so long as there's support for color conversion to the display format. * A backbuffer format of D3DFMT_UNKNOWN is allowed and means that it should be the same as the display format.
parent 35d8c563
...@@ -4000,7 +4000,6 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap ...@@ -4000,7 +4000,6 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
enum wined3d_device_type device_type, enum wined3d_format_id display_format, enum wined3d_device_type device_type, enum wined3d_format_id display_format,
enum wined3d_format_id backbuffer_format, BOOL windowed) enum wined3d_format_id backbuffer_format, BOOL windowed)
{ {
UINT mode_count;
HRESULT hr; HRESULT hr;
TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n", TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
...@@ -4014,10 +4013,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap ...@@ -4014,10 +4013,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
* combination is available on the given adapter. In fullscreen mode microsoft specified * combination is available on the given adapter. In fullscreen mode microsoft specified
* that the display format shouldn't provide alpha and that ignoring alpha the backbuffer * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
* and display format should match exactly. * and display format should match exactly.
* In windowed mode format conversion can occur and this depends on the driver. When format * In windowed mode format conversion can occur and this depends on the driver. */
* conversion is done, this function should nevertheless fail and applications need to use
* CheckDeviceFormatConversion.
* At the moment we assume that fullscreen and windowed have the same capabilities. */
/* There are only 4 display formats. */ /* There are only 4 display formats. */
if (!(display_format == WINED3DFMT_B5G6R5_UNORM if (!(display_format == WINED3DFMT_B5G6R5_UNORM
...@@ -4029,6 +4025,35 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap ...@@ -4029,6 +4025,35 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
if (windowed)
{
/* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
if (display_format == WINED3DFMT_B10G10R10A2_UNORM)
{
TRACE("Unsupported display/backbuffer format combination %s / %s for windowed mode.\n",
debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
return WINED3DERR_NOTAVAILABLE;
}
/* Windowed mode allows you to specify WINED3DFMT_UNKNOWN for the backbuffer format,
* it means 'reuse' the display format for the backbuffer. */
if (backbuffer_format == WINED3DFMT_UNKNOWN)
backbuffer_format = display_format;
/* In windowed mode, if color conversion from the backbuffer format to the
* display format is supported, then the format combination is supported. */
hr = wined3d_check_device_format_conversion(wined3d, adapter_idx, device_type, backbuffer_format, display_format);
if (FAILED(hr))
{
TRACE("Unsupported display/backbuffer format combination %s / %s; no color conversion.\n",
debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
return WINED3DERR_NOTAVAILABLE;
}
}
else
{
UINT mode_count;
/* If the requested display format is not available, don't continue. */ /* If the requested display format is not available, don't continue. */
mode_count = wined3d_get_adapter_mode_count(wined3d, adapter_idx, mode_count = wined3d_get_adapter_mode_count(wined3d, adapter_idx,
display_format, WINED3D_SCANLINE_ORDERING_UNKNOWN); display_format, WINED3D_SCANLINE_ORDERING_UNKNOWN);
...@@ -4038,9 +4063,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap ...@@ -4038,9 +4063,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
/* Windowed mode allows you to specify WINED3DFMT_UNKNOWN for the backbuffer format, if (backbuffer_format == WINED3DFMT_UNKNOWN)
* it means 'reuse' the display format for the backbuffer. */
if (!windowed && backbuffer_format == WINED3DFMT_UNKNOWN)
{ {
TRACE("backbuffer_format WINED3FMT_UNKNOWN only available in windowed mode.\n"); TRACE("backbuffer_format WINED3FMT_UNKNOWN only available in windowed mode.\n");
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
...@@ -4077,15 +4100,16 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap ...@@ -4077,15 +4100,16 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
/* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode and it /* WINED3DFMT_B10G10R10A2_UNORM can only be mixed with backbuffer format
* can only be mixed with backbuffer format WINED3DFMT_B10G10R10A2_UNORM. */ * WINED3DFMT_B10G10R10A2_UNORM. */
if (display_format == WINED3DFMT_B10G10R10A2_UNORM if (display_format == WINED3DFMT_B10G10R10A2_UNORM
&& (backbuffer_format != WINED3DFMT_B10G10R10A2_UNORM || windowed)) && backbuffer_format != WINED3DFMT_B10G10R10A2_UNORM)
{ {
TRACE("Unsupported display/backbuffer format combination %s / %s.\n", TRACE("Unsupported display/backbuffer format combination %s / %s.\n",
debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
}
/* Use CheckDeviceFormat to see if the backbuffer_format is usable with the given display_format */ /* Use CheckDeviceFormat to see if the backbuffer_format is usable with the given display_format */
hr = wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format, hr = wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment