wined3d: Add device->isInDraw checks in LoadLocation.
authorAlexander Dorofeyev <alexd4@inbox.lv>
Sun, 6 Apr 2008 21:06:25 +0000 (00:06 +0300)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 7 Apr 2008 19:18:36 +0000 (21:18 +0200)
Prevents calling ActivateContext while holding gl lock, e.g. when preloading
texture in sampler().

dlls/wined3d/surface.c

index 8190a15c2054f462d90a7108c63f5e98ac043ea1..97f0438129d285a456e69bc690160778cf884374 100644 (file)
@@ -4043,7 +4043,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
 
         /* Download the surface to system memory */
         if(This->Flags & SFLAG_INTEXTURE) {
-            ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+            if(!device->isInDraw) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
             surface_bind_and_dirtify(This);
 
             surface_download_data(This);
@@ -4101,7 +4101,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
         } else { /* Upload from system memory */
             d3dfmt_get_conv(This, TRUE /* We need color keying */, TRUE /* We will use textures */, &format, &internal, &type, &convert, &bpp, This->srgb);
 
-            ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+            if(!device->isInDraw) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
             surface_bind_and_dirtify(This);
             ENTER_GL();