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;
continue;
}
- for (i = 0; i < texture_slices(texImage); i++) {
+ slices = texture_slices(texImage);
+
+ for (i = 0; i < slices; i++) {
GLubyte *map;
GLint rowStride;
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;
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;