Lines Matching refs:type

31    this->type = glsl_type::error_type;
138 if (v->type->is_scalar())
141 if (v->type->is_vector()) {
142 const unsigned mask = (1U << v->type->vector_elements) - 1;
149 * composite type (and the whole thing is assigned.
163 if (lhs->type->is_scalar() || lhs->type->is_vector()) {
170 assert(lhs_components == this->rhs->type->vector_elements);
181 /* If the RHS is a vector type, assume that all components of the vector
182 * type are being written to the LHS. The write mask comes from the RHS
188 if (rhs->type->is_vector())
189 this->write_mask = (1U << rhs->type->vector_elements) - 1;
190 else if (rhs->type->is_scalar())
199 ir_expression::ir_expression(int op, const struct glsl_type *type,
204 this->type = type;
212 ir_expression::ir_expression(int op, const struct glsl_type *type,
218 this->type = type;
226 ir_expression::ir_expression(int op, const struct glsl_type *type,
231 this->type = type;
275 this->type = op0->type;
282 this->type = glsl_type::get_instance(GLSL_TYPE_INT,
283 op0->type->vector_elements, 1);
291 this->type = glsl_type::get_instance(GLSL_TYPE_FLOAT,
292 op0->type->vector_elements, 1);
297 this->type = glsl_type::get_instance(GLSL_TYPE_BOOL,
298 op0->type->vector_elements, 1);
304 this->type = glsl_type::get_instance(GLSL_TYPE_UINT,
305 op0->type->vector_elements, 1);
309 this->type = glsl_type::float_type;
313 this->type = glsl_type::bool_type;
317 assert(!"not reached: missing automatic type setup for ir_expression");
318 this->type = op0->type;
338 this->type = glsl_type::bool_type;
349 if (op0->type->is_scalar()) {
350 this->type = op1->type;
351 } else if (op1->type->is_scalar()) {
352 this->type = op0->type;
355 assert(!op0->type->is_matrix() && !op1->type->is_matrix());
356 assert(op0->type == op1->type);
357 this->type = op0->type;
367 if (op0->type->is_scalar()) {
368 this->type = op1->type;
369 } else if (op1->type->is_scalar()) {
370 this->type = op0->type;
380 assert(op0->type == op1->type);
381 this->type = glsl_type::get_instance(GLSL_TYPE_BOOL,
382 op0->type->vector_elements, 1);
386 this->type = glsl_type::float_type;
391 this->type = op0->type;
395 assert(!"not reached: missing automatic type setup for ir_expression");
396 this->type = glsl_type::float_type;
531 ir_constant::ir_constant(const struct glsl_type *type,
534 assert((type->base_type >= GLSL_TYPE_UINT)
535 && (type->base_type <= GLSL_TYPE_BOOL));
538 this->type = type;
545 this->type = glsl_type::float_type;
555 this->type = glsl_type::uint_type;
565 this->type = glsl_type::int_type;
575 this->type = glsl_type::bool_type;
585 this->type = c->type->get_base_type();
587 switch (this->type->base_type) {
596 ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list)
599 this->type = type;
601 assert(type->is_scalar() || type->is_vector() || type->is_matrix()
602 || type->is_record() || type->is_array());
604 if (type->is_array()) {
605 this->array_elements = ralloc_array(this, ir_constant *, type->length);
621 /* FINISHME: Should there be some type checking and / or assertions here? */
625 if (type->is_record()) {
641 if (value->type->is_scalar() && value->next->is_tail_sentinel()) {
642 if (type->is_matrix()) {
644 assert(type->base_type == GLSL_TYPE_FLOAT);
645 for (unsigned i = 0; i < type->matrix_columns; i++)
646 this->value.f[i * type->vector_elements + i] = value->value.f[0];
649 switch (type->base_type) {
652 for (unsigned i = 0; i < type->components(); i++)
656 for (unsigned i = 0; i < type->components(); i++)
660 for (unsigned i = 0; i < type->components(); i++)
671 if (type->is_matrix() && value->type->is_matrix()) {
679 unsigned cols = MIN2(type->matrix_columns, value->type->matrix_columns);
680 unsigned rows = MIN2(type->vector_elements, value->type->vector_elements);
683 const unsigned src = i * value->type->vector_elements + j;
684 const unsigned dst = i * type->vector_elements + j;
690 for (unsigned i = cols; i < type->matrix_columns; i++)
691 this->value.f[i * type->vector_elements + i] = 1.0;
699 for (unsigned i = 0; i < type->components(); /* empty */) {
703 for (unsigned j = 0; j < value->type->components(); j++) {
704 switch (type->base_type) {
724 if (i >= type->components())
733 ir_constant::zero(void *mem_ctx, const glsl_type *type)
735 assert(type->is_scalar() || type->is_vector() || type->is_matrix()
736 || type->is_record() || type->is_array());
739 c->type = type;
742 if (type->is_array()) {
743 c->array_elements = ralloc_array(c, ir_constant *, type->length);
745 for (unsigned i = 0; i < type->length; i++)
746 c->array_elements[i] = ir_constant::zero(c, type->element_type());
749 if (type->is_record()) {
750 for (unsigned i = 0; i < type->length; i++) {
751 ir_constant *comp = ir_constant::zero(mem_ctx, type->fields.structure[i].type);
762 switch (this->type->base_type) {
779 switch (this->type->base_type) {
796 switch (this->type->base_type) {
813 switch (this->type->base_type) {
830 assert(this->type->is_array());
844 else if (i >= this->type->length)
845 i = this->type->length - 1;
853 int idx = this->type->field_index(name);
878 switch (this->type->base_type) {
883 unsigned int size = src->type->components();
884 assert (size <= this->type->components() - offset);
886 switch (this->type->base_type) {
907 assert (src->type == this->type);
918 assert (src->type == this->type);
919 for (unsigned i = 0; i < this->type->length; i++) {
934 assert (!type->is_array() && !type->is_record());
936 if (!type->is_vector() && !type->is_matrix()) {
944 switch (this->type->base_type) {
968 if (this->type != c->type)
971 if (this->type->is_array()) {
972 for (unsigned i = 0; i < this->type->length; i++) {
979 if (this->type->base_type == GLSL_TYPE_STRUCT) {
999 for (unsigned i = 0; i < this->type->components(); i++) {
1000 switch (this->type->base_type) {
1029 if (!this->type->is_scalar() && !this->type->is_vector())
1032 for (unsigned c = 0; c < this->type->vector_elements; c++) {
1033 switch (this->type->base_type) {
1066 if (!this->type->is_scalar() && !this->type->is_vector())
1069 for (unsigned c = 0; c < this->type->vector_elements; c++) {
1070 switch (this->type->base_type) {
1103 if (!this->type->is_scalar() && !this->type->is_vector())
1106 if (this->type->is_boolean())
1109 for (unsigned c = 0; c < this->type->vector_elements; c++) {
1110 switch (this->type->base_type) {
1139 if (!this->type->is_scalar() && !this->type->is_vector())
1142 if (this->type->is_boolean())
1146 for (unsigned c = 0; c < this->type->vector_elements; c++) {
1147 switch (this->type->base_type) {
1196 this->type = var->type;
1227 const glsl_type *const vt = this->array->type;
1230 type = vt->element_type();
1232 type = vt->column_type();
1234 type = vt->get_base_type();
1247 this->type = this->record->type->field_type(field);
1259 this->type = this->record->type->field_type(field);
1278 if (this->type->contains_sampler())
1307 ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type)
1310 assert(type != NULL);
1312 this->type = type;
1315 assert(type->base_type == GLSL_TYPE_INT);
1317 assert(sampler->type->sampler_type == (int) type->base_type);
1318 if (sampler->type->sampler_shadow)
1319 assert(type->vector_elements == 4 || type->vector_elements == 1);
1321 assert(type->vector_elements == 4);
1361 /* Based on the number of elements in the swizzle and the base type
1363 * generate the type of the resulting value.
1365 type = glsl_type::get_instance(val->type->base_type, mask.num_components, 1);
1390 this->type = glsl_type::get_instance(val->type->base_type,
1484 ir_variable::ir_variable(const struct glsl_type *type, const char *name,
1490 this->type = type;
1504 if (type && type->base_type == GLSL_TYPE_SAMPLER)
1631 v->type = glsl_type::error_type;
1660 if (constant->type->is_record()) {
1665 } else if (constant->type->is_array()) {
1666 for (unsigned int i = 0; i < constant->type->length; i++) {