check for pixels=NULL in _mesa_store_teximage[123]d()
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 23 Jul 2001 16:07:12 +0000 (16:07 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Mon, 23 Jul 2001 16:07:12 +0000 (16:07 +0000)
src/mesa/main/texstore.c

index c71ef96631813c15eb1a6868bffa5813eeb68e45..480ad07232c557cfe806bdd46f9cdb8a255d8853 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: texstore.c,v 1.32 2001/07/16 15:54:23 brianp Exp $ */
+/* $Id: texstore.c,v 1.33 2001/07/23 16:07:12 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -651,18 +651,22 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
       return;
    }
 
-   /* unpack image, apply transfer ops and store in texImage->Data */
-   _mesa_transfer_teximage(ctx, 1, _mesa_base_tex_format(ctx, internalFormat),
-                           texImage->TexFormat, texImage->Data,
-                           width, 1, 1, 0, 0, 0,
-                           0, /* dstRowStride */
-                           0, /* dstImageStride */
-                           format, type, pixels, packing);
-
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+   if (pixels) {
+      /* unpack image, apply transfer ops and store in texImage->Data */
+      _mesa_transfer_teximage(ctx, 1,
+                              _mesa_base_tex_format(ctx, internalFormat),
+                              texImage->TexFormat, texImage->Data,
+                              width, 1, 1, 0, 0, 0,
+                              0, /* dstRowStride */
+                              0, /* dstImageStride */
+                              format, type, pixels, packing);
+
+      /* GL_SGIS_generate_mipmap */
+      if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+         _mesa_generate_mipmap(ctx,
+                               &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                               texObj);
+      }
    }
 }
 
@@ -720,18 +724,22 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
       return;
    }
 
-   /* unpack image, apply transfer ops and store in texImage->Data */
-   _mesa_transfer_teximage(ctx, 2, _mesa_base_tex_format(ctx, internalFormat),
-                           texImage->TexFormat, texImage->Data,
-                           width, height, 1, 0, 0, 0,
-                           texImage->Width * texelBytes,
-                           0, /* dstImageStride */
-                           format, type, pixels, packing);
-
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+   if (pixels) {
+      /* unpack image, apply transfer ops and store in texImage->Data */
+      _mesa_transfer_teximage(ctx, 2,
+                              _mesa_base_tex_format(ctx, internalFormat),
+                              texImage->TexFormat, texImage->Data,
+                              width, height, 1, 0, 0, 0,
+                              texImage->Width * texelBytes,
+                              0, /* dstImageStride */
+                              format, type, pixels, packing);
+
+      /* GL_SGIS_generate_mipmap */
+      if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+         _mesa_generate_mipmap(ctx,
+                               &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                               texObj);
+      }
    }
 }
 
@@ -782,18 +790,22 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
       return;
    }
 
-   /* unpack image, apply transfer ops and store in texImage->Data */
-   _mesa_transfer_teximage(ctx, 3, _mesa_base_tex_format(ctx, internalFormat),
-                           texImage->TexFormat, texImage->Data,
-                           width, height, depth, 0, 0, 0,
-                           texImage->Width * texelBytes,
-                           texImage->Width * texImage->Height * texelBytes,
-                           format, type, pixels, packing);
-
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+   if (pixels) {
+      /* unpack image, apply transfer ops and store in texImage->Data */
+      _mesa_transfer_teximage(ctx, 3,
+                              _mesa_base_tex_format(ctx, internalFormat),
+                              texImage->TexFormat, texImage->Data,
+                              width, height, depth, 0, 0, 0,
+                              texImage->Width * texelBytes,
+                              texImage->Width * texImage->Height * texelBytes,
+                              format, type, pixels, packing);
+
+      /* GL_SGIS_generate_mipmap */
+      if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+         _mesa_generate_mipmap(ctx,
+                               &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                               texObj);
+      }
    }
 }