cogl: Expose API for creating texture from EGLImage
Later to be used by mutter to create EGLImage's from Wayland buffers. https://bugzilla.gnome.org/show_bug.cgi?id=773629
This commit is contained in:
parent
18b9cf8a85
commit
ecc1f56009
@ -36,10 +36,6 @@
|
|||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-texture-2d.h"
|
#include "cogl-texture-2d.h"
|
||||||
|
|
||||||
#ifdef COGL_HAS_EGL_SUPPORT
|
|
||||||
#include "cogl-egl-defines.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct _CoglTexture2D
|
struct _CoglTexture2D
|
||||||
{
|
{
|
||||||
CoglTexture _parent;
|
CoglTexture _parent;
|
||||||
@ -70,19 +66,6 @@ CoglTexture2D *
|
|||||||
_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
||||||
CoglBool can_convert_in_place);
|
CoglBool can_convert_in_place);
|
||||||
|
|
||||||
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
|
|
||||||
/* NB: The reason we require the width, height and format to be passed
|
|
||||||
* even though they may seem redundant is because GLES 1/2 don't
|
|
||||||
* provide a way to query these properties. */
|
|
||||||
CoglTexture2D *
|
|
||||||
_cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
CoglPixelFormat format,
|
|
||||||
EGLImageKHR image,
|
|
||||||
CoglError **error);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
_cogl_texture_2d_create_base (CoglContext *ctx,
|
_cogl_texture_2d_create_base (CoglContext *ctx,
|
||||||
int width,
|
int width,
|
||||||
|
@ -236,12 +236,12 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
* even though they may seem redundant is because GLES 1/2 don't
|
* even though they may seem redundant is because GLES 1/2 don't
|
||||||
* provide a way to query these properties. */
|
* provide a way to query these properties. */
|
||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
_cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
EGLImageKHR image,
|
EGLImageKHR image,
|
||||||
CoglError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglTextureLoader *loader;
|
CoglTextureLoader *loader;
|
||||||
CoglTexture2D *tex;
|
CoglTexture2D *tex;
|
||||||
@ -430,11 +430,11 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
|||||||
EGL_WAYLAND_BUFFER_WL,
|
EGL_WAYLAND_BUFFER_WL,
|
||||||
buffer,
|
buffer,
|
||||||
NULL);
|
NULL);
|
||||||
tex = _cogl_egl_texture_2d_new_from_image (ctx,
|
tex = cogl_egl_texture_2d_new_from_image (ctx,
|
||||||
width, height,
|
width, height,
|
||||||
internal_format,
|
internal_format,
|
||||||
image,
|
image,
|
||||||
error);
|
error);
|
||||||
_cogl_egl_destroy_image (ctx, image);
|
_cogl_egl_destroy_image (ctx, image);
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,10 @@
|
|||||||
#include "cogl-context.h"
|
#include "cogl-context.h"
|
||||||
#include "cogl-bitmap.h"
|
#include "cogl-bitmap.h"
|
||||||
|
|
||||||
|
#ifdef COGL_HAS_EGL_SUPPORT
|
||||||
|
#include "cogl-egl-defines.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
COGL_BEGIN_DECLS
|
COGL_BEGIN_DECLS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,6 +231,19 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap);
|
cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap);
|
||||||
|
|
||||||
|
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
|
||||||
|
/* NB: The reason we require the width, height and format to be passed
|
||||||
|
* even though they may seem redundant is because GLES 1/2 don't
|
||||||
|
* provide a way to query these properties. */
|
||||||
|
CoglTexture2D *
|
||||||
|
cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
CoglPixelFormat format,
|
||||||
|
EGLImageKHR image,
|
||||||
|
CoglError **error);
|
||||||
|
#endif
|
||||||
|
|
||||||
COGL_END_DECLS
|
COGL_END_DECLS
|
||||||
|
|
||||||
#endif /* __COGL_TEXTURE_2D_H */
|
#endif /* __COGL_TEXTURE_2D_H */
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
#include "cogl-texture-pixmap-x11-private.h"
|
#include "cogl-texture-pixmap-x11-private.h"
|
||||||
#include "cogl-texture-2d-private.h"
|
#include "cogl-texture-2d-private.h"
|
||||||
|
#include "cogl-texture-2d.h"
|
||||||
#include "cogl-error-private.h"
|
#include "cogl-error-private.h"
|
||||||
#include "cogl-poll-private.h"
|
#include "cogl-poll-private.h"
|
||||||
|
|
||||||
@ -741,12 +742,12 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
COGL_PIXEL_FORMAT_RGB_888);
|
COGL_PIXEL_FORMAT_RGB_888);
|
||||||
|
|
||||||
egl_tex_pixmap->texture = COGL_TEXTURE (
|
egl_tex_pixmap->texture = COGL_TEXTURE (
|
||||||
_cogl_egl_texture_2d_new_from_image (ctx,
|
cogl_egl_texture_2d_new_from_image (ctx,
|
||||||
tex->width,
|
tex->width,
|
||||||
tex->height,
|
tex->height,
|
||||||
texture_format,
|
texture_format,
|
||||||
egl_tex_pixmap->image,
|
egl_tex_pixmap->image,
|
||||||
NULL));
|
NULL));
|
||||||
|
|
||||||
tex_pixmap->winsys = egl_tex_pixmap;
|
tex_pixmap->winsys = egl_tex_pixmap;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user