Always mark tex state atom as dirty when the texture image is dirty, this ensures...
authorRoland Scheidegger <rscheidegger@gmx.ch>
Wed, 13 Sep 2006 23:20:10 +0000 (23:20 +0000)
committerRoland Scheidegger <rscheidegger@gmx.ch>
Wed, 13 Sep 2006 23:20:10 +0000 (23:20 +0000)
src/mesa/drivers/dri/r200/r200_texstate.c
src/mesa/drivers/dri/radeon/radeon_texstate.c

index 9c8997a8c77e742cda7095fb09cfa2d534ecded1..433bc67e3f3aa51b38c46b0e986fdc9d2b598a84 100644 (file)
@@ -1137,7 +1137,10 @@ static void import_tex_obj_state( r200ContextPtr rmesa,
                                  int unit,
                                  r200TexObjPtr texobj )
 {
-   GLuint *cmd = R200_DB_STATE( tex[unit] );
+/* do not use RADEON_DB_STATE to avoid stale texture caches */
+   GLuint *cmd = &rmesa->hw.tex[unit].cmd[TEX_CMD_0];
+
+   R200_STATECHANGE( rmesa, tex[unit] );
 
    cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK;
    cmd[TEX_PP_TXFILTER] |= texobj->pp_txfilter & TEXOBJ_TXFILTER_MASK;
@@ -1156,9 +1159,11 @@ static void import_tex_obj_state( r200ContextPtr rmesa,
    }
 
    if (texobj->base.tObj->Target == GL_TEXTURE_CUBE_MAP) {
-      GLuint *cube_cmd = R200_DB_STATE( cube[unit] );
+      GLuint *cube_cmd = &rmesa->hw.cube[unit].cmd[CUBE_CMD_0];
       GLuint bytesPerFace = texobj->base.totalSize / 6;
       ASSERT(texobj->base.totalSize % 6 == 0);
+
+      R200_STATECHANGE( rmesa, cube[unit] );
       cube_cmd[CUBE_PP_CUBIC_FACES] = texobj->pp_cubic_faces;
       if (rmesa->r200Screen->drmSupportsFragShader) {
         /* that value is submitted twice. could change cube atom
@@ -1170,9 +1175,7 @@ static void import_tex_obj_state( r200ContextPtr rmesa,
       cube_cmd[CUBE_PP_CUBIC_OFFSET_F3] = texobj->pp_txoffset + 3 * bytesPerFace;
       cube_cmd[CUBE_PP_CUBIC_OFFSET_F4] = texobj->pp_txoffset + 4 * bytesPerFace;
       cube_cmd[CUBE_PP_CUBIC_OFFSET_F5] = texobj->pp_txoffset + 5 * bytesPerFace;
-      R200_DB_STATECHANGE( rmesa, &rmesa->hw.cube[unit] );
    }
-   R200_DB_STATECHANGE( rmesa, &rmesa->hw.tex[unit] );
 
    texobj->dirty_state &= ~(1<<unit);
 }
index b6a472ffa73b2464aa98bdf460f171a0fe75d391..1e3a3951e2dcf657d048e139b538c02da9511e32 100644 (file)
@@ -847,9 +847,12 @@ static void import_tex_obj_state( radeonContextPtr rmesa,
                                  int unit,
                                  radeonTexObjPtr texobj )
 {
-   GLuint *cmd = RADEON_DB_STATE( tex[unit] );
+/* do not use RADEON_DB_STATE to avoid stale texture caches */
+   GLuint *cmd = &rmesa->hw.tex[unit].cmd[TEX_CMD_0];
    GLuint se_coord_fmt = rmesa->hw.set.cmd[SET_SE_COORDFMT];
 
+   RADEON_STATECHANGE( rmesa, tex[unit] );
+
    cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK;
    cmd[TEX_PP_TXFILTER] |= texobj->pp_txfilter & TEXOBJ_TXFILTER_MASK;
    cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
@@ -868,10 +871,11 @@ static void import_tex_obj_state( radeonContextPtr rmesa,
       se_coord_fmt &= ~(RADEON_VTX_ST0_NONPARAMETRIC << unit);
 
       if (texobj->base.tObj->Target == GL_TEXTURE_CUBE_MAP) {
-        GLuint *cube_cmd = RADEON_DB_STATE( cube[unit] );
+        GLuint *cube_cmd = &rmesa->hw.cube[unit].cmd[CUBE_CMD_0];
         GLuint bytesPerFace = texobj->base.totalSize / 6;
         ASSERT(texobj->base.totalSize % 6 == 0);
 
+        RADEON_STATECHANGE( rmesa, cube[unit] );
         cube_cmd[CUBE_PP_CUBIC_FACES] = texobj->pp_cubic_faces;
         /* dont know if this setup conforms to OpenGL.. 
          * at least it matches the behavior of mesa software renderer
@@ -881,12 +885,10 @@ static void import_tex_obj_state( radeonContextPtr rmesa,
         cube_cmd[CUBE_PP_CUBIC_OFFSET_2] = texobj->pp_txoffset + 2 * bytesPerFace; /* top */
         cube_cmd[CUBE_PP_CUBIC_OFFSET_3] = texobj->pp_txoffset + 3 * bytesPerFace; /* bottom */
         cube_cmd[CUBE_PP_CUBIC_OFFSET_4] = texobj->pp_txoffset + 4 * bytesPerFace; /* front */
-        RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.cube[unit] );
         cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset + 5 * bytesPerFace; /* back */
       }
    }
 
-   RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.tex[unit] );
    if (se_coord_fmt != rmesa->hw.set.cmd[SET_SE_COORDFMT]) {
       RADEON_STATECHANGE( rmesa, set );
       rmesa->hw.set.cmd[SET_SE_COORDFMT] = se_coord_fmt;