mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-31 07:00:27 +01:00
spirv: split constant initializers on in/out structs
The SPIR-V parser splits in/out struct variables and creates a separate variable for each first-level member of the struct. When the struct variable has an initializer this means that we also need to split the initializer. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
1d20001d97
commit
ef439a4fdc
1 changed files with 8 additions and 0 deletions
|
|
@ -1837,7 +1837,15 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
|
|||
interface_type->members[i]->type;
|
||||
var->members[i]->data.mode = nir_mode;
|
||||
var->members[i]->data.patch = var->patch;
|
||||
|
||||
if (initializer) {
|
||||
assert(i < initializer->num_elements);
|
||||
var->members[i]->constant_initializer =
|
||||
nir_constant_clone(initializer->elements[i], var->members[i]);
|
||||
}
|
||||
}
|
||||
|
||||
initializer = NULL;
|
||||
} else {
|
||||
var->var = rzalloc(b->shader, nir_variable);
|
||||
var->var->name = ralloc_strdup(var->var, val->name);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue