summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_codegen.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-12-12 13:05:29 -0700
committerBrian Paul <[email protected]>2008-12-12 13:05:29 -0700
commit8571401d7d7c9c91c6f053e5dc8c94a4567140fe (patch)
treedafb7e7ddef619e20827ed80425ee4226e1271e6 /src/mesa/shader/slang/slang_codegen.c
parentd5367622a3f1cffe67af0fb6fca99ad02eefd374 (diff)
mesa: fix some more GLSL 1.20 array things.
Function that return arrays should work now.
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 3f31f956fa5..38f6713aff9 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -67,9 +67,9 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper);
* Returns GL_FALSE otherwise.
*/
static GLboolean
-typeof_operation(const struct slang_assemble_ctx_ * A,
- slang_operation * op,
- slang_typeinfo * ti)
+typeof_operation(const struct slang_assemble_ctx_ *A,
+ slang_operation *op,
+ slang_typeinfo *ti)
{
return _slang_typeof_operation(op, &A->space, ti, A->atoms, A->log);
}
@@ -2559,6 +2559,14 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var,
(void *) store, store->Index, store->Size);
#endif
+ if (var->type.array_len > 0) {
+ /* the type is an array, ex: float[4] x; */
+ GLint sz = (store->Size + 3) & ~3;
+ /* total size = element size * array length */
+ sz *= var->type.array_len;
+ store->Size = sz;
+ }
+
if (var->array_len > 0) {
/* this is an array */
/* round up the element size to a multiple of 4 */