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

Henri Verbeet hverbeet at codeweavers.com
Tue Jan 12 11:27:57 CST 2021


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50485
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 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));
-- 
2.20.1




More information about the wine-devel mailing list