summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2017-07-05 14:48:33 -0600
committerBrian Paul <[email protected]>2017-07-06 16:33:57 -0600
commit7cc6ee56c657782fe218aaf3dbc46905f4663c21 (patch)
treee2d764f8d476664d475981526909196830e74bde /src/mesa
parentf3a608d9f924187ce4452d86cf7ec7b94d9e0f02 (diff)
mesa: simplify get_tex_images_for_clear()
Get rid of redundant code. Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/teximage.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 7b5df54ca15..5e13025ed1b 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4378,7 +4378,7 @@ get_tex_images_for_clear(struct gl_context *ctx,
struct gl_texture_image **texImages)
{
GLenum target;
- int i;
+ int numFaces, i;
if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid level)", function);
@@ -4386,28 +4386,23 @@ get_tex_images_for_clear(struct gl_context *ctx,
}
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
- for (i = 0; i < MAX_FACES; i++) {
- target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
-
- texImages[i] = _mesa_select_tex_image(texObj, target, level);
- if (texImages[i] == NULL) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(invalid level)", function);
- return 0;
- }
- }
-
- return MAX_FACES;
+ target = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+ numFaces = MAX_FACES;
+ }
+ else {
+ target = texObj->Target;
+ numFaces = 1;
}
- texImages[0] = _mesa_select_tex_image(texObj, texObj->Target, level);
-
- if (texImages[0] == NULL) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid level)", function);
- return 0;
+ for (i = 0; i < numFaces; i++) {
+ texImages[i] = _mesa_select_tex_image(texObj, target + i, level);
+ if (texImages[i] == NULL) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid level)", function);
+ return 0;
+ }
}
- return 1;
+ return numFaces;
}
void GLAPIENTRY