diff options
author | Dave Airlie <airliedfreedesktop.org> | 2004-06-17 13:42:45 +0000 |
---|---|---|
committer | Dave Airlie <airliedfreedesktop.org> | 2004-06-17 13:42:45 +0000 |
commit | 919498e41c7fd766165db6905ca2f36449d27522 (patch) | |
tree | 2e1d67fb22bbb33adb958e511346581789c59de9 /src/mesa/drivers/dri/i830 | |
parent | 85ffbdd8d7ee03698dabb15db0c479f0d49599b7 (diff) |
Fix up texture compression mipmapping .. not sure if it fixes FXT1 but
with S3TC patch it fixes those
Diffstat (limited to 'src/mesa/drivers/dri/i830')
-rw-r--r-- | src/mesa/drivers/dri/i830/i830_texmem.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i830/i830_texstate.c | 10 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i830/i830_texmem.c b/src/mesa/drivers/dri/i830/i830_texmem.c index 1a5abf5bab7..6a30b496555 100644 --- a/src/mesa/drivers/dri/i830/i830_texmem.c +++ b/src/mesa/drivers/dri/i830/i830_texmem.c @@ -105,17 +105,23 @@ static void i830UploadTexLevel( i830ContextPtr imesa, if (!image || !image->Data) return; - if (image->Width * image->TexFormat->TexelBytes == t->Pitch) { + if (image->IsCompressed) { GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset); GLubyte *src = (GLubyte *)image->Data; - - memcpy( dst, src, t->Pitch * image->Height ); + + if ((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_FXT1) + { + for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) { + __memcpy(dst, src, (image->Width*2) ); + src += image->Width*2; + } + } } - else if (image->IsCompressed) { - GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset); + else if (image->Width * image->TexFormat->TexelBytes == t->Pitch) { + GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset); GLubyte *src = (GLubyte *)image->Data; - memcpy( dst, src, image->CompressedSize ); + memcpy( dst, src, t->Pitch * image->Height ); } else switch (image->TexFormat->TexelBytes) { case 1: diff --git a/src/mesa/drivers/dri/i830/i830_texstate.c b/src/mesa/drivers/dri/i830/i830_texstate.c index 6b8193c9246..d5440141bfe 100644 --- a/src/mesa/drivers/dri/i830/i830_texstate.c +++ b/src/mesa/drivers/dri/i830/i830_texstate.c @@ -159,8 +159,16 @@ static void i830SetTexImages( i830ContextPtr imesa, break; t->image[0][i].offset = total_height * pitch; + if (t->image[0][i].image->IsCompressed) + { + if (t->image[0][i].image->Height > 4) + total_height += t->image[0][i].image->Height/4; + else + total_height += 1; + } + else + total_height += t->image[0][i].image->Height; t->image[0][i].internalFormat = baseImage->Format; - total_height += t->image[0][i].image->Height; } t->Pitch = pitch; |