diff options
author | Brian Paul <[email protected]> | 2014-04-23 09:59:55 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2014-04-24 08:16:01 -0600 |
commit | 0a92c88a51f8719ac256e93968ff8a3e3723a81d (patch) | |
tree | d45560d6f822bdf2ea3c5eaef120c5285462378c /src/mesa/swrast/s_texture.c | |
parent | 1a7fa8b2ebad2e07f57a430c8c77558bb07b0151 (diff) |
swrast: move texture_slices() calls out of loops
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/swrast/s_texture.c')
-rw-r--r-- | src/mesa/swrast/s_texture.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 9273e94f94b..5fd80ca4d83 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -269,7 +269,7 @@ _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj) for (level = texObj->BaseLevel; level < MAX_TEXTURE_LEVELS; level++) { struct gl_texture_image *texImage = texObj->Image[face][level]; struct swrast_texture_image *swImage = swrast_texture_image(texImage); - unsigned int i; + unsigned int i, slices; if (!texImage) continue; @@ -289,7 +289,9 @@ _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj) continue; } - for (i = 0; i < texture_slices(texImage); i++) { + slices = texture_slices(texImage); + + for (i = 0; i < slices; i++) { GLubyte *map; GLint rowStride; @@ -327,7 +329,7 @@ _swrast_unmap_texture(struct gl_context *ctx, struct gl_texture_object *texObj) for (level = texObj->BaseLevel; level < MAX_TEXTURE_LEVELS; level++) { struct gl_texture_image *texImage = texObj->Image[face][level]; struct swrast_texture_image *swImage = swrast_texture_image(texImage); - unsigned int i; + unsigned int i, slices; if (!texImage) continue; @@ -338,7 +340,9 @@ _swrast_unmap_texture(struct gl_context *ctx, struct gl_texture_object *texObj) if (!swImage->ImageSlices) continue; - for (i = 0; i < texture_slices(texImage); i++) { + slices = texture_slices(texImage); + + for (i = 0; i < slices; i++) { if (swImage->ImageSlices[i]) { ctx->Driver.UnmapTextureImage(ctx, texImage, i); swImage->ImageSlices[i] = NULL; |