diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-12-16 14:29:52 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-01-06 09:14:56 -0700 |
commit | c2009111cc839ff3ba5df7c3a9170d31f706fa79 (patch) | |
tree | 8d90af8942ea11d491d02f2fd7f5558cd191d1d1 /src/mesa/shader/slang/slang_compile.c | |
parent | 2ced2647fb6787170545205eb01afe167c6604ea (diff) |
mesa: fix some GLSL array regressions
array.length() wasn't working.
Swizzle mask for accessing elements of float arrays was incorrect.
(cherry picked from commit 368df1615ef65afed96a44e1f43ade8cc703696f)
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index cc6d214c72..9ffffc3b49 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -158,7 +158,7 @@ typedef struct slang_output_ctx_ /* Debugging aid, print file/line where parsing error is detected */ #define RETURN0 \ do { \ - if (0) \ + if (1) \ printf("slang error at %s:%d\n", __FILE__, __LINE__); \ return 0; \ } while (0) @@ -1425,6 +1425,9 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O, if (op->a_id == SLANG_ATOM_NULL) RETURN0; + assert(*C->I == OP_END); + C->I++; + while (*C->I != OP_END) if (!parse_child_operation(C, O, op, 0)) RETURN0; @@ -1977,6 +1980,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, var->type.centroid = type->centroid; var->type.precision = type->precision; var->type.variant = type->variant; + var->type.array_len = type->array_len; var->a_name = a_name; if (var->a_name == SLANG_ATOM_NULL) RETURN0; @@ -1989,7 +1993,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, break; case VARIABLE_INITIALIZER: /* initialized variable - copy the specifier and parse the expression */ - if (type->array_len >= 0) { + if (0 && type->array_len >= 0) { /* The type was something like "float[4]" */ convert_to_array(C, var, &type->specifier); var->array_len = type->array_len; @@ -2026,6 +2030,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, break; case VARIABLE_ARRAY_EXPLICIT: if (type->array_len >= 0) { + /* the user is trying to do something like: float[2] x[3]; */ slang_info_log_error(C->L, "multi-dimensional arrays not allowed"); RETURN0; } |