summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-04-29 18:05:26 -0700
committerKenneth Graunke <[email protected]>2016-06-23 11:58:50 -0700
commitef78df8d3b0cf540e5f08c8c2f6caa338b64a6c7 (patch)
treeb5e6e76636e75b0faf75357991405f555656fc64
parentf7741c521119ce147215d94a4c238e84fc8b1130 (diff)
glsl: Make lower_const_arrays_to_uniforms work directly on constants.
There's really no point in looking at ir_dereference_array of a constant. It also misses cases like: (assign () (var_ref tmp) (constant (array ...) ...)) No changes in shader-db, but keeps it working after the next commit. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/compiler/glsl/lower_const_arrays_to_uniforms.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/compiler/glsl/lower_const_arrays_to_uniforms.cpp b/src/compiler/glsl/lower_const_arrays_to_uniforms.cpp
index 2d024d4b78c..99481505e0e 100644
--- a/src/compiler/glsl/lower_const_arrays_to_uniforms.cpp
+++ b/src/compiler/glsl/lower_const_arrays_to_uniforms.cpp
@@ -70,17 +70,13 @@ lower_const_array_visitor::handle_rvalue(ir_rvalue **rvalue)
if (!*rvalue)
return;
- ir_dereference_array *dra = (*rvalue)->as_dereference_array();
- if (!dra)
- return;
-
- ir_constant *con = dra->array->as_constant();
+ ir_constant *con = (*rvalue)->as_constant();
if (!con || !con->type->is_array())
return;
void *mem_ctx = ralloc_parent(con);
- char *uniform_name = ralloc_asprintf(mem_ctx, "constarray__%p", dra);
+ char *uniform_name = ralloc_asprintf(mem_ctx, "constarray__%p", con);
ir_variable *uni =
new(mem_ctx) ir_variable(con->type, uniform_name, ir_var_uniform);
@@ -93,8 +89,7 @@ lower_const_array_visitor::handle_rvalue(ir_rvalue **rvalue)
uni->data.max_array_access = uni->type->length - 1;
instructions->push_head(uni);
- ir_dereference_variable *varref = new(mem_ctx) ir_dereference_variable(uni);
- *rvalue = new(mem_ctx) ir_dereference_array(varref, dra->array_index);
+ *rvalue = new(mem_ctx) ir_dereference_variable(uni);
progress = true;
}