4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2009 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 * Neil Roberts <neil@linux.intel.com>
31 #include "cogl-private.h"
32 #include "cogl-util.h"
33 #include "cogl-texture-private.h"
34 #include "cogl-texture-2d-private.h"
35 #include "cogl-texture-driver.h"
36 #include "cogl-context-private.h"
37 #include "cogl-handle.h"
38 #include "cogl-journal-private.h"
39 #include "cogl-pipeline-opengl-private.h"
40 #include "cogl-framebuffer-private.h"
41 #ifdef COGL_HAS_EGL_SUPPORT
42 #include "cogl-winsys-egl-private.h"
48 #ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
49 #include "cogl-wayland-server.h"
52 static void _cogl_texture_2d_free (CoglTexture2D *tex_2d);
54 COGL_TEXTURE_DEFINE (Texture2D, texture_2d);
56 static const CoglTextureVtable cogl_texture_2d_vtable;
58 typedef struct _CoglTexture2DManualRepeatData
60 CoglTexture2D *tex_2d;
61 CoglMetaTextureCallback callback;
63 } CoglTexture2DManualRepeatData;
66 _cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex,
71 CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
73 _COGL_GET_CONTEXT (ctx, NO_RETVAL);
75 /* Only set the wrap mode if it's different from the current value
76 to avoid too many GL calls. Texture 2D doesn't make use of the r
77 coordinate so we can ignore its wrap mode */
78 if (tex_2d->wrap_mode_s != wrap_mode_s ||
79 tex_2d->wrap_mode_t != wrap_mode_t)
81 _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
84 GE( ctx, glTexParameteri (GL_TEXTURE_2D,
87 GE( ctx, glTexParameteri (GL_TEXTURE_2D,
91 tex_2d->wrap_mode_s = wrap_mode_s;
92 tex_2d->wrap_mode_t = wrap_mode_t;
97 _cogl_texture_2d_free (CoglTexture2D *tex_2d)
99 if (!tex_2d->is_foreign)
100 _cogl_delete_gl_texture (tex_2d->gl_texture);
103 _cogl_texture_free (COGL_TEXTURE (tex_2d));
107 _cogl_texture_2d_can_create (unsigned int width,
109 CoglPixelFormat internal_format)
114 _COGL_GET_CONTEXT (ctx, FALSE);
116 /* If NPOT textures aren't supported then the size must be a power
118 if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT) &&
119 (!_cogl_util_is_pot (width) ||
120 !_cogl_util_is_pot (height)))
123 ctx->texture_driver->pixel_format_to_gl (internal_format,
128 /* Check that the driver can create a texture with that size */
129 if (!ctx->texture_driver->size_supported (GL_TEXTURE_2D,
139 static CoglTexture2D *
140 _cogl_texture_2d_create_base (unsigned int width,
142 CoglTextureFlags flags,
143 CoglPixelFormat internal_format)
145 CoglTexture2D *tex_2d = g_new (CoglTexture2D, 1);
146 CoglTexture *tex = COGL_TEXTURE (tex_2d);
148 _cogl_texture_init (tex, &cogl_texture_2d_vtable);
150 tex_2d->width = width;
151 tex_2d->height = height;
152 tex_2d->mipmaps_dirty = TRUE;
153 tex_2d->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0;
155 /* We default to GL_LINEAR for both filters */
156 tex_2d->min_filter = GL_LINEAR;
157 tex_2d->mag_filter = GL_LINEAR;
159 /* Wrap mode not yet set */
160 tex_2d->wrap_mode_s = GL_FALSE;
161 tex_2d->wrap_mode_t = GL_FALSE;
163 tex_2d->is_foreign = FALSE;
165 tex_2d->format = internal_format;
171 cogl_texture_2d_new_with_size (CoglContext *ctx,
174 CoglPixelFormat internal_format,
177 CoglTexture2D *tex_2d;
182 /* Since no data, we need some internal format */
183 if (internal_format == COGL_PIXEL_FORMAT_ANY)
184 internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE;
186 if (!_cogl_texture_2d_can_create (width, height, internal_format))
188 g_set_error (error, COGL_TEXTURE_ERROR,
189 COGL_TEXTURE_ERROR_SIZE,
190 "Failed to create texture 2d due to size/format"
195 internal_format = ctx->texture_driver->pixel_format_to_gl (internal_format,
200 tex_2d = _cogl_texture_2d_create_base (width, height, COGL_TEXTURE_NONE,
203 ctx->texture_driver->gen (GL_TEXTURE_2D, 1, &tex_2d->gl_texture);
204 _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
207 GE( ctx, glTexImage2D (GL_TEXTURE_2D, 0, gl_intformat,
208 width, height, 0, gl_format, gl_type, NULL) );
210 return _cogl_texture_2d_handle_new (tex_2d);
214 _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
215 CoglTextureFlags flags,
216 CoglPixelFormat internal_format,
219 CoglTexture2D *tex_2d;
226 _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
228 _COGL_RETURN_VAL_IF_FAIL (bmp != NULL, COGL_INVALID_HANDLE);
231 _cogl_texture_determine_internal_format (cogl_bitmap_get_format (bmp),
234 if (!_cogl_texture_2d_can_create (cogl_bitmap_get_width (bmp),
235 cogl_bitmap_get_height (bmp),
238 g_set_error (error, COGL_TEXTURE_ERROR,
239 COGL_TEXTURE_ERROR_SIZE,
240 "Failed to create texture 2d due to size/format"
246 if ((dst_bmp = _cogl_texture_prepare_for_upload (bmp,
253 g_set_error (error, COGL_TEXTURE_ERROR,
254 COGL_TEXTURE_ERROR_FORMAT,
255 "Failed to prepare texture upload due to format");
259 tex_2d = _cogl_texture_2d_create_base (cogl_bitmap_get_width (bmp),
260 cogl_bitmap_get_height (bmp),
264 /* Keep a copy of the first pixel so that if glGenerateMipmap isn't
265 supported we can fallback to using GL_GENERATE_MIPMAP */
266 if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN) &&
267 (data = _cogl_bitmap_map (dst_bmp,
268 COGL_BUFFER_ACCESS_READ, 0)))
270 CoglPixelFormat format = cogl_bitmap_get_format (dst_bmp);
271 tex_2d->first_pixel.gl_format = gl_format;
272 tex_2d->first_pixel.gl_type = gl_type;
273 memcpy (tex_2d->first_pixel.data, data,
274 _cogl_pixel_format_get_bytes_per_pixel (format));
276 _cogl_bitmap_unmap (dst_bmp);
279 ctx->texture_driver->gen (GL_TEXTURE_2D, 1, &tex_2d->gl_texture);
280 ctx->texture_driver->upload_to_gl (GL_TEXTURE_2D,
288 tex_2d->gl_format = gl_intformat;
290 cogl_object_unref (dst_bmp);
292 return _cogl_texture_2d_handle_new (tex_2d);
296 cogl_texture_2d_new_from_data (CoglContext *ctx,
299 CoglPixelFormat format,
300 CoglPixelFormat internal_format,
308 _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
309 _COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
311 /* Rowstride from width if not given */
313 rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
315 /* Wrap the data into a bitmap */
316 bmp = cogl_bitmap_new_for_data (ctx,
322 tex =_cogl_texture_2d_new_from_bitmap (bmp, COGL_TEXTURE_NONE,
326 cogl_object_unref (bmp);
332 cogl_texture_2d_new_from_foreign (CoglContext *ctx,
336 CoglPixelFormat format,
339 /* NOTE: width, height and internal format are not queriable
340 * in GLES, hence such a function prototype.
344 GLint gl_compressed = GL_FALSE;
345 GLenum gl_int_format = 0;
346 CoglTexture2D *tex_2d;
348 if (!ctx->texture_driver->allows_foreign_gl_target (GL_TEXTURE_2D))
349 return COGL_INVALID_HANDLE;
351 /* Make sure it is a valid GL texture object */
352 if (!ctx->glIsTexture (gl_handle))
353 return COGL_INVALID_HANDLE;
355 /* Make sure binding succeeds */
356 while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR)
359 _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, gl_handle, TRUE);
360 if (ctx->glGetError () != GL_NO_ERROR)
361 return COGL_INVALID_HANDLE;
363 /* Obtain texture parameters
364 (only level 0 we are interested in) */
367 if (ctx->driver == COGL_DRIVER_GL)
369 GE( ctx, glGetTexLevelParameteriv (GL_TEXTURE_2D, 0,
370 GL_TEXTURE_COMPRESSED,
376 GE( ctx, glGetTexLevelParameteriv (GL_TEXTURE_2D, 0,
377 GL_TEXTURE_INTERNAL_FORMAT,
383 /* If we can query GL for the actual pixel format then we'll ignore
384 the passed in format and use that. */
385 if (!ctx->texture_driver->pixel_format_from_gl_internal (gl_int_format,
387 return COGL_INVALID_HANDLE;
392 /* Otherwise we'll assume we can derive the GL format from the
394 ctx->texture_driver->pixel_format_to_gl (format,
400 /* Note: We always trust the given width and height without querying
401 * the texture object because the user may be creating a Cogl
402 * texture for a texture_from_pixmap object where glTexImage2D may
403 * not have been called and the texture_from_pixmap spec doesn't
404 * clarify that it is reliable to query back the size from OpenGL.
407 /* Validate width and height */
408 if (width <= 0 || height <= 0)
409 return COGL_INVALID_HANDLE;
411 /* Compressed texture images not supported */
412 if (gl_compressed == GL_TRUE)
413 return COGL_INVALID_HANDLE;
415 /* Note: previously this code would query the texture object for
416 whether it has GL_GENERATE_MIPMAP enabled to determine whether to
417 auto-generate the mipmap. This doesn't make much sense any more
418 since Cogl switch to using glGenerateMipmap. Ideally I think
419 cogl_texture_new_from_foreign should take a flags parameter so
420 that the application can decide whether it wants
421 auto-mipmapping. To be compatible with existing code, Cogl now
422 disables its own auto-mipmapping but leaves the value of
423 GL_GENERATE_MIPMAP alone so that it would still work but without
424 the dirtiness tracking that Cogl would do. */
426 /* Create new texture */
427 tex_2d = _cogl_texture_2d_create_base (width, height,
428 COGL_TEXTURE_NO_AUTO_MIPMAP,
431 /* Setup bitmap info */
432 tex_2d->is_foreign = TRUE;
433 tex_2d->mipmaps_dirty = TRUE;
435 tex_2d->format = format;
437 tex_2d->gl_texture = gl_handle;
438 tex_2d->gl_format = gl_int_format;
441 tex_2d->min_filter = GL_FALSE;
442 tex_2d->mag_filter = GL_FALSE;
444 return _cogl_texture_2d_handle_new (tex_2d);
447 #if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
448 /* NB: The reason we require the width, height and format to be passed
449 * even though they may seem redundant is because GLES 1/2 don't
450 * provide a way to query these properties. */
452 _cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
455 CoglPixelFormat format,
459 CoglTexture2D *tex_2d;
462 _COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints &
463 COGL_RENDERER_CONSTRAINT_USES_EGL,
466 _COGL_RETURN_VAL_IF_FAIL (ctx->private_feature_flags &
467 COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE,
470 tex_2d = _cogl_texture_2d_create_base (width, height, COGL_TEXTURE_NONE,
473 ctx->texture_driver->gen (GL_TEXTURE_2D, 1, &tex_2d->gl_texture);
474 _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
478 while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR)
480 ctx->glEGLImageTargetTexture2D (GL_TEXTURE_2D, image);
481 if (ctx->glGetError () != GL_NO_ERROR)
485 COGL_TEXTURE_ERROR_BAD_PARAMETER,
486 "Could not create a CoglTexture2D from a given EGLImage");
490 return _cogl_texture_2d_handle_new (tex_2d);
492 #endif /* defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) */
494 #ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
496 cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
497 struct wl_buffer *buffer,
500 if (wl_buffer_is_shm (buffer))
502 int stride = wl_shm_buffer_get_stride (buffer);
503 CoglPixelFormat format;
504 CoglPixelFormat internal_format = COGL_PIXEL_FORMAT_ANY;
506 switch (wl_shm_buffer_get_format (buffer))
508 #if G_BYTE_ORDER == G_BIG_ENDIAN
509 case WL_SHM_FORMAT_ARGB8888:
510 format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
512 case WL_SHM_FORMAT_XRGB32:
513 format = COGL_PIXEL_FORMAT_ARGB_8888;
514 internal_format = COGL_PIXEL_FORMAT_RGB_888;
516 #elif G_BYTE_ORDER == G_LITTLE_ENDIAN
517 case WL_SHM_FORMAT_ARGB8888:
518 format = COGL_PIXEL_FORMAT_BGRA_8888_PRE;
520 case WL_SHM_FORMAT_XRGB8888:
521 format = COGL_PIXEL_FORMAT_BGRA_8888;
522 internal_format = COGL_PIXEL_FORMAT_BGR_888;
526 g_warn_if_reached ();
527 format = COGL_PIXEL_FORMAT_ARGB_8888;
530 return cogl_texture_2d_new_from_data (ctx,
536 wl_shm_buffer_get_data (buffer),
544 _COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints &
545 COGL_RENDERER_CONSTRAINT_USES_EGL,
547 image = _cogl_egl_create_image (ctx,
548 EGL_WAYLAND_BUFFER_WL,
551 tex = _cogl_egl_texture_2d_new_from_image (ctx,
554 COGL_PIXEL_FORMAT_ARGB_8888_PRE,
557 _cogl_egl_destroy_image (ctx, image);
561 #endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */
564 _cogl_texture_2d_externally_modified (CoglHandle handle)
566 if (!cogl_is_texture_2d (handle))
569 COGL_TEXTURE_2D (handle)->mipmaps_dirty = TRUE;
573 _cogl_texture_2d_copy_from_framebuffer (CoglHandle handle,
581 CoglTexture2D *tex_2d;
583 _COGL_GET_CONTEXT (ctx, NO_RETVAL);
585 _COGL_RETURN_IF_FAIL (cogl_is_texture_2d (handle));
587 tex_2d = COGL_TEXTURE_2D (handle);
589 /* Make sure the current framebuffers are bound, though we don't need to
590 * flush the clip state here since we aren't going to draw to the
592 _cogl_framebuffer_flush_state (cogl_get_draw_framebuffer (),
593 _cogl_get_read_framebuffer (),
594 COGL_FRAMEBUFFER_STATE_ALL &
595 ~COGL_FRAMEBUFFER_STATE_CLIP);
597 _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
601 ctx->glCopyTexSubImage2D (GL_TEXTURE_2D,
607 tex_2d->mipmaps_dirty = TRUE;
611 _cogl_texture_2d_get_max_waste (CoglTexture *tex)
617 _cogl_texture_2d_is_sliced (CoglTexture *tex)
623 _cogl_texture_2d_can_hardware_repeat (CoglTexture *tex)
629 _cogl_texture_2d_transform_coords_to_gl (CoglTexture *tex,
633 /* The texture coordinates map directly so we don't need to do
637 static CoglTransformResult
638 _cogl_texture_2d_transform_quad_coords_to_gl (CoglTexture *tex,
641 /* The texture coordinates map directly so we don't need to do
642 anything other than check for repeats */
644 gboolean need_repeat = FALSE;
647 for (i = 0; i < 4; i++)
648 if (coords[i] < 0.0f || coords[i] > 1.0f)
651 return (need_repeat ? COGL_TRANSFORM_HARDWARE_REPEAT
652 : COGL_TRANSFORM_NO_REPEAT);
656 _cogl_texture_2d_get_gl_texture (CoglTexture *tex,
657 GLuint *out_gl_handle,
658 GLenum *out_gl_target)
660 CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
663 *out_gl_handle = tex_2d->gl_texture;
666 *out_gl_target = GL_TEXTURE_2D;
672 _cogl_texture_2d_set_filters (CoglTexture *tex,
676 CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
678 _COGL_GET_CONTEXT (ctx, NO_RETVAL);
680 if (min_filter == tex_2d->min_filter
681 && mag_filter == tex_2d->mag_filter)
684 /* Store new values */
685 tex_2d->min_filter = min_filter;
686 tex_2d->mag_filter = mag_filter;
688 /* Apply new filters to the texture */
689 _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
692 GE( ctx, glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter) );
693 GE( ctx, glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter) );
697 _cogl_texture_2d_pre_paint (CoglTexture *tex, CoglTexturePrePaintFlags flags)
699 CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
701 _COGL_GET_CONTEXT (ctx, NO_RETVAL);
703 /* Only update if the mipmaps are dirty */
704 if ((flags & COGL_TEXTURE_NEEDS_MIPMAP) &&
705 tex_2d->auto_mipmap && tex_2d->mipmaps_dirty)
707 _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
711 /* glGenerateMipmap is defined in the FBO extension. If it's not
712 available we'll fallback to temporarily enabling
713 GL_GENERATE_MIPMAP and reuploading the first pixel */
714 if (cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
715 ctx->texture_driver->gl_generate_mipmaps (GL_TEXTURE_2D);
716 #if defined(HAVE_COGL_GLES) || defined(HAVE_COGL_GL)
719 GE( ctx, glTexParameteri (GL_TEXTURE_2D,
722 GE( ctx, glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 1, 1,
723 tex_2d->first_pixel.gl_format,
724 tex_2d->first_pixel.gl_type,
725 tex_2d->first_pixel.data) );
726 GE( ctx, glTexParameteri (GL_TEXTURE_2D,
732 tex_2d->mipmaps_dirty = FALSE;
737 _cogl_texture_2d_ensure_non_quad_rendering (CoglTexture *tex)
739 /* Nothing needs to be done */
743 _cogl_texture_2d_set_region (CoglTexture *tex,
748 unsigned int dst_width,
749 unsigned int dst_height,
752 CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
757 _COGL_GET_CONTEXT (ctx, FALSE);
759 bmp = _cogl_texture_prepare_for_upload (bmp,
760 cogl_texture_get_format (tex),
766 /* If this touches the first pixel then we'll update our copy */
767 if (dst_x == 0 && dst_y == 0 &&
768 !cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN) &&
769 (data = _cogl_bitmap_map (bmp, COGL_BUFFER_ACCESS_READ, 0)))
771 CoglPixelFormat bpp =
772 _cogl_pixel_format_get_bytes_per_pixel (cogl_bitmap_get_format (bmp));
773 tex_2d->first_pixel.gl_format = gl_format;
774 tex_2d->first_pixel.gl_type = gl_type;
775 memcpy (tex_2d->first_pixel.data,
776 data + cogl_bitmap_get_rowstride (bmp) * src_y + bpp * src_x,
779 _cogl_bitmap_unmap (bmp);
782 /* Send data to GL */
783 ctx->texture_driver->upload_subregion_to_gl (GL_TEXTURE_2D,
788 dst_width, dst_height,
793 tex_2d->mipmaps_dirty = TRUE;
795 cogl_object_unref (bmp);
801 _cogl_texture_2d_get_data (CoglTexture *tex,
802 CoglPixelFormat format,
803 unsigned int rowstride,
806 CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
811 _COGL_GET_CONTEXT (ctx, FALSE);
813 bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
815 ctx->texture_driver->pixel_format_to_gl (format,
816 NULL, /* internal format */
820 ctx->texture_driver->prep_gl_for_pixels_download (rowstride, bpp);
822 _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
825 return ctx->texture_driver->gl_get_tex_image (GL_TEXTURE_2D,
831 static CoglPixelFormat
832 _cogl_texture_2d_get_format (CoglTexture *tex)
834 return COGL_TEXTURE_2D (tex)->format;
838 _cogl_texture_2d_get_gl_format (CoglTexture *tex)
840 return COGL_TEXTURE_2D (tex)->gl_format;
844 _cogl_texture_2d_get_width (CoglTexture *tex)
846 return COGL_TEXTURE_2D (tex)->width;
850 _cogl_texture_2d_get_height (CoglTexture *tex)
852 return COGL_TEXTURE_2D (tex)->height;
856 _cogl_texture_2d_is_foreign (CoglTexture *tex)
858 return COGL_TEXTURE_2D (tex)->is_foreign;
861 static CoglTextureType
862 _cogl_texture_2d_get_type (CoglTexture *tex)
864 return COGL_TEXTURE_TYPE_2D;
867 static const CoglTextureVtable
868 cogl_texture_2d_vtable =
870 _cogl_texture_2d_set_region,
871 _cogl_texture_2d_get_data,
872 NULL, /* foreach_sub_texture_in_region */
873 _cogl_texture_2d_get_max_waste,
874 _cogl_texture_2d_is_sliced,
875 _cogl_texture_2d_can_hardware_repeat,
876 _cogl_texture_2d_transform_coords_to_gl,
877 _cogl_texture_2d_transform_quad_coords_to_gl,
878 _cogl_texture_2d_get_gl_texture,
879 _cogl_texture_2d_set_filters,
880 _cogl_texture_2d_pre_paint,
881 _cogl_texture_2d_ensure_non_quad_rendering,
882 _cogl_texture_2d_set_wrap_mode_parameters,
883 _cogl_texture_2d_get_format,
884 _cogl_texture_2d_get_gl_format,
885 _cogl_texture_2d_get_width,
886 _cogl_texture_2d_get_height,
887 _cogl_texture_2d_get_type,
888 _cogl_texture_2d_is_foreign