summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-07-30 09:10:26 -0600
committerBrian Paul <brianp@vmware.com>2009-07-30 09:10:26 -0600
commit9c9a9abd7b953ec9b6cfc52c2f6981c5d38b1691 (patch)
tree17840dd04e0a5d7612c0b8e1707d21f238c88a99 /src/mesa
parent1e355a0cb36f206e681d1098b425ac541bc80840 (diff)
mesa: simplify _mesa_set_tex_image()
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/teximage.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 6e21066537..6e9073fa9f 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -679,37 +679,14 @@ _mesa_set_tex_image(struct gl_texture_object *tObj,
GLenum target, GLint level,
struct gl_texture_image *texImage)
{
+ const GLuint face = _mesa_tex_target_to_face(target);
+
ASSERT(tObj);
ASSERT(texImage);
- /* XXX simplify this with _mesa_tex_target_to_face() */
- switch (target) {
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- case GL_TEXTURE_1D_ARRAY_EXT:
- case GL_TEXTURE_2D_ARRAY_EXT:
- tObj->Image[0][level] = texImage;
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
- {
- GLuint face = ((GLuint) target -
- (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X);
- tObj->Image[face][level] = texImage;
- }
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- ASSERT(level == 0);
- tObj->Image[0][level] = texImage;
- break;
- default:
- _mesa_problem(NULL, "bad target in _mesa_set_tex_image()");
- return;
- }
+ ASSERT(target != GL_TEXTURE_RECTANGLE_NV || level == 0);
+
+ tObj->Image[face][level] = texImage;
+
/* Set the 'back' pointer */
texImage->TexObject = tObj;
}