Akihiro Sagawa : wined3d: Let GetRasterStatus return D3D_OK, again.
Alexandre Julliard
julliard at winehq.org
Thu Jan 19 14:56:52 CST 2012
Module: wine
Branch: master
Commit: bd97589dbac60d1ed78ed1e49cf6ce6cee8c40b7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bd97589dbac60d1ed78ed1e49cf6ce6cee8c40b7
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Wed Jan 18 23:33:53 2012 +0900
wined3d: Let GetRasterStatus return D3D_OK, again.
---
dlls/wined3d/swapchain.c | 37 ++++++++++++++++++++++++++++++++-----
1 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index de31fd3..3e3451d 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -206,19 +206,46 @@ HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain
struct wined3d_raster_status *raster_status)
{
static BOOL warned;
+ LARGE_INTEGER counter, freq_per_sec;
+ LONGLONG freq_per_frame, freq_per_line;
+ struct wined3d_display_mode mode;
+
/* No OpenGL equivalent */
if (!warned)
{
- FIXME("swapchain %p, raster_status %p stub!\n", swapchain, raster_status);
+ FIXME("swapchain %p, raster_status %p semi-stub!\n", swapchain, raster_status);
warned = TRUE;
}
/* Obtaining the raster status is a widely implemented but optional
* feature. When this method returns OK StarCraft 2 expects the
- * raster_status->InVBlank value to actually change over time. To prevent
- * StarCraft 2 from running in an infinite loop at startup this method
- * returns INVALIDCALL. */
- return WINED3DERR_INVALIDCALL;
+ * raster_status->InVBlank value to actually change over time.
+ * And Endless Alice Crysis doesn't care even if this method fails.
+ * Thus this method returns OK and fakes raster_status by
+ * QueryPerformanceCounter. */
+
+ if (!QueryPerformanceCounter(&counter) || !QueryPerformanceFrequency(&freq_per_sec))
+ return WINED3DERR_INVALIDCALL;
+
+ if (FAILED(wined3d_swapchain_get_display_mode(swapchain, &mode)))
+ return WINED3DERR_INVALIDCALL;
+ if (mode.refresh_rate == DEFAULT_REFRESH_RATE)
+ mode.refresh_rate = 60;
+
+ freq_per_frame = freq_per_sec.QuadPart / mode.refresh_rate;
+ /* Assume 20 scan lines in the vertical blank */
+ freq_per_line = freq_per_frame / (mode.height + 20);
+ raster_status->scan_line = (counter.QuadPart % freq_per_frame) / freq_per_line;
+ if (raster_status->scan_line < mode.height)
+ raster_status->in_vblank = FALSE;
+ else
+ {
+ raster_status->scan_line = 0;
+ raster_status->in_vblank = TRUE;
+ }
+ TRACE("Returning fake value, in_vblank %u, scan_line %u.\n",
+ raster_status->in_vblank, raster_status->scan_line);
+ return WINED3D_OK;
}
HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain,
More information about the wine-cvs
mailing list