glsl: move is_gl_identifier() to linker_util
This had started to multiply around the NIR linker. Here we move it to a common helper shared by GLSL IR and NIR. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25371>
This commit is contained in:

committed by
Marge Bot

parent
78b9f1053f
commit
0bfae24640
@@ -25,6 +25,7 @@
|
|||||||
#include "ast.h"
|
#include "ast.h"
|
||||||
#include "compiler/glsl_types.h"
|
#include "compiler/glsl_types.h"
|
||||||
#include "ir.h"
|
#include "ir.h"
|
||||||
|
#include "linker_util.h"
|
||||||
#include "main/shader_types.h"
|
#include "main/shader_types.h"
|
||||||
#include "main/consts_exts.h"
|
#include "main/consts_exts.h"
|
||||||
#include "main/shaderobj.h"
|
#include "main/shaderobj.h"
|
||||||
|
@@ -47,15 +47,6 @@ struct uniform_array_info {
|
|||||||
BITSET_WORD *indices;
|
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
|
static unsigned
|
||||||
uniform_storage_size(const struct glsl_type *type)
|
uniform_storage_size(const struct glsl_type *type)
|
||||||
{
|
{
|
||||||
|
@@ -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
|
* Record the given producer/consumer variable pair in the list of variables
|
||||||
* that should later be assigned locations.
|
* that should later be assigned locations.
|
||||||
|
@@ -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
|
static bool
|
||||||
inout_has_same_location(const nir_variable *var, unsigned stage)
|
inout_has_same_location(const nir_variable *var, unsigned stage)
|
||||||
{
|
{
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
#include "gl_nir_link_varyings.h"
|
#include "gl_nir_link_varyings.h"
|
||||||
#include "gl_nir_linker.h"
|
#include "gl_nir_linker.h"
|
||||||
|
#include "linker_util.h"
|
||||||
#include "nir_builder.h"
|
#include "nir_builder.h"
|
||||||
#include "nir_gl_types.h"
|
#include "nir_gl_types.h"
|
||||||
#include "nir_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));
|
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
|
static void
|
||||||
gather_info_on_varying_deref(struct varying_info *info, nir_deref_instr *deref)
|
gather_info_on_varying_deref(struct varying_info *info, nir_deref_instr *deref)
|
||||||
{
|
{
|
||||||
|
@@ -2468,15 +2468,6 @@ prototype_string(const glsl_type *return_type, const char *name,
|
|||||||
const char *
|
const char *
|
||||||
mode_string(const ir_variable *var);
|
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" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <inttypes.h> /* for PRIx64 macro */
|
#include <inttypes.h> /* for PRIx64 macro */
|
||||||
#include "ir_print_visitor.h"
|
#include "ir_print_visitor.h"
|
||||||
|
#include "linker_util.h"
|
||||||
#include "compiler/glsl_types.h"
|
#include "compiler/glsl_types.h"
|
||||||
#include "glsl_parser_extras.h"
|
#include "glsl_parser_extras.h"
|
||||||
#include "main/macros.h"
|
#include "main/macros.h"
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "ir.h"
|
#include "ir.h"
|
||||||
#include "ir_hierarchical_visitor.h"
|
#include "ir_hierarchical_visitor.h"
|
||||||
|
#include "linker_util.h"
|
||||||
#include "util/u_debug.h"
|
#include "util/u_debug.h"
|
||||||
#include "util/hash_table.h"
|
#include "util/hash_table.h"
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "glsl_symbol_table.h"
|
#include "glsl_symbol_table.h"
|
||||||
#include "ir.h"
|
#include "ir.h"
|
||||||
#include "linker.h"
|
#include "linker.h"
|
||||||
|
#include "linker_util.h"
|
||||||
#include "link_varyings.h"
|
#include "link_varyings.h"
|
||||||
|
|
||||||
|
|
||||||
|
@@ -32,6 +32,15 @@ struct gl_constants;
|
|||||||
struct gl_shader_program;
|
struct gl_shader_program;
|
||||||
struct gl_uniform_storage;
|
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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include "ir.h"
|
#include "ir.h"
|
||||||
#include "ir_visitor.h"
|
#include "ir_visitor.h"
|
||||||
#include "ir_optimization.h"
|
#include "ir_optimization.h"
|
||||||
|
#include "linker_util.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pre-linking, optimize unused built-in variables
|
* Pre-linking, optimize unused built-in variables
|
||||||
|
Reference in New Issue
Block a user