summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_reader.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-12-31 01:48:02 -0800
committerKenneth Graunke <[email protected]>2011-01-12 23:55:33 -0800
commitd7988152722cd5f3930064a139b567cbcb0e5f53 (patch)
treeb17b82ce389b74e347bef5c8c43d619bdbcf5f12 /src/glsl/ir_reader.cpp
parentdaeb0c646e0d652bfa16d326028753ecf092c0c9 (diff)
ir_reader: Remove s_list::length() method.
Most code now relies on the pattern matcher rather than this function, and for the only remaining case, not using this saves an iteration.
Diffstat (limited to 'src/glsl/ir_reader.cpp')
-rw-r--r--src/glsl/ir_reader.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 00146d8c15e..98906c4ad73 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -754,13 +754,7 @@ read_constant(_mesa_glsl_parse_state *st, s_list *list)
}
if (type->is_array()) {
- const unsigned elements_supplied = values->length();
- if (elements_supplied != type->length) {
- ir_read_error(st, values, "expected exactly %u array elements, "
- "given %u", type->length, elements_supplied);
- return NULL;
- }
-
+ unsigned elements_supplied = 0;
exec_list elements;
foreach_iter(exec_list_iterator, it, values->subexpressions) {
s_expression *expr = (s_expression *) it.get();
@@ -774,6 +768,13 @@ read_constant(_mesa_glsl_parse_state *st, s_list *list)
if (ir_elt == NULL)
return NULL;
elements.push_tail(ir_elt);
+ elements_supplied++;
+ }
+
+ if (elements_supplied != type->length) {
+ ir_read_error(st, values, "expected exactly %u array elements, "
+ "given %u", type->length, elements_supplied);
+ return NULL;
}
return new(ctx) ir_constant(type, &elements);
}