Commit f9701d37 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

wined3d: Pass a struct wined3d_output pointer to wined3d_check_device_type().

parent 5df46227
...@@ -213,16 +213,22 @@ static HRESULT WINAPI d3d8_CheckDeviceType(IDirect3D8 *iface, UINT adapter, D3DD ...@@ -213,16 +213,22 @@ static HRESULT WINAPI d3d8_CheckDeviceType(IDirect3D8 *iface, UINT adapter, D3DD
D3DFORMAT display_format, D3DFORMAT backbuffer_format, BOOL windowed) D3DFORMAT display_format, D3DFORMAT backbuffer_format, BOOL windowed)
{ {
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface); struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
unsigned int output_idx;
HRESULT hr; HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n", TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n",
iface, adapter, device_type, display_format, backbuffer_format, windowed); iface, adapter, device_type, display_format, backbuffer_format, windowed);
output_idx = adapter;
if (output_idx >= d3d8->wined3d_output_count)
return D3DERR_INVALIDCALL;
if (!windowed && display_format != D3DFMT_X8R8G8B8 && display_format != D3DFMT_R5G6B5) if (!windowed && display_format != D3DFMT_X8R8G8B8 && display_format != D3DFMT_R5G6B5)
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_check_device_type(d3d8->wined3d, adapter, device_type, wined3dformat_from_d3dformat(display_format), hr = wined3d_check_device_type(d3d8->wined3d, d3d8->wined3d_outputs[output_idx], device_type,
wined3dformat_from_d3dformat(display_format),
wined3dformat_from_d3dformat(backbuffer_format), windowed); wined3dformat_from_d3dformat(backbuffer_format), windowed);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
......
...@@ -236,17 +236,23 @@ static HRESULT WINAPI d3d9_CheckDeviceType(IDirect3D9Ex *iface, UINT adapter, D3 ...@@ -236,17 +236,23 @@ static HRESULT WINAPI d3d9_CheckDeviceType(IDirect3D9Ex *iface, UINT adapter, D3
D3DFORMAT display_format, D3DFORMAT backbuffer_format, BOOL windowed) D3DFORMAT display_format, D3DFORMAT backbuffer_format, BOOL windowed)
{ {
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface); struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
unsigned int output_idx;
HRESULT hr; HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n", TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n",
iface, adapter, device_type, display_format, backbuffer_format, windowed); iface, adapter, device_type, display_format, backbuffer_format, windowed);
output_idx = adapter;
if (output_idx >= d3d9->wined3d_output_count)
return D3DERR_INVALIDCALL;
/* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out. */ /* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out. */
if (!windowed && display_format != D3DFMT_X8R8G8B8 && display_format != D3DFMT_R5G6B5) if (!windowed && display_format != D3DFMT_X8R8G8B8 && display_format != D3DFMT_R5G6B5)
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_check_device_type(d3d9->wined3d, adapter, device_type, wined3dformat_from_d3dformat(display_format), hr = wined3d_check_device_type(d3d9->wined3d, d3d9->wined3d_outputs[output_idx], device_type,
wined3dformat_from_d3dformat(display_format),
wined3dformat_from_d3dformat(backbuffer_format), windowed); wined3dformat_from_d3dformat(backbuffer_format), windowed);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
......
...@@ -1783,19 +1783,17 @@ HRESULT CDECL wined3d_check_device_format_conversion(const struct wined3d_output ...@@ -1783,19 +1783,17 @@ HRESULT CDECL wined3d_check_device_format_conversion(const struct wined3d_output
return WINED3D_OK; return WINED3D_OK;
} }
HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adapter_idx, HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d,
enum wined3d_device_type device_type, enum wined3d_format_id display_format, const struct wined3d_output *output, enum wined3d_device_type device_type,
enum wined3d_format_id backbuffer_format, BOOL windowed) enum wined3d_format_id display_format, enum wined3d_format_id backbuffer_format,
BOOL windowed)
{ {
BOOL present_conversion = wined3d->flags & WINED3D_PRESENT_CONVERSION; BOOL present_conversion = wined3d->flags & WINED3D_PRESENT_CONVERSION;
TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n", TRACE("wined3d %p, output %p, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(display_format), wined3d, output, debug_d3ddevicetype(device_type), debug_d3dformat(display_format),
debug_d3dformat(backbuffer_format), windowed); debug_d3dformat(backbuffer_format), windowed);
if (adapter_idx >= wined3d->adapter_count)
return WINED3DERR_INVALIDCALL;
/* The task of this function is to check whether a certain display / backbuffer format /* The task of this function is to check whether a certain display / backbuffer format
* 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
...@@ -1815,8 +1813,8 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap ...@@ -1815,8 +1813,8 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
if (!windowed) if (!windowed)
{ {
/* If the requested display format is not available, don't continue. */ /* If the requested display format is not available, don't continue. */
if (!wined3d_output_get_mode_count(&wined3d->adapters[adapter_idx]->outputs[0], if (!wined3d_output_get_mode_count(output, display_format,
display_format, WINED3D_SCANLINE_ORDERING_UNKNOWN)) WINED3D_SCANLINE_ORDERING_UNKNOWN))
{ {
TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format)); TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format));
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
...@@ -1839,8 +1837,8 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap ...@@ -1839,8 +1837,8 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
if (backbuffer_format == WINED3DFMT_UNKNOWN) if (backbuffer_format == WINED3DFMT_UNKNOWN)
backbuffer_format = display_format; backbuffer_format = display_format;
if (FAILED(wined3d_check_device_format_conversion(&wined3d->adapters[adapter_idx]->outputs[0], if (FAILED(wined3d_check_device_format_conversion(output, device_type, backbuffer_format,
device_type, backbuffer_format, display_format))) display_format)))
{ {
TRACE("Format conversion from %s to %s not supported.\n", TRACE("Format conversion from %s to %s not supported.\n",
debug_d3dformat(backbuffer_format), debug_d3dformat(display_format)); debug_d3dformat(backbuffer_format), debug_d3dformat(display_format));
...@@ -1886,8 +1884,9 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap ...@@ -1886,8 +1884,9 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
} }
/* Validate that the back buffer format is usable for render targets. */ /* Validate that the back buffer format is usable for render targets. */
if (FAILED(wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format, if (FAILED(wined3d_check_device_format(wined3d, output->adapter->ordinal, device_type,
0, WINED3D_BIND_RENDER_TARGET, WINED3D_RTYPE_TEXTURE_2D, backbuffer_format))) display_format, 0, WINED3D_BIND_RENDER_TARGET, WINED3D_RTYPE_TEXTURE_2D,
backbuffer_format)))
{ {
TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format)); TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format));
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
@ cdecl wined3d_check_device_format(ptr long long long long long long long) @ cdecl wined3d_check_device_format(ptr long long long long long long long)
@ cdecl wined3d_check_device_format_conversion(ptr long long long) @ cdecl wined3d_check_device_format_conversion(ptr long long long)
@ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr) @ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
@ cdecl wined3d_check_device_type(ptr long long long long long) @ cdecl wined3d_check_device_type(ptr ptr long long long long)
@ cdecl wined3d_create(long) @ cdecl wined3d_create(long)
@ cdecl wined3d_decref(ptr) @ cdecl wined3d_decref(ptr)
@ cdecl wined3d_get_adapter(ptr long) @ cdecl wined3d_get_adapter(ptr long)
......
...@@ -2259,9 +2259,10 @@ HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d_outp ...@@ -2259,9 +2259,10 @@ HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d_outp
HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx, HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed, enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
enum wined3d_multisample_type multisample_type, DWORD *quality_levels); enum wined3d_multisample_type multisample_type, DWORD *quality_levels);
HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d, UINT adapter_idx, HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d,
enum wined3d_device_type device_type, enum wined3d_format_id display_format_id, const struct wined3d_output *output, enum wined3d_device_type device_type,
enum wined3d_format_id backbuffer_format_id, BOOL windowed); enum wined3d_format_id display_format_id, enum wined3d_format_id backbuffer_format_id,
BOOL windowed);
struct wined3d * __cdecl wined3d_create(DWORD flags); struct wined3d * __cdecl wined3d_create(DWORD flags);
ULONG __cdecl wined3d_decref(struct wined3d *wined3d); ULONG __cdecl wined3d_decref(struct wined3d *wined3d);
struct wined3d_adapter * __cdecl wined3d_get_adapter(const struct wined3d *wined3d, struct wined3d_adapter * __cdecl wined3d_get_adapter(const struct wined3d *wined3d,
......
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