[PATCH v2 3/5] wined3d: Don't use fences on GL context cleanup when they are not supported.
Matteo Bruni
mbruni at codeweavers.com
Wed Apr 27 06:21:55 CDT 2022
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
v2: Also handle the fence usage in
wined3d_device_gl_delete_opengl_contexts_cs().
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);
--
2.34.1
More information about the wine-devel
mailing list