On Mon, Jul 21, 2003 at 07:54:31AM -0700, Ian Romanick wrote:
>  The driTextureObject represents what's going 
> on in the hardware, and the Mesa gl_texture_object represents what's 
> going on in OpenGL.

Ok I've attached a new patch which makes dirty_images[0] work on hwlevels.
Is this more to your liking?


> The problem with the glean texEnv test is that, by it's own admission, 
> it only hits a very small subset of the possible cases.  One of the 
> things that it does, IIRC, is only test RGB and RGBA as texture base 
> formats.  I don't think it hits L, I, AL, or A textures at all.  If 
> demos/texenv looks good, then it's a good bet that things are okay.
> 
> I don't think that too many of these other texture base formats are used 
> that often.  It will probably be difficult to find a "real world" test.

Just found one for GL_ALPHA: Freespace2. I got really scared when it
didn't work like it should but then I realised that there was a problem
with hw.alpha_sel. Once it was set to diffused it was never reset to 
fromtex.

-- 
Ville Syrj�l�
[EMAIL PROTECTED]
http://www.sci.fi/~syrjala/
cvs server: Diffing .
Index: mga_texstate.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/mga/mga_texstate.c,v
retrieving revision 1.6
diff -u -r1.6 mga_texstate.c
--- mga_texstate.c      22 Jul 2003 04:54:31 -0000      1.6
+++ mga_texstate.c      23 Jul 2003 13:22:46 -0000
@@ -131,7 +131,7 @@
 
    totalSize = 0;
    for ( i = 0 ; i < numLevels ; i++ ) {
-      const struct gl_texture_image * const texImage = tObj->Image[i];
+      const struct gl_texture_image * const texImage = tObj->Image[i+firstLevel];
 
       if ( (texImage == NULL)
           || ((i != 0)
@@ -168,7 +168,7 @@
     */
 
    t->setup.texctl |= TMC_tpitchlin_enable;
-   t->setup.texctl |= (baseImage->Width & (2048 - 1)) << TMC_tpitchext_SHIFT;
+   t->setup.texctl |= (width & (2048 - 1)) << TMC_tpitchext_SHIFT;
 
 
    /* G400 specifies the number of mip levels in a strange way.  Since there
Index: mgatex.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/mga/mgatex.c,v
retrieving revision 1.45
diff -u -r1.45 mgatex.c
--- mgatex.c    27 May 2003 20:49:33 -0000      1.45
+++ mgatex.c    23 Jul 2003 13:22:48 -0000
@@ -386,7 +386,10 @@
    _mesa_store_teximage2d( ctx, target, level, internalFormat,
                           width, height, border, format, type,
                           pixels, packing, texObj, texImage );
-   t->dirty_images[0] |= (1UL << level);
+
+   level -= t->firstLevel;
+   if (level >= 0)
+      t->dirty_images[0] |= (1UL << level);
 }
 
 static void mgaTexSubImage2D( GLcontext *ctx, 
@@ -418,7 +421,10 @@
    _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width, 
                             height, format, type, pixels, packing, texObj,
                             texImage);
-   t->dirty_images[0] |= (1UL << level);
+
+   level -= t->firstLevel;
+   if (level >= 0)
+      t->dirty_images[0] |= (1UL << level);
 }
 
 
Index: mgatexmem.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c,v
retrieving revision 1.17
diff -u -r1.17 mgatexmem.c
--- mgatexmem.c 22 Jul 2003 04:54:31 -0000      1.17
+++ mgatexmem.c 23 Jul 2003 13:22:48 -0000
@@ -79,7 +79,7 @@
  * 
  * \param mmesa  Driver context.
  * \param t      Texture to be uploaded.
- * \param level  Mipmap level of the texture to be uploaded.
+ * \param hwlevel Mipmap level of the texture to be uploaded.
  * 
  * \bug As mentioned above, this fuction actually copies the entier mipmap
  *      level.  There should be a version of this function that performs
@@ -261,11 +261,13 @@
       mgaWaitAgeLocked( mmesa, mmesa->dirtyAge );
 
    if (t->base.dirty_images[0]) {
+      const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
+
       if (MGA_DEBUG&DEBUG_VERBOSE_TEXTURE)
         fprintf(stderr, "[%s:%d] dirty_images[0] = 0x%04x\n",
                 __FILE__, __LINE__, t->base.dirty_images[0] );
 
-      for (i = 0 ; i <= t->base.lastLevel ; i++) {
+      for (i = 0 ; i < numLevels ; i++) {
         if ( (t->base.dirty_images[0] & (1U << i)) != 0 ) {
            mgaUploadSubImage( mmesa, t, i );
         }
cvs server: Diffing X86

Reply via email to