diff options
author | Iago Toral Quiroga <[email protected]> | 2018-01-23 12:20:16 +0100 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2018-02-06 07:50:18 +0100 |
commit | ef439a4fdc34749ce73bf44834c55eae9e886ac2 (patch) | |
tree | 2d11ab86221763ccc3ae4d197497c60ec4dfc9cf | |
parent | 1d20001d9711a7ea06f42292d3ed545d7ca0f50c (diff) |
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 <[email protected]>
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index eb306d0c4a8..ead68b47848 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -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); |