Ken Thomases : wined3d: Use a separate flag to track if the GL context needs to be made current.

Alexandre Julliard julliard at winehq.org
Sat Feb 22 09:50:04 CST 2014


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Feb 19 16:14:04 2014 -0600

wined3d: Use a separate flag to track if the GL context needs to be made current.

The new needs_set flag can be cleared after it's been heeded whereas restore_ctx
must not be cleared until the context has been released back to level 0.

---

 dlls/wined3d/context.c         |    5 ++++-
 dlls/wined3d/wined3d_private.h |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 7d63ca3..9670d6e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -817,6 +817,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx)
 
         ctx->valid = 1;
     }
+    ctx->needs_set = 0;
     return TRUE;
 }
 
@@ -1080,6 +1081,7 @@ static void context_enter(struct wined3d_context *context)
             context->restore_ctx = current_gl;
             context->restore_dc = wglGetCurrentDC();
             context->restore_pf = GetPixelFormat(context->restore_dc);
+            context->needs_set = 1;
         }
     }
 }
@@ -1476,6 +1478,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     ret->win_handle = swapchain->win_handle;
     ret->hdc = hdc;
     ret->pixel_format = pixel_format;
+    ret->needs_set = 1;
 
     /* Set up the context defaults */
     if (!context_set_current(ret))
@@ -3003,7 +3006,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str
         if (!context_set_current(context))
             ERR("Failed to activate the new context.\n");
     }
-    else if (context->restore_ctx)
+    else if (context->needs_set)
     {
         context_set_gl_context(context);
     }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9446bb8..29a76e2 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1085,7 +1085,8 @@ struct wined3d_context
     DWORD fixed_function_usage_map : 8; /* MAX_TEXTURES, 8 */
     DWORD lowest_disabled_stage : 4;    /* Max MAX_TEXTURES, 8 */
     DWORD rebind_fbo : 1;
-    DWORD padding : 19;
+    DWORD needs_set : 1;
+    DWORD padding : 18;
     DWORD shader_update_mask;
     DWORD constant_update_mask;
     DWORD                   numbered_array_mask;




More information about the wine-cvs mailing list