Stefan Dösinger : wined3d: Call frag_pipe-> enable_extension under the GL lock.

Alexandre Julliard julliard at winehq.org
Thu May 26 10:56:28 CDT 2011


Module: wine
Branch: master
Commit: dda91ac02ad6b0b6a167f419692268506f27d8d6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dda91ac02ad6b0b6a167f419692268506f27d8d6

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue May 24 23:36:16 2011 +0200

wined3d: Call frag_pipe->enable_extension under the GL lock.

---

 dlls/wined3d/arb_program_shader.c    |    4 +---
 dlls/wined3d/ati_fragment_shader.c   |    4 +---
 dlls/wined3d/context.c               |   22 ++++++++++++++--------
 dlls/wined3d/nvidia_texture_shader.c |    4 +---
 dlls/wined3d/state.c                 |    2 +-
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 55435d4..ee5bf86 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5504,10 +5504,9 @@ struct arbfp_ffp_desc
     unsigned int num_textures_used;
 };
 
-/* Context activation is done by the caller. */
+/* Context activation and GL locking are done by the caller. */
 static void arbfp_enable(BOOL enable)
 {
-    ENTER_GL();
     if(enable) {
         glEnable(GL_FRAGMENT_PROGRAM_ARB);
         checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)");
@@ -5515,7 +5514,6 @@ static void arbfp_enable(BOOL enable)
         glDisable(GL_FRAGMENT_PROGRAM_ARB);
         checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
     }
-    LEAVE_GL();
 }
 
 static HRESULT arbfp_alloc(struct wined3d_device *device)
diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index d04ce20..0281757 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -1054,10 +1054,9 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = {
     {0 /* Terminate */,                                   { 0,                                                  0                       }, WINED3D_GL_EXT_NONE             },
 };
 
-/* Context activation is done by the caller. */
+/* Context activation and GL locking are done by the caller. */
 static void atifs_enable(BOOL enable)
 {
-    ENTER_GL();
     if(enable) {
         glEnable(GL_FRAGMENT_SHADER_ATI);
         checkGLcall("glEnable(GL_FRAGMENT_SHADER_ATI)");
@@ -1065,7 +1064,6 @@ static void atifs_enable(BOOL enable)
         glDisable(GL_FRAGMENT_SHADER_ATI);
         checkGLcall("glDisable(GL_FRAGMENT_SHADER_ATI)");
     }
-    LEAVE_GL();
 }
 
 static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index f5d237e..98f1f7d 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1649,11 +1649,10 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     {
         GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT));
     }
+    device->frag_pipe->enable_extension(TRUE);
 
     LEAVE_GL();
 
-    device->frag_pipe->enable_extension(TRUE);
-
     TRACE("Created context %p.\n", ret);
 
     return ret;
@@ -1913,14 +1912,13 @@ static void SetupForBlit(struct wined3d_device *device, struct wined3d_context *
     Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPING), StateTable);
 
     set_blit_dimension(width, height);
+    device->frag_pipe->enable_extension(FALSE);
 
     LEAVE_GL();
 
     context->blit_w = width; context->blit_h = height;
     Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable);
     Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable);
-
-    device->frag_pipe->enable_extension(FALSE);
 }
 
 /* Do not call while under the GL lock. */
@@ -2208,6 +2206,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
         LEAVE_GL();
     }
 
+    ENTER_GL();
     if (context->last_was_blit)
     {
         device->frag_pipe->enable_extension(TRUE);
@@ -2216,7 +2215,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
     /* Blending and clearing should be orthogonal, but tests on the nvidia
      * driver show that disabling blending when clearing improves the clearing
      * performance incredibly. */
-    ENTER_GL();
     glDisable(GL_BLEND);
     glEnable(GL_SCISSOR_TEST);
     checkGLcall("glEnable GL_SCISSOR_TEST");
@@ -2286,12 +2284,12 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
         LEAVE_GL();
     }
 
+    ENTER_GL();
     if (context->last_was_blit)
     {
         device->frag_pipe->enable_extension(TRUE);
     }
 
-    ENTER_GL();
     for (i = 0; i < context->numDirtyEntries; ++i)
     {
         DWORD rep = context->dirtyArray[i];
@@ -2381,8 +2379,16 @@ struct wined3d_context *context_acquire(struct wined3d_device *device, struct wi
 
     if (context != current_context)
     {
-        if (!context_set_current(context)) ERR("Failed to activate the new context.\n");
-        else device->frag_pipe->enable_extension(!context->last_was_blit);
+        if (!context_set_current(context))
+        {
+            ERR("Failed to activate the new context.\n");
+        }
+        else
+        {
+            ENTER_GL();
+            device->frag_pipe->enable_extension(!context->last_was_blit);
+            LEAVE_GL();
+        }
 
         if (context->vshader_const_dirty)
         {
diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c
index 5d584f0..f20fc7a 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -623,10 +623,9 @@ static void nvrc_texfactor(DWORD state, struct wined3d_stateblock *stateblock, s
 /* Context activation is done by the caller. */
 static void nvrc_enable(BOOL enable) {}
 
-/* Context activation is done by the caller. */
+/* Context activation and GL locking are done by the caller. */
 static void nvts_enable(BOOL enable)
 {
-    ENTER_GL();
     if(enable) {
         glEnable(GL_TEXTURE_SHADER_NV);
         checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
@@ -634,7 +633,6 @@ static void nvts_enable(BOOL enable)
         glDisable(GL_TEXTURE_SHADER_NV);
         checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
     }
-    LEAVE_GL();
 }
 
 static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 6ce6938..a2c197b 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -5578,7 +5578,7 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
     {0 /* Terminate */,                                   { 0,                                                  0                   }, WINED3D_GL_EXT_NONE             },
 };
 
-/* Context activation is done by the caller. */
+/* Context activation and GL locking are done by the caller. */
 static void ffp_enable(BOOL enable) {}
 
 static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)




More information about the wine-cvs mailing list