summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/swrast/s_texture.c12
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;