2009-11-27 18:45:36 +00:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* A Low Level GPU Graphics and Utilities API
|
2009-11-27 18:45:36 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Intel Corporation.
|
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person
|
|
|
|
* obtaining a copy of this software and associated documentation
|
|
|
|
* files (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use, copy,
|
|
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
|
|
* of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2009-11-27 18:45:36 +00:00
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
2009-11-27 18:45:36 +00:00
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2010-03-01 12:56:10 +00:00
|
|
|
*
|
|
|
|
*
|
2009-11-27 18:45:36 +00:00
|
|
|
*/
|
|
|
|
|
2012-07-31 14:12:01 +00:00
|
|
|
#ifndef __COGL_TEXTURE_2D_PRIVATE_H
|
|
|
|
#define __COGL_TEXTURE_2D_PRIVATE_H
|
2009-11-27 18:45:36 +00:00
|
|
|
|
2012-04-16 13:14:10 +00:00
|
|
|
#include "cogl-object-private.h"
|
2010-10-27 17:54:57 +00:00
|
|
|
#include "cogl-pipeline-private.h"
|
2009-11-27 18:45:36 +00:00
|
|
|
#include "cogl-texture-private.h"
|
2012-02-18 01:19:17 +00:00
|
|
|
#include "cogl-texture-2d.h"
|
2009-11-27 18:45:36 +00:00
|
|
|
|
2012-07-31 14:00:12 +00:00
|
|
|
#ifdef COGL_HAS_EGL_SUPPORT
|
|
|
|
#include "cogl-egl-defines.h"
|
|
|
|
#endif
|
|
|
|
|
2009-11-27 18:45:36 +00:00
|
|
|
struct _CoglTexture2D
|
|
|
|
{
|
2012-09-10 19:35:39 +00:00
|
|
|
CoglTexture _parent;
|
2009-11-27 18:45:36 +00:00
|
|
|
|
|
|
|
/* The internal format of the GL texture represented as a
|
|
|
|
CoglPixelFormat */
|
2012-11-22 23:01:08 +00:00
|
|
|
CoglPixelFormat internal_format;
|
2012-09-10 19:35:39 +00:00
|
|
|
|
|
|
|
CoglBool auto_mipmap;
|
|
|
|
CoglBool mipmaps_dirty;
|
|
|
|
CoglBool is_foreign;
|
|
|
|
|
|
|
|
/* TODO: factor out these OpenGL specific members into some form
|
|
|
|
* of driver private state. */
|
|
|
|
|
2009-11-27 18:45:36 +00:00
|
|
|
/* The internal format of the GL texture represented as a GL enum */
|
2012-11-09 17:55:54 +00:00
|
|
|
GLenum gl_internal_format;
|
2009-11-27 18:45:36 +00:00
|
|
|
/* The texture object number */
|
2012-09-10 19:35:39 +00:00
|
|
|
GLuint gl_texture;
|
|
|
|
GLenum gl_legacy_texobj_min_filter;
|
|
|
|
GLenum gl_legacy_texobj_mag_filter;
|
|
|
|
GLint gl_legacy_texobj_wrap_mode_s;
|
|
|
|
GLint gl_legacy_texobj_wrap_mode_t;
|
2010-07-13 17:41:01 +00:00
|
|
|
CoglTexturePixel first_pixel;
|
2009-11-27 18:45:36 +00:00
|
|
|
};
|
|
|
|
|
2013-06-07 23:28:14 +00:00
|
|
|
CoglTexture2D *
|
|
|
|
_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
2013-07-02 00:48:54 +00:00
|
|
|
CoglBool can_convert_in_place);
|
2013-06-07 23:28:14 +00:00
|
|
|
|
2011-05-24 21:34:10 +00:00
|
|
|
#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,
|
2012-08-31 18:28:27 +00:00
|
|
|
CoglError **error);
|
2011-05-24 21:34:10 +00:00
|
|
|
#endif
|
|
|
|
|
2012-09-10 20:45:33 +00:00
|
|
|
CoglTexture2D *
|
|
|
|
_cogl_texture_2d_create_base (CoglContext *ctx,
|
|
|
|
int width,
|
|
|
|
int height,
|
2013-06-23 15:18:18 +00:00
|
|
|
CoglPixelFormat internal_format,
|
|
|
|
CoglTextureLoader *loader);
|
2012-09-10 20:45:33 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_texture_2d_set_auto_mipmap (CoglTexture *tex,
|
|
|
|
CoglBool value);
|
|
|
|
|
2010-06-03 14:06:47 +00:00
|
|
|
/*
|
|
|
|
* _cogl_texture_2d_externally_modified:
|
2012-04-16 13:14:10 +00:00
|
|
|
* @texture: A #CoglTexture2D object
|
2010-06-03 14:06:47 +00:00
|
|
|
*
|
|
|
|
* This should be called whenever the texture is modified other than
|
|
|
|
* by using cogl_texture_set_region. It will cause the mipmaps to be
|
|
|
|
* invalidated
|
|
|
|
*/
|
|
|
|
void
|
2012-04-16 13:14:10 +00:00
|
|
|
_cogl_texture_2d_externally_modified (CoglTexture *texture);
|
2010-06-03 14:06:47 +00:00
|
|
|
|
2011-02-10 18:22:27 +00:00
|
|
|
/*
|
|
|
|
* _cogl_texture_2d_copy_from_framebuffer:
|
2012-04-16 13:14:10 +00:00
|
|
|
* @texture: A #CoglTexture2D pointer
|
2011-02-10 18:22:27 +00:00
|
|
|
* @src_x: X-position to within the framebuffer to read from
|
|
|
|
* @src_y: Y-position to within the framebuffer to read from
|
|
|
|
* @width: width of the rectangle to copy
|
|
|
|
* @height: height of the rectangle to copy
|
2012-11-09 17:55:54 +00:00
|
|
|
* @src_fb: A source #CoglFramebuffer to copy from
|
|
|
|
* @dst_x: X-position to store the image within the texture
|
|
|
|
* @dst_y: Y-position to store the image within the texture
|
|
|
|
* @level: The mipmap level of @texture to copy too
|
2011-02-10 18:22:27 +00:00
|
|
|
*
|
2012-11-08 23:35:45 +00:00
|
|
|
* This copies a portion of the given @src_fb into the
|
2011-02-10 18:22:27 +00:00
|
|
|
* texture.
|
|
|
|
*/
|
|
|
|
void
|
2012-04-16 13:14:10 +00:00
|
|
|
_cogl_texture_2d_copy_from_framebuffer (CoglTexture2D *texture,
|
2011-02-10 18:22:27 +00:00
|
|
|
int src_x,
|
|
|
|
int src_y,
|
|
|
|
int width,
|
2012-11-09 17:55:54 +00:00
|
|
|
int height,
|
|
|
|
CoglFramebuffer *src_fb,
|
|
|
|
int dst_x,
|
|
|
|
int dst_y,
|
|
|
|
int level);
|
2011-02-10 18:22:27 +00:00
|
|
|
|
2012-07-31 14:12:01 +00:00
|
|
|
#endif /* __COGL_TEXTURE_2D_PRIVATE_H */
|