* must have the exact number of arguments with matching types in the
* correct order.
*/
- if (constructor_type->is_record()) {
+ if (constructor_type->is_struct()) {
return process_record_constructor(instructions, constructor_type,
&loc, &this->expressions,
state);
&this->expressions, state);
}
- if (constructor_type->is_record()) {
+ if (constructor_type->is_struct()) {
return process_record_constructor(instructions, constructor_type, &loc,
&this->expressions, state);
}
const glsl_type *const t = type->without_array();
return (t->is_float() || t->is_integer() || t->contains_opaque()) &&
- !t->is_record();
+ !t->is_struct();
}
const glsl_type *
/* Make sure nested structs don't contain unsized arrays, and validate
* any xfb_offsets on interface members.
*/
- if (t_without_array->is_record() || t_without_array->is_interface())
+ if (t_without_array->is_struct() || t_without_array->is_interface())
for (unsigned int i = 0; i < t_without_array->length; i++) {
const glsl_type *member_t = t_without_array->fields.structure[i].type;
const glsl_type *type = var->type->without_array();
unsigned components = type->component_slots();
- if (type->is_matrix() || type->is_record()) {
+ if (type->is_matrix() || type->is_struct()) {
_mesa_glsl_error(loc, state, "component layout qualifier "
"cannot be applied to a matrix, a structure, "
"a block, or an array containing any of "
_mesa_shader_stage_to_string(state->stage));
}
if (var->type->is_array() &&
- var->type->fields.array->is_record()) {
+ var->type->fields.array->is_struct()) {
_mesa_glsl_error(&loc, state,
"fragment shader input "
"cannot have an array of structs");
}
- if (var->type->is_record()) {
+ if (var->type->is_struct()) {
for (unsigned i = 0; i < var->type->length; i++) {
if (var->type->fields.structure[i].type->is_array() ||
- var->type->fields.structure[i].type->is_record())
+ var->type->fields.structure[i].type->is_struct())
_mesa_glsl_error(&loc, state,
"fragment shader input cannot have "
"a struct that contains an "
* * A structure
*/
if (state->stage == MESA_SHADER_FRAGMENT) {
- if (check_type->is_record() || check_type->is_matrix())
+ if (check_type->is_struct() || check_type->is_matrix())
_mesa_glsl_error(&loc, state,
"fragment shader output "
"cannot have struct or matrix type");
type = var->type->fields.array;
}
- if (type->is_array() && type->fields.array->is_record()) {
+ if (type->is_array() && type->fields.array->is_struct()) {
_mesa_glsl_error(&loc, state,
"%s shader output cannot have "
"an array of structs",
_mesa_shader_stage_to_string(state->stage));
}
- if (type->is_record()) {
+ if (type->is_struct()) {
for (unsigned i = 0; i < type->length; i++) {
if (type->fields.structure[i].type->is_array() ||
- type->fields.structure[i].type->is_record())
+ type->fields.structure[i].type->is_struct())
_mesa_glsl_error(&loc, state,
"%s shader output cannot have a "
"struct that contains an "
if (is_interface && layout &&
(layout->flags.q.uniform || layout->flags.q.buffer) &&
(field_type->without_array()->is_matrix()
- || field_type->without_array()->is_record())) {
+ || field_type->without_array()->is_struct())) {
/* If no layout is specified for the field, inherit the layout
* from the block.
*/
}
/* If the aggregate is a struct, recursively set its fields' types. */
- } else if (type->is_record()) {
+ } else if (type->is_struct()) {
exec_node *expr_node = ai->expressions.get_head_raw();
/* Iterate through the struct's fields. */
YYLTYPE loc = expr->get_location();
if (op->type->is_error()) {
/* silently propagate the error */
- } else if (op->type->is_record() || op->type->is_interface()) {
+ } else if (op->type->is_struct() || op->type->is_interface()) {
result = new(ctx) ir_dereference_record(op,
expr->primary_expression.identifier);
this->type = type;
assert(type->is_scalar() || type->is_vector() || type->is_matrix()
- || type->is_record() || type->is_array());
+ || type->is_struct() || type->is_array());
/* If the constant is a record, the types of each of the entries in
* value_list must be a 1-for-1 match with the structure components. Each
* entry must also be a constant. Just move the nodes from the value_list
* to the list in the ir_constant.
*/
- if (type->is_array() || type->is_record()) {
+ if (type->is_array() || type->is_struct()) {
this->const_elements = ralloc_array(this, ir_constant *, type->length);
unsigned i = 0;
foreach_in_list(ir_constant, value, value_list) {
ir_constant::zero(void *mem_ctx, const glsl_type *type)
{
assert(type->is_scalar() || type->is_vector() || type->is_matrix()
- || type->is_record() || type->is_array());
+ || type->is_struct() || type->is_array());
ir_constant *c = new(mem_ctx) ir_constant;
c->type = type;
c->const_elements[i] = ir_constant::zero(c, type->fields.array);
}
- if (type->is_record()) {
+ if (type->is_struct()) {
c->const_elements = ralloc_array(c, ir_constant *, type->length);
for (unsigned i = 0; i < type->length; i++) {
ir_constant *
ir_constant::get_record_field(int idx)
{
- assert(this->type->is_record());
+ assert(this->type->is_struct());
assert(idx >= 0 && (unsigned) idx < this->type->length);
return const_elements[idx];
void
ir_constant::copy_masked_offset(ir_constant *src, int offset, unsigned int mask)
{
- assert (!type->is_array() && !type->is_record());
+ assert (!type->is_array() && !type->is_struct());
if (!type->is_vector() && !type->is_matrix()) {
offset = 0;
if (this->type != c->type)
return false;
- if (this->type->is_array() || this->type->is_record()) {
+ if (this->type->is_array() || this->type->is_struct()) {
for (unsigned i = 0; i < this->type->length; i++) {
if (!this->const_elements[i]->has_value(c->const_elements[i]))
return false;
* visitor, so steal their values by hand.
*/
if (constant != NULL &&
- (constant->type->is_array() || constant->type->is_record())) {
+ (constant->type->is_array() || constant->type->is_struct())) {
for (unsigned int i = 0; i < constant->type->length; i++) {
steal_memory(constant->const_elements[i], ir);
}
fprintf(f, "(array ");
print_type(f, t->fields.array);
fprintf(f, " %u)", t->length);
- } else if (t->is_record() && !is_gl_identifier(t->name)) {
+ } else if (t->is_struct() && !is_gl_identifier(t->name)) {
fprintf(f, "%s@%p", t->name, (void *) t);
} else {
fprintf(f, "%s", t->name);
if (ir->type->is_array()) {
for (unsigned i = 0; i < ir->type->length; i++)
ir->get_array_element(i)->accept(this);
- } else if (ir->type->is_record()) {
+ } else if (ir->type->is_struct()) {
for (unsigned i = 0; i < ir->type->length; i++) {
fprintf(f, "(%s ", ir->type->fields.structure[i].name);
ir->get_record_field(i)->accept(this);
bool row_major,
const enum glsl_interface_packing packing)
{
- assert(type->is_record());
+ assert(type->is_struct());
if (packing == GLSL_INTERFACE_PACKING_STD430)
this->offset = glsl_align(
this->offset, type->std430_base_alignment(row_major));
bool row_major,
const enum glsl_interface_packing packing)
{
- assert(type->is_record());
+ assert(type->is_struct());
/* If this is the last field of a structure, apply rule #9. The
* ARB_uniform_buffer_object spec says:
ir_constant *val, unsigned int boolean_true)
{
const glsl_type *t_without_array = type->without_array();
- if (type->is_record()) {
+ if (type->is_struct()) {
for (unsigned int i = 0; i < type->length; i++) {
const glsl_type *field_type = type->fields.structure[i].type;
const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name,
boolean_true);
}
return;
- } else if (t_without_array->is_record() ||
+ } else if (t_without_array->is_struct() ||
(type->is_array() && type->fields.array->is_array())) {
const glsl_type *const element_type = type->fields.array;
program_resource_visitor::process(const glsl_type *type, const char *name,
bool use_std430_as_default)
{
- assert(type->without_array()->is_record()
+ assert(type->without_array()->is_struct()
|| type->without_array()->is_interface());
unsigned record_array_count = 1;
* processing functions because no information is available to do
* otherwise. See the warning in linker.h.
*/
- if (t_without_array->is_record() ||
+ if (t_without_array->is_struct() ||
(t->is_array() && t->fields.array->is_array())) {
char *name = ralloc_strdup(NULL, var->name);
recursion(var->type, &name, strlen(name), row_major, NULL, packing,
named_ifc_member->name);
recursion(named_ifc_member->type, name, name_length, row_major, NULL,
packing, false, record_array_count, NULL);
- } else if (t->is_record() || t->is_interface()) {
- if (record_type == NULL && t->is_record())
+ } else if (t->is_struct() || t->is_interface()) {
+ if (record_type == NULL && t->is_struct())
record_type = t;
- if (t->is_record())
+ if (t->is_struct())
this->enter_record(t, *name, row_major, packing);
for (unsigned i = 0; i < t->length; i++) {
record_type = NULL;
}
- if (t->is_record()) {
+ if (t->is_struct()) {
(*name)[name_length] = '\0';
this->leave_record(t, *name, row_major, packing);
}
- } else if (t->without_array()->is_record() ||
+ } else if (t->without_array()->is_struct() ||
t->without_array()->is_interface() ||
(t->is_array() && t->fields.array->is_array())) {
- if (record_type == NULL && t->fields.array->is_record())
+ if (record_type == NULL && t->fields.array->is_struct())
record_type = t->fields.array;
unsigned length = t->length;
const enum glsl_interface_packing,
bool /* last_field */)
{
- assert(!type->without_array()->is_record());
+ assert(!type->without_array()->is_struct());
assert(!type->without_array()->is_interface());
assert(!(type->is_array() && type->fields.array->is_array()));
bool row_major,
const enum glsl_interface_packing packing)
{
- assert(type->is_record());
+ assert(type->is_struct());
if (this->buffer_block_index == -1)
return;
if (packing == GLSL_INTERFACE_PACKING_STD430)
bool row_major,
const enum glsl_interface_packing packing)
{
- assert(type->is_record());
+ assert(type->is_struct());
if (this->buffer_block_index == -1)
return;
if (packing == GLSL_INTERFACE_PACKING_STD430)
const enum glsl_interface_packing packing,
bool /* last_field */)
{
- assert(!type->without_array()->is_record());
+ assert(!type->without_array()->is_struct());
assert(!type->without_array()->is_interface());
assert(!(type->is_array() && type->fields.array->is_array()));
/* Assign explicit locations. */
if (current_var->data.explicit_location) {
/* Set sequential locations for struct fields. */
- if (current_var->type->without_array()->is_record() ||
+ if (current_var->type->without_array()->is_struct() ||
current_var->type->is_array_of_arrays()) {
const unsigned entries = MAX2(1, this->uniforms[id].array_elements);
this->uniforms[id].remap_location =
bool found = false;
char sentinel = '\0';
- if (var->type->is_record()) {
+ if (var->type->is_struct()) {
sentinel = '.';
} else if (var->type->is_array() && (var->type->fields.array->is_array()
- || var->type->without_array()->is_record())) {
+ || var->type->without_array()->is_struct())) {
sentinel = '[';
}
create_xfb_varying_names(mem_ctx, ifc_member_t, name, new_length, count,
NULL, NULL, varying_names);
- } else if (t->is_record()) {
+ } else if (t->is_struct()) {
for (unsigned i = 0; i < t->length; i++) {
const char *field = t->fields.structure[i].name;
size_t new_length = name_length;
new_length, count, NULL, NULL,
varying_names);
}
- } else if (t->without_array()->is_record() ||
+ } else if (t->without_array()->is_struct() ||
t->without_array()->is_interface() ||
(t->is_array() && t->fields.array->is_array())) {
for (unsigned i = 0; i < t->length; i++) {
gl_shader_stage stage)
{
unsigned last_comp;
- if (type->without_array()->is_record()) {
+ if (type->without_array()->is_struct()) {
/* The component qualifier can't be used on structs so just treat
* all component slots as used.
*/
producer_stage == MESA_SHADER_TESS_CTRL)
return false;
- return xfb_enabled && (type->is_array() || type->is_record() ||
+ return xfb_enabled && (type->is_array() || type->is_struct() ||
type->is_matrix() || var->data.is_xfb_only);
}
if (enhanced_layouts_enabled) {
const glsl_type *type =
get_varying_type(producer_var, producer_stage);
- if (type->is_array() || type->is_matrix() || type->is_record() ||
+ if (type->is_array() || type->is_matrix() || type->is_struct() ||
type->is_double()) {
unsigned comp_slots = type->component_slots() + offset;
unsigned slots = comp_slots / 4;
const enum glsl_interface_packing,
bool /* last_field */)
{
- assert(!type->without_array()->is_record());
+ assert(!type->without_array()->is_struct());
assert(!type->without_array()->is_interface());
tfeedback_candidate *candidate
if (GLSL_INTERFACE_PACKING_STD140 ==
iface->
get_internal_ifc_packing(ctx->Const.UseSTD430AsDefaultPacking)) {
- if (array_type->is_record() || array_type->is_array())
+ if (array_type->is_struct() || array_type->is_array())
return glsl_align(array_type->std140_size(row_major), 16);
else
return MAX2(array_type->std140_base_alignment(row_major), 16);
enum glsl_interface_packing packing,
unsigned int write_mask)
{
- if (deref->type->is_record()) {
+ if (deref->type->is_struct()) {
unsigned int field_offset = 0;
for (unsigned i = 0; i < deref->type->length; i++) {
case GLSL_MATRIX_LAYOUT_COLUMN_MAJOR:
return false;
case GLSL_MATRIX_LAYOUT_ROW_MAJOR:
- return matrix || deref->type->without_array()->is_record();
+ return matrix || deref->type->without_array()->is_struct();
}
break;
case GLSL_MATRIX_LAYOUT_COLUMN_MAJOR:
return false;
case GLSL_MATRIX_LAYOUT_ROW_MAJOR:
- return matrix || deref->type->without_array()->is_record();
+ return matrix || deref->type->without_array()->is_struct();
}
unreachable("invalid matrix layout");
* of the member following the sub-structure is rounded up to
* the next multiple of the base alignment of the structure."
*/
- if (type->without_array()->is_record()) {
+ if (type->without_array()->is_struct()) {
intra_struct_offset = glsl_align(intra_struct_offset,
field_align);
*/
assert(!gs_input_toplevel || rvalue->type->is_array());
- if (rvalue->type->is_record()) {
+ if (rvalue->type->is_struct()) {
for (unsigned i = 0; i < rvalue->type->length; i++) {
if (i != 0)
rvalue = rvalue->clone(this->mem_ctx, NULL);
*/
const glsl_type *type = var->type;
if (disable_varying_packing && !var->data.is_xfb_only &&
- !((type->is_array() || type->is_record() || type->is_matrix()) &&
+ !((type->is_array() || type->is_struct() || type->is_matrix()) &&
xfb_enabled))
return false;
return false;
/* LHS and RHS must be records */
- if (!ir->lhs->type->is_record() || !ir->rhs->type->is_record())
+ if (!ir->lhs->type->is_struct() || !ir->rhs->type->is_struct())
return false;
/* RHS must be a buffer-backed variable. This is what can cause the problem
{
assert(var);
- if (!var->type->is_record() ||
+ if (!var->type->is_struct() ||
var->data.mode == ir_var_uniform || var->data.mode == ir_var_shader_storage ||
var->data.mode == ir_var_shader_in || var->data.mode == ir_var_shader_out)
return NULL;
{
assert(var);
- if (!var->type->is_record())
+ if (!var->type->is_struct())
return NULL;
foreach_in_list(variable_entry, entry, this->variable_list) {
{
if (this->is_array()) {
return this->fields.array->contains_sampler();
- } else if (this->is_record() || this->is_interface()) {
+ } else if (this->is_struct() || this->is_interface()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_sampler())
return true;
bool
glsl_type::contains_array() const
{
- if (this->is_record() || this->is_interface()) {
+ if (this->is_struct() || this->is_interface()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_array())
return true;
{
if (this->is_array()) {
return this->fields.array->contains_integer();
- } else if (this->is_record() || this->is_interface()) {
+ } else if (this->is_struct() || this->is_interface()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_integer())
return true;
{
if (this->is_array()) {
return this->fields.array->contains_double();
- } else if (this->is_record() || this->is_interface()) {
+ } else if (this->is_struct() || this->is_interface()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_double())
return true;
{
if (this->is_array()) {
return this->fields.array->contains_64bit();
- } else if (this->is_record() || this->is_interface()) {
+ } else if (this->is_struct() || this->is_interface()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_64bit())
return true;
{
if (this->is_array()) {
return this->fields.array->contains_subroutine();
- } else if (this->is_record() || this->is_interface()) {
+ } else if (this->is_struct() || this->is_interface()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_subroutine())
return true;
{
if (this->is_array()) {
return this->fields.array->contains_image();
- } else if (this->is_record() || this->is_interface()) {
+ } else if (this->is_struct() || this->is_interface()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_image())
return true;
{
unsigned offset = 0;
const glsl_type *t = this->without_array();
- if (t->is_record()) {
+ if (t->is_struct()) {
assert(length <= t->length);
for (unsigned i = 0; i < length; i++) {
const glsl_type *st = t->fields.structure[i].type;
const glsl_type *wa = st->without_array();
- if (wa->is_record()) {
+ if (wa->is_struct()) {
unsigned r_offset = wa->record_location_offset(wa->length);
offset += st->is_array() ?
st->arrays_of_arrays_size() * r_offset : r_offset;
return size;
case GLSL_TYPE_ARRAY:
/* Don't count innermost array elements */
- if (this->without_array()->is_record() ||
+ if (this->without_array()->is_struct() ||
this->without_array()->is_interface() ||
this->fields.array->is_array())
return this->length * this->fields.array->varying_count();
this->fields.array->is_matrix()) {
return MAX2(this->fields.array->std140_base_alignment(row_major), 16);
} else {
- assert(this->fields.array->is_record() ||
+ assert(this->fields.array->is_struct() ||
this->fields.array->is_array());
return this->fields.array->std140_base_alignment(row_major);
}
* rounded up to the next multiple of the base alignment of the
* structure.
*/
- if (this->is_record()) {
+ if (this->is_struct()) {
unsigned base_alignment = 16;
for (unsigned i = 0; i < this->length; i++) {
bool field_row_major = row_major;
*/
if (this->is_array()) {
assert(this->explicit_stride == 0);
- if (this->without_array()->is_record()) {
+ if (this->without_array()->is_struct()) {
return this->arrays_of_arrays_size() *
this->without_array()->std140_size(row_major);
} else {
* rounded up to the next multiple of the base alignment of the
* structure.
*/
- if (this->is_record() || this->is_interface()) {
+ if (this->is_struct() || this->is_interface()) {
unsigned size = 0;
unsigned max_align = 0;
max_align = MAX2(align, max_align);
- if (field_type->is_record() && (i + 1 < this->length))
+ if (field_type->is_struct() && (i + 1 < this->length))
size = glsl_align(size, 16);
}
size = glsl_align(size, MAX2(max_align, 16));
* rounded up to the next multiple of the base alignment of the
* structure.
*/
- if (this->is_record()) {
+ if (this->is_struct()) {
unsigned base_alignment = 0;
for (unsigned i = 0; i < this->length; i++) {
bool field_row_major = row_major;
if (this->is_array()) {
assert(this->explicit_stride == 0);
- if (this->without_array()->is_record())
+ if (this->without_array()->is_struct())
return this->arrays_of_arrays_size() *
this->without_array()->std430_size(row_major);
else
this->without_array()->std430_base_alignment(row_major);
}
- if (this->is_record() || this->is_interface()) {
+ if (this->is_struct() || this->is_interface()) {
unsigned size = 0;
unsigned max_align = 0;
/**
* Query whether or not a type is a record
*/
- bool is_record() const
+ bool is_struct() const
{
return base_type == GLSL_TYPE_STRUCT;
}
bool
glsl_type_is_struct(const struct glsl_type *type)
{
- return type->is_record() || type->is_interface();
+ return type->is_struct() || type->is_interface();
}
bool
this->file = VGRF;
this->nr = v->alloc.allocate(type_size_vec4(type));
- if (type->is_array() || type->is_record()) {
+ if (type->is_array() || type->is_struct()) {
this->swizzle = BRW_SWIZZLE_NOOP;
} else {
this->swizzle = brw_swizzle_for_size(type->vector_elements);
this->file = VGRF;
this->nr = v->alloc.allocate(type_size_vec4(type));
- if (type->is_array() || type->is_record()) {
+ if (type->is_array() || type->is_struct()) {
this->writemask = WRITEMASK_XYZW;
} else {
this->writemask = (1 << type->vector_elements) - 1;
* "A valid name cannot be a structure, an array of structures, or any
* portion of a single vector or a matrix."
*/
- if (RESOURCE_UNI(res)->type->without_array()->is_record())
+ if (RESOURCE_UNI(res)->type->without_array()->is_struct())
return -1;
/* From the GL_ARB_uniform_buffer_object spec:
src.reladdr = NULL;
next_temp += type_size(type);
- if (type->is_array() || type->is_record()) {
+ if (type->is_array() || type->is_struct()) {
src.swizzle = SWIZZLE_NOOP;
} else {
src.swizzle = swizzle_for_size(type->vector_elements);
* get lucky, copy propagation will eliminate the extra moves.
*/
- if (ir->type->is_record()) {
+ if (ir->type->is_struct()) {
src_reg temp_base = get_temp(ir->type);
dst_reg temp = dst_reg(temp_base);
if (type->is_array() || type->is_matrix())
return true;
- if (type->is_record()) {
+ if (type->is_struct()) {
for (unsigned i = 0; i < type->length; i++) {
if (type_has_array_or_matrix(type->fields.structure[i].type)) {
return true;
next_temp += type_size(type);
}
- if (type->is_array() || type->is_record()) {
+ if (type->is_array() || type->is_struct()) {
src.swizzle = SWIZZLE_NOOP;
} else {
src.swizzle = swizzle_for_size(type->vector_elements);
* for arrays of structs. Indirect sampler and image indexing is handled
* elsewhere.
*/
- int element_size = ir->type->without_array()->is_record() ?
+ int element_size = ir->type->without_array()->is_struct() ?
st_glsl_storage_type_size(ir->type, var->data.bindless) :
type_size(ir->type);
st_dst_reg *l, st_src_reg *r,
st_src_reg *cond, bool cond_swap)
{
- if (type->is_record()) {
+ if (type->is_struct()) {
for (unsigned int i = 0; i < type->length; i++) {
emit_block_mov(ir, type->fields.structure[i].type, l, r,
cond, cond_swap);
* aggregate constant and move each constant value into it. If we
* get lucky, copy propagation will eliminate the extra moves.
*/
- if (ir->type->is_record()) {
+ if (ir->type->is_struct()) {
st_src_reg temp_base = get_temp(ir->type);
st_dst_reg temp = st_dst_reg(temp_base);