radeon: use txformat to decide to emit rect tex state.
authorDave Airlie <airlied@linux.ie>
Wed, 16 Sep 2009 03:07:02 +0000 (13:07 +1000)
committerDave Airlie <airlied@linux.ie>
Wed, 16 Sep 2009 03:13:43 +0000 (13:13 +1000)
This is more logical, and fixes a TFP issue.

src/mesa/drivers/dri/radeon/radeon_texstate.c

index 9d252aa74c5edfb6f06a4f641ffa3762176ab14e..67ab5636c0350e3c1d36c191284c160f4082cab1 100644 (file)
@@ -833,11 +833,14 @@ static void import_tex_obj_state( r100ContextPtr rmesa,
    cmd[TEX_PP_TXFORMAT] |= texobj->pp_txformat & TEXOBJ_TXFORMAT_MASK;
    cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color;
 
-   if (texobj->base.Target == GL_TEXTURE_RECTANGLE_NV) {
-      GLuint *txr_cmd = RADEON_DB_STATE( txr[unit] );
+   if (texobj->pp_txformat & RADEON_TXFORMAT_NON_POWER2) {
+      uint32_t *txr_cmd = &rmesa->hw.txr[unit].cmd[TXR_CMD_0];
       txr_cmd[TXR_PP_TEX_SIZE] = texobj->pp_txsize; /* NPOT only! */
       txr_cmd[TXR_PP_TEX_PITCH] = texobj->pp_txpitch; /* NPOT only! */
-      RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.txr[unit] );
+      RADEON_STATECHANGE( rmesa, txr[unit] );
+   }
+
+   if (texobj->base.Target == GL_TEXTURE_RECTANGLE_NV) {
       se_coord_fmt |= RADEON_VTX_ST0_NONPARAMETRIC << unit;
    }
    else {
@@ -1114,7 +1117,7 @@ static GLboolean radeon_validate_texture(GLcontext *ctx, struct gl_texture_objec
    RADEON_STATECHANGE( rmesa, ctx );
    rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= 
      (RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE) << unit;
-
+   fprintf(stderr,"enabling tex %d\n", unit);
    RADEON_STATECHANGE( rmesa, tcl );
    rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_ST_BIT(unit);
 
@@ -1171,6 +1174,7 @@ void radeonUpdateTextureState( GLcontext *ctx )
    GLboolean ok;
 
    /* set the ctx all textures off */
+   fprintf(stderr,"resetting tex\n");
    RADEON_STATECHANGE( rmesa, ctx );
    rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~((RADEON_TEX_ENABLE_MASK) | (RADEON_TEX_BLEND_ENABLE_MASK));