struct gl_uniform_block *ubo = get_next_uniform_block(state);
ubo->Name = ralloc_strdup(state->uniform_blocks, this->block_name);
+ if (!state->symbols->add_uniform_block(ubo)) {
+ YYLTYPE loc = this->get_location();
+ _mesa_glsl_error(&loc, state, "Uniform block name `%s' already taken in "
+ "the current scope.\n", ubo->Name);
+ }
+
unsigned int num_variables = 0;
foreach_list_typed(ast_declarator_list, decl_list, link, &declarations) {
foreach_list_const(node, &decl_list->declarations) {
ralloc_free(entry);
}
- symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {}
- symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {}
- symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {}
+ symbol_table_entry(ir_variable *v) : v(v), f(0), t(0), u(0) {}
+ symbol_table_entry(ir_function *f) : v(0), f(f), t(0), u(0) {}
+ symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t), u(0) {}
+ symbol_table_entry(struct gl_uniform_block *u) : v(0), f(0), t(0), u(u) {}
ir_variable *v;
ir_function *f;
const glsl_type *t;
+ struct gl_uniform_block *u;
};
glsl_symbol_table::glsl_symbol_table()
return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
}
+bool glsl_symbol_table::add_uniform_block(struct gl_uniform_block *u)
+{
+ symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(u);
+ return _mesa_symbol_table_add_symbol(table, -1, u->Name, entry) == 0;
+}
+
void glsl_symbol_table::add_global_function(ir_function *f)
{
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);