mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 01:50:10 +01:00
zink: store shader key to shader module
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12842>
This commit is contained in:
parent
8e78a6f67d
commit
19e99e46db
2 changed files with 10 additions and 1 deletions
|
|
@ -160,12 +160,17 @@ get_shader_module_for_stage(struct zink_context *ctx, struct zink_screen *screen
|
|||
ralloc_free(keybox);
|
||||
zm = entry->data;
|
||||
} else {
|
||||
zm = CALLOC_STRUCT(zink_shader_module);
|
||||
zm = malloc(sizeof(struct zink_shader_module) + key->size);
|
||||
if (!zm) {
|
||||
ralloc_free(keybox);
|
||||
return NULL;
|
||||
}
|
||||
zm->hash = hash;
|
||||
zm->num_uniforms = base_size;
|
||||
zm->key_size = key->size;
|
||||
if (base_size)
|
||||
memcpy(zm->uniforms, &key->base, base_size * sizeof(uint32_t));
|
||||
memcpy(zm->key, key, key->size);
|
||||
mod = zink_shader_compile(screen, zs, prog->nir[stage], key);
|
||||
if (!mod) {
|
||||
ralloc_free(keybox);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@ struct zink_shader_module {
|
|||
VkShaderModule shader;
|
||||
uint32_t hash;
|
||||
bool default_variant;
|
||||
uint8_t num_uniforms;
|
||||
uint8_t key_size;
|
||||
uint32_t uniforms[MAX_INLINABLE_UNIFORMS];
|
||||
uint8_t key[0];
|
||||
};
|
||||
|
||||
struct zink_program {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue