summaryrefslogtreecommitdiff
path: root/cogl/cogl-texture-3d.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-03-22 16:32:56 +0000
committerNeil Roberts <neil@linux.intel.com>2012-03-23 13:51:08 +0000
commit60812e6a0e29c8d7b149024c65dec2f4e3349a02 (patch)
treea2886abfddfa4c63b9039599fbcfc380721515e0 /cogl/cogl-texture-3d.c
parentccb67927815fbc74c6ba9c1e4e77a56154f90f22 (diff)
downloadcogl-60812e6a0e29c8d7b149024c65dec2f4e3349a02.tar.gz
Add a vtable for the driver
Cogl already had a vtable for the texture driver. This ended up being used for some things that are not strictly related to texturing such as converting between pixel formats and GL enums. Some other functions that are driver dependent such as updating the features were not indirected through a vtable but instead switched directly by looking at the ctx->driver enum value. This patch normalises to the two uses by adding a separate vtable for driver functions not related to texturing and moves the pixel format conversion functions to it from the texture driver vtable. It also adds a context parameter to all of the functions in the new driver vtable so that they won't have to rely on the global context.
Diffstat (limited to 'cogl/cogl-texture-3d.c')
-rw-r--r--cogl/cogl-texture-3d.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c
index 8662d5af..e33c248d 100644
--- a/cogl/cogl-texture-3d.c
+++ b/cogl/cogl-texture-3d.c
@@ -167,10 +167,11 @@ _cogl_texture_3d_can_create (CoglContext *ctx,
return FALSE;
}
- ctx->texture_driver->pixel_format_to_gl (internal_format,
- &gl_intformat,
- NULL,
- &gl_type);
+ ctx->driver_vtable->pixel_format_to_gl (ctx,
+ internal_format,
+ &gl_intformat,
+ NULL,
+ &gl_type);
/* Check that the driver can create a texture with that size */
if (!ctx->texture_driver->size_supported_3d (GL_TEXTURE_3D,
@@ -213,10 +214,11 @@ cogl_texture_3d_new_with_size (CoglContext *ctx,
error))
return NULL;
- internal_format = ctx->texture_driver->pixel_format_to_gl (internal_format,
- &gl_intformat,
- &gl_format,
- &gl_type);
+ internal_format = ctx->driver_vtable->pixel_format_to_gl (ctx,
+ internal_format,
+ &gl_intformat,
+ &gl_format,
+ &gl_type);
tex_3d = _cogl_texture_3d_create_base (ctx,
width, height, depth,