From 6abbf0a97d9e72b5f599f48c5a591a0d2917eee6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 26 Sep 2013 16:40:34 +0200
Subject: wined3d: Wait for the CS in GetDC.

---
 dlls/wined3d/surface.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index bef62bb..3653626 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2548,6 +2548,20 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
 
     TRACE("surface %p, dc %p.\n", surface, dc);
 
+    if (!(surface->container->resource.format_flags & WINED3DFMT_FLAG_GETDC))
+    {
+        WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
+        return WINED3DERR_INVALIDCALL;
+    }
+
+    if (wined3d_settings.cs_multithreaded)
+    {
+        struct wined3d_device *device = surface->resource.device;
+        FIXME("Waiting for cs.\n");
+        wined3d_cs_emit_glfinish(device->cs);
+        device->cs->ops->finish(device->cs);
+    }
+
     /* Give more detailed info for ddraw. */
     if (surface->flags & SFLAG_DCINUSE)
         return WINEDDERR_DCALREADYCREATED;
-- 
2.5.1

