summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_compile.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-12-16 14:29:52 -0700
committerBrian Paul <[email protected]>2008-12-16 14:29:52 -0700
commit368df1615ef65afed96a44e1f43ade8cc703696f (patch)
treec45fe7f9e6d6d59ef1669e573955f19c2c97a220 /src/mesa/shader/slang/slang_compile.c
parent702b5b076b7591560e7e701e0c9ff2eeb30fa966 (diff)
mesa: fix some GLSL array regressions
array.length() wasn't working. Swizzle mask for accessing elements of float arrays was incorrect.
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r--src/mesa/shader/slang/slang_compile.c9
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 cc6d214c727..9ffffc3b496 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;
}