diff options
author | Matt Turner <[email protected]> | 2013-04-09 16:43:14 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2013-05-06 10:17:12 -0700 |
commit | f9e37879eb6407d9374e74d3982651b60ce096a1 (patch) | |
tree | 38bc198ee8faad1a3c7bdd1b5ce1ac4b438013ee /src | |
parent | f99f78e49a10b92e236ee0909eb806d353e1f2e6 (diff) |
glsl: Rework ir_reader to handle expressions with four operands.
Needed to support the bitfieldInsert() built-in added by
ARB_gpu_shader5.
Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ir_reader.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 16fdc41b456..b3667124fa8 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -676,16 +676,18 @@ ir_reader::read_expression(s_expression *expr) { s_expression *s_type; s_symbol *s_op; - s_expression *s_arg[3]; + s_expression *s_arg[4] = {NULL}; s_pattern pat[] = { "expression", s_type, s_op, s_arg[0] }; if (!PARTIAL_MATCH(expr, pat)) { ir_read_error(expr, "expected (expression <type> <operator> " - "<operand> [<operand>])"); + "<operand> [<operand>] [<operand>] [<operand>])"); return NULL; } s_arg[1] = (s_expression *) s_arg[0]->next; // may be tail sentinel s_arg[2] = (s_expression *) s_arg[1]->next; // may be tail sentinel or NULL + if (s_arg[2]) + s_arg[3] = (s_expression *) s_arg[2]->next; // may be tail sentinel or NULL const glsl_type *type = read_type(s_type); if (type == NULL) @@ -709,7 +711,7 @@ ir_reader::read_expression(s_expression *expr) return NULL; } - ir_rvalue *arg[3] = {NULL, NULL, NULL}; + ir_rvalue *arg[4] = {NULL}; for (int i = 0; i < num_operands; i++) { arg[i] = read_rvalue(s_arg[i]); if (arg[i] == NULL) { @@ -718,7 +720,7 @@ ir_reader::read_expression(s_expression *expr) } } - return new(mem_ctx) ir_expression(op, type, arg[0], arg[1], arg[2]); + return new(mem_ctx) ir_expression(op, type, arg[0], arg[1], arg[2], arg[3]); } ir_swizzle * |