From f3ac0535f8d520c32efed587dfb006f23ea3ee34 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 20 Aug 2024 01:03:32 +0200 Subject: [PATCH] gl: Use the shared GL context when creating GL textures the non-shared context's surface must survive the lifetime of the GL texture, and when the renderer gets unrealized the surface goes away, but we cannot guarantee that all GL textures have been destroyed by then. So better use a context we know will survive becuase it isn't bound to a surface. --- gsk/gl/gskgldriver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c index b927f98244..9dd5383811 100644 --- a/gsk/gl/gskgldriver.c +++ b/gsk/gl/gskgldriver.c @@ -1842,14 +1842,14 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self, state = g_new0 (GskGLTextureState, 1); state->texture_id = texture_id; - state->context = g_object_ref (self->command_queue->context); - if (gdk_gl_context_has_feature (self->command_queue->context, GDK_GL_FEATURE_SYNC)) + state->context = g_object_ref (self->shared_command_queue->context); + if (gdk_gl_context_has_feature (self->shared_command_queue->context, GDK_GL_FEATURE_SYNC)) state->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0); g_hash_table_steal (self->textures, GUINT_TO_POINTER (texture_id)); builder = gdk_gl_texture_builder_new (); - gdk_gl_texture_builder_set_context (builder, self->command_queue->context); + gdk_gl_texture_builder_set_context (builder, self->shared_command_queue->context); gdk_gl_texture_builder_set_id (builder, texture_id); gdk_gl_texture_builder_set_format (builder, format); gdk_gl_texture_builder_set_width (builder, texture->width);