From: Faith Ekstrand Date: Fri, 4 Aug 2023 11:28:19 +0000 (-0500) Subject: Revert "compiler: Combine duplicated implementation of is_gl_identifier into glsl_typ... X-Git-Tag: upstream/23.3.3~4646 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf6d6a0934d4c63a7db136cc0c60f8c406ccfa2d;p=platform%2Fupstream%2Fmesa.git Revert "compiler: Combine duplicated implementation of is_gl_identifier into glsl_types.h" This reverts commit f9860a84b3cf1735ece78bc5907b2be4e2878f8e. It's a bit annoying having this scattered around but it's 100% a GLSL thing and there's no reason why it should go in glsl_types.h. The fact that glsl_print_type() even uses it is a bit sketchy. Part-of: --- diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index c6e0cb5..fb032be 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++ b/src/compiler/glsl/gl_nir_link_uniforms.c @@ -47,6 +47,15 @@ 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 b1c84d1..3ff80c7 100644 --- a/src/compiler/glsl/gl_nir_link_varyings.c +++ b/src/compiler/glsl/gl_nir_link_varyings.c @@ -1778,6 +1778,15 @@ 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 c870d1b..e9be3a9 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -299,6 +299,15 @@ 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 f2cda28..b527af3 100644 --- a/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c +++ b/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c @@ -92,6 +92,15 @@ 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 3360b16..1a37218 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -2483,6 +2483,15 @@ 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_types.cpp b/src/compiler/glsl_types.cpp index e33a5b4..af8f2e9 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -3353,6 +3353,12 @@ glsl_get_sampler_dim_coordinate_components(enum glsl_sampler_dim dim) } } +static inline bool +is_gl_identifier(const char *s) +{ + return s && s[0] == 'g' && s[1] == 'l' && s[2] == '_'; +} + void glsl_print_type(FILE *f, const glsl_type *t) { diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index 70c8e6e..4c11bbb 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -289,15 +289,6 @@ enum { GLSL_PRECISION_LOW }; -/** - * 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