From 6e46c121f9efc941473f797e0a388146a9599eea Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 Jul 2008 13:05:28 -0600 Subject: [PATCH] mesa: fix array storage allocation bug --- src/mesa/shader/slang/slang_codegen.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); } -- 2.30.2