summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordok666 <dok666>2003-05-26 13:31:16 +0000
committerdok666 <dok666>2003-05-26 13:31:16 +0000
commite750ce4e96a4ac8efe7a1f8d9d55ba73666238ba (patch)
tree61ad799b5e6bbca21f3563b1d851aea56e84a271
parent9467e7e226811cd6327cfd047fead99023c650b9 (diff)
Applied patch from Ville Syrjälä <syrjala@sci.fi>, thanks.
Fix tpitch when firstLevel > baseLevel. There was some inconsistency with dirty_images[0]. In some cases it referred to the actual level and to the hw level in others. I changed it so that it uses the actual level. I also changed the way mgaUploadSubImage() is called. Now it's only called for the levels that are actually used. This got rid of all those ugly "Image[n] = NULL" warnings.
-rw-r--r--src/mesa/drivers/dri/mga/mga_texstate.c6
-rw-r--r--src/mesa/drivers/dri/mga/mgatexmem.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c
index 925cdc515a9..ff37f48bb13 100644
--- a/src/mesa/drivers/dri/mga/mga_texstate.c
+++ b/src/mesa/drivers/dri/mga/mga_texstate.c
@@ -131,7 +131,7 @@ mgaSetTexImages( mgaContextPtr mmesa,
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)
@@ -140,7 +140,7 @@ mgaSetTexImages( mgaContextPtr mmesa,
}
t->offsets[i] = totalSize;
- t->base.dirty_images[0] |= (1<<i);
+ t->base.dirty_images[0] |= (1<<(i+firstLevel));
totalSize += ((MAX2( texImage->Width, 8 ) *
MAX2( texImage->Height, 8 ) *
@@ -168,7 +168,7 @@ mgaSetTexImages( mgaContextPtr mmesa,
*/
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
diff --git a/src/mesa/drivers/dri/mga/mgatexmem.c b/src/mesa/drivers/dri/mga/mgatexmem.c
index cfb79f3a1c2..70a311323a3 100644
--- a/src/mesa/drivers/dri/mga/mgatexmem.c
+++ b/src/mesa/drivers/dri/mga/mgatexmem.c
@@ -89,13 +89,13 @@ mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t )
* been hardware accelerated.
*/
static void mgaUploadSubImage( mgaContextPtr mmesa,
- mgaTextureObjectPtr t, GLint hwlevel )
+ mgaTextureObjectPtr t, GLint level )
{
struct gl_texture_image * texImage;
unsigned offset;
unsigned texelBytes;
unsigned length;
- const int level = hwlevel + t->firstLevel;
+ const int hwlevel = level - t->firstLevel;
if ( (hwlevel < 0)
@@ -265,7 +265,7 @@ int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t )
fprintf(stderr, "[%s:%d] dirty_images[0] = 0x%04x\n",
__FILE__, __LINE__, t->base.dirty_images[0] );
- for (i = 0 ; i <= t->lastLevel ; i++) {
+ for (i = t->firstLevel ; i <= t->lastLevel ; i++) {
if ( (t->base.dirty_images[0] & (1U << i)) != 0 ) {
mgaUploadSubImage( mmesa, t, i );
}