diff options
author | Zack Rusin <[email protected]> | 2007-09-19 14:01:18 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-09-19 14:01:18 -0400 |
commit | fe555c39bb7fd530298b5be4a8f06bff41726c86 (patch) | |
tree | 68b9b24eb883c822266f6ef82608de3a817549fc /src/mesa/state_tracker/st_cache.c | |
parent | b6d50abd7d483029469a0faaa28e8e2f2f742c6d (diff) |
Convert the rasterizer cso to the new semantics.
Basically make cso hold the driver specific struct, while
managing the template.
Diffstat (limited to 'src/mesa/state_tracker/st_cache.c')
-rw-r--r-- | src/mesa/state_tracker/st_cache.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c index bd6c63b7a13..0f233cea588 100644 --- a/src/mesa/state_tracker/st_cache.c +++ b/src/mesa/state_tracker/st_cache.c @@ -95,22 +95,24 @@ 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( +const struct cso_rasterizer* st_cached_rasterizer_state( struct st_context *st, - const struct pipe_rasterizer_state *raster) + const struct pipe_rasterizer_state *templ) { - unsigned hash_key = cso_construct_key((void*)raster, + unsigned hash_key = cso_construct_key((void*)templ, sizeof(struct pipe_rasterizer_state)); struct cso_hash_iter iter = cso_find_state_template(st->cache, hash_key, CSO_RASTERIZER, - (void*)raster); + (void*)templ); 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); + struct cso_rasterizer *cso = malloc(sizeof(struct cso_rasterizer)); + memcpy(&cso->state, templ, sizeof(struct pipe_rasterizer_state)); + cso->data = st->pipe->create_rasterizer_state(st->pipe, templ); + if (!cso->data) + cso->data = &cso->state; + iter = cso_insert_state(st->cache, hash_key, CSO_RASTERIZER, cso); } - return (struct pipe_rasterizer_state*)(cso_hash_iter_data(iter)); + return (struct cso_rasterizer*)(cso_hash_iter_data(iter)); } struct pipe_shader_state * st_cached_fs_state( |