From: Brian Paul Date: Tue, 8 Jul 2008 19:05:34 +0000 (-0600) Subject: mesa: compute global var size before doing codegen X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d14b7890a44fe7a3bccd9152645f50b0edb850d8;p=mesa.git mesa: compute global var size before doing codegen --- diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 4cda7124c05..75d1d7621d7 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1634,6 +1634,15 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, return 0; } + /* allocate global address space for a variable with a known size */ + if (C->global_scope + && !(var->type.specifier.type == SLANG_SPEC_ARRAY + && var->array_len == 0)) { + if (!calculate_var_size(C, O, var)) + return GL_FALSE; + var->address = slang_var_pool_alloc(O->global_pool, var->size); + } + /* emit code for global var decl */ if (C->global_scope) { slang_assemble_ctx A; @@ -1648,15 +1657,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, return 0; } - /* allocate global address space for a variable with a known size */ - if (C->global_scope - && !(var->type.specifier.type == SLANG_SPEC_ARRAY - && var->array_len == 0)) { - if (!calculate_var_size(C, O, var)) - return GL_FALSE; - var->address = slang_var_pool_alloc(O->global_pool, var->size); - } - /* initialize global variable */ if (C->global_scope) { if (var->initializer != NULL) {