diff options
author | Timothy Arceri <[email protected]> | 2019-03-05 15:05:52 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2019-03-06 13:10:02 +1100 |
commit | 81ee2cd8ba5a0145520e849e20c1a8e43f78c6fa (patch) | |
tree | e48654b4aa6bd70eda71e17eedbe5e1a20143dfa /src | |
parent | 272e927d0e9fed6e791d706ff5d895b6c2036fc0 (diff) |
glsl: rename is_record() -> is_struct()
Replace was done using:
find ./src -type f -exec sed -i -- \
's/is_record(/is_struct(/g' {} \;
Acked-by: Karol Herbst <[email protected]>
Acked-by: Jason Ekstrand <[email protected]>
Acked-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
22 files changed, 90 insertions, 90 deletions
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp index 2be7a8c195d..6bd8987cd9b 100644 --- a/src/compiler/glsl/ast_function.cpp +++ b/src/compiler/glsl/ast_function.cpp @@ -2118,7 +2118,7 @@ ast_function_expression::hir(exec_list *instructions, * 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); @@ -2458,7 +2458,7 @@ ast_aggregate_initializer::hir(exec_list *instructions, &this->expressions, state); } - if (constructor_type->is_record()) { + if (constructor_type->is_struct()) { return process_record_constructor(instructions, constructor_type, &loc, &this->expressions, state); } diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 92a9650cc05..68acf2666cc 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -2389,7 +2389,7 @@ precision_qualifier_allowed(const glsl_type *type) 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 * @@ -2807,7 +2807,7 @@ validate_xfb_offset_qualifier(YYLTYPE *loc, /* 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; @@ -3691,7 +3691,7 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual, 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 " @@ -5302,15 +5302,15 @@ ast_declarator_list::hir(exec_list *instructions, _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 " @@ -5337,7 +5337,7 @@ ast_declarator_list::hir(exec_list *instructions, * * 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"); @@ -5408,16 +5408,16 @@ ast_declarator_list::hir(exec_list *instructions, 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 " @@ -7468,7 +7468,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions, 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. */ diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index fd3e9e55af1..f2bf9cad16b 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -940,7 +940,7 @@ _mesa_ast_set_aggregate_type(const glsl_type *type, } /* 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. */ diff --git a/src/compiler/glsl/hir_field_selection.cpp b/src/compiler/glsl/hir_field_selection.cpp index 9f23643fd02..cb499d43b06 100644 --- a/src/compiler/glsl/hir_field_selection.cpp +++ b/src/compiler/glsl/hir_field_selection.cpp @@ -46,7 +46,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, 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); diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index 77e37161b74..060bd3ae7f5 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -754,14 +754,14 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) 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) { @@ -909,7 +909,7 @@ ir_constant * 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; @@ -922,7 +922,7 @@ ir_constant::zero(void *mem_ctx, const glsl_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++) { @@ -1114,7 +1114,7 @@ ir_constant::get_array_element(unsigned i) const 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]; @@ -1185,7 +1185,7 @@ ir_constant::copy_offset(ir_constant *src, int offset) 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; @@ -1233,7 +1233,7 @@ ir_constant::has_value(const ir_constant *c) const 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; @@ -1944,7 +1944,7 @@ steal_memory(ir_instruction *ir, void *new_ctx) * 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); } diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp index ef6bca1229e..119e3ee1e2e 100644 --- a/src/compiler/glsl/ir_print_visitor.cpp +++ b/src/compiler/glsl/ir_print_visitor.cpp @@ -149,7 +149,7 @@ print_type(FILE *f, const glsl_type *t) 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); @@ -469,7 +469,7 @@ void ir_print_visitor::visit(ir_constant *ir) 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); diff --git a/src/compiler/glsl/link_uniform_blocks.cpp b/src/compiler/glsl/link_uniform_blocks.cpp index 0b890586298..45f1c0fe98d 100644 --- a/src/compiler/glsl/link_uniform_blocks.cpp +++ b/src/compiler/glsl/link_uniform_blocks.cpp @@ -68,7 +68,7 @@ private: 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)); @@ -81,7 +81,7 @@ private: 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: diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp index 64f47f9913f..61b324592df 100644 --- a/src/compiler/glsl/link_uniform_initializers.cpp +++ b/src/compiler/glsl/link_uniform_initializers.cpp @@ -190,7 +190,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, 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, @@ -200,7 +200,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, 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; diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index 13fc603ce7a..8ca140dcaa8 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -46,7 +46,7 @@ void 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; @@ -88,7 +88,7 @@ program_resource_visitor::process(ir_variable *var, const glsl_type *var_type, * 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, @@ -129,11 +129,11 @@ program_resource_visitor::recursion(const glsl_type *t, char **name, 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++) { @@ -177,14 +177,14 @@ program_resource_visitor::recursion(const glsl_type *t, char **name, 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; @@ -334,7 +334,7 @@ private: 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())); @@ -767,7 +767,7 @@ private: 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) @@ -782,7 +782,7 @@ private: 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) @@ -798,7 +798,7 @@ private: 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())); @@ -849,7 +849,7 @@ private: /* 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 = @@ -1105,10 +1105,10 @@ link_update_uniform_buffer_variables(struct gl_linked_shader *shader, 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 = '['; } diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index 93b3b82b93a..2d17e06240d 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -79,7 +79,7 @@ create_xfb_varying_names(void *mem_ctx, const glsl_type *t, char **name, 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; @@ -90,7 +90,7 @@ create_xfb_varying_names(void *mem_ctx, const glsl_type *t, char **name, 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++) { @@ -461,7 +461,7 @@ check_location_aliasing(struct explicit_location_info explicit_locations[][4], 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. */ @@ -1619,7 +1619,7 @@ varying_matches::is_varying_packing_safe(const glsl_type *type, 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); } @@ -1926,7 +1926,7 @@ varying_matches::store_locations() const 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; @@ -2158,7 +2158,7 @@ private: 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 diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 5a950950b7c..53887ab71da 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -4303,7 +4303,7 @@ get_array_stride(struct gl_context *ctx, struct gl_uniform_storage *uni, 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); diff --git a/src/compiler/glsl/lower_buffer_access.cpp b/src/compiler/glsl/lower_buffer_access.cpp index ff6f9c1fcfe..52ffa887c48 100644 --- a/src/compiler/glsl/lower_buffer_access.cpp +++ b/src/compiler/glsl/lower_buffer_access.cpp @@ -63,7 +63,7 @@ lower_buffer_access::emit_access(void *mem_ctx, 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++) { @@ -214,7 +214,7 @@ lower_buffer_access::is_dereferenced_thing_row_major(const ir_rvalue *deref) 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; @@ -241,7 +241,7 @@ lower_buffer_access::is_dereferenced_thing_row_major(const ir_rvalue *deref) 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"); @@ -414,7 +414,7 @@ lower_buffer_access::setup_buffer_access(void *mem_ctx, * 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); diff --git a/src/compiler/glsl/lower_packed_varyings.cpp b/src/compiler/glsl/lower_packed_varyings.cpp index 5bd6c92ed99..d15a45960b3 100644 --- a/src/compiler/glsl/lower_packed_varyings.cpp +++ b/src/compiler/glsl/lower_packed_varyings.cpp @@ -521,7 +521,7 @@ lower_packed_varyings_visitor::lower_rvalue(ir_rvalue *rvalue, */ 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); @@ -776,7 +776,7 @@ lower_packed_varyings_visitor::needs_lowering(ir_variable *var) */ 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; diff --git a/src/compiler/glsl/lower_ubo_reference.cpp b/src/compiler/glsl/lower_ubo_reference.cpp index 5e1f281174c..5fc936007e8 100644 --- a/src/compiler/glsl/lower_ubo_reference.cpp +++ b/src/compiler/glsl/lower_ubo_reference.cpp @@ -884,7 +884,7 @@ lower_ubo_reference_visitor::check_for_buffer_struct_copy(ir_assignment *ir) 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 diff --git a/src/compiler/glsl/opt_structure_splitting.cpp b/src/compiler/glsl/opt_structure_splitting.cpp index f7562df39c8..c573d07c266 100644 --- a/src/compiler/glsl/opt_structure_splitting.cpp +++ b/src/compiler/glsl/opt_structure_splitting.cpp @@ -103,7 +103,7 @@ ir_structure_reference_visitor::get_variable_entry(ir_variable *var) { 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; @@ -206,7 +206,7 @@ ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) { assert(var); - if (!var->type->is_record()) + if (!var->type->is_struct()) return NULL; foreach_in_list(variable_entry, entry, this->variable_list) { diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index 042f45a926d..260b07b67fe 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -203,7 +203,7 @@ glsl_type::contains_sampler() const { 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; @@ -217,7 +217,7 @@ glsl_type::contains_sampler() const 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; @@ -233,7 +233,7 @@ glsl_type::contains_integer() const { 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; @@ -249,7 +249,7 @@ glsl_type::contains_double() const { 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; @@ -265,7 +265,7 @@ glsl_type::contains_64bit() const { 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; @@ -302,7 +302,7 @@ glsl_type::contains_subroutine() const { 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; @@ -348,7 +348,7 @@ glsl_type::contains_image() const { 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; @@ -1429,13 +1429,13 @@ glsl_type::record_location_offset(unsigned length) const { 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; @@ -1527,7 +1527,7 @@ glsl_type::varying_count() const 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(); @@ -1642,7 +1642,7 @@ glsl_type::std140_base_alignment(bool row_major) const 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); } @@ -1685,7 +1685,7 @@ glsl_type::std140_base_alignment(bool row_major) const * 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; @@ -1789,7 +1789,7 @@ glsl_type::std140_size(bool row_major) const */ 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 { @@ -1811,7 +1811,7 @@ glsl_type::std140_size(bool row_major) const * 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; @@ -1837,7 +1837,7 @@ glsl_type::std140_size(bool row_major) const 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)); @@ -1935,7 +1935,7 @@ glsl_type::std430_base_alignment(bool row_major) const * 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; @@ -2029,7 +2029,7 @@ glsl_type::std430_size(bool row_major) const 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 @@ -2037,7 +2037,7 @@ glsl_type::std430_size(bool row_major) const 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; diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index f9a160b898b..8f9a69556eb 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -663,7 +663,7 @@ public: /** * Query whether or not a type is a record */ - bool is_record() const + bool is_struct() const { return base_type == GLSL_TYPE_STRUCT; } diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index c9e46ef044c..32b47f2b60f 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -280,7 +280,7 @@ glsl_type_is_array_or_matrix(const struct glsl_type *type) 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 diff --git a/src/intel/compiler/brw_vec4_visitor.cpp b/src/intel/compiler/brw_vec4_visitor.cpp index 41cebf0b838..7d6032a31e1 100644 --- a/src/intel/compiler/brw_vec4_visitor.cpp +++ b/src/intel/compiler/brw_vec4_visitor.cpp @@ -686,7 +686,7 @@ src_reg::src_reg(class vec4_visitor *v, const struct glsl_type *type) 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); @@ -716,7 +716,7 @@ dst_reg::dst_reg(class vec4_visitor *v, const struct glsl_type *type) 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; diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 11ecd71c575..d3549535ea0 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -863,7 +863,7 @@ program_resource_location(struct gl_program_resource *res, unsigned array_index) * "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: diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index ed194eb13a3..e83432356f1 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -594,7 +594,7 @@ ir_to_mesa_visitor::get_temp(const glsl_type *type) 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); @@ -1879,7 +1879,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir) * 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); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 264557c9f58..ed941e44268 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -1066,7 +1066,7 @@ type_has_array_or_matrix(const glsl_type *type) 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; @@ -1112,7 +1112,7 @@ glsl_to_tgsi_visitor::get_temp(const glsl_type *type) 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); @@ -2732,7 +2732,7 @@ glsl_to_tgsi_visitor::visit(ir_dereference_array *ir) * 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); @@ -2987,7 +2987,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_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); @@ -3175,7 +3175,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) * 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); |