summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-27 14:47:52 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-09-27 14:47:52 +0000
commit97d052ef1b821af1d43db65c336a69db6fa532fa (patch)
treefe26d3460fdfc61327ce4f1d7e9b5b225a6955f8
parent895c1681f0b00de574283c0a0ab33b026bb70fc2 (diff)
parent9ca9f42452700b29ccbe40449127018d7077fc7c (diff)
downloadgtk+-97d052ef1b821af1d43db65c336a69db6fa532fa.tar.gz
Merge branch 'avoid-gl-texture-download' into 'master'
gsk: Avoid downloading GL textures when possible See merge request GNOME/gtk!2628
-rw-r--r--gsk/gl/gskgldriver.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index a383344eae..b1f8d6ea0e 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -521,8 +521,15 @@ gsk_gl_driver_get_texture_for_texture (GskGLDriver *self,
if (GDK_IS_GL_TEXTURE (texture))
{
GdkGLContext *texture_context = gdk_gl_texture_get_context ((GdkGLTexture *)texture);
+ GdkGLContext *shared_context = gdk_gl_context_get_shared_context (self->gl_context);
- if (texture_context != self->gl_context)
+ if (texture_context == self->gl_context ||
+ (gdk_gl_context_get_shared_context (texture_context) == shared_context && shared_context != NULL))
+ {
+ /* A GL texture from the same GL context is a simple task... */
+ return gdk_gl_texture_get_id ((GdkGLTexture *)texture);
+ }
+ else
{
cairo_surface_t *surface;
@@ -539,11 +546,6 @@ gsk_gl_driver_get_texture_for_texture (GskGLDriver *self,
source_texture = downloaded_texture;
}
- else
- {
- /* A GL texture from the same GL context is a simple task... */
- return gdk_gl_texture_get_id ((GdkGLTexture *)texture);
- }
}
else
{