From 92c64624cd7533cde466dbec8722f7f72f275fd8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Dec 2011 08:24:55 -0700 Subject: mesa: simplify Driver.TexImage() parameters As with TexSubImage(), the target, level and texObj values can be obtained through the texImage pointer. Reviewed-by: Chad Versace Reviewed-by: Eric Anholt --- src/mesa/main/dd.h | 42 +++++++++++++++++++----------------------- src/mesa/main/teximage.c | 23 ++++++++++------------- src/mesa/main/texobj.c | 4 ++-- src/mesa/main/texstore.c | 21 +++++++++------------ src/mesa/main/texstore.h | 21 +++++++++------------ 5 files changed, 49 insertions(+), 62 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 5226a6811cf..05e6d354d3c 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -203,42 +203,38 @@ struct dd_function_table { * fully initialized. * The parameters are the same as glTexImage1D(), plus: * \param packing describes how to unpack the source data. - * \param texObj is the target texture object. - * \param texImage is the target texture image. + * \param texImage is the destination texture image. */ - void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexImage1D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** * Called by glTexImage2D(). * * \sa dd_function_table::TexImage1D. */ - void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexImage2D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** * Called by glTexImage3D(). * * \sa dd_function_table::TexImage1D. */ - void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexImage3D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** * Called by glTexSubImage1D(). Replace a subset of the target texture diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index ad7a1ea0c8d..3dfe6dffef9 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2481,22 +2481,19 @@ teximage(struct gl_context *ctx, GLuint dims, ASSERT(ctx->Driver.TexImage3D); switch (dims) { case 1: - ctx->Driver.TexImage1D(ctx, target, level, internalFormat, + ctx->Driver.TexImage1D(ctx, texImage, internalFormat, width, border, format, - type, pixels, unpack, texObj, - texImage); + type, pixels, unpack); break; case 2: - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, + ctx->Driver.TexImage2D(ctx, texImage, internalFormat, width, height, border, format, - type, pixels, unpack, texObj, - texImage); + type, pixels, unpack); break; case 3: - ctx->Driver.TexImage3D(ctx, target, level, internalFormat, + ctx->Driver.TexImage3D(ctx, texImage, internalFormat, width, height, depth, border, format, - type, pixels, unpack, texObj, - texImage); + type, pixels, unpack); break; default: _mesa_problem(ctx, "invalid dims=%u in teximage()", dims); @@ -2820,14 +2817,14 @@ copyteximage(struct gl_context *ctx, GLuint dims, /* Allocate texture memory (no pixel data yet) */ if (dims == 1) { - ctx->Driver.TexImage1D(ctx, target, level, internalFormat, + ctx->Driver.TexImage1D(ctx, texImage, internalFormat, width, border, GL_NONE, GL_NONE, NULL, - &ctx->Unpack, texObj, texImage); + &ctx->Unpack); } else { - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, + ctx->Driver.TexImage2D(ctx, texImage, internalFormat, width, height, border, GL_NONE, GL_NONE, - NULL, &ctx->Unpack, texObj, texImage); + NULL, &ctx->Unpack); } if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY, diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 8e447cabdd4..425cb5d84fd 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -799,10 +799,10 @@ _mesa_get_fallback_texture(struct gl_context *ctx) ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); /* set image data */ - ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA, + ctx->Driver.TexImage2D(ctx, texImage, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, texels, - &ctx->DefaultPacking, texObj, texImage); + &ctx->DefaultPacking); _mesa_test_texobj_completeness(ctx, texObj); assert(texObj->_Complete); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index e97178dc8b5..5e18b8a1b88 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -4698,13 +4698,12 @@ store_texsubimage(struct gl_context *ctx, * This is the fallback for Driver.TexImage1D(). */ void -_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { if (width == 0) return; @@ -4726,13 +4725,12 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, * This is the fallback for Driver.TexImage2D(). */ void -_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { if (width == 0 || height == 0) return; @@ -4755,13 +4753,12 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, * This is the fallback for Driver.TexImage3D(). */ void -_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { if (width == 0 || height == 0 || depth == 0) return; diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 83826ce97e0..2a9b17743a5 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -91,33 +91,30 @@ _mesa_make_temp_float_image(struct gl_context *ctx, GLuint dims, GLbitfield transferOps); extern void -_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -- cgit v1.2.3