diff options
author | Brian Paul <[email protected]> | 2012-06-05 16:32:23 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-06-06 07:55:59 -0600 |
commit | e42d00b3f4503a0840575c8e5f4517a66c8af613 (patch) | |
tree | c8248d3f0b7bd95fec33d405ce25dc566df8c8b7 /src/mesa/main | |
parent | 8f5fffe75d2f8ae7c7ee706b53379a25bc673ae4 (diff) |
mesa: consolidate internal glTexSubImage1/2/3D code
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/dd.h | 45 | ||||
-rw-r--r-- | src/mesa/main/mipmap.c | 8 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 24 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 50 | ||||
-rw-r--r-- | src/mesa/main/texstore.h | 29 |
5 files changed, 31 insertions, 125 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 711143c5594..c7984177d7f 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -213,44 +213,17 @@ struct dd_function_table { GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing); - /** - * Called by glTexSubImage1D(). Replace a subset of the target texture - * with new texel data. - * \sa dd_function_table::TexImage1D. + * Called by glTexSubImage[123]D(). + * Replace a subset of the target texture with new texel data. */ - void (*TexSubImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage2D(). - * - * \sa dd_function_table::TexSubImage1D. - */ - void (*TexSubImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage3D(). - * - * \sa dd_function_table::TexSubImage1D. - */ - void (*TexSubImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLint depth, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); + void (*TexSubImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index abd26b8d3c8..250d3c6dcf9 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -2133,10 +2133,10 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, } /* The image space was allocated above so use glTexSubImage now */ - ctx->Driver.TexSubImage2D(ctx, dstImage, - 0, 0, dstWidth, dstHeight, - temp_base_format, temp_datatype, - temp_dst, &ctx->DefaultPacking); + ctx->Driver.TexSubImage(ctx, 2, dstImage, + 0, 0, 0, dstWidth, dstHeight, 1, + temp_base_format, temp_datatype, + temp_dst, &ctx->DefaultPacking); /* swap src and dest pointers */ { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 5bb21cd80a8..e8353463758 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2792,26 +2792,10 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, xoffset += texImage->Border; } - switch (dims) { - case 1: - ctx->Driver.TexSubImage1D(ctx, texImage, - xoffset, width, - format, type, pixels, &ctx->Unpack); - break; - case 2: - ctx->Driver.TexSubImage2D(ctx, texImage, - xoffset, yoffset, width, height, - format, type, pixels, &ctx->Unpack); - break; - case 3: - ctx->Driver.TexSubImage3D(ctx, texImage, - xoffset, yoffset, zoffset, - width, height, depth, - format, type, pixels, &ctx->Unpack); - break; - default: - _mesa_problem(ctx, "unexpected dims in subteximage()"); - } + ctx->Driver.TexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels, &ctx->Unpack); check_gen_mipmap(ctx, target, texObj, level); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 1aa79625287..ce8f36bfc2f 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -4293,53 +4293,19 @@ _mesa_store_teximage(struct gl_context *ctx, /* - * This is the fallback for Driver.TexSubImage1D(). + * Fallback for Driver.TexSubImage(). */ void -_mesa_store_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint width, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ - store_texsubimage(ctx, texImage, - xoffset, 0, 0, width, 1, 1, - format, type, pixels, packing, "glTexSubImage1D"); -} - - - -/** - * This is the fallback for Driver.TexSubImage2D(). - */ -void -_mesa_store_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLint width, GLint height, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ - store_texsubimage(ctx, texImage, - xoffset, yoffset, 0, width, height, 1, - format, type, pixels, packing, "glTexSubImage2D"); -} - - -/* - * This is the fallback for Driver.TexSubImage3D(). - */ -void -_mesa_store_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint width, GLint height, GLint depth, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) +_mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, const void *pixels, + const struct gl_pixelstore_attrib *packing) { store_texsubimage(ctx, texImage, xoffset, yoffset, zoffset, width, height, depth, - format, type, pixels, packing, "glTexSubImage3D"); + format, type, pixels, packing, "glTexSubImage"); } diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index b4995fbc898..e6eb2fb4811 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -100,29 +100,12 @@ _mesa_store_teximage(struct gl_context *ctx, extern void -_mesa_store_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint width, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - -extern void -_mesa_store_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLint width, GLint height, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - -extern void -_mesa_store_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint width, GLint height, GLint depth, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); +_mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); extern void |