- Restore texImage->IntFormat.
authorGareth Hughes <gareth@valinux.com>
Wed, 28 Mar 2001 21:36:31 +0000 (21:36 +0000)
committerGareth Hughes <gareth@valinux.com>
Wed, 28 Mar 2001 21:36:31 +0000 (21:36 +0000)
- Fix FX driver texture image conversions.

src/mesa/drivers/glide/fxddtex.c
src/mesa/main/mtypes.h
src/mesa/main/teximage.c
src/mesa/main/texstate.c

index 99af41d..f15fcf8 100644 (file)
@@ -1211,7 +1211,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
       success = GL_FALSE;
    }
    else {
-      success = _mesa_convert_texsubimage2d(mesaTexFormat->IntFormat,
+      success = _mesa_convert_texsubimage2d(mesaTexFormat->MesaFormat,
                                             0, 0, /* xoffset, yoffset */
                                             mml->width, mml->height,
                                             mml->width, /* destImageWidth */
@@ -1256,7 +1256,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
          _mesa_rescale_teximage2d(texFormat,
                                   width, height, mml->width, mml->height,
                                   tempImage, rescaledImage);
-         success = _mesa_convert_texsubimage2d(mesaTexFormat->IntFormat,
+         success = _mesa_convert_texsubimage2d(mesaTexFormat->MesaFormat,
                                             0, 0, /* xoffset, yoffset */
                                             mml->width, mml->height,
                                             mml->width,   /* destImageWidth */
@@ -1267,7 +1267,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
          FREE(rescaledImage);
       }
       else {
-         success = _mesa_convert_texsubimage2d(mesaTexFormat->IntFormat,
+         success = _mesa_convert_texsubimage2d(mesaTexFormat->MesaFormat,
                                             0, 0, /* xoffset, yoffset */
                                             mml->width, mml->height,
                                             mml->width,   /* destImageWidth */
@@ -1326,7 +1326,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
       success = GL_FALSE;
    }
    else {
-      success = _mesa_convert_texsubimage2d(texImage->TexFormat->IntFormat,
+      success = _mesa_convert_texsubimage2d(texImage->TexFormat->MesaFormat,
                                             xoffset, yoffset,
                                             width, height,
                                             mml->width,
@@ -1376,7 +1376,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
          _mesa_rescale_teximage2d(texImage->TexFormat,
                                   width, height, newWidth, newHeight,
                                   tempImage, rescaledImage);
-         success = _mesa_convert_texsubimage2d(texImage->TexFormat->IntFormat,
+         success = _mesa_convert_texsubimage2d(texImage->TexFormat->MesaFormat,
                                             xoffset * wScale, yoffset * hScale,
                                             newWidth, newHeight,
                                             mml->width,   /* destImageWidth */
@@ -1387,13 +1387,13 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
          FREE(rescaledImage);
       }
       else {
-         success = _mesa_convert_texsubimage2d(texImage->TexFormat->IntFormat,
-                                            xoffset, yoffset,
-                                            width, height,
-                                            mml->width,
-                                            simpleFormat, CHAN_TYPE,
-                                            &_mesa_native_packing,
-                                            tempImage, texImage->Data);
+         success = _mesa_convert_texsubimage2d(texImage->TexFormat->MesaFormat,
+                                              xoffset, yoffset,
+                                              width, height,
+                                              mml->width,
+                                              simpleFormat, CHAN_TYPE,
+                                              &_mesa_native_packing,
+                                              tempImage, texImage->Data);
       }
       /* the conversion had better of worked! */
       assert(success);
index 6ecb33d..32bf65c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.34 2001/03/28 20:40:51 gareth Exp $ */
+/* $Id: mtypes.h,v 1.35 2001/03/28 21:36:31 gareth Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -804,6 +804,7 @@ struct gl_texture_image {
                                 * GL_INTENSITY, GL_RGB, GL_RGBA,
                                  * GL_COLOR_INDEX or GL_DEPTH_COMPONENT only.
                                 */
+   GLint IntFormat;            /* Internal format as given by the user */
    GLuint Border;              /* 0 or 1 */
    GLuint Width;               /* = 2^WidthLog2 + 2*Border */
    GLuint Height;              /* = 2^HeightLog2 + 2*Border */
index 4f9e276..d14f577 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.88 2001/03/28 20:40:51 gareth Exp $ */
+/* $Id: teximage.c,v 1.89 2001/03/28 21:36:31 gareth Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -558,6 +558,7 @@ clear_teximage_fields(struct gl_texture_image *img)
 {
    ASSERT(img);
    img->Format = 0;
+   img->IntFormat = 0;
    img->Border = 0;
    img->Width = 0;
    img->Height = 0;
@@ -587,6 +588,7 @@ init_teximage_fields(GLcontext *ctx,
 {
    ASSERT(img);
    img->Format = _mesa_base_tex_format( ctx, internalFormat );
+   img->IntFormat = internalFormat;
    img->Border = border;
    img->Width = width;
    img->Height = height;
@@ -872,7 +874,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
       }
    }
 
-   if (!is_compressed_format(ctx, destTex->TexFormat->IntFormat) &&
+   if (!is_compressed_format(ctx, destTex->IntFormat) &&
        !_mesa_is_legal_format_and_type(format, type)) {
       char message[100];
       sprintf(message, "glTexSubImage%dD(format or type)", dimensions);
index 5e98965..398e23d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.40 2001/03/28 20:40:51 gareth Exp $ */
+/* $Id: texstate.c,v 1.41 2001/03/28 21:36:31 gareth Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -957,7 +957,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          *params = img->Depth;
          return;
       case GL_TEXTURE_INTERNAL_FORMAT:
-         *params = img->TexFormat->IntFormat;
+         *params = img->IntFormat;
          return;
       case GL_TEXTURE_BORDER:
          *params = img->Border;