&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));
}
}
- 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;
+ }
}
&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,
}
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;
+ }
}
}
+
/*
Copyright (C) Intel Corp. 2006. All Rights Reserved.
Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
&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));
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;
+ }
}
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);
/* 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),
- &brw->vs.prog_data,
- &brw->vs.prog_gs_offset))
- return;
-
- do_vs_prog(brw, vp, &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;
+ }
}
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),
- &brw->wm.prog_data,
- &brw->wm.prog_gs_offset))
- return;
-
- do_wm_prog(brw, fp, &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;
+ }
}