wined3d: Pass a struct wined3d_adapter pointer to wined3d_check_depth_stencil_match().

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-03-09 15:41:33 +08:00 committed by Alexandre Julliard
parent 744ff73829
commit 2d1786c55a
5 changed files with 23 additions and 15 deletions

View File

@ -323,13 +323,20 @@ static HRESULT WINAPI d3d8_CheckDepthStencilMatch(IDirect3D8 *iface, UINT adapte
D3DFORMAT adapter_format, D3DFORMAT rt_format, D3DFORMAT ds_format) D3DFORMAT adapter_format, D3DFORMAT rt_format, D3DFORMAT ds_format)
{ {
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface); struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
struct wined3d_adapter *wined3d_adapter;
unsigned int output_idx;
HRESULT hr; HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n", TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n",
iface, adapter, device_type, adapter_format, rt_format, ds_format); iface, adapter, device_type, adapter_format, rt_format, ds_format);
output_idx = adapter;
if (output_idx >= d3d8->wined3d_output_count)
return D3DERR_INVALIDCALL;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_check_depth_stencil_match(d3d8->wined3d, adapter, device_type, wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]);
hr = wined3d_check_depth_stencil_match(wined3d_adapter, device_type,
wined3dformat_from_d3dformat(adapter_format), wined3dformat_from_d3dformat(rt_format), wined3dformat_from_d3dformat(adapter_format), wined3dformat_from_d3dformat(rt_format),
wined3dformat_from_d3dformat(ds_format)); wined3dformat_from_d3dformat(ds_format));
wined3d_mutex_unlock(); wined3d_mutex_unlock();

View File

@ -349,13 +349,20 @@ static HRESULT WINAPI d3d9_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT adap
D3DFORMAT adapter_format, D3DFORMAT rt_format, D3DFORMAT ds_format) D3DFORMAT adapter_format, D3DFORMAT rt_format, D3DFORMAT ds_format)
{ {
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface); struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
struct wined3d_adapter *wined3d_adapter;
unsigned int output_idx;
HRESULT hr; HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n", TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n",
iface, adapter, device_type, adapter_format, rt_format, ds_format); iface, adapter, device_type, adapter_format, rt_format, ds_format);
output_idx = adapter;
if (output_idx >= d3d9->wined3d_output_count)
return D3DERR_INVALIDCALL;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_check_depth_stencil_match(d3d9->wined3d, adapter, device_type, wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
hr = wined3d_check_depth_stencil_match(wined3d_adapter, device_type,
wined3dformat_from_d3dformat(adapter_format), wined3dformat_from_d3dformat(rt_format), wined3dformat_from_d3dformat(adapter_format), wined3dformat_from_d3dformat(rt_format),
wined3dformat_from_d3dformat(ds_format)); wined3dformat_from_d3dformat(ds_format));
wined3d_mutex_unlock(); wined3d_mutex_unlock();

View File

@ -1444,24 +1444,18 @@ HRESULT CDECL wined3d_output_get_raster_status(const struct wined3d_output *outp
return WINED3D_OK; return WINED3D_OK;
} }
HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d, HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d_adapter *adapter,
UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id,
enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id) enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id)
{ {
const struct wined3d_format *rt_format; const struct wined3d_format *rt_format;
const struct wined3d_format *ds_format; const struct wined3d_format *ds_format;
const struct wined3d_adapter *adapter;
TRACE("wined3d %p, adapter_idx %u, device_type %s, " TRACE("adapter %p, device_type %s, adapter_format %s, render_target_format %s, "
"adapter_format %s, render_target_format %s, depth_stencil_format %s.\n", "depth_stencil_format %s.\n",
wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id), adapter, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id),
debug_d3dformat(render_target_format_id), debug_d3dformat(depth_stencil_format_id)); debug_d3dformat(render_target_format_id), debug_d3dformat(depth_stencil_format_id));
if (adapter_idx >= wined3d->adapter_count)
return WINED3DERR_INVALIDCALL;
adapter = wined3d->adapters[adapter_idx];
rt_format = wined3d_get_format(adapter, render_target_format_id, WINED3D_BIND_RENDER_TARGET); rt_format = wined3d_get_format(adapter, render_target_format_id, WINED3D_BIND_RENDER_TARGET);
ds_format = wined3d_get_format(adapter, depth_stencil_format_id, WINED3D_BIND_DEPTH_STENCIL); ds_format = wined3d_get_format(adapter, depth_stencil_format_id, WINED3D_BIND_DEPTH_STENCIL);

View File

@ -2,7 +2,7 @@
@ stdcall wined3d_mutex_unlock() @ stdcall wined3d_mutex_unlock()
@ cdecl wined3d_calculate_format_pitch(ptr long long long) @ cdecl wined3d_calculate_format_pitch(ptr long long long)
@ cdecl wined3d_check_depth_stencil_match(ptr long long long long long) @ cdecl wined3d_check_depth_stencil_match(ptr long long long long)
@ 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)

View File

@ -2247,7 +2247,7 @@ void __stdcall wined3d_mutex_unlock(void);
UINT __cdecl wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT adapter_idx, UINT __cdecl wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_format_id format_id, UINT width); enum wined3d_format_id format_id, UINT width);
HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d *wined3d, UINT adapter_idx, HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d_adapter *adapter,
enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id,
enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id); enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id);
HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx, HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx,