Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/ddraw/ddraw.c | 4 ++-- dlls/wined3d/directx.c | 11 ++++------- dlls/wined3d/swapchain.c | 12 ++++++++++-- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 4 ++-- 5 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index f947ca8b2b6..17a02bbc05d 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -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)) { diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 9ca3053c89b..f5a94b93aa9 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -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; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index c0eb25ffb66..c5fd2879c05 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -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) diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 51745e24183..c426ffd0b6c 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -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) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 6fc3a1aaa85..d31f1aff490 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2266,8 +2266,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, @@ -2502,6 +2500,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);