3 * Top-most include file.
5 * This is the top-most include file of the Mesa sources.
6 * It includes gl.h and all system headers which are needed.
7 * Other Mesa source files should \e not directly include any system
8 * headers. This allows Mesa to be integrated into XFree86 and
9 * allows system-dependent hacks/workarounds to be collected in one place.
11 * \note Actually, a lot of system-dependent stuff is now in imports.[ch].
13 * If you touch this file, everything gets recompiled!
15 * This file should be included before any other header in the .c files.
17 * Put compiler/OS/assembly pragmas and macros here to avoid
18 * cluttering other source files.
22 * Mesa 3-D graphics library
25 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
27 * Permission is hereby granted, free of charge, to any person obtaining a
28 * copy of this software and associated documentation files (the "Software"),
29 * to deal in the Software without restriction, including without limitation
30 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
31 * and/or sell copies of the Software, and to permit persons to whom the
32 * Software is furnished to do so, subject to the following conditions:
34 * The above copyright notice and this permission notice shall be included
35 * in all copies or substantial portions of the Software.
37 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
38 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
40 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
41 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
42 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50 #if defined(XFree86LOADER) && defined(IN_MODULE)
51 #include "xf86_ansic.h"
55 /* If we can use Compaq's Fast Math Library on Alpha */
56 #if defined(__alpha__) && defined(CCPML)
65 #if defined(__linux__) && defined(__i386__)
66 #include <fpu_control.h>
73 /* This is no longer uses since we dumped autoconf/automake! */
78 /* Get typedefs for uintptr_t and friends */
82 typedef UINT_PTR
uintptr_t;
88 #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
90 # define finite _finite
93 #if defined(__WATCOMC__)
94 # define finite _finite
95 # pragma disable_message(201) /* Disable unreachable code warnings */
99 #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
100 # if !defined(__GNUC__) /* mingw environment */
101 # pragma warning( disable : 4068 ) /* unknown pragma */
102 # pragma warning( disable : 4710 ) /* function 'foo' not inlined */
103 # pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
104 # pragma warning( disable : 4127 ) /* conditional expression is constant */
105 # if defined(MESA_MINWARN)
106 # pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
107 # pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
108 # pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
109 # pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
110 # pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
113 # if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
114 # define WGLAPI __declspec(dllexport)
115 # elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
116 # define WGLAPI __declspec(dllimport)
117 # else /* for use with static link lib build of Win32 edition only */
118 # define WGLAPI __declspec(dllimport)
119 # endif /* _STATIC_MESA support */
120 #endif /* WIN32 / CYGWIN bracket */
124 /* XXX why is this here?
125 * It should probaby be somewhere in src/mesa/drivers/windows/
127 #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP)
128 # define WGL_FONT_LINES 0
129 # define WGL_FONT_POLYGONS 1
130 #ifndef _GNU_H_WINDOWS32_FUNCTIONS
132 # define wglUseFontBitmaps wglUseFontBitmapsW
133 # define wglUseFontOutlines wglUseFontOutlinesW
135 # define wglUseFontBitmaps wglUseFontBitmapsA
136 # define wglUseFontOutlines wglUseFontOutlinesA
137 # endif /* !UNICODE */
138 #endif /* _GNU_H_WINDOWS32_FUNCTIONS */
139 typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR
, *PLAYERPLANEDESCRIPTOR
, *LPLAYERPLANEDESCRIPTOR
;
140 typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT
, *PGLYPHMETRICSFLOAT
, *LPGLYPHMETRICSFLOAT
;
141 typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR
, *PPIXELFORMATDESCRIPTOR
, *LPPIXELFORMATDESCRIPTOR
;
142 #if !defined(GLX_USE_MESA)
143 #include <GL/mesa_wgl.h>
146 #endif /* !__MINGW32__ */
150 * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
151 * Do not use them unless absolutely necessary!
152 * Try to use a runtime test instead.
153 * For now, only used by some DRI hardware drivers for color/texel packing.
155 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
156 #if defined(__linux__)
157 #include <byteswap.h>
158 #define CPU_TO_LE32( x ) bswap_32( x )
160 #define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */
162 #define MESA_BIG_ENDIAN 1
164 #define CPU_TO_LE32( x ) ( x )
165 #define MESA_LITTLE_ENDIAN 1
167 #define LE32_TO_CPU( x ) CPU_TO_LE32( x )
170 #define GL_GLEXT_PROTOTYPES
172 #include "GL/glext.h"
175 #if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
178 #include <GL/internal/glcore.h>
181 /* This is a macro on IRIX */
187 /* Turn off macro checking systems used by other libraries */
193 /* Create a macro so that asm functions can be linked into compilers other
197 #if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
198 #define _ASMAPI __cdecl
202 #ifdef PTR_DECL_IN_FRONT
203 #define _ASMAPIP * _ASMAPI
205 #define _ASMAPIP _ASMAPI *
210 #define _NORMAPI _ASMAPI
211 #define _NORMAPIP _ASMAPIP
218 /* Function inlining */
219 #if defined(__GNUC__)
220 # define INLINE __inline__
221 #elif defined(__MSC__)
222 # define INLINE __inline
223 #elif defined(_MSC_VER)
224 # define INLINE __inline
226 # define INLINE __inline
227 #elif defined(__INTEL_COMPILER)
228 # define INLINE inline
229 #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
230 # define INLINE __inline
236 /* If we build the library with gcc's -fvisibility=hidden flag, we'll
237 * use the PUBLIC macro to mark functions that are to be exported.
239 * We also need to define a USED attribute, so the optimizer doesn't
240 * inline a static function that we later use in an alias. - ajax
242 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
243 # define PUBLIC __attribute__((visibility("default")))
244 # define USED __attribute__((used))
251 /* Some compilers don't like some of Mesa's const usage */
259 #if defined(BUILD_FOR_SNAP) && defined(CHECKED)
260 # define ASSERT(X) _CHECK(X)
262 # define ASSERT(X) assert(X)
268 #if !defined __GNUC__ || __GNUC__ < 3
269 # define __builtin_expect(x, y) x
272 /* Windows does not have the ffs() function */
273 #if defined(_WIN32) && !defined(__MINGW32__)
274 int INLINE
ffs(int value
)
279 for (bit
=1; !(value
& 1); bit
++)
287 #endif /* GLHEADER_H */