summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-04-08 13:13:08 -0400
committerMarek Olšák <[email protected]>2018-04-12 19:31:30 -0400
commit43d66c8c2d4d3d4dee1309856b6ce6c5393682e5 (patch)
tree1d2ffdca4a8cf765e8db3c71e491df6611c45556 /src/compiler
parent57f4268da49ce6969e597fe3441d6a9cd8bac562 (diff)
mesa: include mtypes.h less
- remove mtypes.h from most header files - add main/menums.h for often used definitions - remove main/core.h v2: fix radv build Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/ast_function.cpp2
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp1
-rw-r--r--src/compiler/glsl/builtin_functions.cpp2
-rw-r--r--src/compiler/glsl/builtin_functions.h2
-rw-r--r--src/compiler/glsl/builtin_variables.cpp2
-rw-r--r--src/compiler/glsl/glcpp/glcpp-parse.y3
-rw-r--r--src/compiler/glsl/glcpp/glcpp.c1
-rw-r--r--src/compiler/glsl/glcpp/glcpp.h4
-rw-r--r--src/compiler/glsl/glcpp/pp.c1
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp1
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp1
-rw-r--r--src/compiler/glsl/ir.cpp1
-rw-r--r--src/compiler/glsl/ir.h1
-rw-r--r--src/compiler/glsl/ir_constant_expression.cpp2
-rw-r--r--src/compiler/glsl/ir_function_detect_recursion.cpp1
-rw-r--r--src/compiler/glsl/ir_optimization.h3
-rw-r--r--src/compiler/glsl/ir_set_program_inouts.cpp2
-rw-r--r--src/compiler/glsl/ir_uniform.h2
-rw-r--r--src/compiler/glsl/link_atomics.cpp2
-rw-r--r--src/compiler/glsl/link_functions.cpp2
-rw-r--r--src/compiler/glsl/link_interface_blocks.cpp1
-rw-r--r--src/compiler/glsl/link_uniform_blocks.cpp3
-rw-r--r--src/compiler/glsl/link_uniform_initializers.cpp2
-rw-r--r--src/compiler/glsl/link_uniforms.cpp2
-rw-r--r--src/compiler/glsl/link_varyings.cpp1
-rw-r--r--src/compiler/glsl/linker.cpp3
-rw-r--r--src/compiler/glsl/linker.h4
-rw-r--r--src/compiler/glsl/lower_blend_equation_advanced.cpp1
-rw-r--r--src/compiler/glsl/lower_cs_derived.cpp1
-rw-r--r--src/compiler/glsl/lower_distance.cpp1
-rw-r--r--src/compiler/glsl/lower_named_interface_blocks.cpp1
-rw-r--r--src/compiler/glsl/lower_packed_varyings.cpp1
-rw-r--r--src/compiler/glsl/lower_shared_reference.cpp1
-rw-r--r--src/compiler/glsl/lower_tess_level.cpp1
-rw-r--r--src/compiler/glsl/lower_ubo_reference.cpp1
-rw-r--r--src/compiler/glsl/lower_vector_derefs.cpp1
-rw-r--r--src/compiler/glsl/lower_vertex_id.cpp1
-rw-r--r--src/compiler/glsl/main.cpp2
-rw-r--r--src/compiler/glsl/opt_algebraic.cpp1
-rw-r--r--src/compiler/glsl/opt_dead_builtin_varyings.cpp2
-rw-r--r--src/compiler/glsl/s_expression.cpp2
-rw-r--r--src/compiler/glsl/s_expression.h1
-rw-r--r--src/compiler/glsl/shader_cache.cpp2
-rw-r--r--src/compiler/glsl/shader_cache.h3
-rw-r--r--src/compiler/glsl/standalone.cpp1
-rw-r--r--src/compiler/glsl/standalone_scaffolding.cpp1
-rw-r--r--src/compiler/glsl/standalone_scaffolding.h2
-rw-r--r--src/compiler/glsl_types.h7
-rw-r--r--src/compiler/nir/nir_constant_expressions.py1
-rw-r--r--src/compiler/nir/nir_gather_info.c2
-rw-r--r--src/compiler/nir/nir_lower_atomics.c1
-rw-r--r--src/compiler/nir/nir_lower_samplers.c2
-rw-r--r--src/compiler/nir/nir_lower_samplers_as_deref.c2
53 files changed, 63 insertions, 31 deletions
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 94e0a16a9c0..22d58e48c64 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -25,7 +25,7 @@
#include "ast.h"
#include "compiler/glsl_types.h"
#include "ir.h"
-#include "main/core.h" /* for MIN2 */
+#include "main/mtypes.h"
#include "main/shaderobj.h"
#include "builtin_functions.h"
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 168ab7eec2f..94ce3c45d03 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -54,6 +54,7 @@
#include "ast.h"
#include "compiler/glsl_types.h"
#include "util/hash_table.h"
+#include "main/mtypes.h"
#include "main/macros.h"
#include "main/shaderobj.h"
#include "ir.h"
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 5f772c9eaba..e1ee9943172 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -75,7 +75,7 @@
#include <stdarg.h>
#include <stdio.h>
-#include "main/core.h" /* for struct gl_shader */
+#include "main/mtypes.h"
#include "main/shaderobj.h"
#include "ir_builder.h"
#include "glsl_parser_extras.h"
diff --git a/src/compiler/glsl/builtin_functions.h b/src/compiler/glsl/builtin_functions.h
index 89ec9b7d5dd..50f4f3b1494 100644
--- a/src/compiler/glsl/builtin_functions.h
+++ b/src/compiler/glsl/builtin_functions.h
@@ -24,6 +24,8 @@
#ifndef BULITIN_FUNCTIONS_H
#define BULITIN_FUNCTIONS_H
+struct gl_shader;
+
extern void
_mesa_glsl_initialize_builtin_functions();
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index a1cdec597fa..78fccc4e195 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -26,7 +26,7 @@
#include "linker.h"
#include "glsl_parser_extras.h"
#include "glsl_symbol_table.h"
-#include "main/core.h"
+#include "main/mtypes.h"
#include "main/uniforms.h"
#include "program/prog_statevars.h"
#include "program/prog_instruction.h"
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y
index 913bce1fde8..ccb3aa18d36 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -29,8 +29,7 @@
#include <inttypes.h>
#include "glcpp.h"
-#include "main/core.h" /* for struct gl_extensions */
-#include "main/mtypes.h" /* for gl_api enum */
+#include "main/mtypes.h"
static void
yyerror(YYLTYPE *locp, glcpp_parser_t *parser, const char *error);
diff --git a/src/compiler/glsl/glcpp/glcpp.c b/src/compiler/glsl/glcpp/glcpp.c
index f08b14427f4..89728ffc67a 100644
--- a/src/compiler/glsl/glcpp/glcpp.c
+++ b/src/compiler/glsl/glcpp/glcpp.c
@@ -27,7 +27,6 @@
#include <getopt.h>
#include "glcpp.h"
-#include "main/mtypes.h"
#include "main/shaderobj.h"
#include "util/strtod.h"
diff --git a/src/compiler/glsl/glcpp/glcpp.h b/src/compiler/glsl/glcpp/glcpp.h
index 9d997cd9240..c7e382ed30c 100644
--- a/src/compiler/glsl/glcpp/glcpp.h
+++ b/src/compiler/glsl/glcpp/glcpp.h
@@ -27,7 +27,7 @@
#include <stdint.h>
#include <stdbool.h>
-#include "main/mtypes.h"
+#include "main/menums.h"
#include "util/ralloc.h"
@@ -35,6 +35,8 @@
#include "util/string_buffer.h"
+struct gl_context;
+
#define yyscan_t void*
/* Some data types used for parser values. */
diff --git a/src/compiler/glsl/glcpp/pp.c b/src/compiler/glsl/glcpp/pp.c
index fab52227a02..32dee11ee34 100644
--- a/src/compiler/glsl/glcpp/pp.c
+++ b/src/compiler/glsl/glcpp/pp.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <ctype.h>
#include "glcpp.h"
+#include "main/mtypes.h"
void
glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 5dd362b3e38..25003eeccce 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -26,7 +26,6 @@
#include <string.h>
#include <assert.h>
-#include "main/core.h" /* for struct gl_context */
#include "main/context.h"
#include "main/debug_output.h"
#include "main/formats.h"
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index dbb58d82e8f..17d58acc4c2 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -32,6 +32,7 @@
#include "compiler/nir/nir_control_flow.h"
#include "compiler/nir/nir_builder.h"
#include "main/imports.h"
+#include "main/mtypes.h"
/*
* pass to lower GLSL IR to NIR
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 2c61dd9d64e..e3134eaa1c8 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -21,7 +21,6 @@
* DEALINGS IN THE SOFTWARE.
*/
#include <string.h>
-#include "main/core.h" /* for MAX2 */
#include "ir.h"
#include "compiler/glsl_types.h"
#include "glsl_parser_extras.h"
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index 6d3ef89eb87..471d9e787a7 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -33,7 +33,6 @@
#include "list.h"
#include "ir_visitor.h"
#include "ir_hierarchical_visitor.h"
-#include "main/mtypes.h"
#ifdef __cplusplus
diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp
index fe9bd1d0b4a..4a0aff72c6f 100644
--- a/src/compiler/glsl/ir_constant_expression.cpp
+++ b/src/compiler/glsl/ir_constant_expression.cpp
@@ -34,12 +34,12 @@
*/
#include <math.h>
-#include "main/core.h" /* for MAX2, MIN2, CLAMP */
#include "util/rounding.h" /* for _mesa_roundeven */
#include "util/half_float.h"
#include "ir.h"
#include "compiler/glsl_types.h"
#include "util/hash_table.h"
+#include "main/imports.h"
static float
dot_f(ir_constant *op0, ir_constant *op1)
diff --git a/src/compiler/glsl/ir_function_detect_recursion.cpp b/src/compiler/glsl/ir_function_detect_recursion.cpp
index 38e4357eff9..5b05274d001 100644
--- a/src/compiler/glsl/ir_function_detect_recursion.cpp
+++ b/src/compiler/glsl/ir_function_detect_recursion.cpp
@@ -120,7 +120,6 @@
*
* \author Ian Romanick <[email protected]>
*/
-#include "main/core.h"
#include "ir.h"
#include "glsl_parser_extras.h"
#include "linker.h"
diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h
index 81049a479e8..b0e84608c58 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -30,6 +30,9 @@
#ifndef GLSL_IR_OPTIMIZATION_H
#define GLSL_IR_OPTIMIZATION_H
+struct gl_linked_shader;
+struct gl_shader_program;
+
/* Operations for lower_instructions() */
#define SUB_TO_ADD_NEG 0x01
#define FDIV_TO_MUL_RCP 0x02
diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp b/src/compiler/glsl/ir_set_program_inouts.cpp
index 1b6c8d750b9..ba1e44167c3 100644
--- a/src/compiler/glsl/ir_set_program_inouts.cpp
+++ b/src/compiler/glsl/ir_set_program_inouts.cpp
@@ -34,10 +34,10 @@
* from the GLSL IR.
*/
-#include "main/core.h" /* for struct gl_program */
#include "ir.h"
#include "ir_visitor.h"
#include "compiler/glsl_types.h"
+#include "main/mtypes.h"
namespace {
diff --git a/src/compiler/glsl/ir_uniform.h b/src/compiler/glsl/ir_uniform.h
index 9545c4930c7..9770790cb26 100644
--- a/src/compiler/glsl/ir_uniform.h
+++ b/src/compiler/glsl/ir_uniform.h
@@ -28,7 +28,7 @@
/* stdbool.h is necessary because this file is included in both C and C++ code.
*/
#include <stdbool.h>
-
+#include "util/macros.h"
#include "program/prog_parameter.h" /* For union gl_constant_value. */
/**
diff --git a/src/compiler/glsl/link_atomics.cpp b/src/compiler/glsl/link_atomics.cpp
index d4a6eed639f..bc03d64633b 100644
--- a/src/compiler/glsl/link_atomics.cpp
+++ b/src/compiler/glsl/link_atomics.cpp
@@ -25,7 +25,9 @@
#include "ir.h"
#include "ir_uniform.h"
#include "linker.h"
+#include "main/errors.h"
#include "main/macros.h"
+#include "main/mtypes.h"
namespace {
/*
diff --git a/src/compiler/glsl/link_functions.cpp b/src/compiler/glsl/link_functions.cpp
index 56d2933ff82..e73a72c86c9 100644
--- a/src/compiler/glsl/link_functions.cpp
+++ b/src/compiler/glsl/link_functions.cpp
@@ -21,7 +21,6 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include "main/core.h"
#include "glsl_symbol_table.h"
#include "glsl_parser_extras.h"
#include "ir.h"
@@ -29,6 +28,7 @@
#include "util/set.h"
#include "util/hash_table.h"
#include "linker.h"
+#include "main/mtypes.h"
static ir_function_signature *
find_matching_signature(const char *name, const exec_list *actual_parameters,
diff --git a/src/compiler/glsl/link_interface_blocks.cpp b/src/compiler/glsl/link_interface_blocks.cpp
index ce90d916075..7c3037e8975 100644
--- a/src/compiler/glsl/link_interface_blocks.cpp
+++ b/src/compiler/glsl/link_interface_blocks.cpp
@@ -30,6 +30,7 @@
#include "glsl_symbol_table.h"
#include "linker.h"
#include "main/macros.h"
+#include "main/mtypes.h"
#include "util/hash_table.h"
diff --git a/src/compiler/glsl/link_uniform_blocks.cpp b/src/compiler/glsl/link_uniform_blocks.cpp
index 683b296e33b..e9e29d13a17 100644
--- a/src/compiler/glsl/link_uniform_blocks.cpp
+++ b/src/compiler/glsl/link_uniform_blocks.cpp
@@ -21,13 +21,14 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include "main/core.h"
#include "ir.h"
#include "linker.h"
#include "ir_uniform.h"
#include "link_uniform_block_active_visitor.h"
#include "util/hash_table.h"
#include "program.h"
+#include "main/errors.h"
+#include "main/mtypes.h"
namespace {
diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp
index d6d63bd61fc..64f47f9913f 100644
--- a/src/compiler/glsl/link_uniform_initializers.cpp
+++ b/src/compiler/glsl/link_uniform_initializers.cpp
@@ -21,11 +21,11 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include "main/core.h"
#include "ir.h"
#include "linker.h"
#include "ir_uniform.h"
#include "string_to_uint_map.h"
+#include "main/mtypes.h"
/* These functions are put in a "private" namespace instead of being marked
* static so that the unit tests can access them. See
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index a73dcd47275..23ff7ec6728 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -21,7 +21,6 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include "main/core.h"
#include "ir.h"
#include "linker.h"
#include "ir_uniform.h"
@@ -29,6 +28,7 @@
#include "program.h"
#include "string_to_uint_map.h"
#include "ir_array_refcount.h"
+#include "main/mtypes.h"
/**
* \file link_uniforms.cpp
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 1fdfcb877de..211633d9ee3 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -29,6 +29,7 @@
*/
+#include "main/errors.h"
#include "main/mtypes.h"
#include "glsl_symbol_table.h"
#include "glsl_parser_extras.h"
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index af09b7d03ee..ecd267b24f3 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -66,7 +66,6 @@
#include <ctype.h>
#include "util/strndup.h"
-#include "main/core.h"
#include "glsl_symbol_table.h"
#include "glsl_parser_extras.h"
#include "ir.h"
@@ -84,8 +83,10 @@
#include "builtin_functions.h"
#include "shader_cache.h"
+#include "main/imports.h"
#include "main/shaderobj.h"
#include "main/enums.h"
+#include "main/mtypes.h"
namespace {
diff --git a/src/compiler/glsl/linker.h b/src/compiler/glsl/linker.h
index 12a48e0dcd8..454b65aebdf 100644
--- a/src/compiler/glsl/linker.h
+++ b/src/compiler/glsl/linker.h
@@ -25,6 +25,10 @@
#ifndef GLSL_LINKER_H
#define GLSL_LINKER_H
+struct gl_shader_program;
+struct gl_shader;
+struct gl_linked_shader;
+
extern bool
link_function_calls(gl_shader_program *prog, gl_linked_shader *main,
gl_shader **shader_list, unsigned num_shaders);
diff --git a/src/compiler/glsl/lower_blend_equation_advanced.cpp b/src/compiler/glsl/lower_blend_equation_advanced.cpp
index b05a2e0f0bb..c85b39bcaa3 100644
--- a/src/compiler/glsl/lower_blend_equation_advanced.cpp
+++ b/src/compiler/glsl/lower_blend_equation_advanced.cpp
@@ -29,6 +29,7 @@
#include "program/prog_statevars.h"
#include "util/bitscan.h"
#include "builtin_functions.h"
+#include "main/mtypes.h"
using namespace ir_builder;
diff --git a/src/compiler/glsl/lower_cs_derived.cpp b/src/compiler/glsl/lower_cs_derived.cpp
index f7ec2a48b47..15534b0ac6b 100644
--- a/src/compiler/glsl/lower_cs_derived.cpp
+++ b/src/compiler/glsl/lower_cs_derived.cpp
@@ -43,6 +43,7 @@
#include "linker.h"
#include "program/prog_statevars.h"
#include "builtin_functions.h"
+#include "main/mtypes.h"
using namespace ir_builder;
diff --git a/src/compiler/glsl/lower_distance.cpp b/src/compiler/glsl/lower_distance.cpp
index 530f79d4dff..b4e730c64fb 100644
--- a/src/compiler/glsl/lower_distance.cpp
+++ b/src/compiler/glsl/lower_distance.cpp
@@ -50,6 +50,7 @@
#include "ir_rvalue_visitor.h"
#include "ir.h"
#include "program/prog_instruction.h" /* For WRITEMASK_* */
+#include "main/mtypes.h"
#define GLSL_CLIP_VAR_NAME "gl_ClipDistanceMESA"
diff --git a/src/compiler/glsl/lower_named_interface_blocks.cpp b/src/compiler/glsl/lower_named_interface_blocks.cpp
index 136352a131b..498954a33e5 100644
--- a/src/compiler/glsl/lower_named_interface_blocks.cpp
+++ b/src/compiler/glsl/lower_named_interface_blocks.cpp
@@ -64,6 +64,7 @@
#include "ir_optimization.h"
#include "ir_rvalue_visitor.h"
#include "util/hash_table.h"
+#include "main/mtypes.h"
static const glsl_type *
process_array_type(const glsl_type *type, unsigned idx)
diff --git a/src/compiler/glsl/lower_packed_varyings.cpp b/src/compiler/glsl/lower_packed_varyings.cpp
index c622f5ee7b7..5c1eed719f2 100644
--- a/src/compiler/glsl/lower_packed_varyings.cpp
+++ b/src/compiler/glsl/lower_packed_varyings.cpp
@@ -149,6 +149,7 @@
#include "ir_builder.h"
#include "ir_optimization.h"
#include "program/prog_instruction.h"
+#include "main/mtypes.h"
using namespace ir_builder;
diff --git a/src/compiler/glsl/lower_shared_reference.cpp b/src/compiler/glsl/lower_shared_reference.cpp
index 5de269fde82..a46d05419e5 100644
--- a/src/compiler/glsl/lower_shared_reference.cpp
+++ b/src/compiler/glsl/lower_shared_reference.cpp
@@ -37,6 +37,7 @@
#include "main/macros.h"
#include "util/list.h"
#include "glsl_parser_extras.h"
+#include "main/mtypes.h"
using namespace ir_builder;
diff --git a/src/compiler/glsl/lower_tess_level.cpp b/src/compiler/glsl/lower_tess_level.cpp
index b0965eb562d..3e4c7f026ce 100644
--- a/src/compiler/glsl/lower_tess_level.cpp
+++ b/src/compiler/glsl/lower_tess_level.cpp
@@ -49,6 +49,7 @@
#include "ir_rvalue_visitor.h"
#include "ir.h"
#include "program/prog_instruction.h" /* For WRITEMASK_* */
+#include "main/mtypes.h"
namespace {
diff --git a/src/compiler/glsl/lower_ubo_reference.cpp b/src/compiler/glsl/lower_ubo_reference.cpp
index 1e35b44d5fe..453c0fa2b06 100644
--- a/src/compiler/glsl/lower_ubo_reference.cpp
+++ b/src/compiler/glsl/lower_ubo_reference.cpp
@@ -37,6 +37,7 @@
#include "ir_builder.h"
#include "main/macros.h"
#include "glsl_parser_extras.h"
+#include "main/mtypes.h"
using namespace ir_builder;
diff --git a/src/compiler/glsl/lower_vector_derefs.cpp b/src/compiler/glsl/lower_vector_derefs.cpp
index a83658d20f7..7583d1fdd3e 100644
--- a/src/compiler/glsl/lower_vector_derefs.cpp
+++ b/src/compiler/glsl/lower_vector_derefs.cpp
@@ -24,6 +24,7 @@
#include "ir_builder.h"
#include "ir_rvalue_visitor.h"
#include "ir_optimization.h"
+#include "main/mtypes.h"
using namespace ir_builder;
diff --git a/src/compiler/glsl/lower_vertex_id.cpp b/src/compiler/glsl/lower_vertex_id.cpp
index 6b41fee055a..3b641caa01e 100644
--- a/src/compiler/glsl/lower_vertex_id.cpp
+++ b/src/compiler/glsl/lower_vertex_id.cpp
@@ -38,6 +38,7 @@
#include "linker.h"
#include "program/prog_statevars.h"
#include "builtin_functions.h"
+#include "main/mtypes.h"
namespace {
diff --git a/src/compiler/glsl/main.cpp b/src/compiler/glsl/main.cpp
index e082bd69757..a730c033917 100644
--- a/src/compiler/glsl/main.cpp
+++ b/src/compiler/glsl/main.cpp
@@ -21,6 +21,7 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <stdlib.h>
#include <stdio.h>
#include <getopt.h>
@@ -33,7 +34,6 @@
* offline compile GLSL code and examine the resulting GLSL IR.
*/
-#include "main/mtypes.h"
#include "standalone.h"
static struct standalone_options options;
diff --git a/src/compiler/glsl/opt_algebraic.cpp b/src/compiler/glsl/opt_algebraic.cpp
index ce5f26559a7..1a8ee361652 100644
--- a/src/compiler/glsl/opt_algebraic.cpp
+++ b/src/compiler/glsl/opt_algebraic.cpp
@@ -34,6 +34,7 @@
#include "ir_optimization.h"
#include "ir_builder.h"
#include "compiler/glsl_types.h"
+#include "main/mtypes.h"
using namespace ir_builder;
diff --git a/src/compiler/glsl/opt_dead_builtin_varyings.cpp b/src/compiler/glsl/opt_dead_builtin_varyings.cpp
index 4526f2bca00..0ce19218606 100644
--- a/src/compiler/glsl/opt_dead_builtin_varyings.cpp
+++ b/src/compiler/glsl/opt_dead_builtin_varyings.cpp
@@ -46,13 +46,13 @@
* The same is done for the gl_FragData fragment shader output.
*/
-#include "main/core.h" /* for snprintf and ARRAY_SIZE */
#include "ir.h"
#include "ir_rvalue_visitor.h"
#include "ir_optimization.h"
#include "ir_print_visitor.h"
#include "compiler/glsl_types.h"
#include "link_varyings.h"
+#include "main/mtypes.h"
namespace {
diff --git a/src/compiler/glsl/s_expression.cpp b/src/compiler/glsl/s_expression.cpp
index f82e155a6b6..12baf1d3ed3 100644
--- a/src/compiler/glsl/s_expression.cpp
+++ b/src/compiler/glsl/s_expression.cpp
@@ -25,6 +25,8 @@
#include <assert.h>
#include <stdio.h>
#include <math.h>
+#include <string.h>
+#include <stdlib.h>
#include "s_expression.h"
s_symbol::s_symbol(const char *str, size_t n)
diff --git a/src/compiler/glsl/s_expression.h b/src/compiler/glsl/s_expression.h
index 5456b6bab21..38caabbf89e 100644
--- a/src/compiler/glsl/s_expression.h
+++ b/src/compiler/glsl/s_expression.h
@@ -25,7 +25,6 @@
#ifndef S_EXPRESSION_H
#define S_EXPRESSION_H
-#include "main/core.h" /* for Elements */
#include "util/strtod.h"
#include "list.h"
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index e43ed7aa675..042f3a60f5b 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -53,13 +53,13 @@
#include "ir_uniform.h"
#include "linker.h"
#include "link_varyings.h"
-#include "main/core.h"
#include "nir.h"
#include "program.h"
#include "serialize.h"
#include "shader_cache.h"
#include "util/mesa-sha1.h"
#include "string_to_uint_map.h"
+#include "main/mtypes.h"
extern "C" {
#include "main/enums.h"
diff --git a/src/compiler/glsl/shader_cache.h b/src/compiler/glsl/shader_cache.h
index eeefb3aeb25..b3603d956d5 100644
--- a/src/compiler/glsl/shader_cache.h
+++ b/src/compiler/glsl/shader_cache.h
@@ -26,6 +26,9 @@
#include "util/disk_cache.h"
+struct gl_context;
+struct gl_shader_program;
+
void
shader_cache_write_program_metadata(struct gl_context *ctx,
struct gl_shader_program *prog);
diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp
index c989aeff71a..c24a220a48d 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -43,6 +43,7 @@
#include "ir_builder_print_visitor.h"
#include "builtin_functions.h"
#include "opt_add_neg_to_sub.h"
+#include "main/mtypes.h"
class dead_variable_visitor : public ir_hierarchical_visitor {
public:
diff --git a/src/compiler/glsl/standalone_scaffolding.cpp b/src/compiler/glsl/standalone_scaffolding.cpp
index caaddc028f7..ec5f28ae40c 100644
--- a/src/compiler/glsl/standalone_scaffolding.cpp
+++ b/src/compiler/glsl/standalone_scaffolding.cpp
@@ -34,6 +34,7 @@
#include <string.h>
#include "util/ralloc.h"
#include "util/strtod.h"
+#include "main/mtypes.h"
void
_mesa_warning(struct gl_context *ctx, const char *fmt, ...)
diff --git a/src/compiler/glsl/standalone_scaffolding.h b/src/compiler/glsl/standalone_scaffolding.h
index c8d90597ca0..7da76f06fef 100644
--- a/src/compiler/glsl/standalone_scaffolding.h
+++ b/src/compiler/glsl/standalone_scaffolding.h
@@ -31,7 +31,7 @@
#define STANDALONE_SCAFFOLDING_H
#include <assert.h>
-#include "main/mtypes.h"
+#include "main/menums.h"
#include "program/prog_statevars.h"
extern "C" void
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index 88f987fabee..efc63248656 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -30,6 +30,11 @@
#include "shader_enums.h"
#include "blob.h"
+#include "c11/threads.h"
+
+#ifdef __cplusplus
+#include "main/config.h"
+#endif
struct glsl_type;
@@ -146,7 +151,7 @@ enum {
#ifdef __cplusplus
#include "GL/gl.h"
#include "util/ralloc.h"
-#include "main/mtypes.h" /* for gl_texture_index, C++'s enum rules are broken */
+#include "main/menums.h" /* for gl_texture_index, C++'s enum rules are broken */
struct glsl_type {
GLenum gl_type;
diff --git a/src/compiler/nir/nir_constant_expressions.py b/src/compiler/nir/nir_constant_expressions.py
index ee92be51dbe..db5bde2b82d 100644
--- a/src/compiler/nir/nir_constant_expressions.py
+++ b/src/compiler/nir/nir_constant_expressions.py
@@ -76,7 +76,6 @@ template = """\
*/
#include <math.h>
-#include "main/core.h"
#include "util/rounding.h" /* for _mesa_roundeven */
#include "util/half_float.h"
#include "nir_constant_expressions.h"
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 5530009255d..eaf0ca68b0f 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -21,8 +21,8 @@
* IN THE SOFTWARE.
*/
-#include "main/mtypes.h"
#include "nir.h"
+#include "main/menums.h"
static void
set_io_mask(nir_shader *shader, nir_variable *var, int offset, int len,
diff --git a/src/compiler/nir/nir_lower_atomics.c b/src/compiler/nir/nir_lower_atomics.c
index ee66aa3d7d5..383e3236102 100644
--- a/src/compiler/nir/nir_lower_atomics.c
+++ b/src/compiler/nir/nir_lower_atomics.c
@@ -28,6 +28,7 @@
#include "compiler/glsl/ir_uniform.h"
#include "nir.h"
#include "main/config.h"
+#include "main/mtypes.h"
#include <assert.h>
/*
diff --git a/src/compiler/nir/nir_lower_samplers.c b/src/compiler/nir/nir_lower_samplers.c
index 9aa4a9e967f..7690665de30 100644
--- a/src/compiler/nir/nir_lower_samplers.c
+++ b/src/compiler/nir/nir_lower_samplers.c
@@ -29,8 +29,6 @@
#include "main/compiler.h"
#include "main/mtypes.h"
-#include "program/prog_parameter.h"
-#include "program/program.h"
/* Calculate the sampler index based on array indicies and also
* calculate the base uniform location for struct members.
diff --git a/src/compiler/nir/nir_lower_samplers_as_deref.c b/src/compiler/nir/nir_lower_samplers_as_deref.c
index 2a2fb5b093f..cb0c827182c 100644
--- a/src/compiler/nir/nir_lower_samplers_as_deref.c
+++ b/src/compiler/nir/nir_lower_samplers_as_deref.c
@@ -61,8 +61,6 @@
#include "main/compiler.h"
#include "main/mtypes.h"
-#include "program/prog_parameter.h"
-#include "program/program.h"
struct lower_samplers_as_deref_state {
nir_shader *shader;