mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
gltexture: Restore previous GL context
Texture downloads can be initiated due to the weirdest reasons - and if they cause a GL context to be changed, it'd be basically unpredictable when the GL context changes. An example is the Cairo renderer - if it needs to draw a GL texture, it will download it. Now that no longer changes the GL context.
This commit is contained in:
parent
d3f9b3e28a
commit
8aaecc3416
@ -95,10 +95,11 @@ static gboolean
|
||||
gdk_gl_texture_invoke_callback (gpointer data)
|
||||
{
|
||||
InvokeData *invoke = data;
|
||||
GdkGLContext *context;
|
||||
GdkGLContext *context, *previous;
|
||||
|
||||
context = gdk_display_get_gl_context (gdk_gl_context_get_display (invoke->self->context));
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
if (invoke->self->sync && context != invoke->self->context)
|
||||
@ -110,6 +111,11 @@ gdk_gl_texture_invoke_callback (gpointer data)
|
||||
|
||||
g_atomic_int_set (&invoke->spinlock, 1);
|
||||
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
else
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user