[Mesa-dev] [PATCH 14/19] glsl: Make it possible to remove a variable from the symbol table.
Paul Berry
stereotype441 at gmail.com
Wed Oct 2 17:45:27 PDT 2013
In later patches, we'll use this in order to implement the required
behaviour that after the gl_PerVertex interface block has been
redeclared, only members of the redeclared interface block may be
used.
---
src/glsl/glsl_symbol_table.cpp | 9 +++++++++
src/glsl/glsl_symbol_table.h | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp
index 6e916b4..694713a 100644
--- a/src/glsl/glsl_symbol_table.cpp
+++ b/src/glsl/glsl_symbol_table.cpp
@@ -256,3 +256,12 @@ symbol_table_entry *glsl_symbol_table::get_entry(const char *name)
return (symbol_table_entry *)
_mesa_symbol_table_find_symbol(table, -1, name);
}
+
+void
+glsl_symbol_table::remove_variable(const char *name)
+{
+ symbol_table_entry *entry = get_entry(name);
+ if (entry != NULL) {
+ entry->v = NULL;
+ }
+}
diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h
index 62d26b8..b73db3b 100644
--- a/src/glsl/glsl_symbol_table.h
+++ b/src/glsl/glsl_symbol_table.h
@@ -121,6 +121,13 @@ public:
enum ir_variable_mode mode);
/*@}*/
+ /**
+ * Remove a variable from the symbol table. This is necessary when
+ * gl_PerVertex is redeclared, to ensure that previously-available built-in
+ * variables are no longer available.
+ */
+ void remove_variable(const char *name);
+
private:
symbol_table_entry *get_entry(const char *name);
--
1.8.4
More information about the mesa-dev
mailing list