compiler: Combine duplicated implementation of is_gl_identifier into glsl_types.h

As glsl_types.cpp also called is_gl_identifier, so move it into glsl_types.h,
this will help the decouple glsl_types.h from src/compiler/glsl/*

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23420>
This commit is contained in:
Yonggang Luo
2023-06-04 13:52:55 +08:00
committed by Marge Bot
parent 340311dac9
commit f9860a84b3
6 changed files with 9 additions and 45 deletions

View File

@@ -46,15 +46,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)
{

View File

@@ -1258,15 +1258,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.

View File

@@ -198,15 +198,6 @@ can_remove_uniform(nir_variable *var, UNUSED void *data)
return true;
}
/**
* 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)
{

View File

@@ -92,15 +92,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)
{

View File

@@ -2489,15 +2489,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 */

View File

@@ -291,6 +291,15 @@ 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