diff options
author | Paul Berry <[email protected]> | 2012-08-01 17:44:02 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-12-06 12:13:21 -0800 |
commit | 53e572f15cb394a8d4f2cd5856dd2a06b6ccd3f0 (patch) | |
tree | 4ea5a88d76cc8fff693b00747c3f526d60cea23b /src | |
parent | 9a93ba306878693d9157d204743a82becbd5d53e (diff) |
glsl: Simplify symbol table version checking.
Previously, we stored the GLSL language version in the
glsl_symbol_table struct. But this was unnecessary--all
glsl_symbol_table needs to know is whether functions and variables
have separate namespaces (they do in GLSL 1.10 only).
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Acked-by: Carl Worth <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ast_function.cpp | 3 | ||||
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 2 | ||||
-rwxr-xr-x | src/glsl/builtins/tools/generate_builtins.py | 2 | ||||
-rw-r--r-- | src/glsl/glsl_symbol_table.cpp | 6 | ||||
-rw-r--r-- | src/glsl/glsl_symbol_table.h | 3 |
5 files changed, 9 insertions, 7 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index ea3282c5f94..c0e05ad8589 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -324,7 +324,8 @@ match_function_by_name(const char *name, goto done; /* no match */ /* Is the function hidden by a variable (impossible in 1.10)? */ - if (state->language_version != 110 && state->symbols->get_variable(name)) + if (!state->symbols->separate_function_namespace + && state->symbols->get_variable(name)) goto done; /* no match */ if (f != NULL) { diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index d450aa1e40d..75b551b2db4 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -66,7 +66,7 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { _mesa_glsl_initialize_variables(instructions, state); - state->symbols->language_version = state->language_version; + state->symbols->separate_function_namespace = state->language_version == 110; state->current_function = NULL; diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index 14a72fc07a5..3e8d4485580 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -183,7 +183,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh); st->language_version = 140; - st->symbols->language_version = 140; + st->symbols->separate_function_namespace = false; st->ARB_texture_rectangle_enable = true; st->EXT_texture_array_enable = true; st->OES_EGL_image_external_enable = true; diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index bcb65d30182..f934ea86570 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -52,7 +52,7 @@ public: glsl_symbol_table::glsl_symbol_table() { - this->language_version = 120; + this->separate_function_namespace = false; this->table = _mesa_symbol_table_ctor(); this->mem_ctx = ralloc_context(NULL); } @@ -80,7 +80,7 @@ bool glsl_symbol_table::name_declared_this_scope(const char *name) bool glsl_symbol_table::add_variable(ir_variable *v) { - if (this->language_version == 110) { + if (this->separate_function_namespace) { /* In 1.10, functions and variables have separate namespaces. */ symbol_table_entry *existing = get_entry(v->name); if (name_declared_this_scope(v->name)) { @@ -120,7 +120,7 @@ bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) bool glsl_symbol_table::add_function(ir_function *f) { - if (this->language_version == 110 && name_declared_this_scope(f->name)) { + if (this->separate_function_namespace && name_declared_this_scope(f->name)) { /* In 1.10, functions and variables have separate namespaces. */ symbol_table_entry *existing = get_entry(f->name); if ((existing->f == NULL) && (existing->t == NULL)) { diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 637bc033b93..9f5602787f0 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -77,7 +77,8 @@ public: glsl_symbol_table(); ~glsl_symbol_table(); - unsigned int language_version; + /* In 1.10, functions and variables have separate namespaces. */ + bool separate_function_namespace; void push_scope(); void pop_scope(); |