cogl/texture: Add EGLImage texture import flags

The flags are 'none', and 'no-get-data' meaning get_data() is not
supported.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
This commit is contained in:
Jonas Ådahl
2019-07-16 18:29:29 +02:00
committed by Georges Basile Stavracas Neto
parent e6c8939c30
commit 7868ab761f
8 changed files with 22 additions and 0 deletions

View File

@@ -241,6 +241,7 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
int height,
CoglPixelFormat format,
EGLImageKHR image,
CoglEglImageFlags flags,
GError **error)
{
CoglTextureLoader *loader;
@@ -261,6 +262,7 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
loader->src.egl_image.width = width;
loader->src.egl_image.height = height;
loader->src.egl_image.format = format;
loader->src.egl_image.flags = flags;
tex = _cogl_texture_2d_create_base (ctx, width, height, format, loader);

View File

@@ -60,6 +60,12 @@ G_BEGIN_DECLS
typedef struct _CoglTexture2D CoglTexture2D;
#define COGL_TEXTURE_2D(X) ((CoglTexture2D *)X)
typedef enum _CoglEglImageFlags
{
COGL_EGL_IMAGE_FLAG_NONE = 0,
COGL_EGL_IMAGE_FLAG_NO_GET_DATA = 1 << 0,
} CoglEglImageFlags;
/**
* cogl_texture_2d_get_gtype:
*
@@ -219,6 +225,7 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
int height,
CoglPixelFormat format,
EGLImageKHR image,
CoglEglImageFlags flags,
GError **error);
typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d,

View File

@@ -182,6 +182,7 @@ typedef struct _CoglTextureLoader
int width;
int height;
CoglPixelFormat format;
CoglEglImageFlags flags;
} egl_image;
#endif
#if defined (COGL_HAS_EGL_SUPPORT)

View File

@@ -320,6 +320,8 @@ allocate_from_egl_image (CoglTexture2D *tex_2d,
}
tex_2d->internal_format = internal_format;
tex_2d->is_get_data_supported =
!(loader->src.egl_image.flags & COGL_EGL_IMAGE_FLAG_NO_GET_DATA);
_cogl_texture_set_allocated (tex,
internal_format,

View File

@@ -801,6 +801,7 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap)
tex->height,
texture_format,
egl_tex_pixmap->image,
COGL_EGL_IMAGE_FLAG_NONE,
NULL));
tex_pixmap->winsys = egl_tex_pixmap;