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

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

parent c1e5c714
......@@ -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;
......
......@@ -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);
......
......@@ -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)
......
......@@ -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);
......
......@@ -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);
......
......@@ -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();
......
......@@ -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,
......
......@@ -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 |
......
......@@ -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)
......
......@@ -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);
......
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