cogl/texture-driver: Abstract GL specific vfuncs
By moving them up from the abstract Driver to DriverGL. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
This commit is contained in:
parent
1f2ba427b6
commit
fc0a8d343f
@ -43,6 +43,7 @@
|
|||||||
#include "cogl/cogl-blit.h"
|
#include "cogl/cogl-blit.h"
|
||||||
#include "cogl/cogl-private.h"
|
#include "cogl/cogl-private.h"
|
||||||
#include "cogl/driver/gl/cogl-driver-gl-private.h"
|
#include "cogl/driver/gl/cogl-driver-gl-private.h"
|
||||||
|
#include "cogl/driver/gl/cogl-texture-driver-gl-private.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -196,8 +197,10 @@ _cogl_atlas_get_initial_size (CoglContext *ctx,
|
|||||||
{
|
{
|
||||||
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
||||||
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
||||||
CoglTextureDriverClass *tex_driver =
|
CoglTextureDriverGL *tex_driver_gl =
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
@ -225,7 +228,7 @@ _cogl_atlas_get_initial_size (CoglContext *ctx,
|
|||||||
/* Some platforms might not support this large size so we'll
|
/* Some platforms might not support this large size so we'll
|
||||||
decrease the size until it can */
|
decrease the size until it can */
|
||||||
while (size > 1 &&
|
while (size > 1 &&
|
||||||
!tex_driver->size_supported (ctx->texture_driver,
|
!tex_driver_klass->size_supported (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
gl_intformat,
|
gl_intformat,
|
||||||
@ -248,8 +251,10 @@ _cogl_atlas_create_map (CoglContext *ctx,
|
|||||||
{
|
{
|
||||||
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
||||||
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
||||||
CoglTextureDriverClass *tex_driver =
|
CoglTextureDriverGL *tex_driver_gl =
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
@ -263,7 +268,7 @@ _cogl_atlas_create_map (CoglContext *ctx,
|
|||||||
|
|
||||||
/* Keep trying increasingly larger atlases until we can fit all of
|
/* Keep trying increasingly larger atlases until we can fit all of
|
||||||
the textures */
|
the textures */
|
||||||
while (tex_driver->size_supported (ctx->texture_driver,
|
while (tex_driver_klass->size_supported (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
gl_intformat,
|
gl_intformat,
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include "cogl/cogl-gl-header.h"
|
|
||||||
#include "cogl/cogl-pixel-format.h"
|
#include "cogl/cogl-pixel-format.h"
|
||||||
#include "cogl/cogl-types.h"
|
#include "cogl/cogl-types.h"
|
||||||
|
|
||||||
@ -48,116 +47,10 @@ struct _CoglTextureDriverClass
|
|||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
/*
|
|
||||||
* A very small wrapper around glGenTextures() that ensures we default to
|
|
||||||
* non-mipmap filters when creating textures. This is to save some memory as
|
|
||||||
* the driver will not allocate room for the mipmap tree.
|
|
||||||
*/
|
|
||||||
GLuint (* gen) (CoglTextureDriver *driver,
|
|
||||||
CoglContext *ctx,
|
|
||||||
GLenum gl_target,
|
|
||||||
CoglPixelFormat internal_format);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This uploads a sub-region from source_bmp to a single GL texture
|
|
||||||
* handle (i.e a single CoglTexture slice)
|
|
||||||
*
|
|
||||||
* It also updates the array of tex->first_pixels[slice_index] if
|
|
||||||
* dst_{x,y} == 0
|
|
||||||
*
|
|
||||||
* The driver abstraction is in place because GLES doesn't support the pixel
|
|
||||||
* store options required to source from a subregion, so for GLES we have
|
|
||||||
* to manually create a transient source bitmap.
|
|
||||||
*
|
|
||||||
* XXX: sorry for the ridiculous number of arguments :-(
|
|
||||||
*/
|
|
||||||
gboolean (* upload_subregion_to_gl) (CoglTextureDriver *driver,
|
|
||||||
CoglContext *ctx,
|
|
||||||
CoglTexture *texture,
|
|
||||||
int src_x,
|
|
||||||
int src_y,
|
|
||||||
int dst_x,
|
|
||||||
int dst_y,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
int level,
|
|
||||||
CoglBitmap *source_bmp,
|
|
||||||
GLuint source_gl_format,
|
|
||||||
GLuint source_gl_type,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Replaces the contents of the GL texture with the entire bitmap. On
|
|
||||||
* GL this just directly calls glTexImage2D, but under GLES it needs
|
|
||||||
* to copy the bitmap if the rowstride is not a multiple of a possible
|
|
||||||
* alignment value because there is no GL_UNPACK_ROW_LENGTH
|
|
||||||
*/
|
|
||||||
gboolean (* upload_to_gl) (CoglTextureDriver *driver,
|
|
||||||
CoglContext *ctx,
|
|
||||||
GLenum gl_target,
|
|
||||||
GLuint gl_handle,
|
|
||||||
CoglBitmap *source_bmp,
|
|
||||||
GLint internal_gl_format,
|
|
||||||
GLuint source_gl_format,
|
|
||||||
GLuint source_gl_type,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This sets up the glPixelStore state for an download to a destination with
|
|
||||||
* the same size, and with no offset.
|
|
||||||
*/
|
|
||||||
/* NB: GLES can't download pixel data into a sub region of a larger
|
|
||||||
* destination buffer, the GL driver has a more flexible version of
|
|
||||||
* this function that it uses internally. */
|
|
||||||
void (* prep_gl_for_pixels_download) (CoglTextureDriver *driver,
|
|
||||||
CoglContext *ctx,
|
|
||||||
int image_width,
|
|
||||||
int pixels_rowstride,
|
|
||||||
int pixels_bpp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This driver abstraction is needed because GLES doesn't support
|
|
||||||
* glGetTexImage (). On GLES this currently just returns FALSE which
|
|
||||||
* will lead to a generic fallback path being used that simply
|
|
||||||
* renders the texture and reads it back from the framebuffer. (See
|
|
||||||
* _cogl_texture_draw_and_read () )
|
|
||||||
*/
|
|
||||||
gboolean (* gl_get_tex_image) (CoglTextureDriver *driver,
|
|
||||||
CoglContext *ctx,
|
|
||||||
GLenum gl_target,
|
|
||||||
GLenum dest_gl_format,
|
|
||||||
GLenum dest_gl_type,
|
|
||||||
uint8_t *dest);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* It may depend on the driver as to what texture sizes are supported...
|
|
||||||
*/
|
|
||||||
gboolean (* size_supported) (CoglTextureDriver *driver,
|
|
||||||
CoglContext *ctx,
|
|
||||||
GLenum gl_target,
|
|
||||||
GLenum gl_intformat,
|
|
||||||
GLenum gl_format,
|
|
||||||
GLenum gl_type,
|
|
||||||
int width,
|
|
||||||
int height);
|
|
||||||
|
|
||||||
|
|
||||||
gboolean (* format_supports_upload) (CoglTextureDriver *driver,
|
gboolean (* format_supports_upload) (CoglTextureDriver *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
CoglPixelFormat format);
|
CoglPixelFormat format);
|
||||||
|
|
||||||
/*
|
|
||||||
* The driver may impose constraints on what formats can be used to store
|
|
||||||
* texture data read from textures. For example GLES currently only supports
|
|
||||||
* RGBA_8888, and so we need to manually convert the data if the final
|
|
||||||
* destination has another format.
|
|
||||||
*/
|
|
||||||
CoglPixelFormat (* find_best_gl_get_data_format) (CoglTextureDriver *driver,
|
|
||||||
CoglContext *context,
|
|
||||||
CoglPixelFormat format,
|
|
||||||
GLenum *closest_gl_format,
|
|
||||||
GLenum *closest_gl_type);
|
|
||||||
|
|
||||||
|
|
||||||
/* Destroys any driver specific resources associated with the given
|
/* Destroys any driver specific resources associated with the given
|
||||||
* 2D texture. */
|
* 2D texture. */
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include "cogl/cogl-offscreen-private.h"
|
#include "cogl/cogl-offscreen-private.h"
|
||||||
#include "cogl/cogl-framebuffer-private.h"
|
#include "cogl/cogl-framebuffer-private.h"
|
||||||
#include "cogl/cogl-sub-texture.h"
|
#include "cogl/cogl-sub-texture.h"
|
||||||
|
#include "cogl/driver/gl/cogl-texture-driver-gl-private.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -811,7 +812,7 @@ cogl_texture_get_data (CoglTexture *texture,
|
|||||||
uint8_t *data)
|
uint8_t *data)
|
||||||
{
|
{
|
||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
CoglTextureDriverClass *tex_driver;
|
CoglTextureDriverGLClass *tex_driver_gl;
|
||||||
int bpp;
|
int bpp;
|
||||||
int byte_size;
|
int byte_size;
|
||||||
CoglPixelFormat closest_format;
|
CoglPixelFormat closest_format;
|
||||||
@ -849,9 +850,9 @@ cogl_texture_get_data (CoglTexture *texture,
|
|||||||
return byte_size;
|
return byte_size;
|
||||||
|
|
||||||
ctx = cogl_texture_get_context (texture);
|
ctx = cogl_texture_get_context (texture);
|
||||||
tex_driver = COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
tex_driver_gl = COGL_TEXTURE_DRIVER_GL_GET_CLASS (ctx->texture_driver);
|
||||||
closest_format =
|
closest_format =
|
||||||
tex_driver->find_best_gl_get_data_format (ctx->texture_driver,
|
tex_driver_gl->find_best_gl_get_data_format (COGL_TEXTURE_DRIVER_GL (ctx->texture_driver),
|
||||||
ctx,
|
ctx,
|
||||||
format,
|
format,
|
||||||
&closest_gl_format,
|
&closest_gl_format,
|
||||||
|
@ -41,7 +41,8 @@
|
|||||||
#include "cogl/driver/gl/cogl-framebuffer-gl-private.h"
|
#include "cogl/driver/gl/cogl-framebuffer-gl-private.h"
|
||||||
#include "cogl/driver/gl/cogl-bitmap-gl-private.h"
|
#include "cogl/driver/gl/cogl-bitmap-gl-private.h"
|
||||||
#include "cogl/driver/gl/cogl-buffer-gl-private.h"
|
#include "cogl/driver/gl/cogl-buffer-gl-private.h"
|
||||||
#include "cogl/driver/gl/cogl-driver-gl-private.h"
|
#include "cogl/driver/gl/cogl-driver-gl-private.h"
|
||||||
|
#include "cogl/driver/gl/cogl-texture-driver-gl-private.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -406,6 +407,9 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver,
|
|||||||
CoglPixelFormat internal_format =
|
CoglPixelFormat internal_format =
|
||||||
cogl_framebuffer_get_internal_format (framebuffer);
|
cogl_framebuffer_get_internal_format (framebuffer);
|
||||||
CoglDriverGLClass *driver_gl_klass = COGL_DRIVER_GL_GET_CLASS (ctx->driver);
|
CoglDriverGLClass *driver_gl_klass = COGL_DRIVER_GL_GET_CLASS (ctx->driver);
|
||||||
|
CoglTextureDriverGL *tex_driver_gl = COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_gl_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
CoglPixelFormat read_format;
|
CoglPixelFormat read_format;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
@ -466,8 +470,6 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver,
|
|||||||
int bpp, rowstride;
|
int bpp, rowstride;
|
||||||
uint8_t *tmp_data;
|
uint8_t *tmp_data;
|
||||||
gboolean succeeded;
|
gboolean succeeded;
|
||||||
CoglTextureDriverClass *tex_driver =
|
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
|
||||||
|
|
||||||
if (_cogl_pixel_format_can_have_premult (read_format))
|
if (_cogl_pixel_format_can_have_premult (read_format))
|
||||||
{
|
{
|
||||||
@ -485,7 +487,7 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver,
|
|||||||
bpp = cogl_pixel_format_get_bytes_per_pixel (read_format, 0);
|
bpp = cogl_pixel_format_get_bytes_per_pixel (read_format, 0);
|
||||||
rowstride = cogl_bitmap_get_rowstride (tmp_bmp);
|
rowstride = cogl_bitmap_get_rowstride (tmp_bmp);
|
||||||
|
|
||||||
tex_driver->prep_gl_for_pixels_download (ctx->texture_driver,
|
tex_driver_gl_klass->prep_gl_for_pixels_download (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
rowstride,
|
rowstride,
|
||||||
width,
|
width,
|
||||||
@ -528,8 +530,6 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver,
|
|||||||
gboolean succeeded = FALSE;
|
gboolean succeeded = FALSE;
|
||||||
uint8_t *pixels;
|
uint8_t *pixels;
|
||||||
GError *internal_error = NULL;
|
GError *internal_error = NULL;
|
||||||
CoglTextureDriverClass *tex_driver =
|
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
|
||||||
|
|
||||||
rowstride = cogl_bitmap_get_rowstride (bitmap);
|
rowstride = cogl_bitmap_get_rowstride (bitmap);
|
||||||
|
|
||||||
@ -552,7 +552,7 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver,
|
|||||||
|
|
||||||
bpp = cogl_pixel_format_get_bytes_per_pixel (bmp_format, 0);
|
bpp = cogl_pixel_format_get_bytes_per_pixel (bmp_format, 0);
|
||||||
|
|
||||||
tex_driver->prep_gl_for_pixels_download (ctx->texture_driver,
|
tex_driver_gl_klass->prep_gl_for_pixels_download (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
rowstride,
|
rowstride,
|
||||||
width,
|
width,
|
||||||
|
@ -28,17 +28,123 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "cogl/cogl-gl-header.h"
|
||||||
#include "cogl/cogl-texture-driver.h"
|
#include "cogl/cogl-texture-driver.h"
|
||||||
|
|
||||||
struct _CoglTextureDriverGLClass
|
|
||||||
{
|
|
||||||
CoglTextureDriverClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DECLARE_DERIVABLE_TYPE (CoglTextureDriverGL,
|
G_DECLARE_DERIVABLE_TYPE (CoglTextureDriverGL,
|
||||||
cogl_texture_driver_gl,
|
cogl_texture_driver_gl,
|
||||||
COGL,
|
COGL,
|
||||||
TEXTURE_DRIVER_GL,
|
TEXTURE_DRIVER_GL,
|
||||||
CoglTextureDriver)
|
CoglTextureDriver)
|
||||||
|
|
||||||
|
struct _CoglTextureDriverGLClass
|
||||||
|
{
|
||||||
|
CoglTextureDriverClass parent_class;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A very small wrapper around glGenTextures() that ensures we default to
|
||||||
|
* non-mipmap filters when creating textures. This is to save some memory as
|
||||||
|
* the driver will not allocate room for the mipmap tree.
|
||||||
|
*/
|
||||||
|
GLuint (* gen) (CoglTextureDriverGL *driver,
|
||||||
|
CoglContext *ctx,
|
||||||
|
GLenum gl_target,
|
||||||
|
CoglPixelFormat internal_format);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This uploads a sub-region from source_bmp to a single GL texture
|
||||||
|
* handle (i.e a single CoglTexture slice)
|
||||||
|
*
|
||||||
|
* It also updates the array of tex->first_pixels[slice_index] if
|
||||||
|
* dst_{x,y} == 0
|
||||||
|
*
|
||||||
|
* The driver abstraction is in place because GLES doesn't support the pixel
|
||||||
|
* store options required to source from a subregion, so for GLES we have
|
||||||
|
* to manually create a transient source bitmap.
|
||||||
|
*
|
||||||
|
* XXX: sorry for the ridiculous number of arguments :-(
|
||||||
|
*/
|
||||||
|
gboolean (* upload_subregion_to_gl) (CoglTextureDriverGL *driver,
|
||||||
|
CoglContext *ctx,
|
||||||
|
CoglTexture *texture,
|
||||||
|
int src_x,
|
||||||
|
int src_y,
|
||||||
|
int dst_x,
|
||||||
|
int dst_y,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int level,
|
||||||
|
CoglBitmap *source_bmp,
|
||||||
|
GLuint source_gl_format,
|
||||||
|
GLuint source_gl_type,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replaces the contents of the GL texture with the entire bitmap. On
|
||||||
|
* GL this just directly calls glTexImage2D, but under GLES it needs
|
||||||
|
* to copy the bitmap if the rowstride is not a multiple of a possible
|
||||||
|
* alignment value because there is no GL_UNPACK_ROW_LENGTH
|
||||||
|
*/
|
||||||
|
gboolean (* upload_to_gl) (CoglTextureDriverGL *driver,
|
||||||
|
CoglContext *ctx,
|
||||||
|
GLenum gl_target,
|
||||||
|
GLuint gl_handle,
|
||||||
|
CoglBitmap *source_bmp,
|
||||||
|
GLint internal_gl_format,
|
||||||
|
GLuint source_gl_format,
|
||||||
|
GLuint source_gl_type,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This sets up the glPixelStore state for an download to a destination with
|
||||||
|
* the same size, and with no offset.
|
||||||
|
*/
|
||||||
|
/* NB: GLES can't download pixel data into a sub region of a larger
|
||||||
|
* destination buffer, the GL driver has a more flexible version of
|
||||||
|
* this function that it uses internally. */
|
||||||
|
void (* prep_gl_for_pixels_download) (CoglTextureDriverGL *driver,
|
||||||
|
CoglContext *ctx,
|
||||||
|
int image_width,
|
||||||
|
int pixels_rowstride,
|
||||||
|
int pixels_bpp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This driver abstraction is needed because GLES doesn't support
|
||||||
|
* glGetTexImage (). On GLES this currently just returns FALSE which
|
||||||
|
* will lead to a generic fallback path being used that simply
|
||||||
|
* renders the texture and reads it back from the framebuffer. (See
|
||||||
|
* _cogl_texture_draw_and_read () )
|
||||||
|
*/
|
||||||
|
gboolean (* gl_get_tex_image) (CoglTextureDriverGL *driver,
|
||||||
|
CoglContext *ctx,
|
||||||
|
GLenum gl_target,
|
||||||
|
GLenum dest_gl_format,
|
||||||
|
GLenum dest_gl_type,
|
||||||
|
uint8_t *dest);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It may depend on the driver as to what texture sizes are supported...
|
||||||
|
*/
|
||||||
|
gboolean (* size_supported) (CoglTextureDriverGL *driver,
|
||||||
|
CoglContext *ctx,
|
||||||
|
GLenum gl_target,
|
||||||
|
GLenum gl_intformat,
|
||||||
|
GLenum gl_format,
|
||||||
|
GLenum gl_type,
|
||||||
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The driver may impose constraints on what formats can be used to store
|
||||||
|
* texture data read from textures. For example GLES currently only supports
|
||||||
|
* RGBA_8888, and so we need to manually convert the data if the final
|
||||||
|
* destination has another format.
|
||||||
|
*/
|
||||||
|
CoglPixelFormat (* find_best_gl_get_data_format) (CoglTextureDriverGL *driver,
|
||||||
|
CoglContext *context,
|
||||||
|
CoglPixelFormat format,
|
||||||
|
GLenum *closest_gl_format,
|
||||||
|
GLenum *closest_gl_type);
|
||||||
|
};
|
||||||
|
|
||||||
#define COGL_TYPE_TEXTURE_DRIVER_GL (cogl_texture_driver_gl_get_type ())
|
#define COGL_TYPE_TEXTURE_DRIVER_GL (cogl_texture_driver_gl_get_type ())
|
||||||
|
@ -62,14 +62,16 @@ cogl_texture_driver_gl_texture_2d_free (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gl_texture_2d_can_create (CoglTextureDriver *driver,
|
cogl_texture_driver_gl_texture_2d_can_create (CoglTextureDriver *tex_driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglPixelFormat internal_format)
|
CoglPixelFormat internal_format)
|
||||||
{
|
{
|
||||||
CoglTextureDriverClass *tex_driver =
|
CoglTextureDriverGL *tex_driver_gl =
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
||||||
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
@ -88,7 +90,7 @@ cogl_texture_driver_gl_texture_2d_can_create (CoglTextureDriver *driver,
|
|||||||
&gl_type);
|
&gl_type);
|
||||||
|
|
||||||
/* Check that the driver can create a texture with that size */
|
/* Check that the driver can create a texture with that size */
|
||||||
if (!tex_driver->size_supported (ctx->texture_driver,
|
if (!tex_driver_klass->size_supported (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
gl_intformat,
|
gl_intformat,
|
||||||
@ -113,8 +115,10 @@ allocate_with_size (CoglTexture2D *tex_2d,
|
|||||||
CoglContext *ctx = cogl_texture_get_context (tex);
|
CoglContext *ctx = cogl_texture_get_context (tex);
|
||||||
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
||||||
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
||||||
CoglTextureDriverClass *tex_driver =
|
CoglTextureDriverGL *tex_driver_gl =
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
GLenum gl_intformat;
|
GLenum gl_intformat;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
@ -143,7 +147,7 @@ allocate_with_size (CoglTexture2D *tex_2d,
|
|||||||
&gl_format,
|
&gl_format,
|
||||||
&gl_type);
|
&gl_type);
|
||||||
|
|
||||||
gl_texture = tex_driver->gen (ctx->texture_driver,
|
gl_texture = tex_driver_klass->gen (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
internal_format);
|
internal_format);
|
||||||
@ -185,8 +189,10 @@ allocate_from_bitmap (CoglTexture2D *tex_2d,
|
|||||||
CoglContext *ctx = _cogl_bitmap_get_context (bmp);
|
CoglContext *ctx = _cogl_bitmap_get_context (bmp);
|
||||||
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
||||||
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
||||||
CoglTextureDriverClass *tex_driver =
|
CoglTextureDriverGL *tex_driver_gl =
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
CoglPixelFormat internal_format;
|
CoglPixelFormat internal_format;
|
||||||
int width = cogl_bitmap_get_width (bmp);
|
int width = cogl_bitmap_get_width (bmp);
|
||||||
int height = cogl_bitmap_get_height (bmp);
|
int height = cogl_bitmap_get_height (bmp);
|
||||||
@ -230,11 +236,11 @@ allocate_from_bitmap (CoglTexture2D *tex_2d,
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
tex_2d->gl_texture = tex_driver->gen (ctx->texture_driver,
|
tex_2d->gl_texture = tex_driver_klass->gen (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
internal_format);
|
internal_format);
|
||||||
if (!tex_driver->upload_to_gl (ctx->texture_driver,
|
if (!tex_driver_klass->upload_to_gl (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
tex_2d->gl_texture,
|
tex_2d->gl_texture,
|
||||||
@ -268,10 +274,12 @@ allocate_from_egl_image (CoglTexture2D *tex_2d,
|
|||||||
CoglTexture *tex = COGL_TEXTURE (tex_2d);
|
CoglTexture *tex = COGL_TEXTURE (tex_2d);
|
||||||
CoglContext *ctx = cogl_texture_get_context (tex);
|
CoglContext *ctx = cogl_texture_get_context (tex);
|
||||||
CoglPixelFormat internal_format = loader->src.egl_image.format;
|
CoglPixelFormat internal_format = loader->src.egl_image.format;
|
||||||
CoglTextureDriverClass *tex_driver =
|
CoglTextureDriverGL *tex_driver_gl =
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
|
|
||||||
tex_2d->gl_texture = tex_driver->gen (ctx->texture_driver,
|
tex_2d->gl_texture = tex_driver_klass->gen (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
internal_format);
|
internal_format);
|
||||||
@ -471,8 +479,10 @@ cogl_texture_driver_gl_texture_2d_copy_from_bitmap (CoglTextureDriver *driver,
|
|||||||
CoglContext *ctx = cogl_texture_get_context (tex);
|
CoglContext *ctx = cogl_texture_get_context (tex);
|
||||||
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
||||||
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
||||||
CoglTextureDriverClass *tex_driver =
|
CoglTextureDriverGL *tex_driver_gl =
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
CoglBitmap *upload_bmp;
|
CoglBitmap *upload_bmp;
|
||||||
CoglPixelFormat upload_format;
|
CoglPixelFormat upload_format;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
@ -503,7 +513,7 @@ cogl_texture_driver_gl_texture_2d_copy_from_bitmap (CoglTextureDriver *driver,
|
|||||||
if (cogl_texture_get_max_level_set (tex) < level)
|
if (cogl_texture_get_max_level_set (tex) < level)
|
||||||
cogl_texture_gl_set_max_level (tex, level);
|
cogl_texture_gl_set_max_level (tex, level);
|
||||||
|
|
||||||
status = tex_driver->upload_subregion_to_gl (ctx->texture_driver,
|
status = tex_driver_klass->upload_subregion_to_gl (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
tex,
|
tex,
|
||||||
src_x, src_y,
|
src_x, src_y,
|
||||||
|
@ -68,7 +68,7 @@ G_DEFINE_FINAL_TYPE (CoglTextureDriverGL3,
|
|||||||
COGL_TYPE_TEXTURE_DRIVER_GL)
|
COGL_TYPE_TEXTURE_DRIVER_GL)
|
||||||
|
|
||||||
static GLuint
|
static GLuint
|
||||||
cogl_texture_driver_gl3_gen (CoglTextureDriver *driver,
|
cogl_texture_driver_gl3_gen (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
GLenum gl_target,
|
GLenum gl_target,
|
||||||
CoglPixelFormat internal_format)
|
CoglPixelFormat internal_format)
|
||||||
@ -162,7 +162,7 @@ prep_gl_for_pixels_download_full (CoglContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_texture_driver_gl3_prep_gl_for_pixels_download (CoglTextureDriver *driver,
|
cogl_texture_driver_gl3_prep_gl_for_pixels_download (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
int image_width,
|
int image_width,
|
||||||
int pixels_rowstride,
|
int pixels_rowstride,
|
||||||
@ -177,7 +177,7 @@ cogl_texture_driver_gl3_prep_gl_for_pixels_download (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gl3_upload_subregion_to_gl (CoglTextureDriver *driver,
|
cogl_texture_driver_gl3_upload_subregion_to_gl (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
CoglTexture *texture,
|
CoglTexture *texture,
|
||||||
int src_x,
|
int src_x,
|
||||||
@ -295,7 +295,7 @@ cogl_texture_driver_gl3_upload_subregion_to_gl (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gl3_upload_to_gl (CoglTextureDriver *driver,
|
cogl_texture_driver_gl3_upload_to_gl (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
GLenum gl_target,
|
GLenum gl_target,
|
||||||
GLuint gl_handle,
|
GLuint gl_handle,
|
||||||
@ -359,7 +359,7 @@ cogl_texture_driver_gl3_upload_to_gl (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gl3_gl_get_tex_image (CoglTextureDriver *driver,
|
cogl_texture_driver_gl3_gl_get_tex_image (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
GLenum gl_target,
|
GLenum gl_target,
|
||||||
GLenum dest_gl_format,
|
GLenum dest_gl_format,
|
||||||
@ -375,7 +375,7 @@ cogl_texture_driver_gl3_gl_get_tex_image (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gl3_size_supported (CoglTextureDriver *driver,
|
cogl_texture_driver_gl3_size_supported (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
GLenum gl_target,
|
GLenum gl_target,
|
||||||
GLenum gl_intformat,
|
GLenum gl_intformat,
|
||||||
@ -477,7 +477,7 @@ cogl_texture_driver_gl3_upload_supported (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglPixelFormat
|
static CoglPixelFormat
|
||||||
cogl_texture_driver_gl3_find_best_gl_get_data_format (CoglTextureDriver *driver,
|
cogl_texture_driver_gl3_find_best_gl_get_data_format (CoglTextureDriverGL *driver,
|
||||||
CoglContext *context,
|
CoglContext *context,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
GLenum *closest_gl_format,
|
GLenum *closest_gl_format,
|
||||||
@ -509,8 +509,10 @@ cogl_texture_driver_gl3_texture_2d_gl_get_data (CoglTextureDriver *driver,
|
|||||||
uint8_t *data)
|
uint8_t *data)
|
||||||
{
|
{
|
||||||
CoglContext *ctx = cogl_texture_get_context (COGL_TEXTURE (tex_2d));
|
CoglContext *ctx = cogl_texture_get_context (COGL_TEXTURE (tex_2d));
|
||||||
CoglTextureDriverClass *tex_driver =
|
CoglTextureDriverGL *tex_driver_gl =
|
||||||
COGL_TEXTURE_DRIVER_GET_CLASS (ctx->texture_driver);
|
COGL_TEXTURE_DRIVER_GL (ctx->texture_driver);
|
||||||
|
CoglTextureDriverGLClass *tex_driver_klass =
|
||||||
|
COGL_TEXTURE_DRIVER_GL_GET_CLASS (tex_driver_gl);
|
||||||
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
CoglDriverGL *driver_gl = COGL_DRIVER_GL (ctx->driver);
|
||||||
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
CoglDriverGLClass *driver_klass = COGL_DRIVER_GL_GET_CLASS (driver_gl);
|
||||||
uint8_t bpp;
|
uint8_t bpp;
|
||||||
@ -530,7 +532,7 @@ cogl_texture_driver_gl3_texture_2d_gl_get_data (CoglTextureDriver *driver,
|
|||||||
&gl_format,
|
&gl_format,
|
||||||
&gl_type);
|
&gl_type);
|
||||||
|
|
||||||
tex_driver->prep_gl_for_pixels_download (ctx->texture_driver,
|
tex_driver_klass->prep_gl_for_pixels_download (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
rowstride,
|
rowstride,
|
||||||
width,
|
width,
|
||||||
@ -539,7 +541,7 @@ cogl_texture_driver_gl3_texture_2d_gl_get_data (CoglTextureDriver *driver,
|
|||||||
_cogl_bind_gl_texture_transient (ctx, tex_2d->gl_target,
|
_cogl_bind_gl_texture_transient (ctx, tex_2d->gl_target,
|
||||||
tex_2d->gl_texture);
|
tex_2d->gl_texture);
|
||||||
|
|
||||||
tex_driver->gl_get_tex_image (ctx->texture_driver,
|
tex_driver_klass->gl_get_tex_image (tex_driver_gl,
|
||||||
ctx,
|
ctx,
|
||||||
tex_2d->gl_target,
|
tex_2d->gl_target,
|
||||||
gl_format,
|
gl_format,
|
||||||
@ -551,17 +553,19 @@ static void
|
|||||||
cogl_texture_driver_gl3_class_init (CoglTextureDriverGL3Class *klass)
|
cogl_texture_driver_gl3_class_init (CoglTextureDriverGL3Class *klass)
|
||||||
{
|
{
|
||||||
CoglTextureDriverClass *driver_klass = COGL_TEXTURE_DRIVER_CLASS (klass);
|
CoglTextureDriverClass *driver_klass = COGL_TEXTURE_DRIVER_CLASS (klass);
|
||||||
|
CoglTextureDriverGLClass *driver_gl_klass = COGL_TEXTURE_DRIVER_GL_CLASS (klass);
|
||||||
|
|
||||||
driver_klass->gen = cogl_texture_driver_gl3_gen;
|
|
||||||
driver_klass->upload_subregion_to_gl = cogl_texture_driver_gl3_upload_subregion_to_gl;
|
|
||||||
driver_klass->upload_to_gl = cogl_texture_driver_gl3_upload_to_gl;
|
|
||||||
driver_klass->prep_gl_for_pixels_download = cogl_texture_driver_gl3_prep_gl_for_pixels_download;
|
|
||||||
driver_klass->gl_get_tex_image = cogl_texture_driver_gl3_gl_get_tex_image;
|
|
||||||
driver_klass->size_supported = cogl_texture_driver_gl3_size_supported;
|
|
||||||
driver_klass->format_supports_upload = cogl_texture_driver_gl3_upload_supported;
|
driver_klass->format_supports_upload = cogl_texture_driver_gl3_upload_supported;
|
||||||
driver_klass->find_best_gl_get_data_format = cogl_texture_driver_gl3_find_best_gl_get_data_format;
|
|
||||||
driver_klass->texture_2d_is_get_data_supported = cogl_texture_driver_gl3_is_get_data_supported;
|
driver_klass->texture_2d_is_get_data_supported = cogl_texture_driver_gl3_is_get_data_supported;
|
||||||
driver_klass->texture_2d_get_data = cogl_texture_driver_gl3_texture_2d_gl_get_data;
|
driver_klass->texture_2d_get_data = cogl_texture_driver_gl3_texture_2d_gl_get_data;
|
||||||
|
|
||||||
|
driver_gl_klass->gen = cogl_texture_driver_gl3_gen;
|
||||||
|
driver_gl_klass->upload_subregion_to_gl = cogl_texture_driver_gl3_upload_subregion_to_gl;
|
||||||
|
driver_gl_klass->upload_to_gl = cogl_texture_driver_gl3_upload_to_gl;
|
||||||
|
driver_gl_klass->prep_gl_for_pixels_download = cogl_texture_driver_gl3_prep_gl_for_pixels_download;
|
||||||
|
driver_gl_klass->gl_get_tex_image = cogl_texture_driver_gl3_gl_get_tex_image;
|
||||||
|
driver_gl_klass->size_supported = cogl_texture_driver_gl3_size_supported;
|
||||||
|
driver_gl_klass->find_best_gl_get_data_format = cogl_texture_driver_gl3_find_best_gl_get_data_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -82,7 +82,7 @@ G_DEFINE_FINAL_TYPE (CoglTextureDriverGLES2,
|
|||||||
COGL_TYPE_TEXTURE_DRIVER_GL)
|
COGL_TYPE_TEXTURE_DRIVER_GL)
|
||||||
|
|
||||||
static GLuint
|
static GLuint
|
||||||
cogl_texture_driver_gles2_gen (CoglTextureDriver *driver,
|
cogl_texture_driver_gles2_gen (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
GLenum gl_target,
|
GLenum gl_target,
|
||||||
CoglPixelFormat internal_format)
|
CoglPixelFormat internal_format)
|
||||||
@ -146,7 +146,7 @@ _cogl_texture_driver_prep_gl_for_pixels_upload (CoglContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_texture_driver_gles2_prep_gl_for_pixels_download (CoglTextureDriver *driver,
|
cogl_texture_driver_gles2_prep_gl_for_pixels_download (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
int pixels_rowstride,
|
int pixels_rowstride,
|
||||||
int image_width,
|
int image_width,
|
||||||
@ -193,7 +193,7 @@ prepare_bitmap_alignment_for_upload (CoglContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gles2_upload_subregion_to_gl (CoglTextureDriver *driver,
|
cogl_texture_driver_gles2_upload_subregion_to_gl (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
CoglTexture *texture,
|
CoglTexture *texture,
|
||||||
int src_x,
|
int src_x,
|
||||||
@ -349,7 +349,7 @@ cogl_texture_driver_gles2_upload_subregion_to_gl (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gles2_upload_to_gl (CoglTextureDriver *driver,
|
cogl_texture_driver_gles2_upload_to_gl (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
GLenum gl_target,
|
GLenum gl_target,
|
||||||
GLuint gl_handle,
|
GLuint gl_handle,
|
||||||
@ -426,7 +426,7 @@ cogl_texture_driver_gles2_upload_to_gl (CoglTextureDriver *driver,
|
|||||||
* fallback to a generic render + readpixels approach to downloading
|
* fallback to a generic render + readpixels approach to downloading
|
||||||
* texture data. (See _cogl_texture_draw_and_read() ) */
|
* texture data. (See _cogl_texture_draw_and_read() ) */
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gles2_gl_get_tex_image (CoglTextureDriver *driver,
|
cogl_texture_driver_gles2_gl_get_tex_image (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
GLenum gl_target,
|
GLenum gl_target,
|
||||||
GLenum dest_gl_format,
|
GLenum dest_gl_format,
|
||||||
@ -437,7 +437,7 @@ cogl_texture_driver_gles2_gl_get_tex_image (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_texture_driver_gles2_size_supported (CoglTextureDriver *driver,
|
cogl_texture_driver_gles2_size_supported (CoglTextureDriverGL *driver,
|
||||||
CoglContext *ctx,
|
CoglContext *ctx,
|
||||||
GLenum gl_target,
|
GLenum gl_target,
|
||||||
GLenum gl_intformat,
|
GLenum gl_intformat,
|
||||||
@ -545,7 +545,7 @@ cogl_texture_driver_gles2_upload_supported (CoglTextureDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglPixelFormat
|
static CoglPixelFormat
|
||||||
cogl_texture_driver_gles2_find_best_gl_get_data_format (CoglTextureDriver *driver,
|
cogl_texture_driver_gles2_find_best_gl_get_data_format (CoglTextureDriverGL *driver,
|
||||||
CoglContext *context,
|
CoglContext *context,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
GLenum *closest_gl_format,
|
GLenum *closest_gl_format,
|
||||||
@ -570,16 +570,18 @@ static void
|
|||||||
cogl_texture_driver_gles2_class_init (CoglTextureDriverGLES2Class *klass)
|
cogl_texture_driver_gles2_class_init (CoglTextureDriverGLES2Class *klass)
|
||||||
{
|
{
|
||||||
CoglTextureDriverClass *driver_klass = COGL_TEXTURE_DRIVER_CLASS (klass);
|
CoglTextureDriverClass *driver_klass = COGL_TEXTURE_DRIVER_CLASS (klass);
|
||||||
|
CoglTextureDriverGLClass *driver_gl_klass = COGL_TEXTURE_DRIVER_GL_CLASS (klass);
|
||||||
|
|
||||||
driver_klass->gen = cogl_texture_driver_gles2_gen;
|
|
||||||
driver_klass->upload_subregion_to_gl = cogl_texture_driver_gles2_upload_subregion_to_gl;
|
|
||||||
driver_klass->upload_to_gl = cogl_texture_driver_gles2_upload_to_gl;
|
|
||||||
driver_klass->prep_gl_for_pixels_download = cogl_texture_driver_gles2_prep_gl_for_pixels_download;
|
|
||||||
driver_klass->gl_get_tex_image = cogl_texture_driver_gles2_gl_get_tex_image;
|
|
||||||
driver_klass->size_supported = cogl_texture_driver_gles2_size_supported;
|
|
||||||
driver_klass->format_supports_upload = cogl_texture_driver_gles2_upload_supported;
|
|
||||||
driver_klass->find_best_gl_get_data_format = cogl_texture_driver_gles2_find_best_gl_get_data_format;
|
|
||||||
driver_klass->texture_2d_is_get_data_supported = cogl_texture_driver_gles2_texture_2d_is_get_data_supported;
|
driver_klass->texture_2d_is_get_data_supported = cogl_texture_driver_gles2_texture_2d_is_get_data_supported;
|
||||||
|
driver_klass->format_supports_upload = cogl_texture_driver_gles2_upload_supported;
|
||||||
|
|
||||||
|
driver_gl_klass->gen = cogl_texture_driver_gles2_gen;
|
||||||
|
driver_gl_klass->upload_subregion_to_gl = cogl_texture_driver_gles2_upload_subregion_to_gl;
|
||||||
|
driver_gl_klass->upload_to_gl = cogl_texture_driver_gles2_upload_to_gl;
|
||||||
|
driver_gl_klass->prep_gl_for_pixels_download = cogl_texture_driver_gles2_prep_gl_for_pixels_download;
|
||||||
|
driver_gl_klass->gl_get_tex_image = cogl_texture_driver_gles2_gl_get_tex_image;
|
||||||
|
driver_gl_klass->size_supported = cogl_texture_driver_gles2_size_supported;
|
||||||
|
driver_gl_klass->find_best_gl_get_data_format = cogl_texture_driver_gles2_find_best_gl_get_data_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user