summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-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
112 files changed, 402 insertions, 333 deletions
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"