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

wined3d: Remove device_name and device_name_size from struct wined3d_adapter_identifier.

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