diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/ast_to_hir.cpp | 2 | ||||
-rw-r--r-- | src/compiler/glsl/builtin_functions.cpp | 13 | ||||
-rw-r--r-- | src/compiler/glsl/builtin_functions.h | 3 |
3 files changed, 14 insertions, 4 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index b1e490eefd9..c338ad79ca3 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -5916,7 +5916,7 @@ ast_function::hir(exec_list *instructions, /* Local shader has no exact candidates; check the built-ins. */ _mesa_glsl_initialize_builtin_functions(); if (state->language_version >= 300 && - _mesa_glsl_has_builtin_function(name)) { + _mesa_glsl_has_builtin_function(state, name)) { YYLTYPE loc = this->get_location(); _mesa_glsl_error(& loc, state, "A shader cannot redefine or overload built-in " diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index cc1432197b9..84833bdd7d5 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -6227,14 +6227,23 @@ _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state, } bool -_mesa_glsl_has_builtin_function(const char *name) +_mesa_glsl_has_builtin_function(_mesa_glsl_parse_state *state, const char *name) { ir_function *f; + bool ret = false; mtx_lock(&builtins_lock); f = builtins.shader->symbols->get_function(name); + if (f != NULL) { + foreach_in_list(ir_function_signature, sig, &f->signatures) { + if (sig->is_builtin_available(state)) { + ret = true; + break; + } + } + } mtx_unlock(&builtins_lock); - return f != NULL; + return ret; } gl_shader * diff --git a/src/compiler/glsl/builtin_functions.h b/src/compiler/glsl/builtin_functions.h index 14a52b94027..2053c82b745 100644 --- a/src/compiler/glsl/builtin_functions.h +++ b/src/compiler/glsl/builtin_functions.h @@ -32,7 +32,8 @@ _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state, const char *name, exec_list *actual_parameters); extern bool -_mesa_glsl_has_builtin_function(const char *name); +_mesa_glsl_has_builtin_function(_mesa_glsl_parse_state *state, + const char *name); extern gl_shader * _mesa_glsl_get_builtin_function_shader(void); |