Lines Matching defs:zm
70 shader_key_matches(const struct zink_shader_module *zm, bool ignore_size,
73 bool key_size_differs = ignore_size ? false : zm->key_size != key->size;
74 if (key_size_differs || zm->num_uniforms != num_uniforms || zm->has_nonseamless != !!key->base.nonseamless_cube_mask)
76 const uint32_t nonseamless_size = zm->has_nonseamless ? sizeof(uint32_t) : 0;
77 return !memcmp(zm->key, key, zm->key_size) &&
78 (!nonseamless_size || !memcmp(zm->key + zm->key_size, &key->base.nonseamless_cube_mask, nonseamless_size)) &&
79 (!num_uniforms || !memcmp(zm->key + zm->key_size + nonseamless_size,
80 key->base.inlined_uniform_values, zm->num_uniforms * sizeof(uint32_t)));
84 shader_module_hash(const struct zink_shader_module *zm)
86 const uint32_t nonseamless_size = zm->has_nonseamless ? sizeof(uint32_t) : 0;
87 unsigned key_size = zm->key_size + nonseamless_size + zm->num_uniforms * sizeof(uint32_t);
88 return _mesa_hash_data(zm->key, key_size);
99 struct zink_shader_module *zm = NULL;
122 zm = iter;
126 if (!zm) {
127 zm = malloc(sizeof(struct zink_shader_module) + key->size + nonseamless_size + inline_size * sizeof(uint32_t));
128 if (!zm) {
139 FREE(zm);
142 zm->shader = mod;
143 list_inithead(&zm->list);
144 zm->num_uniforms = inline_size;
146 zm->key_size = key->size;
147 memcpy(zm->key, key, key->size);
149 zm->key_size = 0;
150 memset(zm->key, 0, key->size);
154 memcpy(zm->key + key->size, &key->base.nonseamless_cube_mask, nonseamless_size);
156 zm->has_nonseamless = !!nonseamless_size;
158 memcpy(zm->key + key->size + nonseamless_size, key->base.inlined_uniform_values, inline_size * sizeof(uint32_t));
160 zm->hash = patch_vertices;
162 zm->hash = shader_module_hash(zm);
163 zm->default_variant = !inline_size && list_is_empty(&prog->shader_cache[pstage][0][0]);
167 list_add(&zm->list, &prog->shader_cache[pstage][!!nonseamless_size][!!inline_size]);
168 return zm;
172 zink_destroy_shader_module(struct zink_screen *screen, struct zink_shader_module *zm)
174 VKSCR(DestroyShaderModule)(screen->dev, zm->shader, NULL);
175 free(zm);
181 struct zink_shader_module *zm, *next;
182 LIST_FOR_EACH_ENTRY_SAFE(zm, next, sc, list) {
183 list_delinit(&zm->list);
184 zink_destroy_shader_module(screen, zm);
200 struct zink_shader_module *zm = get_shader_module_for_stage(ctx, screen, prog->shaders[pstage], prog, state);
201 state->modules[pstage] = zm->shader;
202 if (prog->modules[pstage] == zm)
207 default_variants &= zm->default_variant;
208 prog->modules[pstage] = zm;
294 struct zink_shader_module *zm = NULL;
314 zm = iter;
318 zm = comp->module;
321 if (!zm) {
322 zm = malloc(sizeof(struct zink_shader_module) + nonseamless_size + inline_size * sizeof(uint32_t));
323 if (!zm) {
328 FREE(zm);
331 zm->shader = mod;
332 list_inithead(&zm->list);
333 zm->num_uniforms = inline_size;
334 zm->key_size = 0;
335 zm->has_nonseamless = !!nonseamless_size;
338 memcpy(zm->key, &key->base.nonseamless_cube_mask, nonseamless_size);
340 memcpy(zm->key + nonseamless_size, key->base.inlined_uniform_values, inline_size * sizeof(uint32_t));
341 zm->hash = shader_module_hash(zm);
342 zm->default_variant = false;
346 if (zm->num_uniforms || nonseamless_size)
347 list_add(&zm->list, &comp->shader_cache[!!nonseamless_size]);
348 if (comp->curr == zm)
351 comp->curr = zm;
352 ctx->compute_pipeline_state.module_hash = zm->hash;