mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 22:31:27 +00:00
wined3d: Refactor wined3d_get_adapter_identifier() to wined3d_adapter_get_identifier().
wined3d_adapter_get_identifier() uses a struct wined3d_adapter pointer as parameter. 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:
parent
a8072e0841
commit
591068cec0
|
@ -105,11 +105,17 @@ static HRESULT WINAPI d3d8_GetAdapterIdentifier(IDirect3D8 *iface, UINT adapter,
|
|||
{
|
||||
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
|
||||
struct wined3d_adapter_identifier adapter_id;
|
||||
struct wined3d_adapter *wined3d_adapter;
|
||||
unsigned int output_idx;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, adapter %u, flags %#x, identifier %p.\n",
|
||||
iface, adapter, flags, identifier);
|
||||
|
||||
output_idx = adapter;
|
||||
if (output_idx >= d3d8->wined3d_output_count)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
adapter_id.driver = identifier->Driver;
|
||||
adapter_id.driver_size = sizeof(identifier->Driver);
|
||||
adapter_id.description = identifier->Description;
|
||||
|
@ -117,7 +123,8 @@ static HRESULT WINAPI d3d8_GetAdapterIdentifier(IDirect3D8 *iface, UINT adapter,
|
|||
adapter_id.device_name = NULL; /* d3d9 only */
|
||||
adapter_id.device_name_size = 0; /* d3d9 only */
|
||||
|
||||
if (SUCCEEDED(hr = wined3d_get_adapter_identifier(d3d8->wined3d, adapter, flags, &adapter_id)))
|
||||
wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]);
|
||||
if (SUCCEEDED(hr = wined3d_adapter_get_identifier(wined3d_adapter, flags, &adapter_id)))
|
||||
{
|
||||
identifier->DriverVersion = adapter_id.driver_version;
|
||||
identifier->VendorId = adapter_id.vendor_id;
|
||||
|
|
|
@ -120,11 +120,17 @@ static HRESULT WINAPI d3d9_GetAdapterIdentifier(IDirect3D9Ex *iface, UINT adapte
|
|||
{
|
||||
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
|
||||
struct wined3d_adapter_identifier adapter_id;
|
||||
struct wined3d_adapter *wined3d_adapter;
|
||||
unsigned int output_idx;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, adapter %u, flags %#x, identifier %p.\n",
|
||||
iface, adapter, flags, identifier);
|
||||
|
||||
output_idx = adapter;
|
||||
if (output_idx >= d3d9->wined3d_output_count)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
adapter_id.driver = identifier->Driver;
|
||||
adapter_id.driver_size = sizeof(identifier->Driver);
|
||||
adapter_id.description = identifier->Description;
|
||||
|
@ -132,7 +138,8 @@ static HRESULT WINAPI d3d9_GetAdapterIdentifier(IDirect3D9Ex *iface, UINT adapte
|
|||
adapter_id.device_name = identifier->DeviceName;
|
||||
adapter_id.device_name_size = sizeof(identifier->DeviceName);
|
||||
|
||||
if (SUCCEEDED(hr = wined3d_get_adapter_identifier(d3d9->wined3d, adapter, flags, &adapter_id)))
|
||||
wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
|
||||
if (SUCCEEDED(hr = wined3d_adapter_get_identifier(wined3d_adapter, flags, &adapter_id)))
|
||||
{
|
||||
identifier->DriverVersion = adapter_id.driver_version;
|
||||
identifier->VendorId = adapter_id.vendor_id;
|
||||
|
@ -590,15 +597,22 @@ static HRESULT WINAPI d3d9_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUI
|
|||
{
|
||||
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
|
||||
struct wined3d_adapter_identifier adapter_id;
|
||||
struct wined3d_adapter *wined3d_adapter;
|
||||
unsigned int output_idx;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, adapter %u, luid %p.\n", iface, adapter, luid);
|
||||
|
||||
output_idx = adapter;
|
||||
if (output_idx >= d3d9->wined3d_output_count)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
adapter_id.driver_size = 0;
|
||||
adapter_id.description_size = 0;
|
||||
adapter_id.device_name_size = 0;
|
||||
|
||||
if (SUCCEEDED(hr = wined3d_get_adapter_identifier(d3d9->wined3d, adapter, 0, &adapter_id)))
|
||||
wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
|
||||
if (SUCCEEDED(hr = wined3d_adapter_get_identifier(wined3d_adapter, 0, &adapter_id)))
|
||||
*luid = adapter_id.adapter_luid;
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -1928,7 +1928,7 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *c
|
|||
{
|
||||
struct wined3d_adapter_identifier desc = {0};
|
||||
|
||||
hr = wined3d_get_adapter_identifier(ddraw->wined3d, WINED3DADAPTER_DEFAULT, 0, &desc);
|
||||
hr = wined3d_adapter_get_identifier(ddraw->wined3d_adapter, 0, &desc);
|
||||
total_vidmem = min(UINT_MAX, desc.video_memory);
|
||||
*total = framebuffer_size > total_vidmem ? 0 : total_vidmem - framebuffer_size;
|
||||
TRACE("Total video memory %#x.\n", *total);
|
||||
|
@ -2609,7 +2609,7 @@ static HRESULT WINAPI ddraw7_GetDeviceIdentifier(IDirectDraw7 *iface,
|
|||
adapter_id.description_size = sizeof(DDDI->szDescription);
|
||||
adapter_id.device_name_size = 0;
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_get_adapter_identifier(ddraw->wined3d, WINED3DADAPTER_DEFAULT, 0x0, &adapter_id);
|
||||
hr = wined3d_adapter_get_identifier(ddraw->wined3d_adapter, 0x0, &adapter_id);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMC
|
|||
adapter_id.description_size = sizeof(DriverDescription);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
if (FAILED(hr = wined3d_get_adapter_identifier(wined3d, adapter_idx, 0x0, &adapter_id)))
|
||||
if (FAILED(hr = wined3d_adapter_get_identifier(wined3d_adapter, 0x0, &adapter_id)))
|
||||
{
|
||||
WARN("Failed to get adapter identifier, hr %#x.\n", hr);
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -163,7 +163,7 @@ static HRESULT dxgi_adapter_get_desc(struct dxgi_adapter *adapter, DXGI_ADAPTER_
|
|||
adapter_id.description_size = sizeof(description);
|
||||
adapter_id.device_name_size = 0;
|
||||
|
||||
if (FAILED(hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id)))
|
||||
if (FAILED(hr = wined3d_adapter_get_identifier(adapter->wined3d_adapter, 0, &adapter_id)))
|
||||
return hr;
|
||||
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, ARRAY_SIZE(description)))
|
||||
|
@ -233,7 +233,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAda
|
|||
wined3d = adapter->factory->wined3d;
|
||||
hr = wined3d_get_device_caps(wined3d, adapter->ordinal, WINED3D_DEVICE_TYPE_HAL, &caps);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = wined3d_get_adapter_identifier(wined3d, adapter->ordinal, 0, &adapter_id);
|
||||
hr = wined3d_adapter_get_identifier(adapter->wined3d_adapter, 0, &adapter_id);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
if (FAILED(hr))
|
||||
|
@ -316,7 +316,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryVideoMemoryInfo(IWineDXGIAdap
|
|||
adapter_id.description_size = 0;
|
||||
adapter_id.device_name_size = 0;
|
||||
|
||||
if (FAILED(hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id)))
|
||||
if (FAILED(hr = wined3d_adapter_get_identifier(adapter->wined3d_adapter, 0, &adapter_id)))
|
||||
return hr;
|
||||
|
||||
switch (segment_group)
|
||||
|
@ -387,7 +387,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_get_adapter_info(IWineDXGIAdapter
|
|||
TRACE("iface %p, info %p.\n", iface, info);
|
||||
|
||||
memset(&adapter_id, 0, sizeof(adapter_id));
|
||||
if (SUCCEEDED(hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id)))
|
||||
if (SUCCEEDED(hr = wined3d_adapter_get_identifier(adapter->wined3d_adapter, 0, &adapter_id)))
|
||||
{
|
||||
info->driver_uuid = adapter_id.driver_uuid;
|
||||
info->device_uuid = adapter_id.device_uuid;
|
||||
|
|
|
@ -1347,21 +1347,13 @@ HRESULT CDECL wined3d_output_set_display_mode(struct wined3d_output *output,
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
|
||||
UINT adapter_idx, DWORD flags, struct wined3d_adapter_identifier *identifier)
|
||||
HRESULT CDECL wined3d_adapter_get_identifier(const struct wined3d_adapter *adapter,
|
||||
DWORD flags, struct wined3d_adapter_identifier *identifier)
|
||||
{
|
||||
const struct wined3d_adapter *adapter;
|
||||
|
||||
TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n",
|
||||
wined3d, adapter_idx, flags, identifier);
|
||||
TRACE("adapter %p, flags %#x, identifier %p.\n", adapter, flags, identifier);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
|
||||
if (adapter_idx >= wined3d->adapter_count)
|
||||
goto fail;
|
||||
|
||||
adapter = wined3d->adapters[adapter_idx];
|
||||
|
||||
wined3d_copy_name(identifier->driver, adapter->driver_info.name, identifier->driver_size);
|
||||
wined3d_copy_name(identifier->description, adapter->driver_info.description, identifier->description_size);
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
@ cdecl wined3d_decref(ptr)
|
||||
@ cdecl wined3d_get_adapter(ptr long)
|
||||
@ cdecl wined3d_get_adapter_count(ptr)
|
||||
@ cdecl wined3d_get_adapter_identifier(ptr long long ptr)
|
||||
@ cdecl wined3d_get_device_caps(ptr long long ptr)
|
||||
@ cdecl wined3d_get_output_desc(ptr long ptr)
|
||||
@ cdecl wined3d_incref(ptr)
|
||||
|
@ -19,6 +18,7 @@
|
|||
@ cdecl wined3d_register_window(ptr ptr ptr long)
|
||||
@ cdecl wined3d_unregister_windows(ptr)
|
||||
|
||||
@ cdecl wined3d_adapter_get_identifier(ptr long ptr)
|
||||
@ cdecl wined3d_adapter_get_output(ptr long)
|
||||
@ cdecl wined3d_adapter_get_output_count(ptr)
|
||||
|
||||
|
|
|
@ -2270,8 +2270,6 @@ 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_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx,
|
||||
DWORD flags, struct wined3d_adapter_identifier *identifier);
|
||||
HRESULT __cdecl wined3d_get_device_caps(const struct wined3d *wined3d, unsigned int adapter_idx,
|
||||
enum wined3d_device_type device_type, struct wined3d_caps *caps);
|
||||
HRESULT __cdecl wined3d_get_output_desc(const struct wined3d *wined3d, unsigned int adapter_idx,
|
||||
|
@ -2282,6 +2280,8 @@ BOOL __cdecl wined3d_register_window(struct wined3d *wined3d, HWND window,
|
|||
struct wined3d_device *device, unsigned int flags);
|
||||
void __cdecl wined3d_unregister_windows(struct wined3d *wined3d);
|
||||
|
||||
HRESULT __cdecl wined3d_adapter_get_identifier(const struct wined3d_adapter *adapter,
|
||||
DWORD flags, struct wined3d_adapter_identifier *identifier);
|
||||
struct wined3d_output * __cdecl wined3d_adapter_get_output(const struct wined3d_adapter *adapter,
|
||||
unsigned int idx);
|
||||
unsigned int __cdecl wined3d_adapter_get_output_count(const struct wined3d_adapter *adapter);
|
||||
|
|
Loading…
Reference in a new issue