From 20ccd1466fc3de129b9b2a3eb4ab35023200afac Mon Sep 17 00:00:00 2001 From: Peter Zubaj Date: Tue, 26 Jun 2007 19:36:35 +0200 Subject: [PATCH] Disable MACRO tiling, it has problems with DXT1. --- src/mesa/drivers/dri/r300/r300_texmem.c | 1 + src/mesa/drivers/dri/r300/r300_texstate.c | 30 +++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c index 7853f77..7c2d9f8 100644 --- a/src/mesa/drivers/dri/r300/r300_texmem.c +++ b/src/mesa/drivers/dri/r300/r300_texmem.c @@ -403,6 +403,7 @@ static void r300UploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t, } else { char *buf = region.address + region.start; int i; + for (i = 0; i < lines; i++) { memcpy(buf, tex, src_pitch); buf += dst_pitch; diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index d753053..13b7775 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -142,7 +142,7 @@ static void r300SetTexImages(r300ContextPtr rmesa, GLint i, texelBytes; GLint numLevels; GLint log2Width, log2Height, log2Depth; - + /* Set the hardware texture format */ if (!t->image_override @@ -174,21 +174,25 @@ static void r300SetTexImages(r300ContextPtr rmesa, */ curOffset = 0; t->tile_bits = 0; + + /* FIXME - only micro tiling s used - macro has problems */ /* figure out if this texture is suitable for tiling. */ if (texelBytes) { if (tObj->Target != GL_TEXTURE_RECTANGLE_NV) /* use tiling for all pot textures */ - t->tile_bits |= R300_TXO_MACRO_TILE | R300_TXO_MICRO_TILE; + t->tile_bits |= /*R300_TXO_MACRO_TILE |*/ R300_TXO_MICRO_TILE; + else + t->tile_bits |= R300_TXO_MICRO_TILE; } else if (tObj->Image[0][t->base.firstLevel]->IsCompressed) { /* use micro tiling only for DXT1 */ if ((t->format & R300_TX_FORMAT_DXT1) == R300_TX_FORMAT_DXT1) t->tile_bits |= R300_TXO_MICRO_TILE; /* we can set macro tiling even for small textures, they will be untiled anyway */ - t->tile_bits |= R300_TXO_MACRO_TILE; + /* t->tile_bits |= R300_TXO_MACRO_TILE;*/ } - + /* setup coef - they are const */ height_coef = 1; /* dxt textures have height/4 */ @@ -270,22 +274,12 @@ static void r300SetTexImages(r300ContextPtr rmesa, /* set tiling register for blit from base texture tiling */ t->image[0][i].src_dst_tile = t->tile_bits >> 2; - /* for not compressed textures with height <= 8 disable micro tiling - and for height < 2 macro tiling too - this is only guess */ - if (!texImage->IsCompressed && texImage->Height <= 8) { - t->image[0][i].src_dst_tile &= ~(R300_TXO_MICRO_TILE >> 2); - if (texImage->Height < 2) - t->image[0][i].src_dst_tile &= ~(R300_TXO_MACRO_TILE >> 2); - } - /* for small sizes turn off macro tiling */ - if (texImage->IsCompressed && (texImage->Width <= 32)) { - t->image[0][i].src_dst_tile &= ~(R300_TXO_MACRO_TILE >> 2); + if (texImage->IsCompressed) { + if (texImage->Width < 64) + t->image[0][i].src_dst_tile &= ~(R300_TXO_MACRO_TILE >> 2); } else { - if (t->transfer_size < 2 ) { - if (texImage->Width <= 32) - t->image[0][i].src_dst_tile &= ~(R300_TXO_MACRO_TILE >> 2); - } else if (texImage->Width <= 16) + if (texImage->Width * texelBytes <= 64) t->image[0][i].src_dst_tile &= ~(R300_TXO_MACRO_TILE >> 2); } -- 1.5.2.1