summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/arbprogram.h1
-rw-r--r--src/mesa/main/arrayobj.h2
-rw-r--r--src/mesa/main/attrib.c1
-rw-r--r--src/mesa/main/bufferobj.h2
-rw-r--r--src/mesa/main/clear.c1
-rw-r--r--src/mesa/main/clear.h2
-rw-r--r--src/mesa/main/clip.h2
-rw-r--r--src/mesa/main/colormac.h2
-rw-r--r--src/mesa/main/config.h2
-rw-r--r--src/mesa/main/context.c15
-rw-r--r--src/mesa/main/convolve.c1
-rw-r--r--src/mesa/main/debug.h3
-rw-r--r--src/mesa/main/depthstencil.h1
-rw-r--r--src/mesa/main/fbobject.c5
-rw-r--r--src/mesa/main/fbobject.h4
-rw-r--r--src/mesa/main/fog.c1
-rw-r--r--src/mesa/main/formats.c1
-rw-r--r--src/mesa/main/formats.h2
-rw-r--r--src/mesa/main/framebuffer.c1
-rw-r--r--src/mesa/main/framebuffer.h1
-rw-r--r--src/mesa/main/get.h2
-rw-r--r--src/mesa/main/histogram.c1
-rw-r--r--src/mesa/main/image.c1
-rw-r--r--src/mesa/main/imports.c2
-rw-r--r--src/mesa/main/mm.c5
-rw-r--r--src/mesa/main/mm.h3
-rw-r--r--src/mesa/main/mtypes.h24
-rw-r--r--src/mesa/main/multisample.h1
-rw-r--r--src/mesa/main/nvprogram.h2
-rw-r--r--src/mesa/main/pixelstore.h1
-rw-r--r--src/mesa/main/querymatrix.c6
-rw-r--r--src/mesa/main/remap.h1
-rw-r--r--src/mesa/main/renderbuffer.h5
-rw-r--r--src/mesa/main/restart.h1
-rw-r--r--src/mesa/main/shared.c1
-rw-r--r--src/mesa/main/shared.h1
-rw-r--r--src/mesa/main/syncobj.h5
-rw-r--r--src/mesa/main/texcompress.c1
-rw-r--r--src/mesa/main/texcompress_fxt1.c2
-rw-r--r--src/mesa/main/texcompress_fxt1.h4
-rw-r--r--src/mesa/main/texcompress_s3tc.c2
-rw-r--r--src/mesa/main/texfetch.c2
-rw-r--r--src/mesa/main/texgen.h5
-rw-r--r--src/mesa/main/texgetimage.h1
-rw-r--r--src/mesa/main/texrender.c1
-rw-r--r--src/mesa/main/texrender.h1
-rw-r--r--src/mesa/main/texstate.h1
-rw-r--r--src/mesa/main/texstore.c1
-rw-r--r--src/mesa/main/uniforms.h4
-rw-r--r--src/mesa/main/viewport.h2
-rw-r--r--src/mesa/main/vtxfmt.h3
51 files changed, 99 insertions, 43 deletions
diff --git a/src/mesa/main/arbprogram.h b/src/mesa/main/arbprogram.h
index 787ffd62f4b..e2e535e911e 100644
--- a/src/mesa/main/arbprogram.h
+++ b/src/mesa/main/arbprogram.h
@@ -27,7 +27,6 @@
#define ARBPROGRAM_H
-#include "compiler.h"
#include "glheader.h"
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
index 8999edc724f..fdf7e2bca46 100644
--- a/src/mesa/main/arrayobj.h
+++ b/src/mesa/main/arrayobj.h
@@ -28,7 +28,7 @@
#ifndef ARRAYOBJ_H
#define ARRAYOBJ_H
-#include "context.h"
+#include "mtypes.h"
/**
* \file arrayobj.h
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 002448fedb8..753949be503 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -41,6 +41,7 @@
#include "hint.h"
#include "light.h"
#include "lines.h"
+#include "macros.h"
#include "matrix.h"
#include "multisample.h"
#include "points.h"
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 912529cfdf9..f234d06c6cc 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -29,7 +29,7 @@
#define BUFFEROBJ_H
-#include "context.h"
+#include "mtypes.h"
/*
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index e76ab5527b0..49d86b3b1f1 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -35,6 +35,7 @@
#include "context.h"
#include "colormac.h"
#include "enums.h"
+#include "macros.h"
#include "state.h"
diff --git a/src/mesa/main/clear.h b/src/mesa/main/clear.h
index 4c78eeda488..6657370c4b6 100644
--- a/src/mesa/main/clear.h
+++ b/src/mesa/main/clear.h
@@ -27,7 +27,7 @@
#define CLEAR_H
-#include "main/mtypes.h"
+#include "glheader.h"
extern void GLAPIENTRY
diff --git a/src/mesa/main/clip.h b/src/mesa/main/clip.h
index d53afb45bdf..ac472d66e08 100644
--- a/src/mesa/main/clip.h
+++ b/src/mesa/main/clip.h
@@ -31,7 +31,7 @@
#ifndef CLIP_H
#define CLIP_H
-#include "mtypes.h"
+#include "glheader.h"
extern void GLAPIENTRY
_mesa_ClipPlane( GLenum plane, const GLdouble *equation );
diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h
index 905f4e22837..245fb658bb3 100644
--- a/src/mesa/main/colormac.h
+++ b/src/mesa/main/colormac.h
@@ -33,9 +33,9 @@
#define COLORMAC_H
-#include "imports.h"
#include "config.h"
#include "macros.h"
+#include "mtypes.h"
/** \def BYTE_TO_CHAN
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 32f7d969d8d..0f2d1a8f8da 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -177,7 +177,7 @@
/**
* Per-program constants (power of two)
*
- * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assmebly shader
+ * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assembly shader
* and GLSL shader names for the same thing. They should \b always have the
* same value. Each refers to the number of vec4 values supplied as
* per-program parameters.
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index a369532e99c..b01fed1781e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -462,7 +462,7 @@ _mesa_init_current(GLcontext *ctx)
/**
- * Init vertex/fragment program limits.
+ * Init vertex/fragment/geometry program limits.
* Important: drivers should override these with actual limits.
*/
static void
@@ -477,16 +477,18 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS;
prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
- if (type == GL_VERTEX_PROGRAM_ARB) {
+ switch (type) {
+ case GL_VERTEX_PROGRAM_ARB:
prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS;
prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
- }
- else if (type == GL_FRAGMENT_PROGRAM_ARB) {
+ break;
+ case GL_FRAGMENT_PROGRAM_ARB:
prog->MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS;
prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
- } else {
+ break;
+ case MESA_GEOMETRY_PROGRAM:
prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS;
prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
@@ -497,6 +499,9 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
prog->MaxGeometryUniformComponents = MAX_GEOMETRY_UNIFORM_COMPONENTS;
prog->MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES;
prog->MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS;
+ break;
+ default:
+ assert(0 && "Bad program type in init_program_limits()");
}
/* Set the native limits to zero. This implies that there is no native
diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c
index 15e8dffc230..f63bddc44d5 100644
--- a/src/mesa/main/convolve.c
+++ b/src/mesa/main/convolve.c
@@ -37,6 +37,7 @@
#include "convolve.h"
#include "context.h"
#include "image.h"
+#include "macros.h"
#include "mtypes.h"
#include "state.h"
#include "main/dispatch.h"
diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h
index 0449cb1798a..b517cc8259f 100644
--- a/src/mesa/main/debug.h
+++ b/src/mesa/main/debug.h
@@ -36,6 +36,9 @@
#ifndef _DEBUG_H
#define _DEBUG_H
+#include "glheader.h"
+#include "mtypes.h"
+
#if _HAVE_FULL_GL
extern void _mesa_print_tri_caps( const char *name, GLuint flags );
diff --git a/src/mesa/main/depthstencil.h b/src/mesa/main/depthstencil.h
index 3dde081f5a5..afbac77f0e2 100644
--- a/src/mesa/main/depthstencil.h
+++ b/src/mesa/main/depthstencil.h
@@ -26,6 +26,7 @@
#ifndef DEPTHSTENCIL_H
#define DEPTHSTENCIL_H
+#include "mtypes.h"
extern struct gl_renderbuffer *
_mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx,
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8c86b392c7b..9a84e5a79cf 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -97,6 +97,11 @@ _mesa_init_fbobjects(GLcontext *ctx)
DummyRenderbuffer.Delete = delete_dummy_renderbuffer;
}
+struct gl_framebuffer *
+_mesa_get_incomplete_framebuffer(void)
+{
+ return &DummyFramebuffer;
+}
/**
* Helper routine for getting a gl_renderbuffer.
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index ff946033a4d..9850ee9aa23 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -26,10 +26,14 @@
#ifndef FBOBJECT_H
#define FBOBJECT_H
+#include "mtypes.h"
extern void
_mesa_init_fbobjects(GLcontext *ctx);
+extern struct gl_framebuffer *
+_mesa_get_incomplete_framebuffer(void);
+
extern struct gl_renderbuffer *
_mesa_lookup_renderbuffer(GLcontext *ctx, GLuint id);
diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c
index 269ff3f8b99..9f26c012d66 100644
--- a/src/mesa/main/fog.c
+++ b/src/mesa/main/fog.c
@@ -27,6 +27,7 @@
#include "colormac.h"
#include "context.h"
#include "fog.h"
+#include "macros.h"
#include "mtypes.h"
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 49463fcc3c2..90449cc04f0 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -26,7 +26,6 @@
#include "imports.h"
#include "formats.h"
-#include "config.h"
/**
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index aa14185628f..ad176caaa0f 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -33,7 +33,7 @@
#define FORMATS_H
-#include "main/mtypes.h"
+#include <GL/gl.h>
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 56558cfcc1e..e0aac26f62b 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -75,7 +75,6 @@ compute_depth_max(struct gl_framebuffer *fb)
fb->_MRD = (GLfloat)1.0 / fb->_DepthMaxF;
}
-
/**
* Create and initialize a gl_framebuffer object.
* This is intended for creating _window_system_ framebuffers, not generic
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index 1b6e3b1f0cb..2e9844282f8 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -26,6 +26,7 @@
#ifndef FRAMEBUFFER_H
#define FRAMEBUFFER_H
+#include "mtypes.h"
extern struct gl_framebuffer *
_mesa_create_framebuffer(const GLvisual *visual);
diff --git a/src/mesa/main/get.h b/src/mesa/main/get.h
index 320492b4ce2..99a004b71dd 100644
--- a/src/mesa/main/get.h
+++ b/src/mesa/main/get.h
@@ -32,7 +32,7 @@
#define GET_H
-#include "mtypes.h"
+#include "glheader.h"
extern void GLAPIENTRY
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c
index 3a65bb19260..4e482bcd54b 100644
--- a/src/mesa/main/histogram.c
+++ b/src/mesa/main/histogram.c
@@ -29,6 +29,7 @@
#include "context.h"
#include "image.h"
#include "histogram.h"
+#include "macros.h"
#include "main/dispatch.h"
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 63c28342f26..86aa6d0d702 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -32,7 +32,6 @@
#include "glheader.h"
#include "colormac.h"
-#include "context.h"
#include "enums.h"
#include "image.h"
#include "imports.h"
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 25080db40c4..46e5c932d0f 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -756,7 +756,7 @@ _mesa_strdup( const char *s )
float
_mesa_strtof( const char *s, char **end )
{
-#ifdef _GNU_SOURCE
+#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__)
static locale_t loc = NULL;
if (!loc) {
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c
index 3ef38e94be9..25a0293703c 100644
--- a/src/mesa/main/mm.c
+++ b/src/mesa/main/mm.c
@@ -22,6 +22,11 @@
*
*/
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "compiler.h"
#include "mm.h"
diff --git a/src/mesa/main/mm.h b/src/mesa/main/mm.h
index df340808ac9..228721ca2a5 100644
--- a/src/mesa/main/mm.h
+++ b/src/mesa/main/mm.h
@@ -32,9 +32,6 @@
#define MM_H
-#include "imports.h"
-
-
struct mem_block {
struct mem_block *next, *prev;
struct mem_block *next_free, *prev_free;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index cbb9eb84f33..8d92892ad7d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -36,7 +36,6 @@
#include "main/glheader.h"
#include "main/config.h"
-#include "main/compiler.h"
#include "main/mfeatures.h"
#include "glapi/glapi.h"
#include "math/m_matrix.h" /* GLmatrix */
@@ -1808,6 +1807,11 @@ struct gl_program
/** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
gl_texture_index SamplerTargets[MAX_SAMPLERS];
+ /** Bitmask of which register files are read/written with indirect
+ * addressing. Mask of (1 << PROGRAM_x) bits.
+ */
+ GLbitfield IndirectRegisterFiles;
+
/** Logical counts */
/*@{*/
GLuint NumInstructions;
@@ -2477,29 +2481,29 @@ struct gl_framebuffer
/**
- * Limits for vertex and fragment programs.
+ * Limits for vertex and fragment programs/shaders.
*/
struct gl_program_constants
{
/* logical limits */
GLuint MaxInstructions;
- GLuint MaxAluInstructions; /* fragment programs only, for now */
- GLuint MaxTexInstructions; /* fragment programs only, for now */
- GLuint MaxTexIndirections; /* fragment programs only, for now */
+ GLuint MaxAluInstructions;
+ GLuint MaxTexInstructions;
+ GLuint MaxTexIndirections;
GLuint MaxAttribs;
GLuint MaxTemps;
- GLuint MaxAddressRegs; /* vertex program only, for now */
+ GLuint MaxAddressRegs;
GLuint MaxParameters;
GLuint MaxLocalParams;
GLuint MaxEnvParams;
/* native/hardware limits */
GLuint MaxNativeInstructions;
- GLuint MaxNativeAluInstructions; /* fragment programs only, for now */
- GLuint MaxNativeTexInstructions; /* fragment programs only, for now */
- GLuint MaxNativeTexIndirections; /* fragment programs only, for now */
+ GLuint MaxNativeAluInstructions;
+ GLuint MaxNativeTexInstructions;
+ GLuint MaxNativeTexIndirections;
GLuint MaxNativeAttribs;
GLuint MaxNativeTemps;
- GLuint MaxNativeAddressRegs; /* vertex program only, for now */
+ GLuint MaxNativeAddressRegs;
GLuint MaxNativeParameters;
/* For shaders */
GLuint MaxUniformComponents;
diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h
index 4305900cc49..998488ef420 100644
--- a/src/mesa/main/multisample.h
+++ b/src/mesa/main/multisample.h
@@ -26,6 +26,7 @@
#ifndef MULTISAMPLE_H
#define MULTISAMPLE_H
+#include "mtypes.h"
extern void GLAPIENTRY
_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
diff --git a/src/mesa/main/nvprogram.h b/src/mesa/main/nvprogram.h
index 8ee59661bd0..260a25ba9e9 100644
--- a/src/mesa/main/nvprogram.h
+++ b/src/mesa/main/nvprogram.h
@@ -29,6 +29,8 @@
#ifndef NVPROGRAM_H
#define NVPROGRAM_H
+#include "glheader.h"
+#include "mtypes.h"
extern void GLAPIENTRY
_mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params);
diff --git a/src/mesa/main/pixelstore.h b/src/mesa/main/pixelstore.h
index ee963f9ba3c..47bff4276d1 100644
--- a/src/mesa/main/pixelstore.h
+++ b/src/mesa/main/pixelstore.h
@@ -33,6 +33,7 @@
#include "glheader.h"
+#include "mtypes.h"
extern void GLAPIENTRY
diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c
index 6f62415ba8c..32aaa79f7fb 100644
--- a/src/mesa/main/querymatrix.c
+++ b/src/mesa/main/querymatrix.c
@@ -36,9 +36,9 @@
#define INT_TO_FIXED(x) ((GLfixed) ((x) << 16))
#define FLOAT_TO_FIXED(x) ((GLfixed) ((x) * 65536.0))
-#if defined(WIN32) || defined(_WIN32_WCE)
+#if defined(_MSC_VER)
/* Oddly, the fpclassify() function doesn't exist in such a form
- * on Windows. This is an implementation using slightly different
+ * on MSVC. This is an implementation using slightly different
* lower-level Windows functions.
*/
#include <float.h>
@@ -72,7 +72,7 @@ fpclassify(double x)
#elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
- (defined(__sun) && defined(__C99FEATURES__))
+ (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__)
/* fpclassify is available. */
diff --git a/src/mesa/main/remap.h b/src/mesa/main/remap.h
index 7afdee36f5b..a2a55f615d5 100644
--- a/src/mesa/main/remap.h
+++ b/src/mesa/main/remap.h
@@ -28,6 +28,7 @@
#define REMAP_H
+#include "main/compiler.h"
#include "main/mfeatures.h"
struct gl_function_pool_remap {
diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h
index 7c205e141c1..bc92b269821 100644
--- a/src/mesa/main/renderbuffer.h
+++ b/src/mesa/main/renderbuffer.h
@@ -26,6 +26,11 @@
#ifndef RENDERBUFFER_H
#define RENDERBUFFER_H
+#include "glheader.h"
+#include "mtypes.h"
+
+struct gl_framebuffer;
+struct gl_renderbuffer;
extern void
_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name);
diff --git a/src/mesa/main/restart.h b/src/mesa/main/restart.h
index 931cd701281..25f58f24c35 100644
--- a/src/mesa/main/restart.h
+++ b/src/mesa/main/restart.h
@@ -28,6 +28,7 @@
#ifndef RESTART_H
#define RESTART_H
+#include "glheader.h"
extern void GLAPIENTRY
_mesa_PrimitiveRestart(void);
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index f9d10f3bbea..cbe004518a0 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -32,7 +32,6 @@
#include "imports.h"
#include "mtypes.h"
#include "hash.h"
-#include "arrayobj.h"
#if FEATURE_ATI_fragment_shader
#include "atifragshader.h"
#endif
diff --git a/src/mesa/main/shared.h b/src/mesa/main/shared.h
index ef164a14590..5166a0ce51f 100644
--- a/src/mesa/main/shared.h
+++ b/src/mesa/main/shared.h
@@ -25,6 +25,7 @@
#ifndef SHARED_H
#define SHARED_H
+#include "mtypes.h"
struct gl_shared_state *
_mesa_alloc_shared_state(GLcontext *ctx);
diff --git a/src/mesa/main/syncobj.h b/src/mesa/main/syncobj.h
index f23fa281e20..c53511995b1 100644
--- a/src/mesa/main/syncobj.h
+++ b/src/mesa/main/syncobj.h
@@ -31,7 +31,10 @@
#ifndef SYNCOBJ_H
#define SYNCOBJ_H
-#include "context.h"
+#include "glheader.h"
+#include "mtypes.h"
+
+struct dd_function_table;
extern void
_mesa_init_sync_object_functions(struct dd_function_table *driver);
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index f4b1119eb17..e911524cbc5 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -33,7 +33,6 @@
#include "glheader.h"
#include "imports.h"
#include "colormac.h"
-#include "context.h"
#include "formats.h"
#include "texcompress.h"
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index 04acf05e528..c8b45bd3a55 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -32,9 +32,9 @@
#include "glheader.h"
#include "imports.h"
#include "colormac.h"
-#include "context.h"
#include "convolve.h"
#include "image.h"
+#include "macros.h"
#include "mipmap.h"
#include "texcompress.h"
#include "texcompress_fxt1.h"
diff --git a/src/mesa/main/texcompress_fxt1.h b/src/mesa/main/texcompress_fxt1.h
index d63ca71e212..38048b26ccb 100644
--- a/src/mesa/main/texcompress_fxt1.h
+++ b/src/mesa/main/texcompress_fxt1.h
@@ -25,9 +25,11 @@
#ifndef TEXCOMPRESS_FXT1_H
#define TEXCOMPRESS_FXT1_H
-#include "main/mtypes.h"
+#include "glheader.h"
#include "texstore.h"
+struct gl_texture_image;
+
#if FEATURE_texture_fxt1
extern GLboolean
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 85c394b051f..c70792cab61 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -36,10 +36,10 @@
#include "glheader.h"
#include "imports.h"
#include "colormac.h"
-#include "context.h"
#include "convolve.h"
#include "dlopen.h"
#include "image.h"
+#include "macros.h"
#include "texcompress.h"
#include "texcompress_s3tc.h"
#include "texstore.h"
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
index fe002082cca..c03bc71cd7a 100644
--- a/src/mesa/main/texfetch.c
+++ b/src/mesa/main/texfetch.c
@@ -34,7 +34,7 @@
#include "colormac.h"
-#include "context.h"
+#include "macros.h"
#include "texcompress.h"
#include "texcompress_fxt1.h"
#include "texcompress_s3tc.h"
diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h
index 397d89e630f..2224a937611 100644
--- a/src/mesa/main/texgen.h
+++ b/src/mesa/main/texgen.h
@@ -27,7 +27,10 @@
#define TEXGEN_H
-#include "main/mtypes.h"
+#include "compiler.h"
+#include "glheader.h"
+
+struct _glapi_table;
#if FEATURE_texgen
diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
index 088d27c7e17..866ab704945 100644
--- a/src/mesa/main/texgetimage.h
+++ b/src/mesa/main/texgetimage.h
@@ -27,6 +27,7 @@
#ifndef TEXGETIMAGE_H
#define TEXGETIMAGE_H
+#include "mtypes.h"
extern void
_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
index d29af5a5b2f..c68105b3951 100644
--- a/src/mesa/main/texrender.c
+++ b/src/mesa/main/texrender.c
@@ -1,6 +1,7 @@
#include "context.h"
#include "colormac.h"
+#include "macros.h"
#include "texfetch.h"
#include "texrender.h"
#include "renderbuffer.h"
diff --git a/src/mesa/main/texrender.h b/src/mesa/main/texrender.h
index 7c3fb0871bd..1e87d594a28 100644
--- a/src/mesa/main/texrender.h
+++ b/src/mesa/main/texrender.h
@@ -1,6 +1,7 @@
#ifndef TEXRENDER_H
#define TEXRENDER_H
+#include "mtypes.h"
extern void
_mesa_render_texture(GLcontext *ctx,
diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h
index 17ac68000c5..912cb677985 100644
--- a/src/mesa/main/texstate.h
+++ b/src/mesa/main/texstate.h
@@ -32,6 +32,7 @@
#define TEXSTATE_H
+#include "compiler.h"
#include "mtypes.h"
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 0f21395af39..2989fdb72ed 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -55,7 +55,6 @@
#include "glheader.h"
#include "bufferobj.h"
#include "colormac.h"
-#include "context.h"
#include "convolve.h"
#include "image.h"
#include "macros.h"
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index 29f77cb35a0..ef98fe16bb1 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -25,6 +25,10 @@
#ifndef UNIFORMS_H
#define UNIFORMS_H
+#include "glheader.h"
+
+struct gl_program;
+struct _glapi_table;
extern void GLAPIENTRY
_mesa_Uniform1fARB(GLint, GLfloat);
diff --git a/src/mesa/main/viewport.h b/src/mesa/main/viewport.h
index f08fef27978..ec054a7c597 100644
--- a/src/mesa/main/viewport.h
+++ b/src/mesa/main/viewport.h
@@ -27,6 +27,8 @@
#ifndef VIEWPORT_H
#define VIEWPORT_H
+#include "glheader.h"
+#include "mtypes.h"
extern void GLAPIENTRY
_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/mesa/main/vtxfmt.h b/src/mesa/main/vtxfmt.h
index fb6c23abe98..aad38b87c35 100644
--- a/src/mesa/main/vtxfmt.h
+++ b/src/mesa/main/vtxfmt.h
@@ -33,6 +33,9 @@
#ifndef _VTXFMT_H_
#define _VTXFMT_H_
+#include "compiler.h"
+#include "mtypes.h"
+
#if FEATURE_beginend
extern void _mesa_init_exec_vtxfmt( GLcontext *ctx );