Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/d3d8/directx.c | 9 ++++++++- dlls/d3d9/directx.c | 9 ++++++++- dlls/wined3d/directx.c | 16 +++++----------- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 2 +- 5 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 13bf7b031c1..e56246613fa 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -323,13 +323,20 @@ static HRESULT WINAPI d3d8_CheckDepthStencilMatch(IDirect3D8 *iface, UINT adapte D3DFORMAT adapter_format, D3DFORMAT rt_format, D3DFORMAT ds_format) { struct d3d8 *d3d8 = impl_from_IDirect3D8(iface); + struct wined3d_adapter *wined3d_adapter; + unsigned int output_idx; HRESULT hr;
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);
+ output_idx = adapter; + if (output_idx >= d3d8->wined3d_output_count) + return D3DERR_INVALIDCALL; + 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(ds_format)); wined3d_mutex_unlock(); diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 4dbdaeef718..cd52a0e68f5 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -349,13 +349,20 @@ static HRESULT WINAPI d3d9_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT adap D3DFORMAT adapter_format, D3DFORMAT rt_format, D3DFORMAT ds_format) { struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface); + struct wined3d_adapter *wined3d_adapter; + unsigned int output_idx; HRESULT hr;
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);
+ output_idx = adapter; + if (output_idx >= d3d9->wined3d_output_count) + return D3DERR_INVALIDCALL; + 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(ds_format)); wined3d_mutex_unlock(); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 7419425d71e..208e00b839f 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1444,24 +1444,18 @@ HRESULT CDECL wined3d_output_get_raster_status(const struct wined3d_output *outp return WINED3D_OK; }
-HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d, - UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, +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_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id) { const struct wined3d_format *rt_format; const struct wined3d_format *ds_format; - const struct wined3d_adapter *adapter;
- TRACE("wined3d %p, adapter_idx %u, device_type %s, " - "adapter_format %s, render_target_format %s, depth_stencil_format %s.\n", - wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id), + TRACE("adapter %p, device_type %s, adapter_format %s, render_target_format %s, " + "depth_stencil_format %s.\n", + adapter, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_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); ds_format = wined3d_get_format(adapter, depth_stencil_format_id, WINED3D_BIND_DEPTH_STENCIL);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 472cd907b32..3530a11f8d3 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -2,7 +2,7 @@ @ stdcall wined3d_mutex_unlock()
@ 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_conversion(ptr long long long) @ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 65de45bc407..c26a6bb328e 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2244,7 +2244,7 @@ void __stdcall wined3d_mutex_unlock(void);
UINT __cdecl wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT adapter_idx, 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_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,