}
-/**
- * Allocate storage for a variable of 'size' bytes from given pool.
- * Return the allocated address for the variable.
- */
-static GLuint
-slang_var_pool_alloc(slang_var_pool * pool, unsigned int size)
-{
- const GLuint addr = pool->next_addr;
- pool->next_addr += size;
- return addr;
-}
-
/*
* slang_code_unit
*/
for (i = 0; i < SLANG_BUILTIN_TOTAL; i++)
_slang_code_unit_ctr(&self->builtin[i], self);
_slang_code_unit_ctr(&self->unit, self);
- self->varpool.next_addr = 0;
slang_atom_pool_construct(&self->atompool);
}
slang_variable_scope *vars;
slang_function_scope *funs;
slang_struct_scope *structs;
- slang_var_pool *global_pool;
struct gl_program *program;
slang_var_table *vartable;
GLuint default_precision[TYPE_SPECIFIER_COUNT];
&& 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 */
o.funs = &unit->funs;
o.structs = &unit->structs;
o.vars = &unit->vars;
- o.global_pool = &unit->object->varpool;
o.program = shader ? shader->Program : NULL;
o.vartable = _slang_new_var_table(maxRegs);
_slang_push_var_table(o.vartable);
} slang_unit_type;
-typedef struct slang_var_pool_
-{
- GLuint next_addr;
-} slang_var_pool;
-
-
typedef struct slang_code_unit_
{
slang_variable_scope vars;
{
slang_code_unit builtin[SLANG_BUILTIN_TOTAL];
slang_code_unit unit;
- slang_var_pool varpool;
slang_atom_pool atompool;
} slang_code_object;
slang_atom a_name; /**< The variable's name (char *) */
GLuint array_len; /**< only if type == SLANG_SPEC_ARRAy */
struct slang_operation_ *initializer; /**< Optional initializer code */
- GLuint address; /**< Storage location */
GLuint size; /**< Variable's size in bytes */
GLboolean isTemp; /**< a named temporary (__resultTmp) */
GLboolean declared; /**< for debug */