summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2017-09-07 19:02:48 -0700
committerIan Romanick <[email protected]>2017-09-19 12:02:43 -0500
commit0e88153e998b5ba97dee2b143915ba2509217281 (patch)
tree1d9ac0711ca41cc159faab043f627452cc41878c /src/compiler
parente5145e28eabbcd9775427114f9469809a74c8fb1 (diff)
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 <[email protected]> Reviewed-by: Alejandro PiƱeiro <[email protected]> Reviewed-by: Elie Tournier <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp2
-rw-r--r--src/compiler/glsl/ir.cpp24
-rw-r--r--src/compiler/glsl/ir.h2
-rw-r--r--src/compiler/glsl/ir_clone.cpp4
-rw-r--r--src/compiler/glsl/link_uniform_initializers.cpp8
-rw-r--r--src/compiler/glsl/tests/uniform_initializer_utils.cpp4
6 files changed, 22 insertions, 22 deletions
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();