diff options
author | Karol Herbst <[email protected]> | 2018-05-04 16:28:03 +0200 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2018-07-12 13:09:00 +0200 |
commit | 686e140ce05f233a8ad569b49b63c1711c13e034 (patch) | |
tree | 0c85e246f5f4f9cdcc29dd479c23d2625f9114bc /src/compiler/spirv/spirv_to_nir.c | |
parent | 154ef32e4633b9aa4eafc8c41e818943fe129630 (diff) |
nir/spirv: handle OpConstantComposites with OpUndef members
Reviewed-by: Jason Ekstrand <[email protected]>
Signed-off-by: Karol Herbst <[email protected]>
Diffstat (limited to 'src/compiler/spirv/spirv_to_nir.c')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 413fbf481c1..235003e872a 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -1494,8 +1494,19 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode, spirv_op_to_string(opcode), elem_count, val->type->length); nir_constant **elems = ralloc_array(b, nir_constant *, elem_count); - for (unsigned i = 0; i < elem_count; i++) - elems[i] = vtn_value(b, w[i + 3], vtn_value_type_constant)->constant; + for (unsigned i = 0; i < elem_count; i++) { + struct vtn_value *val = vtn_untyped_value(b, w[i + 3]); + + if (val->value_type == vtn_value_type_constant) { + elems[i] = val->constant; + } else { + vtn_fail_if(val->value_type != vtn_value_type_undef, + "only constants or undefs allowed for " + "SpvOpConstantComposite"); + /* to make it easier, just insert a NULL constant for now */ + elems[i] = vtn_null_constant(b, val->type->type); + } + } switch (val->type->base_type) { case vtn_base_type_vector: { |