diff options
author | Zack Rusin <[email protected]> | 2007-09-20 08:35:10 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-09-20 08:35:10 -0400 |
commit | a6c0c5532f7bfa50ae54c36cf4d74ad4b9f926f8 (patch) | |
tree | daf1a194cad1b9c4a4033193a19435a60531714b /src/mesa/state_tracker/st_cache.c | |
parent | daf5b0f41baa50951e7c2f9ea5cd90b119085a7f (diff) |
Convert depth_stencil state to the new semantics.
Diffstat (limited to 'src/mesa/state_tracker/st_cache.c')
-rw-r--r-- | src/mesa/state_tracker/st_cache.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c index e5ba0592cfb..c1ec130b321 100644 --- a/src/mesa/state_tracker/st_cache.c +++ b/src/mesa/state_tracker/st_cache.c @@ -78,21 +78,24 @@ struct pipe_sampler_state * st_cached_sampler_state( return (struct pipe_sampler_state*)(cso_hash_iter_data(iter)); } -struct pipe_depth_stencil_state * st_cached_depth_stencil_state( - struct st_context *st, - const struct pipe_depth_stencil_state *depth_stencil) +const struct cso_depth_stencil * +st_cached_depth_stencil_state(struct st_context *st, + const struct pipe_depth_stencil_state *templ) { - unsigned hash_key = cso_construct_key((void*)depth_stencil, sizeof(struct pipe_depth_stencil_state)); + unsigned hash_key = cso_construct_key((void*)templ, + sizeof(struct pipe_depth_stencil_state)); struct cso_hash_iter iter = cso_find_state_template(st->cache, hash_key, CSO_DEPTH_STENCIL, - (void*)depth_stencil); + (void*)templ); if (cso_hash_iter_is_null(iter)) { - const struct pipe_depth_stencil_state *created_state = st->pipe->create_depth_stencil_state( - st->pipe, depth_stencil); - iter = cso_insert_state(st->cache, hash_key, CSO_DEPTH_STENCIL, - (void*)created_state); + struct cso_depth_stencil *cso = malloc(sizeof(struct cso_depth_stencil)); + memcpy(&cso->state, templ, sizeof(struct pipe_depth_stencil_state)); + cso->data = st->pipe->create_depth_stencil_state(st->pipe, templ); + if (!cso->data) + cso->data = &cso->state; + iter = cso_insert_state(st->cache, hash_key, CSO_DEPTH_STENCIL, cso); } - return (struct pipe_depth_stencil_state*)(cso_hash_iter_data(iter)); + return (struct cso_depth_stencil*)(cso_hash_iter_data(iter)); } const struct cso_rasterizer* st_cached_rasterizer_state( |