Module: wine
Branch: master
Commit: ab72e336411a17e0108eb0fbc927e2c1ffb98978
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ab72e336411a17e0108eb0fb…
Author: Matteo Bruni <mbruni(a)codeweavers.com>
Date: Wed Apr 27 13:21:55 2022 +0200
wined3d: Don't use fences on GL context cleanup when they are not supported.
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/wined3d/context_gl.c | 9 ++++++---
dlls/wined3d/device.c | 9 ++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index bb4157c0501..0a731dc85f0 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -1393,13 +1393,16 @@ static void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
{
/* 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.) */
+ * is problematic. In particular, we'd end up back here again in the
+ * process of switching to the newly acquired context.
+ *
+ * If fences aren't supported there should be nothing to wait for
+ * anyway, so just do nothing in that case. */
if (context_gl->c.destroyed)
{
gl_info->gl_ops.gl.p_glFinish();
}
- else
+ else if (context_gl->c.d3d_info->fences)
{
wined3d_context_gl_submit_command_fence(context_gl);
wined3d_context_gl_wait_command_fence(context_gl,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d14b40d8e3e..8937c7fc0fc 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1201,9 +1201,12 @@ void wined3d_device_gl_delete_opengl_contexts_cs(void *object)
device->shader_backend->shader_free_private(device, context);
wined3d_device_gl_destroy_dummy_textures(device_gl, context_gl);
- 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->c.d3d_info->fences)
+ {
+ 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);
+ }
wined3d_allocator_cleanup(&device_gl->allocator);
context_release(context);