diff options
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_gs.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 73263a5fff..fb419367db 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -128,17 +128,6 @@ 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, @@ -187,8 +176,26 @@ static void upload_gs_prog( struct brw_context *brw ) } if (brw->gs.prog_active) { - if (!search_cache(brw, &key)) + 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 { compile_gs_prog( brw, &key ); + brw->state.dirty.cache |= CACHE_NEW_GS_PROG; + } } } |