From e6c8939c304d65e1aa7cd90b0efda72d33d5b278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 16 Jul 2019 18:27:38 +0200 Subject: [PATCH] cogl/texture: Make is_get_data_supported() a bool on the texture Comparing the gl target is not enough. More on that later. https://gitlab.gnome.org/GNOME/mutter/merge_requests/687 --- cogl/cogl/cogl-texture-2d-private.h | 1 + cogl/cogl/cogl-texture-2d.c | 1 + cogl/cogl/driver/gl/cogl-texture-2d-gl.c | 6 ++---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cogl/cogl/cogl-texture-2d-private.h b/cogl/cogl/cogl-texture-2d-private.h index 450d156f1..c1e6dff50 100644 --- a/cogl/cogl/cogl-texture-2d-private.h +++ b/cogl/cogl/cogl-texture-2d-private.h @@ -47,6 +47,7 @@ struct _CoglTexture2D gboolean auto_mipmap; gboolean mipmaps_dirty; gboolean is_foreign; + gboolean is_get_data_supported; /* TODO: factor out these OpenGL specific members into some form * of driver private state. */ diff --git a/cogl/cogl/cogl-texture-2d.c b/cogl/cogl/cogl-texture-2d.c index 05cfff42a..c5b44bf97 100644 --- a/cogl/cogl/cogl-texture-2d.c +++ b/cogl/cogl/cogl-texture-2d.c @@ -106,6 +106,7 @@ _cogl_texture_2d_create_base (CoglContext *ctx, tex_2d->mipmaps_dirty = TRUE; tex_2d->auto_mipmap = TRUE; + tex_2d->is_get_data_supported = TRUE; tex_2d->gl_target = GL_TEXTURE_2D; diff --git a/cogl/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/cogl/driver/gl/cogl-texture-2d-gl.c index 57d40f3a3..08f8b263c 100644 --- a/cogl/cogl/driver/gl/cogl-texture-2d-gl.c +++ b/cogl/cogl/driver/gl/cogl-texture-2d-gl.c @@ -508,6 +508,7 @@ allocate_custom_egl_image_external (CoglTexture2D *tex_2d, tex_2d->internal_format = internal_format; tex_2d->gl_target = GL_TEXTURE_EXTERNAL_OES; + tex_2d->is_get_data_supported = FALSE; return TRUE; } @@ -834,10 +835,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d, gboolean _cogl_texture_2d_gl_is_get_data_supported (CoglTexture2D *tex_2d) { - if (tex_2d->gl_target == GL_TEXTURE_EXTERNAL_OES) - return FALSE; - else - return TRUE; + return tex_2d->is_get_data_supported; } void