{
struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_constant);
val->const_type = vtn_value(b, w[1], vtn_value_type_type)->type->type;
- val->constant = ralloc(b, nir_constant);
+ val->constant = rzalloc(b, nir_constant);
switch (opcode) {
case SpvOpConstantTrue:
assert(val->const_type == glsl_bool_type());
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_ARRAY:
ralloc_steal(val->constant, elems);
+ val->constant->num_elements = elem_count;
val->constant->elements = elems;
break;
var->data.mode = nir_var_global;
var->data.read_only = true;
- nir_constant *val = ralloc(var, nir_constant);
+ nir_constant *val = rzalloc(var, nir_constant);
val->value.u[0] = b->shader->info.cs.local_size[0];
val->value.u[1] = b->shader->info.cs.local_size[1];
val->value.u[2] = b->shader->info.cs.local_size[2];
if (count > 4) {
assert(count == 5);
- var->constant_initializer =
+ nir_constant *constant =
vtn_value(b, w[4], vtn_value_type_constant)->constant;
+ var->constant_initializer = nir_constant_clone(constant, var);
}
val->deref = nir_deref_var_create(b, var);