struct cso_hash_iter
cso_find_state_template(struct cso_cache *sc,
unsigned hash_key, enum cso_cache_type type,
- void *templ, unsigned size);
+ const void *templ, unsigned size);
void
cso_set_maximum_cache_size(struct cso_cache *sc, int number);
static inline unsigned
-cso_construct_key(void *key, int key_size)
+cso_construct_key(const void *key, int key_size)
{
- unsigned hash = 0, *ikey = (unsigned *)key;
+ unsigned hash = 0;
+ const unsigned *ikey = (const unsigned *)key;
unsigned num_elements = key_size / 4;
assert(key_size % 4 == 0);
const unsigned key_size = templ->independent_blend_enable ?
sizeof(struct pipe_blend_state) :
(char *)&(templ->rt[1]) - (char *)templ;
- const unsigned hash_key = cso_construct_key((void*)templ, key_size);
+ const unsigned hash_key = cso_construct_key(templ, key_size);
struct cso_hash_iter iter =
- cso_find_state_template(&ctx->cache, hash_key, CSO_BLEND,
- (void*)templ, key_size);
+ cso_find_state_template(&ctx->cache, hash_key, CSO_BLEND, templ,
+ key_size);
void *handle;
if (cso_hash_iter_is_null(iter)) {
const struct pipe_depth_stencil_alpha_state *templ)
{
const unsigned key_size = sizeof(struct pipe_depth_stencil_alpha_state);
- const unsigned hash_key = cso_construct_key((void*)templ, key_size);
+ const unsigned hash_key = cso_construct_key(templ, key_size);
struct cso_hash_iter iter = cso_find_state_template(&ctx->cache,
hash_key,
CSO_DEPTH_STENCIL_ALPHA,
- (void*)templ, key_size);
+ templ, key_size);
void *handle;
if (cso_hash_iter_is_null(iter)) {
const struct pipe_rasterizer_state *templ)
{
const unsigned key_size = sizeof(struct pipe_rasterizer_state);
- const unsigned hash_key = cso_construct_key((void*)templ, key_size);
+ const unsigned hash_key = cso_construct_key(templ, key_size);
struct cso_hash_iter iter = cso_find_state_template(&ctx->cache,
hash_key,
CSO_RASTERIZER,
- (void*)templ, key_size);
+ templ, key_size);
void *handle = NULL;
/* We can't have both point_quad_rasterization (sprites) and point_smooth
const unsigned hash_key = cso_construct_key((void*)velems, key_size);
struct cso_hash_iter iter =
cso_find_state_template(&ctx->cache, hash_key, CSO_VELEMENTS,
- (void*)velems, key_size);
+ velems, key_size);
void *handle;
if (cso_hash_iter_is_null(iter)) {
unsigned idx, const struct pipe_sampler_state *templ,
size_t key_size)
{
- unsigned hash_key = cso_construct_key((void*)templ, key_size);
+ unsigned hash_key = cso_construct_key(templ, key_size);
struct cso_sampler *cso;
struct cso_hash_iter iter =
cso_find_state_template(&ctx->cache,
hash_key, CSO_SAMPLER,
- (void *) templ, key_size);
+ templ, key_size);
if (cso_hash_iter_is_null(iter)) {
cso = MALLOC(sizeof(struct cso_sampler));
/* need to include the count into the stored state data too. */
key_size = sizeof(struct pipe_vertex_element) * velems->count +
sizeof(unsigned);
- hash_key = cso_construct_key((void*)velems, key_size);
+ hash_key = cso_construct_key(velems, key_size);
iter = cso_find_state_template(&mgr->cso_cache, hash_key, CSO_VELEMENTS,
- (void*)velems, key_size);
+ velems, key_size);
if (cso_hash_iter_is_null(iter)) {
struct cso_velements *cso = MALLOC_STRUCT(cso_velements);