Lines Matching defs:val

202    struct vtn_ssa_value *val = rzalloc(b, struct vtn_ssa_value);
203 val->type = glsl_get_bare_type(type);
206 unsigned num_components = glsl_get_vector_elements(val->type);
207 unsigned bit_size = glsl_get_bit_size(val->type);
208 val->def = nir_ssa_undef(&b->nb, num_components, bit_size);
210 unsigned elems = glsl_get_length(val->type);
211 val->elems = ralloc_array(b, struct vtn_ssa_value *, elems);
215 val->elems[i] = vtn_undef_ssa_value(b, elem_type);
220 val->elems[i] = vtn_undef_ssa_value(b, elem_type);
225 return val;
237 struct vtn_ssa_value *val = rzalloc(b, struct vtn_ssa_value);
238 val->type = glsl_get_bare_type(type);
241 unsigned num_components = glsl_get_vector_elements(val->type);
250 val->def = &load->def;
252 unsigned elems = glsl_get_length(val->type);
253 val->elems = ralloc_array(b, struct vtn_ssa_value *, elems);
257 val->elems[i] = vtn_const_ssa_value(b, constant->elements[i],
264 val->elems[i] = vtn_const_ssa_value(b, constant->elements[i],
270 return val;
276 struct vtn_value *val = vtn_untyped_value(b, value_id);
277 switch (val->value_type) {
279 return vtn_undef_ssa_value(b, val->type->type);
282 return vtn_const_ssa_value(b, val->constant, val->type->type);
285 return val->ssa;
288 vtn_assert(val->pointer->ptr_type && val->pointer->ptr_type->type);
290 vtn_create_ssa_value(b, val->pointer->ptr_type->type);
291 ssa->def = vtn_pointer_to_ssa(b, val->pointer);
309 struct vtn_value *val;
311 val = vtn_push_pointer(b, value_id, vtn_pointer_from_ssa(b, ssa->def, type));
314 val = vtn_push_value(b, value_id, vtn_value_type_invalid);
315 val->value_type = vtn_value_type_ssa;
316 val->ssa = ssa;
319 return val;
535 struct vtn_value *val = vtn_push_value(b, w[1], vtn_value_type_extension);
538 val->ext_handler = vtn_handle_glsl450_instruction;
541 val->ext_handler = vtn_handle_amd_gcn_shader_instruction;
544 val->ext_handler = vtn_handle_amd_shader_ballot_instruction;
547 val->ext_handler = vtn_handle_amd_shader_trinary_minmax_instruction;
550 val->ext_handler = vtn_handle_amd_shader_explicit_vertex_parameter_instruction;
552 val->ext_handler = vtn_handle_opencl_instruction;
554 val->ext_handler = vtn_handle_non_semantic_instruction;
562 struct vtn_value *val = vtn_value(b, w[3], vtn_value_type_extension);
563 bool handled = val->ext_handler(b, w[4], w, count);
661 struct vtn_value *val = vtn_untyped_value(b, target);
688 dec->next = val->decoration;
689 val->decoration = dec;
694 struct vtn_value *val = vtn_untyped_value(b, target);
701 dec->next = val->decoration;
702 val->decoration = dec;
712 struct vtn_value *val = vtn_untyped_value(b, *w);
725 dec->next = val->decoration;
726 val->decoration = dec;
1017 struct vtn_value *val, int member,
1020 struct vtn_type *type = val->type;
1037 UNUSED struct vtn_value *val, int member,
1186 UNUSED struct vtn_value *val, int member,
1227 struct vtn_value *val, int member,
1230 vtn_assert(val->type->base_type == vtn_base_type_struct);
1236 val->type->packed = true;
1242 struct vtn_value *val, int member,
1248 struct vtn_type *type = val->type;
1257 struct vtn_value *val, int member,
1260 struct vtn_type *type = val->type;
1264 assert(val->type->base_type == vtn_base_type_struct);
1265 assert(member >= 0 && member < val->type->length);
1415 struct vtn_value *val = NULL;
1421 val = vtn_push_value(b, w[1], vtn_value_type_type);
1422 vtn_fail_if(val->type != NULL,
1424 val->type = rzalloc(b, struct vtn_type);
1425 val->type->id = w[1];
1430 val->type->base_type = vtn_base_type_void;
1431 val->type->type = glsl_void_type();
1434 val->type->base_type = vtn_base_type_scalar;
1435 val->type->type = glsl_bool_type();
1436 val->type->length = 1;
1444 val->type->base_type = vtn_base_type_scalar;
1445 val->type->type = signedness ? glsl_intN_t_type(bit_size) :
1447 val->type->length = 1;
1453 val->type->base_type = vtn_base_type_scalar;
1456 val->type->type = glsl_floatN_t_type(bit_size);
1457 val->type->length = 1;
1470 val->type->base_type = vtn_base_type_vector;
1471 val->type->type = glsl_vector_type(glsl_get_base_type(base->type), elems);
1472 val->type->length = elems;
1473 val->type->stride = glsl_type_is_boolean(val->type->type)
1475 val->type->array_element = base;
1488 val->type->base_type = vtn_base_type_matrix;
1489 val->type->type = glsl_matrix_type(glsl_get_base_type(base->type),
1492 vtn_fail_if(glsl_type_is_error(val->type->type),
1494 assert(!glsl_type_is_error(val->type->type));
1495 val->type->length = columns;
1496 val->type->array_element = base;
1497 val->type->row_major = false;
1498 val->type->stride = 0;
1508 val->type->length = 0;
1510 val->type->length = vtn_constant_uint(b, w[3]);
1513 val->type->base_type = vtn_base_type_array;
1514 val->type->array_element = array_element;
1516 vtn_foreach_decoration(b, val, array_stride_decoration_cb, NULL);
1517 val->type->type = glsl_array_type(array_element->type, val->type->length,
1518 val->type->stride);
1524 val->type->base_type = vtn_base_type_struct;
1525 val->type->length = num_fields;
1526 val->type->members = ralloc_array(b, struct vtn_type *, num_fields);
1527 val->type->offsets = ralloc_array(b, unsigned, num_fields);
1528 val->type->packed = false;
1532 val->type->members[i] = vtn_get_type(b, w[i + 2]);
1534 for (struct vtn_decoration *dec = val->decoration; dec; dec = dec->next) {
1544 .type = val->type->members[i]->type,
1551 vtn_foreach_decoration(b, val, struct_packed_decoration_cb, NULL);
1556 .type = val->type
1559 vtn_foreach_decoration(b, val, struct_member_decoration_cb, &ctx);
1565 overall_access &= val->type->members[i]->access;
1566 val->type->access = overall_access;
1568 vtn_foreach_decoration(b, val, struct_member_matrix_stride_cb, &ctx);
1570 vtn_foreach_decoration(b, val, struct_block_decoration_cb, NULL);
1572 const char *name = val->name;
1574 if (val->type->block || val->type->buffer_block) {
1578 val->type->type = glsl_interface_type(fields, num_fields,
1582 val->type->type = glsl_struct_type(fields, num_fields,
1584 val->type->packed);
1590 val->type->base_type = vtn_base_type_function;
1591 val->type->type = NULL;
1593 val->type->return_type = vtn_get_type(b, w[2]);
1596 val->type->length = num_params;
1597 val->type->params = ralloc_array(b, struct vtn_type *, num_params);
1599 val->type->params[i] = vtn_get_type(b, w[i + 3]);
1609 val = vtn_untyped_value(b, w[1]);
1624 if (val->value_type == vtn_value_type_invalid) {
1625 val->value_type = vtn_value_type_type;
1626 val->type = rzalloc(b, struct vtn_type);
1627 val->type->id = w[1];
1628 val->type->base_type = vtn_base_type_pointer;
1629 val->type->storage_class = storage_class;
1647 val->type->type = nir_address_format_to_glsl_type(
1650 vtn_fail_if(val->type->storage_class != storage_class,
1658 vtn_fail_if(val->type->deref != NULL,
1668 val->type->deref = deref_type;
1681 vtn_foreach_decoration(b, val, array_stride_decoration_cb, NULL);
1693 val->type->base_type = vtn_base_type_image;
1700 val->type->type = nir_address_format_to_glsl_type(
1744 val->type->access_qualifier = w[9];
1747 val->type->access_qualifier = SpvAccessQualifierReadOnly;
1749 val->type->access_qualifier = SpvAccessQualifierReadWrite;
1760 val->type->image_format = translate_image_format(b, format);
1765 val->type->glsl_image = glsl_texture_type(dim, is_array,
1768 val->type->glsl_image = glsl_image_type(dim, is_array,
1771 val->type->glsl_image = glsl_image_type(dim, is_array,
1780 val->type->base_type = vtn_base_type_sampled_image;
1781 val->type->image = vtn_get_type(b, w[2]);
1798 val->type->type = glsl_vector_type(base_type, 2);
1803 val->type->base_type = vtn_base_type_sampler;
1810 val->type->type = nir_address_format_to_glsl_type(
1815 val->type->base_type = vtn_base_type_accel_struct;
1816 val->type->type = glsl_uint64_t_type();
1821 val->type->base_type = vtn_base_type_struct;
1823 val->type->type = glsl_struct_type(NULL, 0, name, false);
1828 val->type->base_type = vtn_base_type_ray_query;
1829 val->type->type = glsl_uint64_t_type();
1839 val->type->access = ACCESS_INCLUDE_HELPERS;
1844 val->type->base_type = vtn_base_type_event;
1845 val->type->type = glsl_int_type();
1856 vtn_foreach_decoration(b, val, type_decoration_cb, NULL);
1858 if (val->type->base_type == vtn_base_type_struct &&
1859 (val->type->block || val->type->buffer_block)) {
1860 for (unsigned i = 0; i < val->type->length; i++) {
1861 vtn_fail_if(vtn_type_contains_block(b, val->type->members[i]),
1927 spec_constant_decoration_cb(struct vtn_builder *b, UNUSED struct vtn_value *val,
1946 struct vtn_value *val,
1956 vtn_assert(val->type->type == glsl_vector_type(GLSL_TYPE_UINT, 3));
1957 b->workgroup_size_builtin = val;
1964 struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_constant);
1965 val->constant = rzalloc(b, nir_constant);
1971 vtn_fail_if(val->type->type != glsl_bool_type(),
1982 vtn_foreach_decoration(b, val, spec_constant_decoration_cb, &u32val);
1984 val->constant->values[0].b = u32val.u32 != 0;
1990 vtn_fail_if(val->type->base_type != vtn_base_type_scalar,
1993 int bit_size = glsl_get_bit_size(val->type->type);
1996 val->constant->values[0].u64 = vtn_u64_literal(&w[3]);
1999 val->constant->values[0].u32 = w[3];
2002 val->constant->values[0].u16 = w[3];
2005 val->constant->values[0].u8 = w[3];
2012 vtn_foreach_decoration(b, val, spec_constant_decoration_cb,
2013 &val->constant->values[0]);
2020 vtn_fail_if(elem_count != val->type->length,
2022 spirv_op_to_string(opcode), elem_count, val->type->length);
2025 val->is_undef_constant = true;
2031 val->is_undef_constant = val->is_undef_constant &&
2042 switch (val->type->base_type) {
2044 assert(glsl_type_is_vector(val->type->type));
2046 val->constant->values[i] = elems[i]->values[0];
2053 ralloc_steal(val->constant, elems);
2054 val->constant->num_elements = elem_count;
2055 val->constant->elements = elems;
2067 vtn_foreach_decoration(b, val, spec_constant_decoration_cb, &u32op);
2084 unsigned bit_size = glsl_get_bit_size(val->type->type);
2109 val->constant->values[j] = undef;
2114 val->constant->values[j] = combined[comp];
2132 val->constant = nir_constant_clone(comp->constant,
2134 c = &val->constant;
2170 val->constant = *c;
2174 val->constant->values[i] = (*c)->values[elem + i];
2193 nir_alu_type dst_alu_type = nir_get_nir_type_for_glsl_type(val->type->type);
2195 unsigned num_components = glsl_get_vector_elements(val->type->type);
2211 bit_size = glsl_get_bit_size(val->type->type);
2268 nir_eval_const_opcode(op, val->constant->values,
2278 val->constant = vtn_null_constant(b, val->type);
2279 val->is_null_constant = true;
2288 vtn_foreach_decoration(b, val, handle_workgroup_size_decoration_cb,
2569 struct vtn_ssa_value *val = rzalloc(b, struct vtn_ssa_value);
2570 val->type = glsl_get_bare_type(type);
2574 unsigned elems = glsl_get_length(val->type);
2575 val->elems = ralloc_array(b, struct vtn_ssa_value *, elems);
2579 val->elems[i] = vtn_create_ssa_value(b, elem_type);
2584 val->elems[i] = vtn_create_ssa_value(b, elem_type);
2589 return val;
2639 struct vtn_value *val, int member,
3226 struct vtn_value *val =
3228 val->image = ralloc(b, struct vtn_image_pointer);
3230 val->image->image = vtn_nir_deref(b, w[3]);
3231 val->image->coord = get_image_coord(b, w[4]);
3232 val->image->sample = vtn_get_nir_ssa(b, w[5]);
3233 val->image->lod = nir_imm_int(&b->nb, 0);
4950 struct vtn_value *val = vtn_value(b, w[3], vtn_value_type_extension);
4951 if (val->ext_handler == vtn_handle_non_semantic_instruction) {
5390 struct vtn_value *val = vtn_value(b, w[3], vtn_value_type_extension);
5394 return val->ext_handler == vtn_handle_non_semantic_instruction;
5662 nir_ssa_def *val = nir_u2u32(&b->nb, nir_channel(&b->nb, unpacked, i));
5664 nir_store_deref(&b->nb, offset_deref, val, 0x1);
5823 struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_undef);
5824 val->type = vtn_get_type(b, w[1]);