mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-21 00:00:22 +01:00
mesa: compute global var size before doing codegen
This commit is contained in:
parent
2e638cfe3c
commit
0d1f54db6b
1 changed files with 9 additions and 9 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue