aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-07-08 13:05:43 -0600
committerBrian Paul <[email protected]>2008-07-08 15:07:28 -0600
commit0d1f54db6b4e66b164ea4193e7aa41a98b6fce0d (patch)
treea311e3ade436ea034761b9ef8d7ad5b7744e44e3
parent2e638cfe3c3a8ab639d9cdb13abced6dc8ed0755 (diff)
mesa: compute global var size before doing codegen
-rw-r--r--src/mesa/shader/slang/slang_compile.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index e2117c03e67..4acbe802d29 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) {