wined3d: Refactor wined3d_get_adapter_raster_status() to wined3d_output_get_raster_status().

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-09 15:40:21 +08:00 committed by Alexandre Julliard
parent 75a5107c96
commit 2e7db80bad
5 changed files with 19 additions and 14 deletions

View File

@ -1824,7 +1824,7 @@ static HRESULT WINAPI ddraw7_GetVerticalBlankStatus(IDirectDraw7 *iface, BOOL *s
return DDERR_INVALIDPARAMS;
wined3d_mutex_lock();
hr = wined3d_get_adapter_raster_status(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &raster_status);
hr = wined3d_output_get_raster_status(ddraw->wined3d_output, &raster_status);
wined3d_mutex_unlock();
if (FAILED(hr))
{
@ -2170,7 +2170,7 @@ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline)
TRACE("iface %p, line %p.\n", iface, Scanline);
wined3d_mutex_lock();
hr = wined3d_get_adapter_raster_status(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &raster_status);
hr = wined3d_output_get_raster_status(ddraw->wined3d_output, &raster_status);
wined3d_mutex_unlock();
if (FAILED(hr))
{

View File

@ -1392,7 +1392,7 @@ fail:
return WINED3DERR_INVALIDCALL;
}
HRESULT CDECL wined3d_get_adapter_raster_status(const struct wined3d *wined3d, UINT adapter_idx,
HRESULT CDECL wined3d_output_get_raster_status(const struct wined3d_output *output,
struct wined3d_raster_status *raster_status)
{
LONGLONG freq_per_frame, freq_per_line;
@ -1401,11 +1401,9 @@ HRESULT CDECL wined3d_get_adapter_raster_status(const struct wined3d *wined3d, U
static UINT once;
if (!once++)
FIXME("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
wined3d, adapter_idx, raster_status);
FIXME("output %p, raster_status %p semi-stub!\n", output, raster_status);
else
WARN("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
wined3d, adapter_idx, raster_status);
WARN("output %p, raster_status %p semi-stub!\n", output, raster_status);
/* Obtaining the raster status is a widely implemented but optional
* feature. When this method returns OK StarCraft 2 expects the
@ -1416,8 +1414,7 @@ HRESULT CDECL wined3d_get_adapter_raster_status(const struct wined3d *wined3d, U
if (!QueryPerformanceCounter(&counter) || !QueryPerformanceFrequency(&freq_per_sec))
return WINED3DERR_INVALIDCALL;
if (FAILED(wined3d_output_get_display_mode(&wined3d->adapters[adapter_idx]->outputs[0], &mode,
NULL)))
if (FAILED(wined3d_output_get_display_mode(output, &mode, NULL)))
return WINED3DERR_INVALIDCALL;
if (mode.refresh_rate == DEFAULT_REFRESH_RATE)
mode.refresh_rate = 60;

View File

@ -307,10 +307,18 @@ struct wined3d_output * wined3d_swapchain_get_output(const struct wined3d_swapch
HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain,
struct wined3d_raster_status *raster_status)
{
struct wined3d_output *output;
TRACE("swapchain %p, raster_status %p.\n", swapchain, raster_status);
return wined3d_get_adapter_raster_status(swapchain->device->wined3d,
swapchain->device->adapter->ordinal, raster_status);
output = wined3d_swapchain_get_output(swapchain);
if (!output)
{
ERR("Failed to get output from swapchain %p.\n", swapchain);
return E_FAIL;
}
return wined3d_output_get_raster_status(output, raster_status);
}
struct wined3d_swapchain_state * CDECL wined3d_swapchain_get_state(struct wined3d_swapchain *swapchain)

View File

@ -12,7 +12,6 @@
@ cdecl wined3d_get_adapter(ptr long)
@ cdecl wined3d_get_adapter_count(ptr)
@ cdecl wined3d_get_adapter_identifier(ptr long long ptr)
@ cdecl wined3d_get_adapter_raster_status(ptr long ptr)
@ cdecl wined3d_get_device_caps(ptr long long ptr)
@ cdecl wined3d_get_output_desc(ptr long ptr)
@ cdecl wined3d_incref(ptr)
@ -161,6 +160,7 @@
@ 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)
@ cdecl wined3d_output_get_raster_status(ptr ptr)
@ cdecl wined3d_output_set_display_mode(ptr ptr)
@ cdecl wined3d_output_release_ownership(ptr)
@ cdecl wined3d_output_take_ownership(ptr long)

View File

@ -2269,8 +2269,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_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx,
DWORD flags, struct wined3d_adapter_identifier *identifier);
HRESULT __cdecl wined3d_get_adapter_raster_status(const struct wined3d *wined3d, UINT adapter_idx,
struct wined3d_raster_status *raster_status);
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,
@ -2505,6 +2503,8 @@ HRESULT __cdecl wined3d_output_get_mode(const struct wined3d_output *output,
unsigned int mode_idx, struct wined3d_display_mode *mode);
unsigned int __cdecl wined3d_output_get_mode_count(const struct wined3d_output *output,
enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering);
HRESULT __cdecl wined3d_output_get_raster_status(const struct wined3d_output *output,
struct wined3d_raster_status *raster_status);
void __cdecl wined3d_output_release_ownership(const struct wined3d_output *output);
HRESULT __cdecl wined3d_output_set_display_mode(struct wined3d_output *output,
const struct wined3d_display_mode *mode);