diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp index 9ca930a8983..159e378c68e 100644 --- a/src/compiler/glsl/ast_function.cpp +++ b/src/compiler/glsl/ast_function.cpp @@ -25,6 +25,7 @@ #include "ast.h" #include "compiler/glsl_types.h" #include "ir.h" +#include "linker_util.h" #include "main/shader_types.h" #include "main/consts_exts.h" #include "main/shaderobj.h" diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index b27f38577a2..674b63de1ca 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++ b/src/compiler/glsl/gl_nir_link_uniforms.c @@ -47,15 +47,6 @@ struct uniform_array_info { BITSET_WORD *indices; }; -/** - * Built-in / reserved GL variables names start with "gl_" - */ -static inline bool -is_gl_identifier(const char *s) -{ - return s && s[0] == 'g' && s[1] == 'l' && s[2] == '_'; -} - static unsigned uniform_storage_size(const struct glsl_type *type) { diff --git a/src/compiler/glsl/gl_nir_link_varyings.c b/src/compiler/glsl/gl_nir_link_varyings.c index 1c05670c7f3..db33882406c 100644 --- a/src/compiler/glsl/gl_nir_link_varyings.c +++ b/src/compiler/glsl/gl_nir_link_varyings.c @@ -2093,15 +2093,6 @@ varying_matches_compute_packing_order(const nir_variable *var) } } -/** - * Built-in / reserved GL variables names start with "gl_" - */ -static bool -is_gl_identifier(const char *s) -{ - return s && s[0] == 'g' && s[1] == 'l' && s[2] == '_'; -} - /** * Record the given producer/consumer variable pair in the list of variables * that should later be assigned locations. diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index bc83733a5f4..84f58be2f1a 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -299,15 +299,6 @@ disable_varying_optimizations_for_sso(struct gl_shader_program *prog) } } -/** - * Built-in / reserved GL variables names start with "gl_" - */ -static inline bool -is_gl_identifier(const char *s) -{ - return s && s[0] == 'g' && s[1] == 'l' && s[2] == '_'; -} - static bool inout_has_same_location(const nir_variable *var, unsigned stage) { diff --git a/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c b/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c index 3aed5c2c521..02068d92f0b 100644 --- a/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c +++ b/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c @@ -45,6 +45,7 @@ #include "gl_nir_link_varyings.h" #include "gl_nir_linker.h" +#include "linker_util.h" #include "nir_builder.h" #include "nir_gl_types.h" #include "nir_types.h" @@ -92,15 +93,6 @@ initialise_varying_info(struct varying_info *info, nir_variable_mode mode, memset(info->backcolor, 0, sizeof(info->backcolor)); } -/** - * Built-in / reserved GL variables names start with "gl_" - */ -static bool -is_gl_identifier(const char *s) -{ - return s && s[0] == 'g' && s[1] == 'l' && s[2] == '_'; -} - static void gather_info_on_varying_deref(struct varying_info *info, nir_deref_instr *deref) { diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index 79b703ba688..c02fd143736 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -2468,15 +2468,6 @@ prototype_string(const glsl_type *return_type, const char *name, const char * mode_string(const ir_variable *var); -/** - * Built-in / reserved GL variables names start with "gl_" - */ -static inline bool -is_gl_identifier(const char *s) -{ - return s && s[0] == 'g' && s[1] == 'l' && s[2] == '_'; -} - extern "C" { #endif /* __cplusplus */ diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp index b6bbb814b0b..5852340eea5 100644 --- a/src/compiler/glsl/ir_print_visitor.cpp +++ b/src/compiler/glsl/ir_print_visitor.cpp @@ -23,6 +23,7 @@ #include /* for PRIx64 macro */ #include "ir_print_visitor.h" +#include "linker_util.h" #include "compiler/glsl_types.h" #include "glsl_parser_extras.h" #include "main/macros.h" diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp index b959f050f24..165a218ab62 100644 --- a/src/compiler/glsl/ir_validate.cpp +++ b/src/compiler/glsl/ir_validate.cpp @@ -35,6 +35,7 @@ #include "ir.h" #include "ir_hierarchical_visitor.h" +#include "linker_util.h" #include "util/u_debug.h" #include "util/hash_table.h" #include "util/macros.h" diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index 577bf544b46..bfd389a2b6a 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -35,6 +35,7 @@ #include "glsl_symbol_table.h" #include "ir.h" #include "linker.h" +#include "linker_util.h" #include "link_varyings.h" diff --git a/src/compiler/glsl/linker_util.h b/src/compiler/glsl/linker_util.h index f89b4d1292b..1bd9b61eac7 100644 --- a/src/compiler/glsl/linker_util.h +++ b/src/compiler/glsl/linker_util.h @@ -32,6 +32,15 @@ struct gl_constants; struct gl_shader_program; struct gl_uniform_storage; +/** + * Built-in / reserved GL variables names start with "gl_" + */ +static inline bool +is_gl_identifier(const char *s) +{ + return s && s[0] == 'g' && s[1] == 'l' && s[2] == '_'; +} + #ifdef __cplusplus extern "C" { #endif diff --git a/src/compiler/glsl/opt_dead_builtin_variables.cpp b/src/compiler/glsl/opt_dead_builtin_variables.cpp index 0d4e3a8f00a..48452fc312e 100644 --- a/src/compiler/glsl/opt_dead_builtin_variables.cpp +++ b/src/compiler/glsl/opt_dead_builtin_variables.cpp @@ -24,6 +24,7 @@ #include "ir.h" #include "ir_visitor.h" #include "ir_optimization.h" +#include "linker_util.h" /** * Pre-linking, optimize unused built-in variables