summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_compile.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-01-10 13:33:38 -0700
committerBrian <[email protected]>2007-01-10 13:33:38 -0700
commit88e2dbfd10129eab2c7f4a935358a6ab2a18bf65 (patch)
tree11dd7ef5cbacf8e3792cbff6fefc0032619d7eef /src/mesa/shader/slang/slang_compile.c
parent8a48f3557424cfa67269ae5e4dca100ae2a0ddda (diff)
checkpoint: codegen for global vars w/ initializers
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r--src/mesa/shader/slang/slang_compile.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 314c32f7077..bb1da271524 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -38,6 +38,7 @@
#include "slang_preprocess.h"
#include "slang_storage.h"
#include "slang_error.h"
+#include "slang_emit.h"
#include "slang_print.h"
@@ -247,6 +248,7 @@ typedef struct slang_output_ctx_
slang_var_pool *global_pool;
slang_machine *machine;
struct gl_program *program;
+ slang_gen_context *codegen;
} slang_output_ctx;
/* _slang_compile() */
@@ -1719,8 +1721,20 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
}
#if 1
- if (C->global_scope /*&& O->program*/)
- _slang_codegen_global_variable(var, O->program, C->type);
+ if (C->global_scope) {
+ slang_assemble_ctx A;
+
+ A.file = O->assembly;
+ A.mach = O->machine;
+ A.atoms = C->atoms;
+ A.space.funcs = O->funs;
+ A.space.structs = O->structs;
+ A.space.vars = O->vars;
+ A.codegen = O->codegen;
+ A.program = O->program;
+
+ _slang_codegen_global_variable(&A, var, C->type);
+ }
#endif
/* allocate global address space for a variable with a known size */
@@ -1880,6 +1894,7 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition,
A.space.structs = O->structs;
A.space.vars = O->vars;
A.program = O->program;
+ A.codegen = O->codegen;
_slang_reset_error();
@@ -1953,6 +1968,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
o.global_pool = &unit->object->varpool;
o.machine = &unit->object->machine;
o.program = program;
+ o.codegen = _slang_new_codegen_context();
/* parse individual functions and declarations */
while (*C->I != EXTERNAL_NULL) {