mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
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-2d.h"
|
||||
|
||||
#ifdef COGL_HAS_EGL_SUPPORT
|
||||
#include "cogl-egl-defines.h"
|
||||
#endif
|
||||
|
||||
struct _CoglTexture2D
|
||||
{
|
||||
CoglTexture _parent;
|
||||
@ -70,19 +66,6 @@ CoglTexture2D *
|
||||
_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
||||
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 *
|
||||
_cogl_texture_2d_create_base (CoglContext *ctx,
|
||||
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
|
||||
* 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)
|
||||
cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
||||
int width,
|
||||
int height,
|
||||
CoglPixelFormat format,
|
||||
EGLImageKHR image,
|
||||
CoglError **error)
|
||||
{
|
||||
CoglTextureLoader *loader;
|
||||
CoglTexture2D *tex;
|
||||
@ -430,11 +430,11 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
||||
EGL_WAYLAND_BUFFER_WL,
|
||||
buffer,
|
||||
NULL);
|
||||
tex = _cogl_egl_texture_2d_new_from_image (ctx,
|
||||
width, height,
|
||||
internal_format,
|
||||
image,
|
||||
error);
|
||||
tex = cogl_egl_texture_2d_new_from_image (ctx,
|
||||
width, height,
|
||||
internal_format,
|
||||
image,
|
||||
error);
|
||||
_cogl_egl_destroy_image (ctx, image);
|
||||
return tex;
|
||||
}
|
||||
|
@ -40,6 +40,10 @@
|
||||
#include "cogl-context.h"
|
||||
#include "cogl-bitmap.h"
|
||||
|
||||
#ifdef COGL_HAS_EGL_SUPPORT
|
||||
#include "cogl-egl-defines.h"
|
||||
#endif
|
||||
|
||||
COGL_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
@ -227,6 +231,19 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
||||
CoglTexture2D *
|
||||
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
|
||||
|
||||
#endif /* __COGL_TEXTURE_2D_H */
|
||||
|
@ -48,6 +48,7 @@
|
||||
|
||||
#include "cogl-texture-pixmap-x11-private.h"
|
||||
#include "cogl-texture-2d-private.h"
|
||||
#include "cogl-texture-2d.h"
|
||||
#include "cogl-error-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);
|
||||
|
||||
egl_tex_pixmap->texture = COGL_TEXTURE (
|
||||
_cogl_egl_texture_2d_new_from_image (ctx,
|
||||
tex->width,
|
||||
tex->height,
|
||||
texture_format,
|
||||
egl_tex_pixmap->image,
|
||||
NULL));
|
||||
cogl_egl_texture_2d_new_from_image (ctx,
|
||||
tex->width,
|
||||
tex->height,
|
||||
texture_format,
|
||||
egl_tex_pixmap->image,
|
||||
NULL));
|
||||
|
||||
tex_pixmap->winsys = egl_tex_pixmap;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user