diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 02b010c22a4..4b7c03e4e42 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -3701,7 +3701,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine return hr; } - wined3d_get_device_caps(wined3d, adapter, device_type, &caps); + wined3d_get_device_caps(wined3d_adapter, device_type, &caps); device->max_user_clip_planes = caps.MaxUserClipPlanes; device->vs_uniform_count = caps.MaxVertexShaderConst; diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index cbb638f014d..66e7e622f8f 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -370,16 +370,23 @@ static HRESULT WINAPI d3d8_CheckDepthStencilMatch(IDirect3D8 *iface, UINT adapte static HRESULT WINAPI d3d8_GetDeviceCaps(IDirect3D8 *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS8 *caps) { struct d3d8 *d3d8 = impl_from_IDirect3D8(iface); + struct wined3d_adapter *wined3d_adapter; struct wined3d_caps wined3d_caps; + unsigned int output_idx; HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps); + output_idx = adapter; + if (output_idx >= d3d8->wined3d_output_count) + return D3DERR_INVALIDCALL; + if (!caps) return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = wined3d_get_device_caps(d3d8->wined3d, adapter, device_type, &wined3d_caps); + wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]); + hr = wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps); wined3d_mutex_unlock(); d3dcaps_from_wined3dcaps(caps, &wined3d_caps); diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index ec1d18a79fe..b4887dff450 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -4633,7 +4633,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine return hr; } - wined3d_get_device_caps(wined3d, adapter, device_type, &caps); + wined3d_get_device_caps(wined3d_adapter, device_type, &caps); device->max_user_clip_planes = caps.MaxUserClipPlanes; device->vs_uniform_count = caps.MaxVertexShaderConst; if (flags & D3DCREATE_ADAPTERGROUP_DEVICE) diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 6c8ca1c3d3d..d79b32515fa 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -418,18 +418,25 @@ static HRESULT WINAPI d3d9_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS9 *caps) { struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface); + struct wined3d_adapter *wined3d_adapter; struct wined3d_caps wined3d_caps; + unsigned int output_idx; HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps); + output_idx = adapter; + if (output_idx >= d3d9->wined3d_output_count) + return D3DERR_INVALIDCALL; + if (!caps) return D3DERR_INVALIDCALL; memset(caps, 0, sizeof(*caps)); wined3d_mutex_lock(); - hr = wined3d_get_device_caps(d3d9->wined3d, adapter, device_type, &wined3d_caps); + wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]); + hr = wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps); wined3d_mutex_unlock(); d3dcaps_from_wined3dcaps(caps, &wined3d_caps); diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index e82f9644e3b..de457511591 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1227,7 +1227,7 @@ HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) memset(&wined3d_caps, 0, sizeof(wined3d_caps)); wined3d_mutex_lock(); - hr = wined3d_get_device_caps(ddraw->wined3d, 0, WINED3D_DEVICE_TYPE_HAL, &wined3d_caps); + hr = wined3d_get_device_caps(ddraw->wined3d_adapter, WINED3D_DEVICE_TYPE_HAL, &wined3d_caps); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -5017,7 +5017,7 @@ HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type de return E_FAIL; } - if (FAILED(hr = wined3d_get_device_caps(ddraw->wined3d, WINED3DADAPTER_DEFAULT, device_type, &caps))) + if (FAILED(hr = wined3d_get_device_caps(ddraw->wined3d_adapter, device_type, &caps))) { ERR("Failed to get device caps, hr %#x.\n", hr); wined3d_decref(ddraw->wined3d); diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index 2bd69954e10..d48d4755d00 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -211,7 +211,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAda struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface); struct wined3d_adapter_identifier adapter_id; struct wined3d_caps caps; - struct wined3d *wined3d; HRESULT hr; TRACE("iface %p, guid %s, umd_version %p.\n", iface, debugstr_guid(guid), umd_version); @@ -230,8 +229,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAda adapter_id.device_name_size = 0; wined3d_mutex_lock(); - wined3d = adapter->factory->wined3d; - hr = wined3d_get_device_caps(wined3d, adapter->ordinal, WINED3D_DEVICE_TYPE_HAL, &caps); + hr = wined3d_get_device_caps(adapter->wined3d_adapter, WINED3D_DEVICE_TYPE_HAL, &caps); if (SUCCEEDED(hr)) hr = wined3d_adapter_get_identifier(adapter->wined3d_adapter, 0, &adapter_id); wined3d_mutex_unlock(); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 927c9456ec0..c3d2d5124b7 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3810,8 +3810,7 @@ HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device { TRACE("device %p, caps %p.\n", device, caps); - return wined3d_get_device_caps(device->wined3d, device->adapter->ordinal, - device->create_parms.device_type, caps); + return wined3d_get_device_caps(device->adapter, device->create_parms.device_type, caps); } HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx, diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 8f8933801a9..8cf0d77e821 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1874,27 +1874,22 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, return WINED3D_OK; } -HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, unsigned int adapter_idx, +HRESULT CDECL wined3d_get_device_caps(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, struct wined3d_caps *caps) { const struct wined3d_d3d_info *d3d_info; struct wined3d_vertex_caps vertex_caps; - const struct wined3d_adapter *adapter; DWORD ckey_caps, blit_caps, fx_caps; struct fragment_caps fragment_caps; struct shader_caps shader_caps; - TRACE("wined3d %p, adapter_idx %u, device_type %s, caps %p.\n", - wined3d, adapter_idx, debug_d3ddevicetype(device_type), caps); + TRACE("adapter %p, device_type %s, caps %p.\n", + adapter, debug_d3ddevicetype(device_type), caps); - if (adapter_idx >= wined3d->adapter_count) - return WINED3DERR_INVALIDCALL; - - adapter = wined3d->adapters[adapter_idx]; d3d_info = &adapter->d3d_info; caps->DeviceType = (device_type == WINED3D_DEVICE_TYPE_HAL) ? WINED3D_DEVICE_TYPE_HAL : WINED3D_DEVICE_TYPE_REF; - caps->AdapterOrdinal = adapter_idx; + caps->AdapterOrdinal = adapter->ordinal; caps->Caps = 0; caps->Caps2 = WINED3DCAPS2_CANRENDERWINDOWED | diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index a25accc2371..c06cca22ee4 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -11,7 +11,7 @@ @ cdecl wined3d_decref(ptr) @ cdecl wined3d_get_adapter(ptr long) @ cdecl wined3d_get_adapter_count(ptr) -@ cdecl wined3d_get_device_caps(ptr long long ptr) +@ cdecl wined3d_get_device_caps(ptr long ptr) @ cdecl wined3d_get_output_desc(ptr long ptr) @ cdecl wined3d_incref(ptr) @ cdecl wined3d_register_software_device(ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 0dd09f4a3f6..cfb13529b34 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2282,7 +2282,7 @@ ULONG __cdecl wined3d_decref(struct wined3d *wined3d); struct wined3d_adapter * __cdecl wined3d_get_adapter(const struct wined3d *wined3d, unsigned int idx); UINT __cdecl wined3d_get_adapter_count(const struct wined3d *wined3d); -HRESULT __cdecl wined3d_get_device_caps(const struct wined3d *wined3d, unsigned int adapter_idx, +HRESULT __cdecl wined3d_get_device_caps(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, struct wined3d_caps *caps); HRESULT __cdecl wined3d_get_output_desc(const struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_output_desc *desc);