summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/amd/vulkan/radv_pipeline.c1
-rw-r--r--src/amd/vulkan/radv_private.h1
-rw-r--r--src/amd/vulkan/radv_radeon_winsys.h1
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c2
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c2
-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
-rw-r--r--src/gallium/state_trackers/glx/xlib/glx_usefont.c1
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.h2
-rw-r--r--src/intel/common/gen_urb_config.c1
-rw-r--r--src/intel/compiler/brw_compiler.h1
-rw-r--r--src/intel/compiler/brw_eu.h1
-rw-r--r--src/mesa/Makefile.sources2
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h6
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h1
-rw-r--r--src/mesa/drivers/dri/r200/r200_state_init.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_vertprog.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state_init.c1
-rw-r--r--src/mesa/main/api_arrayelt.h5
-rw-r--r--src/mesa/main/buffers.h2
-rw-r--r--src/mesa/main/colormac.h1
-rw-r--r--src/mesa/main/context.h1
-rw-r--r--src/mesa/main/copyimage.h2
-rw-r--r--src/mesa/main/core.h53
-rw-r--r--src/mesa/main/dd.h6
-rw-r--r--src/mesa/main/debug.c1
-rw-r--r--src/mesa/main/debug_output.h3
-rw-r--r--src/mesa/main/dlist.h2
-rw-r--r--src/mesa/main/drawtex.c1
-rw-r--r--src/mesa/main/errors.h4
-rw-r--r--src/mesa/main/eval.h2
-rw-r--r--src/mesa/main/execmem.c2
-rw-r--r--src/mesa/main/extensions.h2
-rw-r--r--src/mesa/main/extensions_table.c1
-rw-r--r--src/mesa/main/ffvertex_prog.c1
-rw-r--r--src/mesa/main/format_pack.py2
-rw-r--r--src/mesa/main/format_unpack.py1
-rw-r--r--src/mesa/main/format_utils.c1
-rw-r--r--src/mesa/main/format_utils.h1
-rw-r--r--src/mesa/main/formats.c1
-rw-r--r--src/mesa/main/glformats.h2
-rw-r--r--src/mesa/main/glheader.h2
-rw-r--r--src/mesa/main/glspirv.c1
-rw-r--r--src/mesa/main/glspirv.h4
-rw-r--r--src/mesa/main/glthread.h3
-rw-r--r--src/mesa/main/hash.c1
-rw-r--r--src/mesa/main/hash.h1
-rw-r--r--src/mesa/main/imports.c1
-rw-r--r--src/mesa/main/imports.h1
-rw-r--r--src/mesa/main/menums.h213
-rw-r--r--src/mesa/main/mipmap.c1
-rw-r--r--src/mesa/main/mipmap.h5
-rw-r--r--src/mesa/main/mtypes.h215
-rw-r--r--src/mesa/main/pack.c1
-rw-r--r--src/mesa/main/pack.h4
-rw-r--r--src/mesa/main/pbo.c1
-rw-r--r--src/mesa/main/pbo.h4
-rw-r--r--src/mesa/main/pixeltransfer.h4
-rw-r--r--src/mesa/main/querymatrix.c1
-rw-r--r--src/mesa/main/querymatrix.h2
-rw-r--r--src/mesa/main/remap.c1
-rw-r--r--src/mesa/main/renderbuffer.h2
-rw-r--r--src/mesa/main/shader_query.cpp1
-rw-r--r--src/mesa/main/shaderapi.h7
-rw-r--r--src/mesa/main/shaderobj.h7
-rw-r--r--src/mesa/main/texcompress_bptc.c1
-rw-r--r--src/mesa/main/texcompress_etc.c1
-rw-r--r--src/mesa/main/texcompress_fxt1.c2
-rw-r--r--src/mesa/main/texcompress_rgtc.c1
-rw-r--r--src/mesa/main/texobj.h1
-rw-r--r--src/mesa/main/texstore.c1
-rw-r--r--src/mesa/main/texstore.h6
-rw-r--r--src/mesa/main/texturebindless.h4
-rw-r--r--src/mesa/main/uniform_query.cpp2
-rw-r--r--src/mesa/main/varray.h2
-rw-r--r--src/mesa/main/version.h7
-rw-r--r--src/mesa/main/vtxfmt.h4
-rw-r--r--src/mesa/math/m_matrix.c1
-rw-r--r--src/mesa/meson.build2
-rw-r--r--src/mesa/program/ir_to_mesa.h2
-rw-r--r--src/mesa/program/prog_execute.c2
-rw-r--r--src/mesa/program/prog_execute.h4
-rw-r--r--src/mesa/program/prog_instruction.c2
-rw-r--r--src/mesa/program/prog_parameter.h33
-rw-r--r--src/mesa/program/prog_print.h2
-rw-r--r--src/mesa/program/prog_to_nir.c1
-rw-r--r--src/mesa/program/program.h2
-rw-r--r--src/mesa/program/program_parse.y1
-rw-r--r--src/mesa/program/programopt.h5
-rw-r--r--src/mesa/program/symbol_table.c1
-rw-r--r--src/mesa/state_tracker/st_atom_depth.c1
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c1
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c1
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c1
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c1
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c1
-rw-r--r--src/mesa/state_tracker/st_draw.c1
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c1
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi_private.h9
-rw-r--r--src/mesa/state_tracker/st_manager.h2
-rw-r--r--src/mesa/state_tracker/st_program.c1
-rw-r--r--src/mesa/swrast/s_context.c1
-rw-r--r--src/mesa/swrast/s_fog.c1
-rw-r--r--src/mesa/swrast/s_span.c1
-rw-r--r--src/mesa/swrast/s_stencil.c1
-rw-r--r--src/mesa/swrast/s_texfetch.c1
-rw-r--r--src/mesa/swrast/s_zoom.c1
-rw-r--r--src/mesa/tnl/t_rebase.c1
-rw-r--r--src/mesa/tnl/t_vb_fog.c1
-rw-r--r--src/mesa/tnl/t_vb_texgen.c1
-rw-r--r--src/mesa/tnl/tnl.h3
-rw-r--r--src/mesa/vbo/vbo_attrib.h2
-rw-r--r--src/mesa/vbo/vbo_context.c2
-rw-r--r--src/mesa/vbo/vbo_exec.c1
-rw-r--r--src/mesa/vbo/vbo_exec.h3
-rw-r--r--src/mesa/vbo/vbo_noop.h4
-rw-r--r--src/mesa/vbo/vbo_primitive_restart.c1
-rw-r--r--src/mesa/vbo/vbo_private.h1
-rw-r--r--src/mesa/vbo/vbo_save.c1
-rw-r--r--src/mesa/vbo/vbo_save.h1
-rw-r--r--src/mesa/vbo/vbo_save_draw.c1
-rw-r--r--src/mesa/vbo/vbo_save_loopback.c1
-rw-r--r--src/util/register_allocate.c1
-rw-r--r--src/util/xmlconfig.h1
177 files changed, 477 insertions, 367 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index fce3201c198..88fccb2b2ea 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -48,6 +48,7 @@
#include "util/debug.h"
#include "ac_exp_param.h"
#include "ac_shader_util.h"
+#include "main/menums.h"
struct radv_blend_state {
uint32_t blend_enable_4bit;
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index fb94c50cb00..df8fe891dcf 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -43,6 +43,7 @@
#define VG(x)
#endif
+#include "c11/threads.h"
#include <amdgpu.h>
#include "compiler/shader_enums.h"
#include "util/macros.h"
diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
index 270b3bceaba..ba16bf332ab 100644
--- a/src/amd/vulkan/radv_radeon_winsys.h
+++ b/src/amd/vulkan/radv_radeon_winsys.h
@@ -29,6 +29,7 @@
#ifndef RADV_RADEON_WINSYS_H
#define RADV_RADEON_WINSYS_H
+#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index 9e83390568a..32f263adddc 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -33,6 +33,8 @@
#include <amdgpu.h>
#include <amdgpu_drm.h>
#include <inttypes.h>
+#include <pthread.h>
+#include <unistd.h>
#include "util/u_atomic.h"
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
index cd7ab384e73..9921d38ab0f 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
@@ -26,6 +26,8 @@
#include <amdgpu.h>
#include <amdgpu_drm.h>
#include <assert.h>
+#include <pthread.h>
+#include <errno.h>
#include "ac_debug.h"
#include "radv_radeon_winsys.h"
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;
diff --git a/src/gallium/state_trackers/glx/xlib/glx_usefont.c b/src/gallium/state_trackers/glx/xlib/glx_usefont.c
index b3e9c79ce2c..819d2e320d8 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_usefont.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_usefont.c
@@ -31,7 +31,6 @@
#include <stdio.h>
-#include "main/core.h"
#include <GL/glx.h>
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h
index e420679313e..d2b57d6b9dd 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -57,7 +57,7 @@ and create a window, you must do the following to use the X/Mesa interface:
#define XMESA_H
-#include "main/core.h" /* for gl_config */
+#include "main/mtypes.h" /* for gl_config */
#include "state_tracker/st_api.h"
#include "os/os_thread.h"
diff --git a/src/intel/common/gen_urb_config.c b/src/intel/common/gen_urb_config.c
index 937163b50b0..0b632149cd9 100644
--- a/src/intel/common/gen_urb_config.c
+++ b/src/intel/common/gen_urb_config.c
@@ -26,6 +26,7 @@
#include "util/macros.h"
#include "main/macros.h"
+#include "compiler/shader_enums.h"
#include "gen_l3_config.h"
diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
index d3ae6499b91..875b2936fd8 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -27,6 +27,7 @@
#include <stdio.h>
#include "dev/gen_device_info.h"
#include "main/macros.h"
+#include "main/mtypes.h"
#include "util/ralloc.h"
#ifdef __cplusplus
diff --git a/src/intel/compiler/brw_eu.h b/src/intel/compiler/brw_eu.h
index ca72666a55a..120a74f0357 100644
--- a/src/intel/compiler/brw_eu.h
+++ b/src/intel/compiler/brw_eu.h
@@ -34,6 +34,7 @@
#define BRW_EU_H
#include <stdbool.h>
+#include <stdio.h>
#include "brw_inst.h"
#include "brw_eu_defines.h"
#include "brw_reg.h"
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 92565ef8f5e..d78493ed9d7 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -55,7 +55,6 @@ MAIN_FILES = \
main/convolve.h \
main/copyimage.c \
main/copyimage.h \
- main/core.h \
main/cpuinfo.c \
main/cpuinfo.h \
main/dd.h \
@@ -148,6 +147,7 @@ MAIN_FILES = \
main/mipmap.h \
main/mm.c \
main/mm.h \
+ main/menums.h \
main/mtypes.h \
main/multisample.c \
main/multisample.h \
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 5018f2fbf68..062c83f79ec 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -55,10 +55,14 @@
#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
-#include "main/mtypes.h"
+#include "main/menums.h"
+#include "main/formats.h"
#include "util/xmlconfig.h"
#include <stdbool.h>
+struct gl_config;
+struct gl_context;
+
/**
* Extensions.
*/
diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h
index 5361dcf5e34..a219c7fb1dc 100644
--- a/src/mesa/drivers/dri/i915/intel_context.h
+++ b/src/mesa/drivers/dri/i915/intel_context.h
@@ -32,6 +32,7 @@
#include <stdbool.h>
#include <string.h>
#include "main/mtypes.h"
+#include "main/errors.h"
#include <drm.h>
#include <intel_bufmgr.h>
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index f049d086492..6d424019183 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -36,6 +36,7 @@
#include <stdbool.h>
#include "main/macros.h"
#include "main/mtypes.h"
+#include "main/errors.h"
#include "vbo/vbo.h"
#include "brw_structs.h"
#include "brw_pipe_control.h"
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index 4b589cd8b83..41c3df710e5 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <[email protected]>
*/
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/imports.h"
#include "main/enums.h"
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index f69f4a0a1e2..7076ec0c7f3 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -30,6 +30,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Aapo Tahkola <[email protected]>
* Roland Scheidegger <[email protected]>
*/
+
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 58d8fc54b79..8b72c98a3b2 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -41,7 +41,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/fbobject.h"
#include "util/simple_list.h"
#include "main/state.h"
-#include "main/core.h"
#include "main/stencil.h"
#include "main/viewport.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c
index b847be54c47..6a8cf606dcb 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state_init.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c
@@ -27,6 +27,7 @@
* Keith Whitwell <[email protected]>
*/
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/imports.h"
#include "main/api_arrayelt.h"
diff --git a/src/mesa/main/api_arrayelt.h b/src/mesa/main/api_arrayelt.h
index 965e0ad3aea..6543a58f724 100644
--- a/src/mesa/main/api_arrayelt.h
+++ b/src/mesa/main/api_arrayelt.h
@@ -27,9 +27,10 @@
#ifndef API_ARRAYELT_H
#define API_ARRAYELT_H
+#include <stdbool.h>
+#include "dd.h"
-#include "main/mtypes.h"
-
+struct _glapi_table;
extern GLboolean _ae_create_context( struct gl_context *ctx );
extern void _ae_destroy_context( struct gl_context *ctx );
diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h
index c43810752b0..913af7842fe 100644
--- a/src/mesa/main/buffers.h
+++ b/src/mesa/main/buffers.h
@@ -34,7 +34,7 @@
#include "glheader.h"
-#include "mtypes.h"
+#include "menums.h"
struct gl_context;
struct gl_framebuffer;
diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h
index 33ca5af0731..8cd305cb31f 100644
--- a/src/mesa/main/colormac.h
+++ b/src/mesa/main/colormac.h
@@ -35,7 +35,6 @@
#include "config.h"
#include "macros.h"
-#include "mtypes.h"
/**
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 86be66f9e09..ef06540e9ba 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -49,6 +49,7 @@
#define CONTEXT_H
+#include "errors.h"
#include "imports.h"
#include "extensions.h"
#include "mtypes.h"
diff --git a/src/mesa/main/copyimage.h b/src/mesa/main/copyimage.h
index ea2f15b4352..7cebb30d997 100644
--- a/src/mesa/main/copyimage.h
+++ b/src/mesa/main/copyimage.h
@@ -29,7 +29,7 @@
#ifndef COPYIMAGE_H
#define COPYIMAGE_H
-#include "mtypes.h"
+#include "glheader.h"
#ifdef __cplusplus
extern "C" {
diff --git a/src/mesa/main/core.h b/src/mesa/main/core.h
deleted file mode 100644
index 73ed01c259b..00000000000
--- a/src/mesa/main/core.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2010 LunarG Inc.
- *
- * 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 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.
- *
- * Authors:
- * Chia-I Wu <[email protected]>
- */
-
-
-/**
- * \file core.h
- * The public header of core mesa.
- *
- * This file is the (only) public header of core mesa. It is supposed to be
- * used by GLX, WGL, and GLSL.
- */
-
-
-#ifndef CORE_H
-#define CORE_H
-
-
-#include "main/glheader.h"
-#include "main/compiler.h"
-#include "main/imports.h"
-#include "main/macros.h"
-
-#include "main/mtypes.h"
-
-/* for GLSL */
-#include "program/prog_parameter.h"
-
-
-#endif /* CORE_H */
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 09e9c41244e..64ddd818835 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -31,9 +31,9 @@
#ifndef DD_INCLUDED
#define DD_INCLUDED
-/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
-
#include "glheader.h"
+#include "formats.h"
+#include "menums.h"
struct gl_bitmap_atlas;
struct gl_buffer_object;
@@ -50,6 +50,8 @@ struct gl_shader_program;
struct gl_texture_image;
struct gl_texture_object;
struct gl_memory_info;
+struct gl_transform_feedback_object;
+struct ati_fragment_shader;
struct util_queue_monitoring;
struct _mesa_prim;
struct _mesa_index_buffer;
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index d7e0143a8f6..b1fa1f067ff 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -24,6 +24,7 @@
*/
#include <stdio.h>
+#include "errors.h"
#include "mtypes.h"
#include "attrib.h"
#include "enums.h"
diff --git a/src/mesa/main/debug_output.h b/src/mesa/main/debug_output.h
index 63e3e7b48e4..8a5eedc21f0 100644
--- a/src/mesa/main/debug_output.h
+++ b/src/mesa/main/debug_output.h
@@ -30,13 +30,14 @@
#include <stdio.h>
#include <stdarg.h>
#include "glheader.h"
-#include "mtypes.h"
+#include "menums.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct gl_context;
void
_mesa_init_debug_output(struct gl_context *ctx);
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h
index 22b696f50c1..1ac17d5bb09 100644
--- a/src/mesa/main/dlist.h
+++ b/src/mesa/main/dlist.h
@@ -33,8 +33,8 @@
#define DLIST_H
#include <stdio.h>
-#include "main/mtypes.h"
+struct gl_context;
/**
* Describes the location and size of a glBitmap image in a texture atlas.
diff --git a/src/mesa/main/drawtex.c b/src/mesa/main/drawtex.c
index 9c4fdf90e3b..6114b3277b0 100644
--- a/src/mesa/main/drawtex.c
+++ b/src/mesa/main/drawtex.c
@@ -21,6 +21,7 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include "main/errors.h"
#include "main/drawtex.h"
#include "main/state.h"
#include "main/imports.h"
diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h
index b784b117761..5911da2956f 100644
--- a/src/mesa/main/errors.h
+++ b/src/mesa/main/errors.h
@@ -39,13 +39,15 @@
#include <stdio.h>
#include <stdarg.h>
#include "glheader.h"
-#include "mtypes.h"
+#include "menums.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct gl_context;
+
extern void
_mesa_warning( struct gl_context *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3);
diff --git a/src/mesa/main/eval.h b/src/mesa/main/eval.h
index 5b2fce11948..938e3579b0e 100644
--- a/src/mesa/main/eval.h
+++ b/src/mesa/main/eval.h
@@ -37,7 +37,7 @@
#define EVAL_H
-#include "main/mtypes.h"
+#include "dd.h"
#include <stdbool.h>
diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c
index 21c5de7ad9d..2142b50a6e9 100644
--- a/src/mesa/main/execmem.c
+++ b/src/mesa/main/execmem.c
@@ -34,7 +34,7 @@
#include <stdio.h>
#include "imports.h"
#include "execmem.h"
-
+#include "c11/threads.h"
#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__)
diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h
index 159610b6e12..705d65dcdb5 100644
--- a/src/mesa/main/extensions.h
+++ b/src/mesa/main/extensions.h
@@ -36,7 +36,7 @@
#ifndef _EXTENSIONS_H_
#define _EXTENSIONS_H_
-#include "glheader.h"
+#include "mtypes.h"
#ifdef __cplusplus
extern "C" {
diff --git a/src/mesa/main/extensions_table.c b/src/mesa/main/extensions_table.c
index 1e37fbcc462..6241705de13 100644
--- a/src/mesa/main/extensions_table.c
+++ b/src/mesa/main/extensions_table.c
@@ -23,7 +23,6 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "main/mtypes.h"
#include "main/extensions.h"
/**
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index c7b639456cd..1c755592bd9 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -33,6 +33,7 @@
*/
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/macros.h"
diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py
index 71c467f7e90..77ab16694ed 100644
--- a/src/mesa/main/format_pack.py
+++ b/src/mesa/main/format_pack.py
@@ -42,6 +42,8 @@ string = """/*
#include <stdint.h>
+#include "config.h"
+#include "errors.h"
#include "format_pack.h"
#include "format_utils.h"
#include "macros.h"
diff --git a/src/mesa/main/format_unpack.py b/src/mesa/main/format_unpack.py
index c8b1b24d169..87f64cc151a 100644
--- a/src/mesa/main/format_unpack.py
+++ b/src/mesa/main/format_unpack.py
@@ -42,6 +42,7 @@ string = """/*
#include <stdint.h>
+#include "errors.h"
#include "format_unpack.h"
#include "format_utils.h"
#include "macros.h"
diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
index 31580750bd4..6959bf062a1 100644
--- a/src/mesa/main/format_utils.c
+++ b/src/mesa/main/format_utils.c
@@ -22,6 +22,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "errors.h"
#include "format_utils.h"
#include "glformats.h"
#include "format_pack.h"
diff --git a/src/mesa/main/format_utils.h b/src/mesa/main/format_utils.h
index 378997b38b2..78365cab533 100644
--- a/src/mesa/main/format_utils.h
+++ b/src/mesa/main/format_utils.h
@@ -31,6 +31,7 @@
#ifndef FORMAT_UTILS_H
#define FORMAT_UTILS_H
+#include "formats.h"
#include "imports.h"
#include "macros.h"
#include "util/rounding.h"
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 8d32757a879..fdb53afd570 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -24,6 +24,7 @@
*/
+#include "errors.h"
#include "imports.h"
#include "formats.h"
#include "macros.h"
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index 5c9d8263ed1..844f1e270c0 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -36,6 +36,8 @@
extern "C" {
#endif
+struct gl_context;
+
extern void
_mesa_compute_component_mapping(GLenum inFormat, GLenum outFormat, GLubyte *map);
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index a6e6b6a2e64..16648820b1b 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -42,10 +42,12 @@
extern "C" {
#endif
+
/* Custom Mesa types to save space. */
typedef unsigned short GLenum16;
typedef unsigned char GLbitfield8;
typedef unsigned short GLbitfield16;
+typedef GLuint64 GLbitfield64;
typedef int GLclampx;
diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c
index 71dc9154ef2..c585bc51bbf 100644
--- a/src/mesa/main/glspirv.c
+++ b/src/mesa/main/glspirv.c
@@ -24,6 +24,7 @@
#include "glspirv.h"
#include "errors.h"
#include "shaderobj.h"
+#include "mtypes.h"
#include "compiler/nir/nir.h"
#include "compiler/spirv/nir_spirv.h"
diff --git a/src/mesa/main/glspirv.h b/src/mesa/main/glspirv.h
index 81626ce75b5..cbcd3c0bcbc 100644
--- a/src/mesa/main/glspirv.h
+++ b/src/mesa/main/glspirv.h
@@ -25,12 +25,14 @@
#define GLSPIRV_H
#include "compiler/nir/nir.h"
-#include "mtypes.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct gl_context;
+struct gl_shader;
+
/**
* A SPIR-V module contains the raw SPIR-V binary as set by ShaderBinary.
*
diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h
index 306246ca1c5..8cd5d022674 100644
--- a/src/mesa/main/glthread.h
+++ b/src/mesa/main/glthread.h
@@ -24,8 +24,6 @@
#ifndef _GLTHREAD_H
#define _GLTHREAD_H
-#include "main/mtypes.h"
-
/* The size of one batch and the maximum size of one call.
*
* This should be as low as possible, so that:
@@ -50,6 +48,7 @@
#include "util/u_queue.h"
enum marshal_dispatch_cmd_id;
+struct gl_context;
/** A single batch of commands queued up for execution. */
struct glthread_batch
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index d0e575ea6b3..9a6d5ed5edb 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -34,6 +34,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "errors.h"
#include "glheader.h"
#include "hash.h"
#include "util/hash_table.h"
diff --git a/src/mesa/main/hash.h b/src/mesa/main/hash.h
index 02960e3b356..64f2962aba6 100644
--- a/src/mesa/main/hash.h
+++ b/src/mesa/main/hash.h
@@ -34,6 +34,7 @@
#include "glheader.h"
#include "imports.h"
+#include "c11/threads.h"
/**
* Magic GLuint object name that gets stored outside of the struct hash_table.
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index de4dd0e33d5..b4685b6dc35 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -48,7 +48,6 @@
#include "util/rounding.h" /* for _mesa_roundeven */
#include "imports.h"
#include "context.h"
-#include "mtypes.h"
#include "version.h"
#ifdef _GNU_SOURCE
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 51fa72cbc37..72ce8783ddb 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -41,7 +41,6 @@
#include <string.h>
#include "compiler.h"
#include "glheader.h"
-#include "errors.h"
#include "util/bitscan.h"
#ifdef __cplusplus
diff --git a/src/mesa/main/menums.h b/src/mesa/main/menums.h
new file mode 100644
index 00000000000..40b16cb9cac
--- /dev/null
+++ b/src/mesa/main/menums.h
@@ -0,0 +1,213 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ * Copyright (C) 2018 Advanced Micro Devices, Inc. All Rights Reserved.
+ *
+ * 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 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.
+ */
+
+/**
+ * \file menums.h
+ * Often used definitions and enums.
+ */
+
+#ifndef MENUMS_H
+#define MENUMS_H
+
+#include "util/macros.h"
+
+/**
+ * Enum for the OpenGL APIs we know about and may support.
+ *
+ * NOTE: This must match the api_enum table in
+ * src/mesa/main/get_hash_generator.py
+ */
+typedef enum
+{
+ API_OPENGL_COMPAT, /* legacy / compatibility contexts */
+ API_OPENGLES,
+ API_OPENGLES2,
+ API_OPENGL_CORE,
+ API_OPENGL_LAST = API_OPENGL_CORE
+} gl_api;
+
+/**
+ * An index for each type of texture object. These correspond to the GL
+ * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc.
+ * Note: the order is from highest priority to lowest priority.
+ */
+typedef enum
+{
+ TEXTURE_2D_MULTISAMPLE_INDEX,
+ TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX,
+ TEXTURE_CUBE_ARRAY_INDEX,
+ TEXTURE_BUFFER_INDEX,
+ TEXTURE_2D_ARRAY_INDEX,
+ TEXTURE_1D_ARRAY_INDEX,
+ TEXTURE_EXTERNAL_INDEX,
+ TEXTURE_CUBE_INDEX,
+ TEXTURE_3D_INDEX,
+ TEXTURE_RECT_INDEX,
+ TEXTURE_2D_INDEX,
+ TEXTURE_1D_INDEX,
+ NUM_TEXTURE_TARGETS
+} gl_texture_index;
+
+/**
+ * Remapped color logical operations
+ *
+ * With the exception of NVIDIA hardware, which consumes the OpenGL enumerants
+ * directly, everything wants this mapping of color logical operations.
+ *
+ * Fun fact: These values are just the bit-reverse of the low-nibble of the GL
+ * enumerant values (i.e., `GL_NOOP & 0x0f` is `b0101' while
+ * \c COLOR_LOGICOP_NOOP is `b1010`).
+ *
+ * Fun fact #2: These values are just an encoding of the operation as a table
+ * of bit values. The result of the logic op is:
+ *
+ * result_bit = (logic_op >> (2 * src_bit + dst_bit)) & 1
+ *
+ * For the GL enums, the result is:
+ *
+ * result_bit = logic_op & (1 << (2 * src_bit + dst_bit))
+ */
+enum PACKED gl_logicop_mode {
+ COLOR_LOGICOP_CLEAR = 0,
+ COLOR_LOGICOP_NOR = 1,
+ COLOR_LOGICOP_AND_INVERTED = 2,
+ COLOR_LOGICOP_COPY_INVERTED = 3,
+ COLOR_LOGICOP_AND_REVERSE = 4,
+ COLOR_LOGICOP_INVERT = 5,
+ COLOR_LOGICOP_XOR = 6,
+ COLOR_LOGICOP_NAND = 7,
+ COLOR_LOGICOP_AND = 8,
+ COLOR_LOGICOP_EQUIV = 9,
+ COLOR_LOGICOP_NOOP = 10,
+ COLOR_LOGICOP_OR_INVERTED = 11,
+ COLOR_LOGICOP_COPY = 12,
+ COLOR_LOGICOP_OR_REVERSE = 13,
+ COLOR_LOGICOP_OR = 14,
+ COLOR_LOGICOP_SET = 15
+};
+
+/**
+ * Indexes for all renderbuffers
+ */
+typedef enum
+{
+ /* the four standard color buffers */
+ BUFFER_FRONT_LEFT,
+ BUFFER_BACK_LEFT,
+ BUFFER_FRONT_RIGHT,
+ BUFFER_BACK_RIGHT,
+ BUFFER_DEPTH,
+ BUFFER_STENCIL,
+ BUFFER_ACCUM,
+ /* optional aux buffer */
+ BUFFER_AUX0,
+ /* generic renderbuffers */
+ BUFFER_COLOR0,
+ BUFFER_COLOR1,
+ BUFFER_COLOR2,
+ BUFFER_COLOR3,
+ BUFFER_COLOR4,
+ BUFFER_COLOR5,
+ BUFFER_COLOR6,
+ BUFFER_COLOR7,
+ BUFFER_COUNT,
+ BUFFER_NONE = -1,
+} gl_buffer_index;
+
+typedef enum
+{
+ MAP_USER,
+ MAP_INTERNAL,
+ MAP_COUNT
+} gl_map_buffer_index;
+
+/** @{
+ *
+ * These are a mapping of the GL_ARB_debug_output/GL_KHR_debug enums
+ * to small enums suitable for use as an array index.
+ */
+
+enum mesa_debug_source
+{
+ MESA_DEBUG_SOURCE_API,
+ MESA_DEBUG_SOURCE_WINDOW_SYSTEM,
+ MESA_DEBUG_SOURCE_SHADER_COMPILER,
+ MESA_DEBUG_SOURCE_THIRD_PARTY,
+ MESA_DEBUG_SOURCE_APPLICATION,
+ MESA_DEBUG_SOURCE_OTHER,
+ MESA_DEBUG_SOURCE_COUNT
+};
+
+enum mesa_debug_type
+{
+ MESA_DEBUG_TYPE_ERROR,
+ MESA_DEBUG_TYPE_DEPRECATED,
+ MESA_DEBUG_TYPE_UNDEFINED,
+ MESA_DEBUG_TYPE_PORTABILITY,
+ MESA_DEBUG_TYPE_PERFORMANCE,
+ MESA_DEBUG_TYPE_OTHER,
+ MESA_DEBUG_TYPE_MARKER,
+ MESA_DEBUG_TYPE_PUSH_GROUP,
+ MESA_DEBUG_TYPE_POP_GROUP,
+ MESA_DEBUG_TYPE_COUNT
+};
+
+enum mesa_debug_severity
+{
+ MESA_DEBUG_SEVERITY_LOW,
+ MESA_DEBUG_SEVERITY_MEDIUM,
+ MESA_DEBUG_SEVERITY_HIGH,
+ MESA_DEBUG_SEVERITY_NOTIFICATION,
+ MESA_DEBUG_SEVERITY_COUNT
+};
+
+/** @} */
+
+/** Set a single bit */
+#define BITFIELD_BIT(b) (1u << (b))
+/** Set all bits up to excluding bit b */
+#define BITFIELD_MASK(b) \
+ ((b) == 32 ? (~0u) : BITFIELD_BIT((b) % 32) - 1)
+/** Set count bits starting from bit b */
+#define BITFIELD_RANGE(b, count) \
+ (BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b))
+
+
+/**
+ * \name 64-bit extension of GLbitfield.
+ */
+/*@{*/
+
+/** Set a single bit */
+#define BITFIELD64_BIT(b) (1ull << (b))
+/** Set all bits up to excluding bit b */
+#define BITFIELD64_MASK(b) \
+ ((b) == 64 ? (~0ull) : BITFIELD64_BIT(b) - 1)
+/** Set count bits starting from bit b */
+#define BITFIELD64_RANGE(b, count) \
+ (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b))
+
+#endif
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 1ed82c52ab6..9b6eee41dbd 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -27,6 +27,7 @@
* \file mipmap.c mipmap generation and teximage resizing functions.
*/
+#include "errors.h"
#include "imports.h"
#include "formats.h"
#include "glformats.h"
diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h
index 1f108f7e5d8..3ec99721743 100644
--- a/src/mesa/main/mipmap.h
+++ b/src/mesa/main/mipmap.h
@@ -26,7 +26,10 @@
#ifndef MIPMAP_H
#define MIPMAP_H
-#include "mtypes.h"
+#include "glheader.h"
+
+struct gl_context;
+struct gl_texture_object;
unsigned
_mesa_compute_num_levels(struct gl_context *ctx,
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b7a7b34a090..b65e7b2c3c2 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -39,6 +39,7 @@
#include "c11/threads.h"
#include "main/glheader.h"
+#include "main/menums.h"
#include "main/config.h"
#include "glapi/glapi.h"
#include "math/m_matrix.h" /* GLmatrix */
@@ -54,33 +55,6 @@
extern "C" {
#endif
-
-/** Set a single bit */
-#define BITFIELD_BIT(b) ((GLbitfield)1 << (b))
-/** Set all bits up to excluding bit b */
-#define BITFIELD_MASK(b) \
- ((b) == 32 ? (~(GLbitfield)0) : BITFIELD_BIT((b) % 32) - 1)
-/** Set count bits starting from bit b */
-#define BITFIELD_RANGE(b, count) \
- (BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b))
-
-
-/**
- * \name 64-bit extension of GLbitfield.
- */
-/*@{*/
-typedef GLuint64 GLbitfield64;
-
-/** Set a single bit */
-#define BITFIELD64_BIT(b) ((GLbitfield64)1 << (b))
-/** Set all bits up to excluding bit b */
-#define BITFIELD64_MASK(b) \
- ((b) == 64 ? (~(GLbitfield64)0) : BITFIELD64_BIT(b) - 1)
-/** Set count bits starting from bit b */
-#define BITFIELD64_RANGE(b, count) \
- (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b))
-
-
#define GET_COLORMASK_BIT(mask, buf, chan) (((mask) >> (4 * (buf) + (chan))) & 0x1)
#define GET_COLORMASK(mask, buf) (((mask) >> (4 * (buf))) & 0xf)
@@ -136,34 +110,6 @@ _mesa_varying_slot_in_fs(gl_varying_slot slot)
}
/**
- * Indexes for all renderbuffers
- */
-typedef enum
-{
- /* the four standard color buffers */
- BUFFER_FRONT_LEFT,
- BUFFER_BACK_LEFT,
- BUFFER_FRONT_RIGHT,
- BUFFER_BACK_RIGHT,
- BUFFER_DEPTH,
- BUFFER_STENCIL,
- BUFFER_ACCUM,
- /* optional aux buffer */
- BUFFER_AUX0,
- /* generic renderbuffers */
- BUFFER_COLOR0,
- BUFFER_COLOR1,
- BUFFER_COLOR2,
- BUFFER_COLOR3,
- BUFFER_COLOR4,
- BUFFER_COLOR5,
- BUFFER_COLOR6,
- BUFFER_COLOR7,
- BUFFER_COUNT,
- BUFFER_NONE = -1,
-} gl_buffer_index;
-
-/**
* Bit flags for all renderbuffers
*/
#define BUFFER_BIT_FRONT_LEFT (1 << BUFFER_FRONT_LEFT)
@@ -417,43 +363,6 @@ union gl_color_union
GLuint ui[4];
};
-/**
- * Remapped color logical operations
- *
- * With the exception of NVIDIA hardware, which consumes the OpenGL enumerants
- * directly, everything wants this mapping of color logical operations.
- *
- * Fun fact: These values are just the bit-reverse of the low-nibble of the GL
- * enumerant values (i.e., `GL_NOOP & 0x0f` is `b0101' while
- * \c COLOR_LOGICOP_NOOP is `b1010`).
- *
- * Fun fact #2: These values are just an encoding of the operation as a table
- * of bit values. The result of the logic op is:
- *
- * result_bit = (logic_op >> (2 * src_bit + dst_bit)) & 1
- *
- * For the GL enums, the result is:
- *
- * result_bit = logic_op & (1 << (2 * src_bit + dst_bit))
- */
-enum PACKED gl_logicop_mode {
- COLOR_LOGICOP_CLEAR = 0,
- COLOR_LOGICOP_NOR = 1,
- COLOR_LOGICOP_AND_INVERTED = 2,
- COLOR_LOGICOP_COPY_INVERTED = 3,
- COLOR_LOGICOP_AND_REVERSE = 4,
- COLOR_LOGICOP_INVERT = 5,
- COLOR_LOGICOP_XOR = 6,
- COLOR_LOGICOP_NAND = 7,
- COLOR_LOGICOP_AND = 8,
- COLOR_LOGICOP_EQUIV = 9,
- COLOR_LOGICOP_NOOP = 10,
- COLOR_LOGICOP_OR_INVERTED = 11,
- COLOR_LOGICOP_COPY = 12,
- COLOR_LOGICOP_OR_REVERSE = 13,
- COLOR_LOGICOP_OR = 14,
- COLOR_LOGICOP_SET = 15
-};
/**
* Color buffer attribute group (GL_COLOR_BUFFER_BIT).
@@ -918,29 +827,6 @@ struct gl_stencil_attrib
/**
- * An index for each type of texture object. These correspond to the GL
- * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc.
- * Note: the order is from highest priority to lowest priority.
- */
-typedef enum
-{
- TEXTURE_2D_MULTISAMPLE_INDEX,
- TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX,
- TEXTURE_CUBE_ARRAY_INDEX,
- TEXTURE_BUFFER_INDEX,
- TEXTURE_2D_ARRAY_INDEX,
- TEXTURE_1D_ARRAY_INDEX,
- TEXTURE_EXTERNAL_INDEX,
- TEXTURE_CUBE_INDEX,
- TEXTURE_3D_INDEX,
- TEXTURE_RECT_INDEX,
- TEXTURE_2D_INDEX,
- TEXTURE_1D_INDEX,
- NUM_TEXTURE_TARGETS
-} gl_texture_index;
-
-
-/**
* Bit flags for each type of texture object
*/
/*@{*/
@@ -1411,14 +1297,6 @@ struct gl_viewport_attrib
};
-typedef enum
-{
- MAP_USER,
- MAP_INTERNAL,
- MAP_COUNT
-} gl_map_buffer_index;
-
-
/**
* Fields describing a mapped buffer range.
*/
@@ -1629,22 +1507,6 @@ struct gl_vertex_array_object
/**
- * Enum for the OpenGL APIs we know about and may support.
- *
- * NOTE: This must match the api_enum table in
- * src/mesa/main/get_hash_generator.py
- */
-typedef enum
-{
- API_OPENGL_COMPAT, /* legacy / compatibility contexts */
- API_OPENGLES,
- API_OPENGLES2,
- API_OPENGL_CORE,
- API_OPENGL_LAST = API_OPENGL_CORE
-} gl_api;
-
-
-/**
* Vertex array state
*/
struct gl_array_attrib
@@ -2113,39 +1975,6 @@ struct gl_bindless_image
/**
- * Names of the various vertex/fragment program register files, etc.
- *
- * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c)
- * All values should fit in a 4-bit field.
- *
- * NOTE: PROGRAM_STATE_VAR, PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be
- * considered to be "uniform" variables since they can only be set outside
- * glBegin/End. They're also all stored in the same Parameters array.
- */
-typedef enum
-{
- PROGRAM_TEMPORARY, /**< machine->Temporary[] */
- PROGRAM_ARRAY, /**< Arrays & Matrixes */
- PROGRAM_INPUT, /**< machine->Inputs[] */
- PROGRAM_OUTPUT, /**< machine->Outputs[] */
- PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */
- PROGRAM_CONSTANT, /**< gl_program->Parameters[] */
- PROGRAM_UNIFORM, /**< gl_program->Parameters[] */
- PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */
- PROGRAM_ADDRESS, /**< machine->AddressReg */
- PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */
- PROGRAM_SYSTEM_VALUE,/**< InstanceId, PrimitiveID, etc. */
- PROGRAM_UNDEFINED, /**< Invalid/TBD value */
- PROGRAM_IMMEDIATE, /**< Immediate value, used by TGSI */
- PROGRAM_BUFFER, /**< for shader buffers, compile-time only */
- PROGRAM_MEMORY, /**< for shared, global and local memory */
- PROGRAM_IMAGE, /**< for shader images, compile-time only */
- PROGRAM_HW_ATOMIC, /**< for hw atomic counters, compile-time only */
- PROGRAM_FILE_MAX
-} gl_register_file;
-
-
-/**
* Current vertex processing mode: fixed function vs. shader.
* In reality, fixed function is probably implemented by a shader but that's
* not what we care about here.
@@ -4531,48 +4360,6 @@ struct gl_dlist_state
} Current;
};
-/** @{
- *
- * These are a mapping of the GL_ARB_debug_output/GL_KHR_debug enums
- * to small enums suitable for use as an array index.
- */
-
-enum mesa_debug_source
-{
- MESA_DEBUG_SOURCE_API,
- MESA_DEBUG_SOURCE_WINDOW_SYSTEM,
- MESA_DEBUG_SOURCE_SHADER_COMPILER,
- MESA_DEBUG_SOURCE_THIRD_PARTY,
- MESA_DEBUG_SOURCE_APPLICATION,
- MESA_DEBUG_SOURCE_OTHER,
- MESA_DEBUG_SOURCE_COUNT
-};
-
-enum mesa_debug_type
-{
- MESA_DEBUG_TYPE_ERROR,
- MESA_DEBUG_TYPE_DEPRECATED,
- MESA_DEBUG_TYPE_UNDEFINED,
- MESA_DEBUG_TYPE_PORTABILITY,
- MESA_DEBUG_TYPE_PERFORMANCE,
- MESA_DEBUG_TYPE_OTHER,
- MESA_DEBUG_TYPE_MARKER,
- MESA_DEBUG_TYPE_PUSH_GROUP,
- MESA_DEBUG_TYPE_POP_GROUP,
- MESA_DEBUG_TYPE_COUNT
-};
-
-enum mesa_debug_severity
-{
- MESA_DEBUG_SEVERITY_LOW,
- MESA_DEBUG_SEVERITY_MEDIUM,
- MESA_DEBUG_SEVERITY_HIGH,
- MESA_DEBUG_SEVERITY_NOTIFICATION,
- MESA_DEBUG_SEVERITY_COUNT
-};
-
-/** @} */
-
/**
* Driver-specific state flags.
*
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 94a6d285d8e..64ad115f8b5 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -42,6 +42,7 @@
#endif
+#include "errors.h"
#include "glheader.h"
#include "enums.h"
#include "image.h"
diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h
index ac0a099e391..8625a145fca 100644
--- a/src/mesa/main/pack.h
+++ b/src/mesa/main/pack.h
@@ -28,8 +28,10 @@
#define PACK_H
-#include "mtypes.h"
+#include "glheader.h"
+struct gl_context;
+struct gl_pixelstore_attrib;
extern void
_mesa_unpack_polygon_stipple(const GLubyte *pattern, GLuint dest[32],
diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c
index 7762324a4ae..cea55f2a0d2 100644
--- a/src/mesa/main/pbo.c
+++ b/src/mesa/main/pbo.c
@@ -31,6 +31,7 @@
+#include "errors.h"
#include "glheader.h"
#include "bufferobj.h"
#include "glformats.h"
diff --git a/src/mesa/main/pbo.h b/src/mesa/main/pbo.h
index b3f24e62bd2..bc764175ff4 100644
--- a/src/mesa/main/pbo.h
+++ b/src/mesa/main/pbo.h
@@ -28,8 +28,10 @@
#define PBO_H
-#include "mtypes.h"
+#include "glheader.h"
+struct gl_context;
+struct gl_pixelstore_attrib;
extern GLboolean
_mesa_validate_pbo_access(GLuint dimensions,
diff --git a/src/mesa/main/pixeltransfer.h b/src/mesa/main/pixeltransfer.h
index b0a301f2638..caa2911fcf1 100644
--- a/src/mesa/main/pixeltransfer.h
+++ b/src/mesa/main/pixeltransfer.h
@@ -28,7 +28,9 @@
#define PIXELTRANSFER_H
-#include "mtypes.h"
+#include "glheader.h"
+
+struct gl_context;
extern void
diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c
index 18361c929fb..b80bae6a6d2 100644
--- a/src/mesa/main/querymatrix.c
+++ b/src/mesa/main/querymatrix.c
@@ -17,6 +17,7 @@
#include "glheader.h"
#include "querymatrix.h"
#include "main/get.h"
+#include "util/macros.h"
/**
diff --git a/src/mesa/main/querymatrix.h b/src/mesa/main/querymatrix.h
index e08d843a963..64921891000 100644
--- a/src/mesa/main/querymatrix.h
+++ b/src/mesa/main/querymatrix.h
@@ -25,7 +25,7 @@
#define QUERYMATRIX_H
-#include "mtypes.h"
+#include "glheader.h"
/*
diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c
index 6dc4235cba0..fa412c0c4f7 100644
--- a/src/mesa/main/remap.c
+++ b/src/mesa/main/remap.c
@@ -44,6 +44,7 @@
#define need_MESA_remap_table
#include "main/remap_helper.h"
+#include "errors.h"
/* this is global for quick access */
diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h
index f9a6462d536..3f568e1e7f1 100644
--- a/src/mesa/main/renderbuffer.h
+++ b/src/mesa/main/renderbuffer.h
@@ -27,7 +27,7 @@
#define RENDERBUFFER_H
#include "glheader.h"
-#include "mtypes.h"
+#include "menums.h"
#ifdef __cplusplus
extern "C" {
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 6712bb45fb2..86064a98b97 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -29,7 +29,6 @@
*/
#include "main/context.h"
-#include "main/core.h"
#include "main/enums.h"
#include "main/shaderapi.h"
#include "main/shaderobj.h"
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
index 7915248e391..dbfd68fd3a1 100644
--- a/src/mesa/main/shaderapi.h
+++ b/src/mesa/main/shaderapi.h
@@ -29,7 +29,7 @@
#include "glheader.h"
-
+#include "compiler/shader_enums.h"
#ifdef __cplusplus
extern "C" {
@@ -38,6 +38,11 @@ extern "C" {
struct _glapi_table;
struct gl_context;
+struct gl_linked_shader;
+struct gl_pipeline_object;
+struct gl_program;
+struct gl_program_resource;
+struct gl_shader;
struct gl_shader_program;
extern GLbitfield
diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h
index fedb4dc3dec..c7ccc54afe4 100644
--- a/src/mesa/main/shaderobj.h
+++ b/src/mesa/main/shaderobj.h
@@ -28,14 +28,19 @@
#include "main/glheader.h"
-#include "main/mtypes.h"
+#include "compiler/shader_enums.h"
#include "program/ir_to_mesa.h"
+#include "util/macros.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct gl_shader_program_data;
+struct gl_linked_shader;
+struct dd_function_table;
+struct gl_pipeline_object;
/**
* Internal functions
diff --git a/src/mesa/main/texcompress_bptc.c b/src/mesa/main/texcompress_bptc.c
index 26e59158007..fd37be97f36 100644
--- a/src/mesa/main/texcompress_bptc.c
+++ b/src/mesa/main/texcompress_bptc.c
@@ -34,6 +34,7 @@
#include "texstore.h"
#include "macros.h"
#include "image.h"
+#include "mtypes.h"
#define BLOCK_SIZE 4
#define N_PARTITIONS 64
diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index faeaae90937..099787b7f40 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -41,6 +41,7 @@
#include "texcompress.h"
#include "texcompress_etc.h"
#include "texstore.h"
+#include "config.h"
#include "macros.h"
#include "format_unpack.h"
#include "util/format_srgb.h"
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index c5646fbd7a3..19df6baf371 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -29,6 +29,7 @@
*/
+#include "errors.h"
#include "glheader.h"
#include "imports.h"
#include "image.h"
@@ -37,6 +38,7 @@
#include "texcompress.h"
#include "texcompress_fxt1.h"
#include "texstore.h"
+#include "mtypes.h"
static void
diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c
index 8cab7a56b1a..843b42e54e6 100644
--- a/src/mesa/main/texcompress_rgtc.c
+++ b/src/mesa/main/texcompress_rgtc.c
@@ -33,6 +33,7 @@
*/
+#include "config.h"
#include "glheader.h"
#include "imports.h"
#include "image.h"
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index dbac1fe8cb8..743e6b73ddf 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -33,7 +33,6 @@
#include "glheader.h"
-#include "mtypes.h"
#include "samplerobj.h"
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 3314e557c0a..31163f67717 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -51,6 +51,7 @@
*/
+#include "errors.h"
#include "glheader.h"
#include "bufferobj.h"
#include "format_pack.h"
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index b8281c51e2a..2fef7ba7d7d 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -36,9 +36,13 @@
#define TEXSTORE_H
-#include "mtypes.h"
+#include "glheader.h"
#include "formats.h"
+#include "util/macros.h"
+struct gl_context;
+struct gl_pixelstore_attrib;
+struct gl_texture_image;
/**
* This macro defines the (many) parameters to the texstore functions.
diff --git a/src/mesa/main/texturebindless.h b/src/mesa/main/texturebindless.h
index 8a9fff6d57e..ac97e95e81c 100644
--- a/src/mesa/main/texturebindless.h
+++ b/src/mesa/main/texturebindless.h
@@ -24,12 +24,14 @@
#ifndef TEXTUREBINDLESS_H
#define TEXTUREBINDLESS_H
-#include "mtypes.h"
+#include "glheader.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct gl_context;
+
/**
* \name Internal functions
*/
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index f901fcb3e58..de594fcc3d7 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -26,8 +26,8 @@
#include <stdlib.h>
#include <inttypes.h> /* for PRIx64 macro */
+#include <math.h>
-#include "main/core.h"
#include "main/context.h"
#include "main/shaderapi.h"
#include "main/shaderobj.h"
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 77027be8002..25d2a29e731 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -27,8 +27,6 @@
#ifndef VARRAY_H
#define VARRAY_H
-
-#include "mtypes.h"
#include "bufferobj.h"
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index adfec6f8282..4469509c08e 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -27,8 +27,13 @@
#ifndef VERSION_H
#define VERSION_H
-#include "mtypes.h"
+#include <stdbool.h>
+#include "glheader.h"
+#include "menums.h"
+struct gl_context;
+struct gl_constants;
+struct gl_extensions;
extern GLuint
_mesa_get_version(const struct gl_extensions *extensions,
diff --git a/src/mesa/main/vtxfmt.h b/src/mesa/main/vtxfmt.h
index 4f8bc9cdf06..20fc4667019 100644
--- a/src/mesa/main/vtxfmt.h
+++ b/src/mesa/main/vtxfmt.h
@@ -33,12 +33,14 @@
#ifndef _VTXFMT_H_
#define _VTXFMT_H_
-#include "mtypes.h"
+#include "dd.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct gl_context;
+
extern void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt );
extern void _mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt );
extern void _mesa_initialize_vbo_vtxfmt(struct gl_context *ctx);
diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c
index 493d0e5cb27..57a49533de2 100644
--- a/src/mesa/math/m_matrix.c
+++ b/src/mesa/math/m_matrix.c
@@ -35,6 +35,7 @@
#include "c99_math.h"
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/imports.h"
#include "main/macros.h"
diff --git a/src/mesa/meson.build b/src/mesa/meson.build
index d2d058bfa3c..7bfd19690a9 100644
--- a/src/mesa/meson.build
+++ b/src/mesa/meson.build
@@ -106,7 +106,6 @@ files_libmesa_common = files(
'main/convolve.h',
'main/copyimage.c',
'main/copyimage.h',
- 'main/core.h',
'main/cpuinfo.c',
'main/cpuinfo.h',
'main/dd.h',
@@ -190,6 +189,7 @@ files_libmesa_common = files(
'main/mipmap.h',
'main/mm.c',
'main/mm.h',
+ 'main/menums.h',
'main/mtypes.h',
'main/multisample.c',
'main/multisample.h',
diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h
index 9714f50443a..7a4911cd74a 100644
--- a/src/mesa/program/ir_to_mesa.h
+++ b/src/mesa/program/ir_to_mesa.h
@@ -33,6 +33,8 @@ extern "C" {
struct gl_context;
struct gl_shader;
struct gl_shader_program;
+struct gl_linked_shader;
+struct gl_program_parameter_list;
void _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
GLboolean _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c
index b5a7a692aeb..c50465dfc49 100644
--- a/src/mesa/program/prog_execute.c
+++ b/src/mesa/program/prog_execute.c
@@ -36,8 +36,10 @@
#include "c99_math.h"
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
+#include "main/mtypes.h"
#include "prog_execute.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
diff --git a/src/mesa/program/prog_execute.h b/src/mesa/program/prog_execute.h
index 3603e3bdddf..ef04087301e 100644
--- a/src/mesa/program/prog_execute.h
+++ b/src/mesa/program/prog_execute.h
@@ -26,8 +26,10 @@
#define PROG_EXECUTE_H
#include "main/config.h"
-#include "main/mtypes.h"
+#include "main/glheader.h"
+#include "compiler/shader_enums.h"
+struct gl_context;
typedef void (*FetchTexelLodFunc)(struct gl_context *ctx, const GLfloat texcoord[4],
GLfloat lambda, GLuint unit, GLfloat color[4]);
diff --git a/src/mesa/program/prog_instruction.c b/src/mesa/program/prog_instruction.c
index 9f03867f0b0..91830d87f25 100644
--- a/src/mesa/program/prog_instruction.c
+++ b/src/mesa/program/prog_instruction.c
@@ -26,8 +26,8 @@
#include "main/glheader.h"
#include "main/imports.h"
-#include "main/mtypes.h"
#include "prog_instruction.h"
+#include "prog_parameter.h"
/**
diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h
index 8e36a1c5904..cc551c18910 100644
--- a/src/mesa/program/prog_parameter.h
+++ b/src/mesa/program/prog_parameter.h
@@ -31,7 +31,6 @@
#ifndef PROG_PARAMETER_H
#define PROG_PARAMETER_H
-#include "main/mtypes.h"
#include "prog_statevars.h"
#include <string.h>
@@ -40,6 +39,38 @@
extern "C" {
#endif
+/**
+ * Names of the various vertex/fragment program register files, etc.
+ *
+ * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c)
+ * All values should fit in a 4-bit field.
+ *
+ * NOTE: PROGRAM_STATE_VAR, PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be
+ * considered to be "uniform" variables since they can only be set outside
+ * glBegin/End. They're also all stored in the same Parameters array.
+ */
+typedef enum
+{
+ PROGRAM_TEMPORARY, /**< machine->Temporary[] */
+ PROGRAM_ARRAY, /**< Arrays & Matrixes */
+ PROGRAM_INPUT, /**< machine->Inputs[] */
+ PROGRAM_OUTPUT, /**< machine->Outputs[] */
+ PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */
+ PROGRAM_CONSTANT, /**< gl_program->Parameters[] */
+ PROGRAM_UNIFORM, /**< gl_program->Parameters[] */
+ PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */
+ PROGRAM_ADDRESS, /**< machine->AddressReg */
+ PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */
+ PROGRAM_SYSTEM_VALUE,/**< InstanceId, PrimitiveID, etc. */
+ PROGRAM_UNDEFINED, /**< Invalid/TBD value */
+ PROGRAM_IMMEDIATE, /**< Immediate value, used by TGSI */
+ PROGRAM_BUFFER, /**< for shader buffers, compile-time only */
+ PROGRAM_MEMORY, /**< for shared, global and local memory */
+ PROGRAM_IMAGE, /**< for shader images, compile-time only */
+ PROGRAM_HW_ATOMIC, /**< for hw atomic counters, compile-time only */
+ PROGRAM_FILE_MAX
+} gl_register_file;
+
/**
* Actual data for constant values of parameters.
diff --git a/src/mesa/program/prog_print.h b/src/mesa/program/prog_print.h
index 98a43e63a00..89fc42363cd 100644
--- a/src/mesa/program/prog_print.h
+++ b/src/mesa/program/prog_print.h
@@ -29,7 +29,7 @@
#include <stdio.h>
#include "main/glheader.h"
-#include "main/mtypes.h"
+#include "prog_parameter.h"
#ifdef __cplusplus
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index 3ee44ce489e..cd874e489f3 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -27,6 +27,7 @@
#include "compiler/nir/nir_builder.h"
#include "compiler/glsl/list.h"
#include "main/imports.h"
+#include "main/mtypes.h"
#include "util/ralloc.h"
#include "prog_to_nir.h"
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index 659385f55b1..49e888e57df 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -40,7 +40,7 @@
#ifndef PROGRAM_H
#define PROGRAM_H
-#include "main/mtypes.h"
+#include "prog_parameter.h"
#ifdef __cplusplus
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index 9b63764f752..415ff2a28ec 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
+#include "main/errors.h"
#include "main/mtypes.h"
#include "main/imports.h"
#include "program/program.h"
diff --git a/src/mesa/program/programopt.h b/src/mesa/program/programopt.h
index 5d70e57bc33..70a820ae0ea 100644
--- a/src/mesa/program/programopt.h
+++ b/src/mesa/program/programopt.h
@@ -26,13 +26,16 @@
#ifndef PROGRAMOPT_H
#define PROGRAMOPT_H 1
-#include "main/mtypes.h"
+#include "main/glheader.h"
+#include "prog_parameter.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct gl_context;
+struct gl_program;
extern void
_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog);
diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c
index f5dacbbf1ed..e01faa5c6e1 100644
--- a/src/mesa/program/symbol_table.c
+++ b/src/mesa/program/symbol_table.c
@@ -22,6 +22,7 @@
*/
#include "main/imports.h"
+#include "main/errors.h"
#include "symbol_table.h"
#include "../../util/hash_table.h"
#include "util/u_string.h"
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index 3b2beaf6ed7..6ddb8f525cf 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -41,7 +41,6 @@
#include "pipe/p_defines.h"
#include "cso_cache/cso_context.h"
-#include "main/core.h"
#include "main/stencil.h"
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index c41ed2ba02b..b25ae5f80eb 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -30,6 +30,7 @@
* Brian Paul
*/
+#include "main/errors.h"
#include "main/imports.h"
#include "main/image.h"
#include "main/bufferobj.h"
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 044916b4dc8..5ebe94f4545 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -33,6 +33,7 @@
#include <inttypes.h> /* for PRId64 macro */
+#include "main/errors.h"
#include "main/imports.h"
#include "main/mtypes.h"
#include "main/arrayobj.h"
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 68677182abf..fbc577a370c 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -33,6 +33,7 @@
* Michel Dänzer
*/
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/accum.h"
#include "main/formats.h"
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 471eb196614..bb73644753a 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -30,6 +30,7 @@
* Brian Paul
*/
+#include "main/errors.h"
#include "main/imports.h"
#include "main/image.h"
#include "main/bufferobj.h"
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 628e4af1e67..8cc8e08a623 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include "main/bufferobj.h"
#include "main/enums.h"
+#include "main/errors.h"
#include "main/fbobject.h"
#include "main/formats.h"
#include "main/format_utils.h"
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 8011d0f25ca..6243659b50d 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -36,6 +36,7 @@
*/
+#include "main/errors.h"
#include "main/imports.h"
#include "main/image.h"
#include "main/bufferobj.h"
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index f2aa8005a03..3f105871a5e 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -26,6 +26,7 @@
**************************************************************************/
+#include "main/errors.h"
#include "main/imports.h"
#include "main/mipmap.h"
#include "main/teximage.h"
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_private.h b/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
index 19dde16ed91..c482828eddb 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
@@ -26,10 +26,11 @@
#ifndef ST_GLSL_TO_TGSI_PRIVATE_H
#define ST_GLSL_TO_TGSI_PRIVATE_H
-#include <mesa/main/mtypes.h>
-#include <compiler/glsl_types.h>
-#include <compiler/glsl/ir.h>
-#include <tgsi/tgsi_info.h>
+#include "mesa/main/mtypes.h"
+#include "program/prog_parameter.h"
+#include "compiler/glsl_types.h"
+#include "compiler/glsl/ir.h"
+#include "tgsi/tgsi_info.h"
#include <ostream>
int swizzle_for_size(int size);
diff --git a/src/mesa/state_tracker/st_manager.h b/src/mesa/state_tracker/st_manager.h
index 1a1ea79af8e..162dcc2ca57 100644
--- a/src/mesa/state_tracker/st_manager.h
+++ b/src/mesa/state_tracker/st_manager.h
@@ -28,7 +28,7 @@
#ifndef ST_MANAGER_H
#define ST_MANAGER_H
-#include "main/mtypes.h"
+#include "main/menums.h"
#include "pipe/p_compiler.h"
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3f8df31da18..fe72ddaf2c0 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -31,6 +31,7 @@
*/
+#include "main/errors.h"
#include "main/imports.h"
#include "main/hash.h"
#include "main/mtypes.h"
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 0c12a63ae0b..9480d9ec7a5 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -25,6 +25,7 @@
* Keith Whitwell <[email protected]> Brian Paul
*/
+#include "main/errors.h"
#include "main/imports.h"
#include "main/bufferobj.h"
#include "main/mtypes.h"
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index 8b0bdf8fa28..33da09b618d 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -24,6 +24,7 @@
#include "c99_math.h"
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 9bc1f227fe1..87b72e81970 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -32,6 +32,7 @@
*/
#include "c99_math.h"
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/format_pack.h"
#include "main/format_unpack.h"
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index 294b593a20f..7a4dc45ae86 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -28,7 +28,6 @@
#include "main/imports.h"
#include "main/format_pack.h"
#include "main/format_unpack.h"
-#include "main/core.h"
#include "main/stencil.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index e2c3c085b57..fec8728a7a1 100644
--- a/src/mesa/swrast/s_texfetch.c
+++ b/src/mesa/swrast/s_texfetch.c
@@ -33,6 +33,7 @@
*/
+#include "main/errors.h"
#include "main/macros.h"
#include "main/texcompress.h"
#include "main/texcompress_fxt1.h"
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 34b8eb19657..2472aa730f9 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -22,6 +22,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
#include "main/imports.h"
diff --git a/src/mesa/tnl/t_rebase.c b/src/mesa/tnl/t_rebase.c
index d28512423c3..09a8a3da720 100644
--- a/src/mesa/tnl/t_rebase.c
+++ b/src/mesa/tnl/t_rebase.c
@@ -48,6 +48,7 @@
#include <stdio.h>
#include "main/bufferobj.h"
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/imports.h"
#include "main/mtypes.h"
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index 5489ed6857f..c224a4192a4 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -27,6 +27,7 @@
#include "c99_math.h"
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
#include "main/imports.h"
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index a13262d1db2..bd585324e2b 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -34,6 +34,7 @@
* including any use thereof or modifications thereto.
*/
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
#include "main/imports.h"
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index 45052a3a89c..e506aee6dfb 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -33,6 +33,9 @@
struct gl_vertex_array;
struct gl_context;
struct gl_program;
+struct gl_buffer_object;
+struct gl_transform_feedback_object;
+struct dd_function_table;
/* These are the public-access functions exported from tnl. (A few
diff --git a/src/mesa/vbo/vbo_attrib.h b/src/mesa/vbo/vbo_attrib.h
index 0592d845ba4..165734b30a6 100644
--- a/src/mesa/vbo/vbo_attrib.h
+++ b/src/mesa/vbo/vbo_attrib.h
@@ -32,8 +32,6 @@
#ifndef VBO_ATTRIB_H
#define VBO_ATTRIB_H
-#include "main/mtypes.h"
-
/*
* Note: The first 32 attributes match the VERT_ATTRIB_* definitions.
* However, we have extra attributes for storing per-vertex glMaterial
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index f698fd0f416..ada78ffd63b 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -26,7 +26,7 @@
*/
#include "c99_alloca.h"
-#include "main/mtypes.h"
+#include "main/errors.h"
#include "main/bufferobj.h"
#include "math/m_eval.h"
#include "main/vtxfmt.h"
diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index b23747aa393..357ec1da767 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -28,7 +28,6 @@
#include "main/glheader.h"
#include "main/arrayobj.h"
-#include "main/mtypes.h"
#include "main/api_arrayelt.h"
#include "main/vtxfmt.h"
#include "vbo_private.h"
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index 853fc68c963..1170883f871 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -34,8 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef VBO_EXEC_H
#define VBO_EXEC_H
-
-#include "main/mtypes.h"
+#include "main/dd.h"
#include "main/imports.h"
#include "vbo.h"
#include "vbo_attrib.h"
diff --git a/src/mesa/vbo/vbo_noop.h b/src/mesa/vbo/vbo_noop.h
index 8aa17ce9ede..0ca1bfa8e1b 100644
--- a/src/mesa/vbo/vbo_noop.h
+++ b/src/mesa/vbo/vbo_noop.h
@@ -26,9 +26,9 @@
#ifndef VBO_NOOP_H
#define VBO_NOOP_H
+#include "main/dd.h"
-#include "main/mtypes.h"
-
+struct _glapi_table;
extern void
_mesa_noop_vtxfmt_init(GLvertexformat *vfmt);
diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c
index f170347fbe4..a3c65f422ba 100644
--- a/src/mesa/vbo/vbo_primitive_restart.c
+++ b/src/mesa/vbo/vbo_primitive_restart.c
@@ -28,6 +28,7 @@
*
*/
+#include "main/errors.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/varray.h"
diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h
index 7cc64ecdbcf..589c61d675e 100644
--- a/src/mesa/vbo/vbo_private.h
+++ b/src/mesa/vbo/vbo_private.h
@@ -35,7 +35,6 @@
#include "vbo/vbo_attrib.h"
#include "vbo/vbo_exec.h"
#include "vbo/vbo_save.h"
-#include "main/mtypes.h"
#include "main/varray.h"
diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c
index 361964195c3..73bc49a24bf 100644
--- a/src/mesa/vbo/vbo_save.c
+++ b/src/mesa/vbo/vbo_save.c
@@ -26,7 +26,6 @@
*/
-#include "main/mtypes.h"
#include "main/arrayobj.h"
#include "main/bufferobj.h"
diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h
index b158c077957..2a1922461dd 100644
--- a/src/mesa/vbo/vbo_save.h
+++ b/src/mesa/vbo/vbo_save.h
@@ -34,7 +34,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef VBO_SAVE_H
#define VBO_SAVE_H
-#include "main/mtypes.h"
#include "vbo.h"
#include "vbo_attrib.h"
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 096e43c8169..f4b2c807480 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -32,7 +32,6 @@
#include "main/bufferobj.h"
#include "main/context.h"
#include "main/imports.h"
-#include "main/mtypes.h"
#include "main/macros.h"
#include "main/light.h"
#include "main/state.h"
diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c
index f1a93d6e434..36b1f71eb5f 100644
--- a/src/mesa/vbo/vbo_save_loopback.c
+++ b/src/mesa/vbo/vbo_save_loopback.c
@@ -30,7 +30,6 @@
#include "main/glheader.h"
#include "main/enums.h"
#include "main/imports.h"
-#include "main/mtypes.h"
#include "main/dispatch.h"
#include "glapi/glapi.h"
diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c
index de8978bb93e..500540bfdd9 100644
--- a/src/util/register_allocate.c
+++ b/src/util/register_allocate.c
@@ -75,7 +75,6 @@
#include "ralloc.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/mtypes.h"
#include "util/bitset.h"
#include "register_allocate.h"
diff --git a/src/util/xmlconfig.h b/src/util/xmlconfig.h
index 77aa14c20e0..f7683a650e0 100644
--- a/src/util/xmlconfig.h
+++ b/src/util/xmlconfig.h
@@ -32,6 +32,7 @@
#include "util/mesa-sha1.h"
#include "util/ralloc.h"
+#include <string.h>
#define STRING_CONF_MAXLEN 25