aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-28 21:19:00 +0200
committermarha <marha@users.sourceforge.net>2014-07-28 21:19:00 +0200
commitb33b8d8ae86876b50df96881b96074b3fe177cce (patch)
treebcdfa896ef05643b7edc1cd06518cbb7fed72c72 /mesalib/src/glsl/link_uniform_block_active_visitor.cpp
parentd0c30e7945e76ac119f6d867e27137c8a76f7e15 (diff)
downloadvcxsrv-b33b8d8ae86876b50df96881b96074b3fe177cce.tar.gz
vcxsrv-b33b8d8ae86876b50df96881b96074b3fe177cce.tar.bz2
vcxsrv-b33b8d8ae86876b50df96881b96074b3fe177cce.zip
plink fontconfig libX11 libXext xserver xkeyboard-config mesa git update 28 July 2014
xserver commit 4afedf545b673282f2e214c0e2c759c9be9b9a2a xkeyboard-config commit 9010f6c0745f472b670c22340b5bbd36e33ce37e libX11 commit 0885cad1e4a9ed57266582be320be55259c881bf libXext commit efdcbb7634501e1117d422636a0a75d7ea84b16b fontconfig commit a9e7b0494e04b3925d1bccc140ff2500cfff9618 mesa commit cc1e1da24a6c535617d9fb38858d48d8c2999e68 plink revision 10211
Diffstat (limited to 'mesalib/src/glsl/link_uniform_block_active_visitor.cpp')
-rw-r--r--mesalib/src/glsl/link_uniform_block_active_visitor.cpp50
1 files changed, 31 insertions, 19 deletions
diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
index d19ce20c7..854309f9b 100644
--- a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
+++ b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
@@ -109,32 +109,44 @@ link_uniform_block_active_visitor::visit_enter(ir_dereference_array *ir)
assert((b->num_array_elements == 0) == (b->array_elements == NULL));
assert(b->type != NULL);
- /* Determine whether or not this array index has already been added to the
- * list of active array indices. At this point all constant folding must
- * have occured, and the array index must be a constant.
- */
ir_constant *c = ir->array_index->as_constant();
- assert(c != NULL);
- const unsigned idx = c->get_uint_component(0);
+ if (c) {
+ /* Index is a constant, so mark just that element used, if not already */
+ const unsigned idx = c->get_uint_component(0);
- unsigned i;
- for (i = 0; i < b->num_array_elements; i++) {
- if (b->array_elements[i] == idx)
- break;
- }
+ unsigned i;
+ for (i = 0; i < b->num_array_elements; i++) {
+ if (b->array_elements[i] == idx)
+ break;
+ }
- assert(i <= b->num_array_elements);
+ assert(i <= b->num_array_elements);
- if (i == b->num_array_elements) {
- b->array_elements = reralloc(this->mem_ctx,
- b->array_elements,
- unsigned,
- b->num_array_elements + 1);
+ if (i == b->num_array_elements) {
+ b->array_elements = reralloc(this->mem_ctx,
+ b->array_elements,
+ unsigned,
+ b->num_array_elements + 1);
- b->array_elements[b->num_array_elements] = idx;
+ b->array_elements[b->num_array_elements] = idx;
- b->num_array_elements++;
+ b->num_array_elements++;
+ }
+ } else {
+ /* The array index is not a constant, so mark the entire array used. */
+ assert(b->type->is_array());
+ if (b->num_array_elements < b->type->length) {
+ b->num_array_elements = b->type->length;
+ b->array_elements = reralloc(this->mem_ctx,
+ b->array_elements,
+ unsigned,
+ b->num_array_elements);
+
+ for (unsigned i = 0; i < b->num_array_elements; i++) {
+ b->array_elements[i] = i;
+ }
+ }
}
return visit_continue_with_parent;