diff options
author | Zack Rusin <[email protected]> | 2007-09-17 12:59:50 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-09-18 07:18:12 -0400 |
commit | 294401814d1d89cc731de1c22c25333aa5d59374 (patch) | |
tree | c392643aaed3660fe9d577044b3f928fb50c4ac7 /src/mesa/state_tracker/st_cache.c | |
parent | d6ac959833a8e40a27907940969c622692f749b1 (diff) |
converting the setup state to immutable object and renaming it to rasterizer state
Diffstat (limited to 'src/mesa/state_tracker/st_cache.c')
-rw-r--r-- | src/mesa/state_tracker/st_cache.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c index 64c03be99db..a687c155874 100644 --- a/src/mesa/state_tracker/st_cache.c +++ b/src/mesa/state_tracker/st_cache.c @@ -93,3 +93,21 @@ struct pipe_depth_stencil_state * st_cached_depth_stencil_state( } return (struct pipe_depth_stencil_state*)(cso_hash_iter_data(iter)); } + +struct pipe_rasterizer_state * st_cached_rasterizer_state( + struct st_context *st, + const struct pipe_rasterizer_state *raster) +{ + unsigned hash_key = cso_construct_key((void*)raster, + sizeof(struct pipe_rasterizer_state)); + struct cso_hash_iter iter = cso_find_state_template(st->cache, + hash_key, CSO_RASTERIZER, + (void*)raster); + if (cso_hash_iter_is_null(iter)) { + const struct pipe_rasterizer_state *created_state = + st->pipe->create_rasterizer_state(st->pipe, raster); + iter = cso_insert_state(st->cache, hash_key, CSO_RASTERIZER, + (void*)created_state); + } + return (struct pipe_rasterizer_state*)(cso_hash_iter_data(iter)); +} |