R500: add support for 4k textures
authorAlex Deucher <alex@botch2.com>
Mon, 12 May 2008 15:57:08 +0000 (11:57 -0400)
committerAlex Deucher <alex@botch2.com>
Mon, 12 May 2008 15:57:08 +0000 (11:57 -0400)
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_texstate.c

index 3f9d9da3998f42344729a217a3fe87caf2cd38b2..df7f29a2ce59fb556d271aa75da7c1ebb82f5055 100644 (file)
@@ -164,7 +164,7 @@ static inline void r300EmitAtoms(r300ContextPtr r300, GLboolean dirty)
        r300->cmdbuf.count_used++;
 
        /* Emit cache flush */
-       *dest = cmdpacket0(R300_TX_CNTL, 1);
+       *dest = cmdpacket0(R300_TX_INVALTAGS, 1);
        dest++;
        r300->cmdbuf.count_used++;
 
index c56a76228974e44f5251202384e506b76adea411..31cc00a081b4e12e903f1fbae4b2c3171a7c4260 100644 (file)
@@ -278,6 +278,11 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
                 ctx->Const.MaxTextureCoordUnits);
        ctx->Const.MaxTextureMaxAnisotropy = 16.0;
 
+       if (screen->chip_family >= CHIP_FAMILY_RV515) {
+           ctx->Const.MaxTextureLevels = 13;
+           ctx->Const.MaxTextureRectSize = 4096;
+       }
+
        ctx->Const.MinPointSize = 1.0;
        ctx->Const.MinPointSizeAA = 1.0;
        ctx->Const.MaxPointSize = R300_POINTSIZE_MAX;
index a6719d6553cef31a7cdc93134f692101f2bbe28d..8e3fe0c5245068af29aae7bda15fde10ebfa7b8e 100644 (file)
@@ -745,7 +745,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* gap */
 
 /* Zero to flush caches. */
-#define R300_TX_CNTL                        0x4100
+#define R300_TX_INVALTAGS                   0x4100
 #define R300_TX_FLUSH                       0x0
 
 /* The upper enable bits are guessed, based on fglrx reported limits. */
index 43d1406da348793001d39576bd81d91737fa5d0e..f69a27671b157c26fbedac644eb4f428c34f8caa 100644 (file)
@@ -398,16 +398,24 @@ static void r300SetTexImages(r300ContextPtr rmesa,
                R300_TX_HEIGHTMASK_SHIFT))
            | ((numLevels - 1) << R300_TX_MAX_MIP_LEVEL_SHIFT);
 
+       t->pitch = 0;
+       if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
+           if (tObj->Image[0][t->base.firstLevel]->Width > 2048)
+               t->pitch |= R500_TXWIDTH_BIT11;
+           if (tObj->Image[0][t->base.firstLevel]->Height > 2048)
+               t->pitch |= R500_TXHEIGHT_BIT11;
+       }
+
        /* Only need to round to nearest 32 for textures, but the blitter
         * requires 64-byte aligned pitches, and we may/may not need the
         * blitter.   NPOT only!
         */
        if (baseImage->IsCompressed) {
-               t->pitch =
+               t->pitch |=
                    (tObj->Image[0][t->base.firstLevel]->Width + 63) & ~(63);
        } else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
                unsigned int align = blitWidth - 1;
-               t->pitch = ((tObj->Image[0][t->base.firstLevel]->Width *
+               t->pitch |= ((tObj->Image[0][t->base.firstLevel]->Width *
                             texelBytes) + 63) & ~(63);
                t->size |= R300_TX_SIZE_TXPITCH_EN;
                if (!t->image_override)
@@ -415,7 +423,7 @@ static void r300SetTexImages(r300ContextPtr rmesa,
                            (((tObj->Image[0][t->base.firstLevel]->Width) +
                              align) & ~align) - 1;
        } else {
-               t->pitch =
+               t->pitch |=
                    ((tObj->Image[0][t->base.firstLevel]->Width *
                      texelBytes) + 63) & ~(63);
        }