diff options
author | Zack Rusin <[email protected]> | 2007-09-20 10:07:10 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-09-20 10:07:10 -0400 |
commit | 7a06c026ad24b74048f6d125383faf25deb1dfbb (patch) | |
tree | e6422224c0da110d2d2e2349377c29ddc976684f /src/mesa/state_tracker/st_cache.c | |
parent | a6c0c5532f7bfa50ae54c36cf4d74ad4b9f926f8 (diff) |
Fix failover state binding and convert the sampler to use the new
state constant state object semantics.
Diffstat (limited to 'src/mesa/state_tracker/st_cache.c')
-rw-r--r-- | src/mesa/state_tracker/st_cache.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c index c1ec130b321..007a2311e98 100644 --- a/src/mesa/state_tracker/st_cache.c +++ b/src/mesa/state_tracker/st_cache.c @@ -61,21 +61,23 @@ const struct cso_blend * st_cached_blend_state(struct st_context *st, return ((struct cso_blend *)cso_hash_iter_data(iter)); } -struct pipe_sampler_state * st_cached_sampler_state( - struct st_context *st, - const struct pipe_sampler_state *sampler) +const struct cso_sampler * +st_cached_sampler_state(struct st_context *st, + const struct pipe_sampler_state *templ) { - unsigned hash_key = cso_construct_key((void*)sampler, sizeof(struct pipe_sampler_state)); + unsigned hash_key = cso_construct_key((void*)templ, sizeof(struct pipe_sampler_state)); struct cso_hash_iter iter = cso_find_state_template(st->cache, hash_key, CSO_SAMPLER, - (void*)sampler); + (void*)templ); if (cso_hash_iter_is_null(iter)) { - const struct pipe_sampler_state *created_state = st->pipe->create_sampler_state( - st->pipe, sampler); - iter = cso_insert_state(st->cache, hash_key, CSO_SAMPLER, - (void*)created_state); + struct cso_sampler *cso = malloc(sizeof(struct cso_sampler)); + memcpy(&cso->state, templ, sizeof(struct pipe_sampler_state)); + cso->data = st->pipe->create_sampler_state(st->pipe, templ); + if (!cso->data) + cso->data = &cso->state; + iter = cso_insert_state(st->cache, hash_key, CSO_SAMPLER, cso); } - return (struct pipe_sampler_state*)(cso_hash_iter_data(iter)); + return (struct cso_sampler*)(cso_hash_iter_data(iter)); } const struct cso_depth_stencil * |