[Mesa-dev] [PATCH 34/59] glsl: Move builtin_function related prototypes to a separate file

Ian Romanick idr at freedesktop.org
Wed Oct 26 00:59:40 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/Makefile.sources                      |  1 +
 src/compiler/glsl/ast_function.cpp                 |  1 +
 src/compiler/glsl/ast_to_hir.cpp                   |  1 +
 src/compiler/glsl/builtin_functions.cpp            |  1 +
 src/compiler/glsl/builtin_functions.h              | 46 ++++++++++++++++++++++
 src/compiler/glsl/builtin_variables.cpp            |  1 +
 src/compiler/glsl/glsl_parser_extras.cpp           |  1 +
 src/compiler/glsl/ir.h                             | 19 ---------
 src/compiler/glsl/linker.cpp                       |  1 +
 .../glsl/lower_blend_equation_advanced.cpp         |  1 +
 src/compiler/glsl/lower_vertex_id.cpp              |  1 +
 src/compiler/glsl/standalone.cpp                   |  1 +
 12 files changed, 56 insertions(+), 19 deletions(-)
 create mode 100644 src/compiler/glsl/builtin_functions.h

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 9f2d362..a573fcb 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -19,6 +19,7 @@ LIBGLSL_FILES = \
 	glsl/blob.c \
 	glsl/blob.h \
 	glsl/builtin_functions.cpp \
+	glsl/builtin_functions.h \
 	glsl/builtin_types.cpp \
 	glsl/builtin_variables.cpp \
 	glsl/glsl_parser_extras.cpp \
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 6d20f6b..b8732cf 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -27,6 +27,7 @@
 #include "ir.h"
 #include "main/core.h" /* for MIN2 */
 #include "main/shaderobj.h"
+#include "builtin_functions.h"
 
 static ir_rvalue *
 convert_component(ir_rvalue *src, const glsl_type *desired_type);
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 427deaf..1e105de 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -58,6 +58,7 @@
 #include "main/shaderobj.h"
 #include "ir.h"
 #include "ir_builder.h"
+#include "builtin_functions.h"
 
 using namespace ir_builder;
 
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index e229c09..e56cb01 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -61,6 +61,7 @@
 #include "glsl_parser_extras.h"
 #include "program/prog_instruction.h"
 #include <math.h>
+#include "builtin_functions.h"
 
 #define M_PIf   ((float) M_PI)
 #define M_PI_2f ((float) M_PI_2)
diff --git a/src/compiler/glsl/builtin_functions.h b/src/compiler/glsl/builtin_functions.h
new file mode 100644
index 0000000..747b4fb
--- /dev/null
+++ b/src/compiler/glsl/builtin_functions.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef BULITIN_FUNCTIONS_H
+#define BULITIN_FUNCTIONS_H
+
+extern void
+_mesa_glsl_initialize_builtin_functions();
+
+extern ir_function_signature *
+_mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state,
+                                 const char *name, exec_list *actual_parameters);
+
+extern ir_function *
+_mesa_glsl_find_builtin_function_by_name(const char *name);
+
+extern gl_shader *
+_mesa_glsl_get_builtin_function_shader(void);
+
+extern ir_function_signature *
+_mesa_get_main_function_signature(glsl_symbol_table *symbols);
+
+extern void
+_mesa_glsl_release_builtin_functions(void);
+
+#endif /* BULITIN_FUNCTIONS_H */
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index ca266a4..88b7d48 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -30,6 +30,7 @@
 #include "main/uniforms.h"
 #include "program/prog_statevars.h"
 #include "program/prog_instruction.h"
+#include "builtin_functions.h"
 
 using namespace ir_builder;
 
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 6b41c9f..8fb566b 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -36,6 +36,7 @@
 #include "glsl_parser.h"
 #include "ir_optimization.h"
 #include "loop_analysis.h"
+#include "builtin_functions.h"
 
 /**
  * Format a short human-readable description of the given GLSL version.
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index 1a0a49f..3b04908 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -2364,25 +2364,6 @@ _mesa_glsl_initialize_derived_variables(struct gl_context *ctx,
                                         gl_shader *shader);
 
 extern void
-_mesa_glsl_initialize_builtin_functions();
-
-extern ir_function_signature *
-_mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state,
-                                 const char *name, exec_list *actual_parameters);
-
-extern ir_function *
-_mesa_glsl_find_builtin_function_by_name(const char *name);
-
-extern gl_shader *
-_mesa_glsl_get_builtin_function_shader(void);
-
-extern ir_function_signature *
-_mesa_get_main_function_signature(glsl_symbol_table *symbols);
-
-extern void
-_mesa_glsl_release_builtin_functions(void);
-
-extern void
 reparent_ir(exec_list *list, void *mem_ctx);
 
 extern void
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 7fca121..34d9aab 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -79,6 +79,7 @@
 #include "ir_optimization.h"
 #include "ir_rvalue_visitor.h"
 #include "ir_uniform.h"
+#include "builtin_functions.h"
 
 #include "main/shaderobj.h"
 #include "main/enums.h"
diff --git a/src/compiler/glsl/lower_blend_equation_advanced.cpp b/src/compiler/glsl/lower_blend_equation_advanced.cpp
index 1d03392..1f885d7 100644
--- a/src/compiler/glsl/lower_blend_equation_advanced.cpp
+++ b/src/compiler/glsl/lower_blend_equation_advanced.cpp
@@ -28,6 +28,7 @@
 #include "program/prog_instruction.h"
 #include "program/prog_statevars.h"
 #include "util/bitscan.h"
+#include "builtin_functions.h"
 
 using namespace ir_builder;
 
diff --git a/src/compiler/glsl/lower_vertex_id.cpp b/src/compiler/glsl/lower_vertex_id.cpp
index 412b97e..6b41fee 100644
--- a/src/compiler/glsl/lower_vertex_id.cpp
+++ b/src/compiler/glsl/lower_vertex_id.cpp
@@ -37,6 +37,7 @@
 #include "ir_builder.h"
 #include "linker.h"
 #include "program/prog_statevars.h"
+#include "builtin_functions.h"
 
 namespace {
 
diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp
index d5374ea..084dc37 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -41,6 +41,7 @@
 #include "linker.h"
 #include "glsl_parser_extras.h"
 #include "ir_builder_print_visitor.h"
+#include "builtin_functions.h"
 
 class add_neg_to_sub_visitor : public ir_hierarchical_visitor {
 public:
-- 
2.5.5



More information about the mesa-dev mailing list