Henri Verbeet : wined3d: Use glFinish() for synchronisation when cleaning up a destroyed context in wined3d_context_gl_cleanup().

Alexandre Julliard julliard at winehq.org
Mon Jun 7 15:02:04 CDT 2021


Module: wine
Branch: stable
Commit: dbfed2e2f67453160e37874d74eccfddb519c474
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=dbfed2e2f67453160e37874d74eccfddb519c474

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Jan 12 21:15:57 2021 +0330

wined3d: Use glFinish() for synchronisation when cleaning up a destroyed context in wined3d_context_gl_cleanup().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50485
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 3cc8147594de868884d3e57babff8eef058c63a3)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/wined3d/context_gl.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index 467f5b64d6c..a51e5ec9095 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -1374,9 +1374,20 @@ static void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
 
     if (context_gl->valid)
     {
-        wined3d_context_gl_submit_command_fence(context_gl);
-        wined3d_context_gl_wait_command_fence(context_gl,
-                wined3d_device_gl(context_gl->c.device)->current_fence_id - 1);
+        /* If we're here because we're switching away from a previously
+         * destroyed context, acquiring a context in order to submit a fence
+         * is problematic. (In particular, we'd end up back here again in the
+         * process of switching to the newly acquired context.) */
+        if (context_gl->c.destroyed)
+        {
+            gl_info->gl_ops.gl.p_glFinish();
+        }
+        else
+        {
+            wined3d_context_gl_submit_command_fence(context_gl);
+            wined3d_context_gl_wait_command_fence(context_gl,
+                    wined3d_device_gl(context_gl->c.device)->current_fence_id - 1);
+        }
 
         if (context_gl->dummy_arbfp_prog)
             GL_EXTCALL(glDeleteProgramsARB(1, &context_gl->dummy_arbfp_prog));




More information about the wine-cvs mailing list