Revert "[965] Add missing flagging of new stage programs for updating stage state."
authorEric Anholt <eric@anholt.net>
Thu, 6 Dec 2007 00:57:27 +0000 (16:57 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 6 Dec 2007 00:57:27 +0000 (16:57 -0800)
I had forgotten part of brw_state_cache.c that made this fix not relevant for
master (last_addr comparison and flagging based on cache id).

This reverts commit a4642f3d18bdaebaba31e5dee72fe5de9d890ffb.

src/mesa/drivers/dri/i965/brw_clip.c
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_sf.c
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_wm.c

index c548681aca5b2be16c4ae68f0604e55353ae0928..8287fd9edf3be7a0dde2e628bda9e229c64d0691 100644 (file)
@@ -128,14 +128,25 @@ static void compile_clip_prog( struct brw_context *brw,
                                                &brw->clip.prog_data );
 }
 
+
+static GLboolean search_cache( struct brw_context *brw, 
+                              struct brw_clip_prog_key *key )
+{
+   return brw_search_cache(&brw->cache[BRW_CLIP_PROG], 
+                          key, sizeof(*key),
+                          &brw->clip.prog_data,
+                          &brw->clip.prog_gs_offset);
+}
+
+
+
+
 /* Calculate interpolants for triangle and line rasterization.
  */
 static void upload_clip_prog( struct brw_context *brw )
 {
    GLcontext *ctx = &brw->intel.ctx;
    struct brw_clip_prog_key key;
-   struct brw_clip_prog_data *prog_data;
-   uint32_t offset;
 
    memset(&key, 0, sizeof(key));
 
@@ -241,23 +252,8 @@ static void upload_clip_prog( struct brw_context *brw )
       }
    }
 
-   if (brw_search_cache(&brw->cache[BRW_CLIP_PROG],
-                       &key, sizeof(key),
-                       &prog_data,
-                       &offset)) {
-      if (offset != brw->clip.prog_gs_offset ||
-         !brw->clip.prog_data ||
-         memcmp(prog_data, &brw->clip.prog_data,
-                sizeof(*brw->clip.prog_data)) != 0)
-      {
-        brw->clip.prog_gs_offset = offset;
-        brw->clip.prog_data = prog_data;
-        brw->state.dirty.cache |= CACHE_NEW_CLIP_PROG;
-      }
-   } else {
-      compile_clip_prog(brw, &key);
-      brw->state.dirty.cache |= CACHE_NEW_CLIP_PROG;
-   }
+   if (!search_cache(brw, &key))
+      compile_clip_prog( brw, &key );
 }
 
 
index fb419367db24753365c3618631568688b2cacf1b..73263a5fff4ba2ca7b76c54973f184cb605a203b 100644 (file)
@@ -128,6 +128,17 @@ static void compile_gs_prog( struct brw_context *brw,
                                              &brw->gs.prog_data );
 }
 
+
+static GLboolean search_cache( struct brw_context *brw, 
+                              struct brw_gs_prog_key *key )
+{
+   return brw_search_cache(&brw->cache[BRW_GS_PROG], 
+                          key, sizeof(*key),
+                          &brw->gs.prog_data,
+                          &brw->gs.prog_gs_offset);
+}
+
+
 static const GLenum gs_prim[GL_POLYGON+1] = {  
    GL_POINTS,
    GL_LINES,
@@ -176,26 +187,8 @@ static void upload_gs_prog( struct brw_context *brw )
    }
 
    if (brw->gs.prog_active) {
-      struct brw_gs_prog_data *prog_data;
-      uint32_t offset;
-
-      if (brw_search_cache(&brw->cache[BRW_GS_PROG],
-                          &key, sizeof(key),
-                          &prog_data,
-                          &offset)) {
-        if (offset != brw->gs.prog_gs_offset ||
-            !brw->gs.prog_data ||
-            memcmp(prog_data, &brw->gs.prog_data,
-                   sizeof(*brw->gs.prog_data)) != 0)
-        {
-           brw->gs.prog_gs_offset = offset;
-           brw->gs.prog_data = prog_data;
-           brw->state.dirty.cache |= CACHE_NEW_GS_PROG;
-        }
-      } else {
+      if (!search_cache(brw, &key))
         compile_gs_prog( brw, &key );
-        brw->state.dirty.cache |= CACHE_NEW_GS_PROG;
-      }
    }
 }
 
index fd7fb9659f7d3902a99f2c8b1e83020431ed54b2..738ceb0552ea95142555e83b9eaa71b04fd7dcf5 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
  Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
@@ -126,13 +125,22 @@ static void compile_sf_prog( struct brw_context *brw,
                                              &brw->sf.prog_data );
 }
 
+
+static GLboolean search_cache( struct brw_context *brw, 
+                              struct brw_sf_prog_key *key )
+{
+   return brw_search_cache(&brw->cache[BRW_SF_PROG], 
+                          key, sizeof(*key),
+                          &brw->sf.prog_data,
+                          &brw->sf.prog_gs_offset);
+}
+
+
 /* Calculate interpolants for triangle and line rasterization.
  */
 static void upload_sf_prog( struct brw_context *brw )
 {
    struct brw_sf_prog_key key;
-   struct brw_sf_prog_data *prog_data;
-   uint32_t offset;
 
    memset(&key, 0, sizeof(key));
 
@@ -172,23 +180,9 @@ static void upload_sf_prog( struct brw_context *brw )
    if (key.do_twoside_color)
       key.frontface_ccw = (brw->attribs.Polygon->FrontFace == GL_CCW);
 
-   if (brw_search_cache(&brw->cache[BRW_SF_PROG],
-                       &key, sizeof(key),
-                       &prog_data,
-                       &offset)) {
-      if (offset != brw->sf.prog_gs_offset ||
-         !brw->sf.prog_data ||
-         memcmp(prog_data, &brw->sf.prog_data,
-                sizeof(*brw->sf.prog_data)) != 0)
-      {
-        brw->sf.prog_gs_offset = offset;
-        brw->sf.prog_data = prog_data;
-        brw->state.dirty.cache |= CACHE_NEW_SF_PROG;
-      }
-   } else {
+
+   if (!search_cache(brw, &key))
       compile_sf_prog( brw, &key );
-      brw->state.dirty.cache |= CACHE_NEW_SF_PROG;
-   }
 }
 
 
index a889a9900fe5601e44649d524dda755ad591082c..e173f6fce3e8b6ec0c2abb3c7d5b8ab387ba1f58 100644 (file)
@@ -90,8 +90,6 @@ static void brw_upload_vs_prog( struct brw_context *brw )
    struct brw_vs_prog_key key;
    struct brw_vertex_program *vp = 
       (struct brw_vertex_program *)brw->vertex_program;
-   struct brw_vs_prog_data *prog_data;
-   uint32_t offset;
 
    assert (vp && !vp->program.IsNVProgram);
    
@@ -112,23 +110,13 @@ static void brw_upload_vs_prog( struct brw_context *brw )
 
    /* Make an early check for the key.
     */
-   if (brw_search_cache(&brw->cache[BRW_VS_PROG],
+   if (brw_search_cache(&brw->cache[BRW_VS_PROG], 
                        &key, sizeof(key),
-                       &prog_data,
-                       &offset)) {
-      if (offset != brw->vs.prog_gs_offset ||
-         !brw->vs.prog_data ||
-         memcmp(prog_data, &brw->vs.prog_data,
-                sizeof(*brw->vs.prog_data)) != 0)
-      {
-        brw->vs.prog_gs_offset = offset;
-        brw->vs.prog_data = prog_data;
-        brw->state.dirty.cache |= CACHE_NEW_VS_PROG;
-      }
-   } else {
-      do_vs_prog(brw, vp, &key);
-      brw->state.dirty.cache |= CACHE_NEW_VS_PROG;
-   }
+                       &brw->vs.prog_data,
+                       &brw->vs.prog_gs_offset))
+       return;
+
+   do_vs_prog(brw, vp, &key);
 }
 
 
index b7f027c5d695cc3ba2ce97ea39558da0d5db22b4..2d6249e3b562169852d52642847f16933f0e0d09 100644 (file)
@@ -326,30 +326,18 @@ static void brw_upload_wm_prog( struct brw_context *brw )
    struct brw_wm_prog_key key;
    struct brw_fragment_program *fp = (struct brw_fragment_program *)
       brw->fragment_program;
-   struct brw_wm_prog_data *prog_data;
-   uint32_t offset;
-
+     
    brw_wm_populate_key(brw, &key);
 
    /* Make an early check for the key.
     */
-   if (brw_search_cache(&brw->cache[BRW_WM_PROG],
+   if (brw_search_cache(&brw->cache[BRW_WM_PROG], 
                        &key, sizeof(key),
-                       &prog_data,
-                       &offset)) {
-      if (offset != brw->wm.prog_gs_offset ||
-         !brw->wm.prog_data ||
-         memcmp(prog_data, &brw->wm.prog_data,
-                sizeof(*brw->wm.prog_data)) != 0)
-      {
-        brw->wm.prog_gs_offset = offset;
-        brw->wm.prog_data = prog_data;
-        brw->state.dirty.cache |= CACHE_NEW_WM_PROG;
-      }
-   } else {
-      do_wm_prog(brw, fp, &key);
-      brw->state.dirty.cache |= CACHE_NEW_WM_PROG;
-   }
+                       &brw->wm.prog_data,
+                       &brw->wm.prog_gs_offset))
+      return;
+
+   do_wm_prog(brw, fp, &key);
 }