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-2003 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>
78 #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
80 # define finite _finite
83 #if defined(__WATCOMC__)
84 # define finite _finite
87 #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
88 # pragma warning( disable : 4068 ) /* unknown pragma */
89 # pragma warning( disable : 4710 ) /* function 'foo' not inlined */
90 # pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
91 # pragma warning( disable : 4127 ) /* conditional expression is constant */
92 # if defined(MESA_MINWARN)
93 # pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
94 # pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
95 # pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
96 # pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
97 # pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
99 # if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
100 # define GLAPI __declspec(dllexport)
101 # define WGLAPI __declspec(dllexport)
102 # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
103 # define GLAPI __declspec(dllimport)
104 # define WGLAPI __declspec(dllimport)
105 # else /* for use with static link lib build of Win32 edition only */
106 # define GLAPI extern
107 # define WGLAPI __declspec(dllimport)
108 # endif /* _STATIC_MESA support */
109 # define GLAPIENTRY __stdcall
110 # define GLAPIENTRYP GLAPIENTRY *
111 # define GLCALLBACK __stdcall
112 # define GLCALLBACKP GLCALLBACK *
113 # if defined(__CYGWIN__)
114 # define GLCALLBACKPCAST *
116 # define GLCALLBACKPCAST __stdcall *
118 # define GLWINAPI __stdcall
119 # define GLWINAPIV __cdecl
120 #elif !defined(BUILD_FOR_SNAP)
121 /* non-Windows compilation */
122 # define GLAPI extern
125 # define GLAPIENTRYP *
128 # define GLCALLBACKP *
129 # define GLCALLBACKPCAST *
132 #endif /* WIN32 / CYGWIN bracket */
134 /* compatibility guard so we don't need to change client code */
136 #if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
138 # define CALLBACK GLCALLBACK
142 typedef int (GLAPIENTRY
*PROC
)();
143 typedef unsigned long COLORREF
;
147 /* Make sure we include glext.h from gl.h */
148 #define GL_GLEXT_PROTOTYPES
151 #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP)
152 # define WGL_FONT_LINES 0
153 # define WGL_FONT_POLYGONS 1
154 #ifndef _GNU_H_WINDOWS32_FUNCTIONS
156 # define wglUseFontBitmaps wglUseFontBitmapsW
157 # define wglUseFontOutlines wglUseFontOutlinesW
159 # define wglUseFontBitmaps wglUseFontBitmapsA
160 # define wglUseFontOutlines wglUseFontOutlinesA
161 # endif /* !UNICODE */
162 #endif /* _GNU_H_WINDOWS32_FUNCTIONS */
163 typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR
, *PLAYERPLANEDESCRIPTOR
, *LPLAYERPLANEDESCRIPTOR
;
164 typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT
, *PGLYPHMETRICSFLOAT
, *LPGLYPHMETRICSFLOAT
;
165 typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR
, *PPIXELFORMATDESCRIPTOR
, *LPPIXELFORMATDESCRIPTOR
;
166 #if !defined(GLX_USE_MESA)
167 #include <GL/mesa_wgl.h>
173 * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
174 * Do not use them unless absolutely necessary!
175 * Try to use a runtime test instead.
176 * For now, only used by some DRI hardware drivers for color/texel packing.
178 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
179 #if defined(__linux__)
180 #include <byteswap.h>
181 #define CPU_TO_LE32( x ) bswap_32( x )
183 #define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */
185 #define MESA_BIG_ENDIAN 1
187 #define CPU_TO_LE32( x ) ( x )
188 #define MESA_LITTLE_ENDIAN 1
190 #define LE32_TO_CPU( x ) CPU_TO_LE32( x )
193 /* This is a macro on IRIX */
201 #include "GL/glext.h"
205 #if defined(WIN32) && !defined(BUILD_FOR_SNAP)
211 #include <GL/internal/glcore.h>
215 /* Disable unreachable code warnings for Watcom C++ */
217 #pragma disable_message(201)
221 /* Turn off macro checking systems used by other libraries */
227 /* Create a macro so that asm functions can be linked into compilers other
231 #if !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )
232 #define _ASMAPI __cdecl
236 #ifdef PTR_DECL_IN_FRONT
237 #define _ASMAPIP * _ASMAPI
239 #define _ASMAPIP _ASMAPI *
244 #define _NORMAPI _ASMAPI
245 #define _NORMAPIP _ASMAPIP
252 /* Function inlining */
253 #if defined(__GNUC__)
254 # define INLINE __inline__
255 #elif defined(__MSC__)
256 # define INLINE __inline
257 #elif defined(_MSC_VER)
258 # define INLINE __inline
260 # define INLINE __inline
261 #elif defined(__INTEL_COMPILER)
262 # define INLINE inline
263 #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
264 # define INLINE __inline
270 /* Some compilers don't like some of Mesa's const usage */
278 #if defined(BUILD_FOR_SNAP) && defined(CHECKED)
279 # define ASSERT(X) _CHECK(X)
281 # define ASSERT(X) assert(X)
288 * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float
289 * as a int (thereby using integer registers instead of FP registers) is
290 * a performance win. Typically, this can be done with ordinary casts.
291 * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0)
292 * these casts generate warnings.
293 * The following union typedef is used to solve that.
295 typedef union { GLfloat f
; GLint i
; } fi_type
;
300 #endif /* GLHEADER_H */