aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-06-05 16:32:23 -0600
committerBrian Paul <[email protected]>2012-06-06 07:55:59 -0600
commit8f5fffe75d2f8ae7c7ee706b53379a25bc673ae4 (patch)
tree03874713de5f5f611a8d6f7569b658a5ce3f9700 /src/mesa/main/teximage.c
parent3a62e8bcac75ca296619adb7fe4ea806a98beef9 (diff)
mesa: consolidate internal glTexImage1/2/3D code
The functions for handling 1D, 2D and 3D texture images were nearly identical. This folds them all together. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 694f6fa0010..5bb21cd80a8 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2606,26 +2606,9 @@ teximage(struct gl_context *ctx, GLuint dims,
border, internalFormat, texFormat);
/* Give the texture to the driver. <pixels> may be null. */
- ASSERT(ctx->Driver.TexImage3D);
- switch (dims) {
- case 1:
- ctx->Driver.TexImage1D(ctx, texImage, internalFormat,
- width, border, format,
- type, pixels, unpack);
- break;
- case 2:
- ctx->Driver.TexImage2D(ctx, texImage, internalFormat,
- width, height, border, format,
- type, pixels, unpack);
- break;
- case 3:
- ctx->Driver.TexImage3D(ctx, texImage, internalFormat,
- width, height, depth, border, format,
- type, pixels, unpack);
- break;
- default:
- _mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
- }
+ ctx->Driver.TexImage(ctx, dims, texImage, internalFormat,
+ width, height, depth, border, format,
+ type, pixels, unpack);
check_gen_mipmap(ctx, target, texObj, level);
@@ -2968,16 +2951,9 @@ copyteximage(struct gl_context *ctx, GLuint dims,
border, internalFormat, texFormat);
/* Allocate texture memory (no pixel data yet) */
- if (dims == 1) {
- ctx->Driver.TexImage1D(ctx, texImage, internalFormat,
- width, border, GL_NONE, GL_NONE, NULL,
- &ctx->Unpack);
- }
- else {
- ctx->Driver.TexImage2D(ctx, texImage, internalFormat,
- width, height, border, GL_NONE, GL_NONE,
- NULL, &ctx->Unpack);
- }
+ ctx->Driver.TexImage(ctx, dims, texImage, internalFormat,
+ width, height, 1, border, GL_NONE, GL_NONE,
+ NULL, &ctx->Unpack);
if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
&width, &height)) {