From b07e8b3edbaab4b2818926abb65702450b1447ba Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Wed, 25 Mar 2020 17:51:09 +0800 Subject: [PATCH] wined3d: Remove device_name and device_name_size from struct wined3d_adapter_identifier. Signed-off-by: Zhiyi Zhang Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d8/directx.c | 2 -- dlls/d3d9/directx.c | 15 ++++++++++++--- dlls/ddraw/ddraw.c | 1 - dlls/ddraw/main.c | 12 ++++++------ dlls/dxgi/adapter.c | 3 --- dlls/wined3d/directx.c | 15 --------------- include/wine/wined3d.h | 2 -- 7 files changed, 18 insertions(+), 32 deletions(-) diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 509a76239d6..874f9ea047b 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -120,8 +120,6 @@ static HRESULT WINAPI d3d8_GetAdapterIdentifier(IDirect3D8 *iface, UINT adapter, adapter_id.driver_size = sizeof(identifier->Driver); adapter_id.description = identifier->Description; adapter_id.description_size = sizeof(identifier->Description); - adapter_id.device_name = NULL; /* d3d9 only */ - adapter_id.device_name_size = 0; /* d3d9 only */ wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]); if (SUCCEEDED(hr = wined3d_adapter_get_identifier(wined3d_adapter, flags, &adapter_id))) diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 070387dde3e..6c67be31b45 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -121,6 +121,7 @@ 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; + struct wined3d_output_desc output_desc; unsigned int output_idx; HRESULT hr; @@ -131,12 +132,20 @@ static HRESULT WINAPI d3d9_GetAdapterIdentifier(IDirect3D9Ex *iface, UINT adapte if (output_idx >= d3d9->wined3d_output_count) return D3DERR_INVALIDCALL; + wined3d_mutex_lock(); + if (FAILED(hr = wined3d_output_get_desc(d3d9->wined3d_outputs[output_idx], &output_desc))) + { + wined3d_mutex_unlock(); + WARN("Failed to get output description, hr %#x.\n", hr); + return hr; + } + WideCharToMultiByte(CP_ACP, 0, output_desc.device_name, -1, identifier->DeviceName, + sizeof(identifier->DeviceName), NULL, NULL); + adapter_id.driver = identifier->Driver; adapter_id.driver_size = sizeof(identifier->Driver); adapter_id.description = identifier->Description; adapter_id.description_size = sizeof(identifier->Description); - adapter_id.device_name = identifier->DeviceName; - adapter_id.device_name_size = sizeof(identifier->DeviceName); wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]); if (SUCCEEDED(hr = wined3d_adapter_get_identifier(wined3d_adapter, flags, &adapter_id))) @@ -149,6 +158,7 @@ static HRESULT WINAPI d3d9_GetAdapterIdentifier(IDirect3D9Ex *iface, UINT adapte memcpy(&identifier->DeviceIdentifier, &adapter_id.device_identifier, sizeof(identifier->DeviceIdentifier)); identifier->WHQLLevel = adapter_id.whql_level; } + wined3d_mutex_unlock(); return hr; } @@ -636,7 +646,6 @@ static HRESULT WINAPI d3d9_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUI adapter_id.driver_size = 0; adapter_id.description_size = 0; - adapter_id.device_name_size = 0; wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]); if (SUCCEEDED(hr = wined3d_adapter_get_identifier(wined3d_adapter, 0, &adapter_id))) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 050f625f715..db7fc2c9486 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2607,7 +2607,6 @@ static HRESULT WINAPI ddraw7_GetDeviceIdentifier(IDirectDraw7 *iface, adapter_id.driver_size = sizeof(DDDI->szDriver); adapter_id.description = DDDI->szDescription; adapter_id.description_size = sizeof(DDDI->szDescription); - adapter_id.device_name_size = 0; wined3d_mutex_lock(); hr = wined3d_adapter_get_identifier(ddraw->wined3d_adapter, 0x0, &adapter_id); wined3d_mutex_unlock(); diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index b9fe6b1e4b4..4b00c016ed0 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -68,15 +68,13 @@ static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMC while (cont_enum && (wined3d_adapter = wined3d_get_adapter(wined3d, adapter_idx))) { - char DriverName[512] = "", DriverDescription[512] = ""; + char device_name[512] = "", description[512] = ""; /* The Battle.net System Checker expects the GetAdapterIdentifier DeviceName to match the * Driver Name, so obtain the DeviceName and GUID from D3D. */ memset(&adapter_id, 0x0, sizeof(adapter_id)); - adapter_id.device_name = DriverName; - adapter_id.device_name_size = sizeof(DriverName); - adapter_id.description = DriverDescription; - adapter_id.description_size = sizeof(DriverDescription); + adapter_id.description = description; + adapter_id.description_size = sizeof(description); wined3d_mutex_lock(); if (FAILED(hr = wined3d_adapter_get_identifier(wined3d_adapter, 0x0, &adapter_id))) @@ -101,8 +99,10 @@ static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMC TRACE("Interface %u: %s\n", interface_count++, wine_dbgstr_guid(&adapter_id.device_identifier)); + WideCharToMultiByte(CP_ACP, 0, output_desc.device_name, -1, device_name, + sizeof(device_name), NULL, NULL); cont_enum = callback(&adapter_id.device_identifier, adapter_id.description, - adapter_id.device_name, context, output_desc.monitor); + device_name, context, output_desc.monitor); } if (FAILED(hr)) diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index d48d4755d00..ad4e4b13057 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -161,7 +161,6 @@ static HRESULT dxgi_adapter_get_desc(struct dxgi_adapter *adapter, DXGI_ADAPTER_ adapter_id.driver_size = 0; adapter_id.description = description; adapter_id.description_size = sizeof(description); - adapter_id.device_name_size = 0; if (FAILED(hr = wined3d_adapter_get_identifier(adapter->wined3d_adapter, 0, &adapter_id))) return hr; @@ -226,7 +225,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAda adapter_id.driver_size = 0; adapter_id.description_size = 0; - adapter_id.device_name_size = 0; wined3d_mutex_lock(); hr = wined3d_get_device_caps(adapter->wined3d_adapter, WINED3D_DEVICE_TYPE_HAL, &caps); @@ -312,7 +310,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryVideoMemoryInfo(IWineDXGIAdap adapter_id.driver_size = 0; adapter_id.description_size = 0; - adapter_id.device_name_size = 0; if (FAILED(hr = wined3d_adapter_get_identifier(adapter->wined3d_adapter, 0, &adapter_id))) return hr; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index a50f5948544..3dc3043bceb 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1357,17 +1357,6 @@ HRESULT CDECL wined3d_adapter_get_identifier(const struct wined3d_adapter *adapt wined3d_copy_name(identifier->driver, adapter->driver_info.name, identifier->driver_size); wined3d_copy_name(identifier->description, adapter->driver_info.description, identifier->description_size); - /* Note that d3d8 doesn't supply a device name. */ - if (identifier->device_name_size) - { - if (!WideCharToMultiByte(CP_ACP, 0, adapter->device_name, -1, identifier->device_name, - identifier->device_name_size, NULL, NULL)) - { - ERR("Failed to convert device name, last error %#x.\n", GetLastError()); - goto fail; - } - } - identifier->driver_version.u.HighPart = adapter->driver_info.version_high; identifier->driver_version.u.LowPart = adapter->driver_info.version_low; identifier->vendor_id = adapter->driver_info.vendor; @@ -1385,10 +1374,6 @@ HRESULT CDECL wined3d_adapter_get_identifier(const struct wined3d_adapter *adapt wined3d_mutex_unlock(); return WINED3D_OK; - -fail: - wined3d_mutex_unlock(); - return WINED3DERR_INVALIDCALL; } HRESULT CDECL wined3d_output_get_raster_status(const struct wined3d_output *output, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 30b6f9a7e8d..0b3b41896e4 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1742,8 +1742,6 @@ struct wined3d_adapter_identifier unsigned int driver_size; char *description; unsigned int description_size; - char *device_name; - unsigned int device_name_size; LARGE_INTEGER driver_version; DWORD vendor_id; DWORD device_id;