X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglsl%2Fglsl_symbol_table.h;h=5d654e5e6a778eed89357bb2c6266247d295deb5;hb=ef9e6d1ec8389f800d22c0dd091efb30f189fa45;hp=9f5602787f083c1a077b8bb93d18debb28ebbe18;hpb=53e572f15cb394a8d4f2cd5856dd2a06b6ccd3f0;p=mesa.git diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 9f5602787f0..5d654e5e6a7 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -32,9 +32,9 @@ extern "C" { #include "program/symbol_table.h" } #include "ir.h" -#include "glsl_types.h" class symbol_table_entry; +struct glsl_type; /** * Facade class for _mesa_symbol_table @@ -43,37 +43,8 @@ class symbol_table_entry; * type safe and some symbol table invariants. */ struct glsl_symbol_table { -private: - static void - _glsl_symbol_table_destructor (glsl_symbol_table *table) - { - table->~glsl_symbol_table(); - } - -public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *table; - - table = ralloc_size(ctx, size); - assert(table != NULL); - - ralloc_set_destructor(table, (void (*)(void*)) _glsl_symbol_table_destructor); - - return table; - } - - /* If the user *does* call delete, that's OK, we will just - * ralloc_free in that case. Here, C++ will have already called the - * destructor so tell ralloc not to do that again. */ - static void operator delete(void *table) - { - ralloc_set_destructor(table, NULL); - ralloc_free(table); - } - + DECLARE_RALLOC_CXX_OPERATORS(glsl_symbol_table) + glsl_symbol_table(); ~glsl_symbol_table(); @@ -99,6 +70,9 @@ public: bool add_variable(ir_variable *v); bool add_type(const char *name, const glsl_type *t); bool add_function(ir_function *f); + bool add_interface(const char *name, const glsl_type *i, + enum ir_variable_mode mode); + bool add_default_precision_qualifier(const char *type_name, int precision); /*@}*/ /** @@ -113,8 +87,19 @@ public: ir_variable *get_variable(const char *name); const glsl_type *get_type(const char *name); ir_function *get_function(const char *name); + const glsl_type *get_interface(const char *name, + enum ir_variable_mode mode); + int get_default_precision_qualifier(const char *type_name); /*@}*/ + /** + * Disable a previously-added variable so that it no longer appears to be + * in the symbol table. This is necessary when gl_PerVertex is redeclared, + * to ensure that previously-available built-in variables are no longer + * available. + */ + void disable_variable(const char *name); + private: symbol_table_entry *get_entry(const char *name);