* values *do* diverge, then the behavior of the operation requiring a
* dynamically uniform expression is undefined.
*/
- if (array->type->element_type()->is_sampler()) {
+ if (array->type->without_array()->is_sampler()) {
if (!state->is_version(130, 100)) {
if (state->es_shader) {
_mesa_glsl_warning(&loc, state,
if (is_unsized_array) {
constructor_type =
- glsl_type::get_array_instance(constructor_type->element_type(),
+ glsl_type::get_array_instance(constructor_type->fields.array,
parameter_count);
assert(constructor_type != NULL);
assert(constructor_type->length == parameter_count);
ir_rvalue *result = ir;
const glsl_base_type element_base_type =
- constructor_type->element_type()->base_type;
+ constructor_type->fields.array->base_type;
/* Apply implicit conversions (not the scalar constructor rules!). See
* the spec quote above. */
}
}
- if (result->type != constructor_type->element_type()) {
+ if (result->type != constructor_type->fields.array) {
_mesa_glsl_error(loc, state, "type error in array constructor: "
"expected: %s, found %s",
- constructor_type->element_type()->name,
+ constructor_type->fields.array->name,
result->type->name);
return ir_rvalue::error_value(ctx);
}
* is handled by ir_dereference::is_lvalue.
*/
if (lhs_type->is_unsized_array() && rhs->type->is_array()
- && (lhs_type->element_type() == rhs->type->element_type())) {
+ && (lhs_type->fields.array == rhs->type->fields.array)) {
if (is_initializer) {
return rhs;
} else {
var->data.max_array_access);
}
- var->type = glsl_type::get_array_instance(lhs->type->element_type(),
+ var->type = glsl_type::get_array_instance(lhs->type->fields.array,
rhs->type->array_size());
d->type = var->type;
}
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
- const glsl_type *base_type =
- (var->type->is_array() ? var->type->element_type() : var->type);
+ const glsl_type *base_type = var->type->without_array();
if (base_type->is_image()) {
if (var->data.mode != ir_var_uniform &&
* type and specify a size."
*/
if (earlier->type->is_unsized_array() && var->type->is_array()
- && (var->type->element_type() == earlier->type->element_type())) {
+ && (var->type->fields.array == earlier->type->fields.array)) {
/* FINISHME: This doesn't match the qualifiers on the two
* FINISHME: declarations. It's not 100% clear whether this is
* FINISHME: required or not.
/* If the aggregate is an array, recursively set its elements' types. */
if (type->is_array()) {
- /* Each array element has the type type->element_type().
+ /* Each array element has the type type->fields.array.
*
* E.g., if <type> if struct S[2] we want to set each element's type to
* struct S.
link);
if (expr->oper == ast_aggregate)
- _mesa_ast_set_aggregate_type(type->element_type(), expr);
+ _mesa_ast_set_aggregate_type(type->fields.array, expr);
}
/* If the aggregate is a struct, recursively set its fields' types. */
case GLSL_TYPE_ATOMIC_UINT:
return true;
case GLSL_TYPE_ARRAY:
- return element_type()->contains_opaque();
+ return fields.array->contains_opaque();
case GLSL_TYPE_STRUCT:
for (unsigned int i = 0; i < length; i++) {
if (fields.structure[i].type->contains_opaque())
*/
const glsl_type *get_scalar_type() const;
- /**
- * Query the type of elements in an array
- *
- * \return
- * Pointer to the type of elements in the array for array types, or \c NULL
- * for non-array types.
- */
- const glsl_type *element_type() const
- {
- return is_array() ? fields.array : NULL;
- }
-
/**
* Get the instance of a built-in scalar, vector, or matrix type
*/
if (base_type == GLSL_TYPE_ATOMIC_UINT)
return ATOMIC_COUNTER_SIZE;
else if (is_array())
- return length * element_type()->atomic_size();
+ return length * fields.array->atomic_size();
else
return 0;
}
c->array_elements = ralloc_array(c, ir_constant *, type->length);
for (unsigned i = 0; i < type->length; i++)
- c->array_elements[i] = ir_constant::zero(c, type->element_type());
+ c->array_elements[i] = ir_constant::zero(c, type->fields.array);
}
if (type->is_record()) {
const glsl_type *const vt = this->array->type;
if (vt->is_array()) {
- type = vt->element_type();
+ type = vt->fields.array;
} else if (vt->is_matrix()) {
type = vt->column_type();
} else if (vt->is_vector()) {
storage->atomic_buffer_index = i;
storage->offset = var->data.atomic.offset;
storage->array_stride = (var->type->is_array() ?
- var->type->element_type()->atomic_size() : 0);
+ var->type->without_array()->atomic_size() : 0);
}
/* Assign stage-specific fields. */
const glsl_type *type_to_match = input->type;
if (consumer_stage == MESA_SHADER_GEOMETRY) {
assert(type_to_match->is_array()); /* Enforced by ast_to_hir */
- type_to_match = type_to_match->element_type();
+ type_to_match = type_to_match->fields.array;
}
if (type_to_match != output->type) {
/* There is a bit of a special case for gl_TexCoord. This
return visit_continue;
}
- var->type = glsl_type::get_array_instance(var->type->element_type(),
+ var->type = glsl_type::get_array_instance(var->type->fields.array,
this->num_vertices);
var->data.max_array_access = this->num_vertices - 1;
{
const glsl_type *const vt = ir->array->type;
if (vt->is_array())
- ir->type = vt->element_type();
+ ir->type = vt->fields.array;
return visit_continue;
}
};
return visit_continue;
assert (ir->type->is_array());
- if (!ir->type->element_type()->is_array()) {
+ if (!ir->type->fields.array->is_array()) {
/* 1D gl_ClipDistance (used for vertex and geometry output, and fragment
* input).
*/
this->progress = true;
this->old_clip_distance_1d_var = ir;
- assert (ir->type->element_type() == glsl_type::float_type);
+ assert (ir->type->fields.array == glsl_type::float_type);
unsigned new_size = (ir->type->array_size() + 3) / 4;
/* Clone the old var so that we inherit all of its properties */
this->progress = true;
this->old_clip_distance_2d_var = ir;
- assert (ir->type->element_type()->element_type() == glsl_type::float_type);
- unsigned new_size = (ir->type->element_type()->array_size() + 3) / 4;
+ assert (ir->type->fields.array->fields.array == glsl_type::float_type);
+ unsigned new_size = (ir->type->fields.array->array_size() + 3) / 4;
/* Clone the old var so that we inherit all of its properties */
this->new_clip_distance_2d_var = ir->clone(ralloc_parent(ir), NULL);