Module: Mesa
Branch: main
Commit: 18abdb8596f02d2608e6f9875e8203525586a51d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=18abdb8596f02d2608e6f9875e8203525586a51d

Author: Yonggang Luo <[email protected]>
Date:   Tue Jan  2 13:38:46 2024 +0800

compiler/glsl: Move glsl specific _mesa_glsl_initialize_types out and 
glsl_symbol_table of glsl_types.h

To make sure C-ABI compat,

struct _mesa_glsl_parse_state;
struct gl_shader_program;
struct gl_builtin_uniform_desc;

are wrapped with extern "C"

And getting _mesa_glsl_initialize_variables c-compat for consistence

Signed-off-by: Yonggang Luo <[email protected]>
Reviewed-by: Caio Oliveira <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26804>

---

 src/compiler/glsl/ir.h    | 26 +++++++++++++++++++-------
 src/compiler/glsl_types.h |  5 -----
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index 68a3ab64544..b288ba34618 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -37,6 +37,18 @@
 #include "ir_hierarchical_visitor.h"
 #include "util/glheader.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _mesa_glsl_parse_state;
+struct gl_shader_program;
+struct gl_builtin_uniform_desc;
+
+#ifdef __cplusplus
+}
+#endif
+
 #ifdef __cplusplus
 
 /**
@@ -2418,9 +2430,6 @@ visit_exec_list(exec_list *list, ir_visitor *visitor);
  */
 void validate_ir_tree(exec_list *instructions);
 
-struct _mesa_glsl_parse_state;
-struct gl_shader_program;
-
 /**
  * Detect whether an unlinked shader contains static recursion
  *
@@ -2453,10 +2462,6 @@ detect_recursion_linked(struct gl_shader_program *prog,
 void
 clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in);
 
-extern void
-_mesa_glsl_initialize_variables(exec_list *instructions,
-                               struct _mesa_glsl_parse_state *state);
-
 extern void
 reparent_ir(exec_list *list, void *mem_ctx);
 
@@ -2470,6 +2475,13 @@ mode_string(const ir_variable *var);
 extern "C" {
 #endif /* __cplusplus */
 
+extern void
+_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state);
+
+extern void
+_mesa_glsl_initialize_variables(struct exec_list *instructions,
+                                struct _mesa_glsl_parse_state *state);
+
 extern void _mesa_print_ir(FILE *f, struct exec_list *instructions,
                            struct _mesa_glsl_parse_state *state);
 
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index ad1c4dbe0ef..07a2df75047 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -41,8 +41,6 @@ extern "C" {
 
 typedef struct glsl_type glsl_type;
 typedef struct glsl_struct_field glsl_struct_field;
-struct _mesa_glsl_parse_state;
-struct glsl_symbol_table;
 
 extern void
 glsl_type_singleton_init_or_ref(void);
@@ -50,9 +48,6 @@ glsl_type_singleton_init_or_ref(void);
 extern void
 glsl_type_singleton_decref(void);
 
-extern void
-_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state);
-
 void encode_type_to_blob(struct blob *blob, const glsl_type *type);
 
 const glsl_type *decode_type_from_blob(struct blob_reader *blob);

Reply via email to