summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_reader.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2011-01-01 03:37:02 -0800
committerKenneth Graunke <[email protected]>2011-01-12 23:55:34 -0800
commitbbafd2b849629d3155fe0eef655bbc166a901925 (patch)
treef7188d2fbed20f2fccefb0adfc1e490f49cde477 /src/glsl/ir_reader.cpp
parentb74ff382a42bcb81bbf0dc6a85bb38404c46260d (diff)
ir_reader: Make assignment conditions optional.
You can now simply write (assign (xy) <lhs> <rhs>) instead of the verbose (assign (constant bool (1)) (xy) <lhs> <rhs>).
Diffstat (limited to 'src/glsl/ir_reader.cpp')
-rw-r--r--src/glsl/ir_reader.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 11a8cb7ac24..40901dc6c92 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -538,20 +538,25 @@ ir_reader::read_rvalue(s_expression *expr)
ir_assignment *
ir_reader::read_assignment(s_expression *expr)
{
- s_expression *cond_expr, *lhs_expr, *rhs_expr;
+ s_expression *cond_expr = NULL;
+ s_expression *lhs_expr, *rhs_expr;
s_list *mask_list;
- s_pattern pat[] = { "assign", cond_expr, mask_list, lhs_expr, rhs_expr };
- if (!MATCH(expr, pat)) {
- ir_read_error(expr, "expected (assign <condition> (<write mask>) "
+ s_pattern pat4[] = { "assign", mask_list, lhs_expr, rhs_expr };
+ s_pattern pat5[] = { "assign", cond_expr, mask_list, lhs_expr, rhs_expr };
+ if (!MATCH(expr, pat4) && !MATCH(expr, pat5)) {
+ ir_read_error(expr, "expected (assign [<condition>] (<write mask>) "
"<lhs> <rhs>)");
return NULL;
}
- ir_rvalue *condition = read_rvalue(cond_expr);
- if (condition == NULL) {
- ir_read_error(NULL, "when reading condition of assignment");
- return NULL;
+ ir_rvalue *condition = NULL;
+ if (cond_expr != NULL) {
+ condition = read_rvalue(cond_expr);
+ if (condition == NULL) {
+ ir_read_error(NULL, "when reading condition of assignment");
+ return NULL;
+ }
}
unsigned mask = 0;