[g3dvl] move z-coord generation for multiple render targets into vertex shader
[mesa.git] / src / mesa / drivers / dri / unichrome / via_tex.c
index 01cb3ebbc8811a4e85101f5df4c0e1d74beb9660..18fb8f33b9fedd20d7b364eaea3e80f4a91dfc88 100644 (file)
@@ -31,7 +31,6 @@
 #include "main/mtypes.h"
 #include "main/enums.h"
 #include "main/formats.h"
-#include "main/colortab.h"
 #include "main/context.h"
 #include "main/mipmap.h"
 #include "main/mm.h"
@@ -46,7 +45,7 @@
 #include "via_3d_reg.h"
 
 static gl_format
-viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
+viaChooseTexFormat( struct gl_context *ctx, GLint internalFormat,
                    GLenum format, GLenum type )
 {
    struct via_context *vmesa = VIA_CONTEXT(ctx);
@@ -438,7 +437,7 @@ GLboolean viaSwapOutWork( struct via_context *vmesa )
 /* Basically, just collect the image dimensions and addresses for each
  * image and update the texture object state accordingly.
  */
-static GLboolean viaSetTexImages(GLcontext *ctx,
+static GLboolean viaSetTexImages(struct gl_context *ctx,
                                 struct gl_texture_object *texObj)
 {
    struct via_context *vmesa = VIA_CONTEXT(ctx);
@@ -625,7 +624,7 @@ static GLboolean viaSetTexImages(GLcontext *ctx,
 }
 
 
-GLboolean viaUpdateTextureState( GLcontext *ctx )
+GLboolean viaUpdateTextureState( struct gl_context *ctx )
 {
    struct gl_texture_unit *texUnit = ctx->Texture.Unit;
    GLuint i;
@@ -652,7 +651,7 @@ GLboolean viaUpdateTextureState( GLcontext *ctx )
                                 
 
 
-static void viaTexImage(GLcontext *ctx, 
+static void viaTexImage(struct gl_context *ctx, 
                        GLint dims,
                        GLenum target, GLint level,
                        GLint internalFormat,
@@ -663,6 +662,8 @@ static void viaTexImage(GLcontext *ctx,
                        struct gl_texture_image *texImage)
 {
    struct via_context *vmesa = VIA_CONTEXT(ctx);
+   GLint postConvWidth = width;
+   GLint postConvHeight = height;
    GLint texelBytes, sizeInBytes;
    struct via_texture_object *viaObj = (struct via_texture_object *)texObj;
    struct via_texture_image *viaImage = (struct via_texture_image *)texImage;
@@ -682,13 +683,13 @@ static void viaTexImage(GLcontext *ctx,
    texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
 
    /* Minimum pitch of 32 bytes */
-   if (width * texelBytes < 32) {
-      width = 32 / texelBytes;
-      texImage->RowStride = width;
+   if (postConvWidth * texelBytes < 32) {
+      postConvWidth = 32 / texelBytes;
+      texImage->RowStride = postConvWidth;
    }
 
-   assert(texImage->RowStride == width);
-   viaImage->pitchLog2 = logbase2(width * texelBytes);
+   assert(texImage->RowStride == postConvWidth);
+   viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes);
 
    /* allocate memory */
    if (_mesa_is_format_compressed(texImage->TexFormat))
@@ -697,7 +698,7 @@ static void viaTexImage(GLcontext *ctx,
                                             texImage->Height,
                                             texImage->Depth);
    else
-      sizeInBytes = width * height * texelBytes;
+      sizeInBytes = postConvWidth * postConvHeight * texelBytes;
 
 
    /* Attempt to allocate texture memory directly, otherwise use main
@@ -778,7 +779,7 @@ static void viaTexImage(GLcontext *ctx,
          dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
       }
       else {
-         dstRowStride = width * _mesa_get_format_bytes(texImage->TexFormat);
+         dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat);
       }
       success = _mesa_texstore(ctx, dims,
                                texImage->_BaseFormat,
@@ -797,7 +798,7 @@ static void viaTexImage(GLcontext *ctx,
    _mesa_unmap_teximage_pbo(ctx, packing);
 }
 
-static void viaTexImage2D(GLcontext *ctx, 
+static void viaTexImage2D(struct gl_context *ctx, 
                          GLenum target, GLint level,
                          GLint internalFormat,
                          GLint width, GLint height, GLint border,
@@ -812,7 +813,7 @@ static void viaTexImage2D(GLcontext *ctx,
                packing, texObj, texImage );
 }
 
-static void viaTexSubImage2D(GLcontext *ctx,
+static void viaTexSubImage2D(struct gl_context *ctx,
                              GLenum target,
                              GLint level,
                              GLint xoffset, GLint yoffset,
@@ -833,7 +834,7 @@ static void viaTexSubImage2D(GLcontext *ctx,
                             texImage);
 }
 
-static void viaTexImage1D(GLcontext *ctx, 
+static void viaTexImage1D(struct gl_context *ctx, 
                          GLenum target, GLint level,
                          GLint internalFormat,
                          GLint width, GLint border,
@@ -848,7 +849,7 @@ static void viaTexImage1D(GLcontext *ctx,
                packing, texObj, texImage );
 }
 
-static void viaTexSubImage1D(GLcontext *ctx,
+static void viaTexSubImage1D(struct gl_context *ctx,
                              GLenum target,
                              GLint level,
                              GLint xoffset,
@@ -871,7 +872,7 @@ static void viaTexSubImage1D(GLcontext *ctx,
 
 
 
-static GLboolean viaIsTextureResident(GLcontext *ctx,
+static GLboolean viaIsTextureResident(struct gl_context *ctx,
                                       struct gl_texture_object *texObj)
 {
    struct via_texture_object *viaObj = 
@@ -883,14 +884,14 @@ static GLboolean viaIsTextureResident(GLcontext *ctx,
 
 
 
-static struct gl_texture_image *viaNewTextureImage( GLcontext *ctx )
+static struct gl_texture_image *viaNewTextureImage( struct gl_context *ctx )
 {
    (void) ctx;
    return (struct gl_texture_image *)CALLOC_STRUCT(via_texture_image);
 }
 
 
-static struct gl_texture_object *viaNewTextureObject( GLcontext *ctx, 
+static struct gl_texture_object *viaNewTextureObject( struct gl_context *ctx, 
                                                      GLuint name, 
                                                      GLenum target )
 {
@@ -905,7 +906,7 @@ static struct gl_texture_object *viaNewTextureObject( GLcontext *ctx,
 }
 
 
-static void viaFreeTextureImageData( GLcontext *ctx, 
+static void viaFreeTextureImageData( struct gl_context *ctx, 
                                     struct gl_texture_image *texImage )
 {
    struct via_context *vmesa = VIA_CONTEXT(ctx);
@@ -950,7 +951,6 @@ void viaInitTextureFuncs(struct dd_function_table * functions)
    functions->TextureMemCpy = memcpy;
 #endif
 
-   functions->UpdateTexturePalette = 0;
    functions->IsTextureResident = viaIsTextureResident;
 }