Revert "compiler: Combine duplicated implementation of is_gl_identifier into glsl_typ...
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Fri, 4 Aug 2023 11:28:19 +0000 (06:28 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 13:14:35 +0000 (13:14 +0000)
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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24491>

src/compiler/glsl/gl_nir_link_uniforms.c
src/compiler/glsl/gl_nir_link_varyings.c
src/compiler/glsl/gl_nir_linker.c
src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c
src/compiler/glsl/ir.h
src/compiler/glsl_types.cpp
src/compiler/glsl_types.h

index c6e0cb5..fb032be 100644 (file)
@@ -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)
 {
index b1c84d1..3ff80c7 100644 (file)
@@ -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.
  *
index c870d1b..e9be3a9 100644 (file)
@@ -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)
 {
index f2cda28..b527af3 100644 (file)
@@ -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)
 {
index 3360b16..1a37218 100644 (file)
@@ -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 */
 
index e33a5b4..af8f2e9 100644 (file)
@@ -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)
 {
index 70c8e6e..4c11bbb 100644 (file)
@@ -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