From: Ian Romanick Date: Fri, 8 Sep 2017 02:02:48 +0000 (-0700) Subject: glsl: Rename ir_constant::array_elements to ::const_elements X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0e88153e998b5ba97dee2b143915ba2509217281;p=mesa.git glsl: Rename ir_constant::array_elements to ::const_elements The next patch will unify ::array_elements and ::components, so the name ::array_elements wouldn't be appropriate. A lot of things use the names array_elements and components, so grepping for either is pretty useless. Signed-off-by: Ian Romanick Reviewed-by: Alejandro PiƱeiro Reviewed-by: Elie Tournier --- diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index bb2ba17b220..f3cf74d34d6 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -302,7 +302,7 @@ constant_copy(ir_constant *ir, void *mem_ctx) ret->num_elements = ir->type->length; for (i = 0; i < ir->type->length; i++) - ret->elements[i] = constant_copy(ir->array_elements[i], mem_ctx); + ret->elements[i] = constant_copy(ir->const_elements[i], mem_ctx); break; default: diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index 52ca83689e8..c223ec688e6 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -627,14 +627,14 @@ ir_expression::variable_referenced() const ir_constant::ir_constant() : ir_rvalue(ir_type_constant) { - this->array_elements = NULL; + this->const_elements = NULL; } ir_constant::ir_constant(const struct glsl_type *type, const ir_constant_data *data) : ir_rvalue(ir_type_constant) { - this->array_elements = NULL; + this->const_elements = NULL; assert((type->base_type >= GLSL_TYPE_UINT) && (type->base_type <= GLSL_TYPE_IMAGE)); @@ -737,7 +737,7 @@ ir_constant::ir_constant(bool b, unsigned vector_elements) ir_constant::ir_constant(const ir_constant *c, unsigned i) : ir_rvalue(ir_type_constant) { - this->array_elements = NULL; + this->const_elements = NULL; this->type = c->type->get_base_type(); switch (this->type->base_type) { @@ -753,19 +753,19 @@ ir_constant::ir_constant(const ir_constant *c, unsigned i) ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) : ir_rvalue(ir_type_constant) { - this->array_elements = NULL; + this->const_elements = NULL; this->type = type; assert(type->is_scalar() || type->is_vector() || type->is_matrix() || type->is_record() || type->is_array()); if (type->is_array()) { - this->array_elements = ralloc_array(this, ir_constant *, type->length); + this->const_elements = ralloc_array(this, ir_constant *, type->length); unsigned i = 0; foreach_in_list(ir_constant, value, value_list) { assert(value->as_constant() != NULL); - this->array_elements[i++] = value; + this->const_elements[i++] = value; } return; } @@ -924,10 +924,10 @@ ir_constant::zero(void *mem_ctx, const glsl_type *type) memset(&c->value, 0, sizeof(c->value)); if (type->is_array()) { - c->array_elements = ralloc_array(c, ir_constant *, type->length); + c->const_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->fields.array); + c->const_elements[i] = ir_constant::zero(c, type->fields.array); } if (type->is_record()) { @@ -1100,7 +1100,7 @@ ir_constant::get_array_element(unsigned i) const else if (i >= this->type->length) i = this->type->length - 1; - return array_elements[i]; + return const_elements[i]; } ir_constant * @@ -1181,7 +1181,7 @@ ir_constant::copy_offset(ir_constant *src, int offset) case GLSL_TYPE_ARRAY: { assert (src->type == this->type); for (unsigned i = 0; i < this->type->length; i++) { - this->array_elements[i] = src->array_elements[i]->clone(this, NULL); + this->const_elements[i] = src->const_elements[i]->clone(this, NULL); } break; } @@ -1243,7 +1243,7 @@ ir_constant::has_value(const ir_constant *c) const if (this->type->is_array()) { for (unsigned i = 0; i < this->type->length; i++) { - if (!this->array_elements[i]->has_value(c->array_elements[i])) + if (!this->const_elements[i]->has_value(c->const_elements[i])) return false; } return true; @@ -1976,7 +1976,7 @@ steal_memory(ir_instruction *ir, void *new_ctx) } } else if (constant->type->is_array()) { for (unsigned int i = 0; i < constant->type->length; i++) { - steal_memory(constant->array_elements[i], ir); + steal_memory(constant->const_elements[i], ir); } } } diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index e2b72772a26..d87f7c32b72 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -2263,7 +2263,7 @@ public: union ir_constant_data value; /* Array elements */ - ir_constant **array_elements; + ir_constant **const_elements; /* Structure fields */ exec_list components; diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp index 4fb9fa31f9b..114367c8555 100644 --- a/src/compiler/glsl/ir_clone.cpp +++ b/src/compiler/glsl/ir_clone.cpp @@ -364,9 +364,9 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const ir_constant *c = new(mem_ctx) ir_constant; c->type = this->type; - c->array_elements = ralloc_array(c, ir_constant *, this->type->length); + c->const_elements = ralloc_array(c, ir_constant *, this->type->length); for (unsigned i = 0; i < this->type->length; i++) { - c->array_elements[i] = this->array_elements[i]->clone(mem_ctx, NULL); + c->const_elements[i] = this->const_elements[i]->clone(mem_ctx, NULL); } return c; } diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp index 01754cd3daf..beb9038db59 100644 --- a/src/compiler/glsl/link_uniform_initializers.cpp +++ b/src/compiler/glsl/link_uniform_initializers.cpp @@ -227,7 +227,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, const char *element_name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i); set_uniform_initializer(mem_ctx, prog, element_name, - element_type, val->array_elements[i], + element_type, val->const_elements[i], boolean_true); } return; @@ -240,15 +240,15 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, if (val->type->is_array()) { const enum glsl_base_type base_type = - val->array_elements[0]->type->base_type; - const unsigned int elements = val->array_elements[0]->type->components(); + val->const_elements[0]->type->base_type; + const unsigned int elements = val->const_elements[0]->type->components(); unsigned int idx = 0; unsigned dmul = glsl_base_type_is_64bit(base_type) ? 2 : 1; assert(val->type->length >= storage->array_elements); for (unsigned int i = 0; i < storage->array_elements; i++) { copy_constant_to_storage(& storage->storage[idx], - val->array_elements[i], + val->const_elements[i], base_type, elements, boolean_true); diff --git a/src/compiler/glsl/tests/uniform_initializer_utils.cpp b/src/compiler/glsl/tests/uniform_initializer_utils.cpp index 9a66ebafbcd..c5502b63269 100644 --- a/src/compiler/glsl/tests/uniform_initializer_utils.cpp +++ b/src/compiler/glsl/tests/uniform_initializer_utils.cpp @@ -215,11 +215,11 @@ verify_data(gl_constant_value *storage, unsigned storage_array_size, unsigned int boolean_true) { if (val->type->is_array()) { - const glsl_type *const element_type = val->array_elements[0]->type; + const glsl_type *const element_type = val->const_elements[0]->type; for (unsigned i = 0; i < storage_array_size; i++) { verify_data(storage + (i * element_type->components()), 0, - val->array_elements[i], 0, boolean_true); + val->const_elements[i], 0, boolean_true); } const unsigned components = element_type->components(); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 11207dd8289..432ec746350 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1940,7 +1940,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir) assert(size > 0); for (i = 0; i < ir->type->length; i++) { - ir->array_elements[i]->accept(this); + ir->const_elements[i]->accept(this); src = this->result; for (int j = 0; j < size; j++) { emit(ir, OPCODE_MOV, temp, src); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index c0dde74de73..409a207419d 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3073,7 +3073,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) in_array++; for (i = 0; i < ir->type->length; i++) { - ir->array_elements[i]->accept(this); + ir->const_elements[i]->accept(this); src = this->result; for (int j = 0; j < size; j++) { emit_asm(ir, TGSI_OPCODE_MOV, temp, src);