compiler/glsl: Move glsl_print_type from glsl_types.* to ir_print_visitor.cpp

glsl_print_type only referenced in ir_print_visitor.cpp
there is no need expose it

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24824>
This commit is contained in:
Yonggang Luo 2023-08-06 13:08:09 +08:00 committed by Marge Bot
parent 01ddb18427
commit 26c5200acf
3 changed files with 14 additions and 23 deletions

View file

@ -45,6 +45,20 @@ ir_instruction::fprint(FILE *f) const
deconsted->accept(&v); deconsted->accept(&v);
} }
static void
glsl_print_type(FILE *f, const glsl_type *t)
{
if (t->is_array()) {
fprintf(f, "(array ");
glsl_print_type(f, t->fields.array);
fprintf(f, " %u)", t->length);
} else if (t->is_struct() && !is_gl_identifier(t->name)) {
fprintf(f, "%s@%p", t->name, (void *) t);
} else {
fprintf(f, "%s", t->name);
}
}
extern "C" { extern "C" {
void void
_mesa_print_ir(FILE *f, exec_list *instructions, _mesa_print_ir(FILE *f, exec_list *instructions,

View file

@ -3382,24 +3382,4 @@ 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)
{
if (t->is_array()) {
fprintf(f, "(array ");
glsl_print_type(f, t->fields.array);
fprintf(f, " %u)", t->length);
} else if (t->is_struct() && !is_gl_identifier(t->name)) {
fprintf(f, "%s@%p", t->name, (void *) t);
} else {
fprintf(f, "%s", t->name);
}
}
} }

View file

@ -54,9 +54,6 @@ glsl_type_singleton_decref();
extern void extern void
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state);
void
glsl_print_type(FILE *f, const struct glsl_type *t);
void encode_type_to_blob(struct blob *blob, const struct glsl_type *type); void encode_type_to_blob(struct blob *blob, const struct glsl_type *type);
const struct glsl_type *decode_type_from_blob(struct blob_reader *blob); const struct glsl_type *decode_type_from_blob(struct blob_reader *blob);