[mutter] cogl/texture: Make is_get_data_supported() a bool on the texture



commit e6c8939c304d65e1aa7cd90b0efda72d33d5b278
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Jul 16 18:27:38 2019 +0200

    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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]