wined3d: Refactor wined3d_get_output_desc() to wined3d_output_get_desc().

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:
Zhiyi Zhang 2020-03-19 17:07:30 +08:00 committed by Alexandre Julliard
parent 0f901b8e47
commit 5dae33dc3c
7 changed files with 24 additions and 17 deletions

View File

@ -398,12 +398,17 @@ static HMONITOR WINAPI d3d8_GetAdapterMonitor(IDirect3D8 *iface, UINT adapter)
{
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
struct wined3d_output_desc desc;
unsigned int output_idx;
HRESULT hr;
TRACE("iface %p, adapter %u.\n", iface, adapter);
output_idx = adapter;
if (output_idx >= d3d8->wined3d_output_count)
return NULL;
wined3d_mutex_lock();
hr = wined3d_get_output_desc(d3d8->wined3d, adapter, &desc);
hr = wined3d_output_get_desc(d3d8->wined3d_outputs[output_idx], &desc);
wined3d_mutex_unlock();
if (FAILED(hr))

View File

@ -448,12 +448,17 @@ static HMONITOR WINAPI d3d9_GetAdapterMonitor(IDirect3D9Ex *iface, UINT adapter)
{
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
struct wined3d_output_desc desc;
unsigned int output_idx;
HRESULT hr;
TRACE("iface %p, adapter %u.\n", iface, adapter);
output_idx = adapter;
if (output_idx >= d3d9->wined3d_output_count)
return NULL;
wined3d_mutex_lock();
hr = wined3d_get_output_desc(d3d9->wined3d, adapter, &desc);
hr = wined3d_output_get_desc(d3d9->wined3d_outputs[output_idx], &desc);
wined3d_mutex_unlock();
if (FAILED(hr))

View File

@ -59,6 +59,7 @@ static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMC
struct wined3d_adapter_identifier adapter_id;
struct wined3d_adapter *wined3d_adapter;
struct wined3d_output_desc output_desc;
struct wined3d_output *wined3d_output;
unsigned int interface_count = 0;
unsigned int adapter_idx = 0;
unsigned int output_idx;
@ -86,11 +87,11 @@ static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMC
}
wined3d_mutex_unlock();
for (output_idx = 0; cont_enum && wined3d_adapter_get_output(wined3d_adapter, output_idx);
++output_idx)
for (output_idx = 0; cont_enum && (wined3d_output = wined3d_adapter_get_output(
wined3d_adapter, output_idx)); ++output_idx)
{
wined3d_mutex_lock();
if (FAILED(hr = wined3d_get_output_desc(wined3d, output_idx, &output_desc)))
if (FAILED(hr = wined3d_output_get_desc(wined3d_output, &output_desc)))
{
WARN("Failed to get output description, hr %#x.\n", hr);
wined3d_mutex_unlock();

View File

@ -289,8 +289,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput4 *iface, DXGI_O
return E_INVALIDARG;
wined3d_mutex_lock();
hr = wined3d_get_output_desc(output->adapter->factory->wined3d,
output->adapter->ordinal, &wined3d_desc);
hr = wined3d_output_get_desc(output->wined3d_output, &wined3d_desc);
wined3d_mutex_unlock();
if (FAILED(hr))

View File

@ -915,7 +915,7 @@ HRESULT CDECL wined3d_register_software_device(struct wined3d *wined3d, void *in
return WINED3D_OK;
}
HRESULT CDECL wined3d_get_output_desc(const struct wined3d *wined3d, unsigned int adapter_idx,
HRESULT CDECL wined3d_output_get_desc(const struct wined3d_output *output,
struct wined3d_output_desc *desc)
{
enum wined3d_display_rotation rotation;
@ -924,16 +924,13 @@ HRESULT CDECL wined3d_get_output_desc(const struct wined3d *wined3d, unsigned in
HMONITOR monitor;
HRESULT hr;
TRACE("wined3d %p, adapter_idx %u, desc %p.\n", wined3d, adapter_idx, desc);
TRACE("output %p, desc %p.\n", output, desc);
if (adapter_idx >= wined3d->adapter_count)
return WINED3DERR_INVALIDCALL;
adapter = wined3d->adapters[adapter_idx];
adapter = output->adapter;
if (!(monitor = MonitorFromPoint(adapter->monitor_position, MONITOR_DEFAULTTOPRIMARY)))
return WINED3DERR_INVALIDCALL;
if (FAILED(hr = wined3d_output_get_display_mode(&adapter->outputs[0], &mode, &rotation)))
if (FAILED(hr = wined3d_output_get_display_mode(output, &mode, &rotation)))
return hr;
memcpy(desc->device_name, adapter->device_name, sizeof(desc->device_name));

View File

@ -12,7 +12,6 @@
@ cdecl wined3d_get_adapter(ptr long)
@ cdecl wined3d_get_adapter_count(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)
@ cdecl wined3d_register_window(ptr ptr ptr long)
@ -158,6 +157,7 @@
@ cdecl wined3d_output_find_closest_matching_mode(ptr ptr)
@ cdecl wined3d_output_get_adapter(ptr)
@ cdecl wined3d_output_get_desc(ptr ptr)
@ cdecl wined3d_output_get_display_mode(ptr ptr ptr)
@ cdecl wined3d_output_get_mode(ptr long long long ptr)
@ cdecl wined3d_output_get_mode_count(ptr long long)

View File

@ -2281,8 +2281,6 @@ struct wined3d_adapter * __cdecl wined3d_get_adapter(const struct wined3d *wined
UINT __cdecl wined3d_get_adapter_count(const struct wined3d *wined3d);
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);
ULONG __cdecl wined3d_incref(struct wined3d *wined3d);
HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *init_function);
BOOL __cdecl wined3d_register_window(struct wined3d *wined3d, HWND window,
@ -2509,6 +2507,8 @@ HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *devi
HRESULT __cdecl wined3d_output_find_closest_matching_mode(const struct wined3d_output *output,
struct wined3d_display_mode *mode);
struct wined3d_adapter * __cdecl wined3d_output_get_adapter(const struct wined3d_output *output);
HRESULT __cdecl wined3d_output_get_desc(const struct wined3d_output *output,
struct wined3d_output_desc *desc);
HRESULT __cdecl wined3d_output_get_display_mode(const struct wined3d_output *output,
struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation);
HRESULT __cdecl wined3d_output_get_mode(const struct wined3d_output *output,