diff options
author | Eric Anholt <eric@anholt.net> | 2007-12-05 15:52:13 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-12-05 16:44:49 -0800 |
commit | a4642f3d18bdaebaba31e5dee72fe5de9d890ffb (patch) | |
tree | aaed9266b2b92529cf11be514214deba53329c77 /src/mesa/drivers/dri/i965/brw_sf.c | |
parent | 259eacfa94a1086e4c99db83516989cc27832ef4 (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_sf.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_sf.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 738ceb0552..fd7fb9659f 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -1,3 +1,4 @@ + /* Copyright (C) Intel Corp. 2006. All Rights Reserved. Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to @@ -125,22 +126,13 @@ 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)); @@ -180,9 +172,23 @@ static void upload_sf_prog( struct brw_context *brw ) if (key.do_twoside_color) key.frontface_ccw = (brw->attribs.Polygon->FrontFace == GL_CCW); - - if (!search_cache(brw, &key)) + 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 { compile_sf_prog( brw, &key ); + brw->state.dirty.cache |= CACHE_NEW_SF_PROG; + } } |