summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_clip.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-12-05 15:52:13 -0800
committerEric Anholt <eric@anholt.net>2007-12-05 16:44:49 -0800
commita4642f3d18bdaebaba31e5dee72fe5de9d890ffb (patch)
treeaaed9266b2b92529cf11be514214deba53329c77 /src/mesa/drivers/dri/i965/brw_clip.c
parent259eacfa94a1086e4c99db83516989cc27832ef4 (diff)
[965] Add missing flagging of new stage programs for updating stage state.
Otherwise, choosing a new program wouldn't necessarily update the state, and and an old program could be executed, leading to various sorts of pretty pictures or hangs.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_clip.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index 8287fd9edf..c548681aca 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -128,25 +128,14 @@ 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));
@@ -252,8 +241,23 @@ static void upload_clip_prog( struct brw_context *brw )
}
}
- if (!search_cache(brw, &key))
- compile_clip_prog( brw, &key );
+ 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;
+ }
}