summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_compile.c
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-07-11 00:05:53 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-07-11 00:05:53 +1000
commit19171ab1d30f14ac0d39894125a3d53a91ca5b89 (patch)
tree7adb5b8317f9acfe1f4f0ba2e10dd79b228cd57d /src/mesa/shader/slang/slang_compile.c
parent225863aeb5f2dfe4980ae5887f5623ecb05e9ced (diff)
parent64f92e00c8292113f9a6372959febe903af09db6 (diff)
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r--src/mesa/shader/slang/slang_compile.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index e2117c03e6..ccb04494bf 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) {
@@ -2167,6 +2167,9 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
type = SLANG_UNIT_FRAGMENT_SHADER;
}
+ if (!shader->Source)
+ return GL_FALSE;
+
ctx->Shader.MemPool = _slang_new_mempool(1024*1024);
/* XXX temporary hack */