Play a little bit with texture formats.
authorVladimir Dergachev <volodya@freedesktop.org>
Wed, 5 Jan 2005 00:18:46 +0000 (00:18 +0000)
committerVladimir Dergachev <volodya@freedesktop.org>
Wed, 5 Jan 2005 00:18:46 +0000 (00:18 +0000)
Get NeHe demos 06, 07 and 19 working.

src/mesa/drivers/dri/r300/r300_render.c
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_tex.c
src/mesa/drivers/dri/r300/r300_texstate.c

index aad85703784b66732fcb22f23bc191700e1487cc..5b4d94e796996a48e3c6f08347682978954483ba 100644 (file)
@@ -279,11 +279,13 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx,
        e32(0x00000003);
        
    
+       #if 0 /* looks like the Z offset issue got fixed */
    rmesa->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA
                                | R300_VPORT_X_OFFSET_ENA
                                | R300_VPORT_Y_SCALE_ENA
                                | R300_VPORT_Y_OFFSET_ENA
                                | R300_VTX_W0_FMT;
+       #endif
    R300_STATECHANGE(rmesa, vte);
    
    r300EmitState(rmesa);
@@ -312,6 +314,12 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx,
    r300EmitVertexShader(rmesa);
    r300EmitPixelShader(rmesa);
    
+   #if 0
+   reg_start(R300_RB3D_COLORMASK, 0);
+       e32(0xf);
+   #endif
+   /* ----------------------------------- */
+   
    /* We need LOAD_VBPNTR to setup AOS_ATTR fields.. the offsets are irrelevant */
    r300EmitLOAD_VBPNTR(rmesa, 0);
    
index f67025494f0104d41efd85792654bf66335a9c3f..023e22f15669bd6ee10b851ca988b61b67229e25 100644 (file)
@@ -812,20 +812,35 @@ void r300_setup_textures(GLcontext *ctx)
                        r300->hw.tex.unknown4.cmd[R300_TEX_VALUE_0+i]=0x0;
                        r300->hw.tex.unknown5.cmd[R300_TEX_VALUE_0+i]=0x0;
                        
+                       
+                       fprintf(stderr, "Want to set format %08x\n", t->format);
                        /* We don't know how to set this yet */
                        r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x88a0c;
+                       r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x88013;
+                       /* Use the code below to quickly find matching texture
+                          formats. Requires an app that displays the same texture
+                          repeatedly  */
+                             #if 0
+                               { 
+                               static int fmt=0;
+                               static int k=0;
+                               k++;
+                               if(k>400){
+                                       k=0;
+                                       fmt++;
+                                       if(fmt>0xff){
+                                               exit(-1);
+                                               fmt=0;
+                                               }
+                                       //sleep(1);
+                                       }
+                               r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x00a0c | (fmt<<12);
+                               }
+                             #endif
+                       r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x53a0c;
+                       fprintf(stderr, "Instead setting format %08x\n", r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]);
+
                        
-                       } else {
-                       /* Fill in with 0's */
-                       #if 0 /* No need.. */
-                       r300->hw.tex.filter.cmd[R300_TEX_VALUE_0+i]=0x0;
-                       r300->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+i]=0x0;
-                       r300->hw.tex.size.cmd[R300_TEX_VALUE_0+i]=0x0;
-                       r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x0;
-                       r300->hw.tex.offset.cmd[R300_TEX_VALUE_0+i]=r300->radeon.radeonScreen->fbLocation;
-                       r300->hw.tex.unknown4.cmd[R300_TEX_VALUE_0+i]=0x0;
-                       r300->hw.tex.unknown5.cmd[R300_TEX_VALUE_0+i]=0x0;
-                       #endif
                        }
                        
                }
index d32b9f0288f514a2f1103e1c58affc232b62df85..7577eb8ddd940f2a901a3bac173fc34e824550bb 100644 (file)
@@ -318,7 +318,7 @@ static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx,
        const GLboolean force16bpt =
            (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16);
        (void)format;
-
+       
        switch (internalFormat) {
        case 4:
        case GL_RGBA:
index 22d1d6c6f9d0c3440e3902a6bfe34304c985380c..55d97f304e24197aed9f85aa8e5f23b606bca62a 100644 (file)
@@ -239,13 +239,13 @@ static void r300SetTexImages(r300ContextPtr rmesa,
        t->filter &= ~R200_MAX_MIP_LEVEL_MASK;
        t->filter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT;
 
-       t->format &= ~(R200_TXFORMAT_WIDTH_MASK |
-                           R200_TXFORMAT_HEIGHT_MASK |
+       t->format &= ~(R300_TX_FORMAT_WIDTH_MASK |
+                           R300_TX_FORMAT_HEIGHT_MASK |
                            R200_TXFORMAT_CUBIC_MAP_ENABLE |
                            R200_TXFORMAT_F5_WIDTH_MASK |
                            R200_TXFORMAT_F5_HEIGHT_MASK);
-       t->format |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) |
-                          (log2Height << R200_TXFORMAT_HEIGHT_SHIFT));
+       t->format |= ((log2Width << R300_TX_FORMAT_WIDTH_SHIFT) |
+                          (log2Height << R300_TX_FORMAT_HEIGHT_SHIFT));
 
        t->format_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK);
        if (tObj->Target == GL_TEXTURE_3D) {
@@ -1291,7 +1291,7 @@ void r300UpdateTextureState(GLcontext * ctx)
        if (GET_CHIP(rmesa->radeon.radeonScreen) == RADEON_CHIP_REAL_R200) {
                /*
                 * T0 hang workaround -------------
-                * not needed for r300 derivatives?
+                * not needed for r200 derivatives?
                 */
                if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_ENABLE_MASK) ==
                    R200_TEX_0_ENABLE
@@ -1339,7 +1339,7 @@ void r300UpdateTextureState(GLcontext * ctx)
 
                /*
                 * Texture cache LRU hang workaround -------------
-                * not needed for r300 derivatives?
+                * not needed for r200 derivatives?
                 */
                dbg = 0x0;