[PATCH 2/5] wined3d: Do not call device_switch_onscreen_ds() while under the GL lock.

Henri Verbeet hverbeet at codeweavers.com
Sun Sep 5 16:38:48 CDT 2010


---
 dlls/wined3d/arb_program_shader.c |    1 +
 dlls/wined3d/device.c             |    9 +++++++++
 dlls/wined3d/surface.c            |    4 ++++
 dlls/wined3d/wined3d_private.h    |    3 ++-
 4 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 7901f0f..3ca5004 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7170,6 +7170,7 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_
     return WINED3D_OK;
 }
 
+/* Do not call while under the GL lock. */
 static HRESULT arbfp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
         const RECT *dst_rect, const WINED3DCOLORVALUE *color)
 {
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5116961..6cd07bb 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -576,6 +576,7 @@ void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect)
     }
 }
 
+/* Do not call while under the GL lock. */
 void device_switch_onscreen_ds(IWineD3DDeviceImpl *device,
         struct wined3d_context *context, IWineD3DSurfaceImpl *depth_stencil)
 {
@@ -653,6 +654,7 @@ static void prepare_ds_clear(IWineD3DSurfaceImpl *ds, struct wined3d_context *co
     surface_modify_ds_location(ds, location, ds->ds_current_size.cx, ds->ds_current_size.cy);
 }
 
+/* Do not call while under the GL lock. */
 HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, IWineD3DSurfaceImpl **rts,
         UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags,
         const WINED3DCOLORVALUE *color, float depth, DWORD stencil)
@@ -715,7 +717,11 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I
         DWORD location = context->render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN;
 
         if (location == SFLAG_DS_ONSCREEN && depth_stencil != device->onscreen_depth_stencil)
+        {
+            LEAVE_GL();
             device_switch_onscreen_ds(device, context, depth_stencil);
+            ENTER_GL();
+        }
         prepare_ds_clear(depth_stencil, context, location, draw_rect, rect_count, clear_rect);
         surface_modify_location(depth_stencil, SFLAG_INDRAWABLE, TRUE);
 
@@ -4574,6 +4580,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface,
     return WINED3D_OK;
 }
 
+/* Do not call while under the GL lock. */
 static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD rect_count,
         const RECT *rects, DWORD flags, WINED3DCOLOR color, float depth, DWORD stencil)
 {
@@ -5493,6 +5500,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT
     return WINED3DERR_INVALIDCALL;
 }
 
+/* Do not call while under the GL lock. */
 static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface,
         IWineD3DSurface *surface, const RECT *rect, const WINED3DCOLORVALUE *color)
 {
@@ -5511,6 +5519,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface,
     return surface_color_fill(s, rect, color);
 }
 
+/* Do not call while under the GL lock. */
 static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *iface,
         IWineD3DRendertargetView *rendertarget_view, const WINED3DCOLORVALUE *color)
 {
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index fe26fd5..8f39a97 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3356,6 +3356,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT
     context_release(context);
 }
 
+/* Do not call while under the GL lock. */
 HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color)
 {
     IWineD3DDeviceImpl *device = s->resource.device;
@@ -3373,6 +3374,7 @@ HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED
 }
 
 /* Not called from the VTable */
+/* Do not call while under the GL lock. */
 static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, const RECT *DestRect,
         IWineD3DSurfaceImpl *src_surface, const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx,
         WINED3DTEXTUREFILTERTYPE Filter)
@@ -4873,6 +4875,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
     return FALSE;
 }
 
+/* Do not call while under the GL lock. */
 static HRESULT ffp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
         const RECT *dst_rect, const WINED3DCOLORVALUE *color)
 {
@@ -4924,6 +4927,7 @@ static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
     return FALSE;
 }
 
+/* Do not call while under the GL lock. */
 static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
         const RECT *dst_rect, const WINED3DCOLORVALUE *color)
 {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 691b8cc..2963933 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1133,7 +1133,8 @@ enum blit_operation
     BLIT_OP_COLOR_FILL
 };
 
-/* Shaders for color conversions in blits */
+/* Shaders for color conversions in blits. Do not do blit operations while
+ * already under the GL lock. */
 struct blit_shader
 {
     HRESULT (*alloc_private)(IWineD3DDevice *iface);
-- 
1.7.1




More information about the wine-patches mailing list