aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-07-03 16:23:18 -0600
committerBrian Paul <[email protected]>2008-07-03 17:21:23 -0600
commit0ed3f6f575ebdb345ad9891380686eafce63c75e (patch)
tree2d66e6655986b300c8fb49e3f63551a6db1c42be /src
parent22ac107971151a02cbe7a03a05bc99a53bc80eb1 (diff)
mesa: fix array storage allocation bug
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 4846c257f16..14fa38c3cda 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2071,6 +2071,14 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var)
n->Store->File = PROGRAM_TEMPORARY;
n->Store->Size = _slang_sizeof_type_specifier(&n->Var->type.specifier);
+ if (var->array_len > 0) {
+ /* this is an array */
+ /* round up element size to mult of 4 */
+ GLint sz = (n->Store->Size + 3) & ~3;
+ /* mult by array size */
+ sz *= var->array_len;
+ n->Store->Size = sz;
+ }
A->program->NumTemporaries++;
assert(n->Store->Size > 0);
}