test version of startmenu root with big icons
[reactos.git] / reactos / lib / mesa32 / src / main / glheader.h
1 /**
2 * \file glheader.h
3 * Top-most include file.
4 *
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.
10 *
11 * \note Actually, a lot of system-dependent stuff is now in imports.[ch].
12 *
13 * If you touch this file, everything gets recompiled!
14 *
15 * This file should be included before any other header in the .c files.
16 *
17 * Put compiler/OS/assembly pragmas and macros here to avoid
18 * cluttering other source files.
19 */
20
21 /*
22 * Mesa 3-D graphics library
23 * Version: 6.2
24 *
25 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
26 *
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:
33 *
34 * The above copyright notice and this permission notice shall be included
35 * in all copies or substantial portions of the Software.
36 *
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.
43 */
44
45
46 #ifndef GLHEADER_H
47 #define GLHEADER_H
48
49
50 #if defined(XFree86LOADER) && defined(IN_MODULE)
51 #include "xf86_ansic.h"
52 #else
53 #include <assert.h>
54 #include <ctype.h>
55 /* If we can use Compaq's Fast Math Library on Alpha */
56 #if defined(__alpha__) && defined(CCPML)
57 #include <cpml.h>
58 #else
59 #include <math.h>
60 #endif
61 #include <limits.h>
62 #include <stdlib.h>
63 #include <stdio.h>
64 #include <string.h>
65 #if defined(__linux__) && defined(__i386__)
66 #include <fpu_control.h>
67 #endif
68 #endif
69 #include <float.h>
70 #include <stdarg.h>
71
72
73 #ifdef HAVE_CONFIG_H
74 #include "conf.h"
75 #endif
76
77
78 #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
79 # define __WIN32__
80 # define finite _finite
81 #endif
82
83 #if defined(__WATCOMC__)
84 # define finite _finite
85 #endif
86
87 #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
88 # if !defined(__GNUC__) /* mingw environment */
89 # pragma warning( disable : 4068 ) /* unknown pragma */
90 # pragma warning( disable : 4710 ) /* function 'foo' not inlined */
91 # pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
92 # pragma warning( disable : 4127 ) /* conditional expression is constant */
93 # if defined(MESA_MINWARN)
94 # pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
95 # pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
96 # pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
97 # pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
98 # pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
99 # endif
100 # endif
101 # if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
102 # define GLAPI __declspec(dllexport)
103 # define WGLAPI __declspec(dllexport)
104 # elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
105 # define GLAPI __declspec(dllimport)
106 # define WGLAPI __declspec(dllimport)
107 # else /* for use with static link lib build of Win32 edition only */
108 # define GLAPI extern
109 # define WGLAPI __declspec(dllimport)
110 # endif /* _STATIC_MESA support */
111 # define GLAPIENTRY __stdcall
112 # define GLAPIENTRYP GLAPIENTRY *
113 # define GLCALLBACK __stdcall
114 # define GLCALLBACKP GLCALLBACK *
115 # if defined(__CYGWIN__)
116 # define GLCALLBACKPCAST *
117 # else
118 # define GLCALLBACKPCAST __stdcall *
119 # endif
120 # define GLWINAPI __stdcall
121 # define GLWINAPIV __cdecl
122 #elif !defined(BUILD_FOR_SNAP)
123 /* non-Windows compilation */
124 # define GLAPI extern
125 # define GLAPIENTRY
126 # ifndef GLAPIENTRYP
127 # define GLAPIENTRYP *
128 # endif
129 # define GLCALLBACK
130 # define GLCALLBACKP *
131 # define GLCALLBACKPCAST *
132 # define GLWINAPI
133 # define GLWINAPIV
134 #endif /* WIN32 / CYGWIN bracket */
135
136 /* compatibility guard so we don't need to change client code */
137
138 #if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
139 #if 0
140 # define CALLBACK GLCALLBACK
141 typedef void *HGLRC;
142 typedef void *HDC;
143 #endif
144 typedef int (GLAPIENTRY *PROC)();
145 typedef unsigned long COLORREF;
146 #endif
147
148
149 /* Make sure we include glext.h from gl.h */
150 #define GL_GLEXT_PROTOTYPES
151
152
153 #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP)
154 # define WGL_FONT_LINES 0
155 # define WGL_FONT_POLYGONS 1
156 #ifndef _GNU_H_WINDOWS32_FUNCTIONS
157 # ifdef UNICODE
158 # define wglUseFontBitmaps wglUseFontBitmapsW
159 # define wglUseFontOutlines wglUseFontOutlinesW
160 # else
161 # define wglUseFontBitmaps wglUseFontBitmapsA
162 # define wglUseFontOutlines wglUseFontOutlinesA
163 # endif /* !UNICODE */
164 #endif /* _GNU_H_WINDOWS32_FUNCTIONS */
165 typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
166 typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
167 typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
168 #if !defined(GLX_USE_MESA)
169 #include <GL/mesa_wgl.h>
170 #endif
171 #endif
172
173
174 /*
175 * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
176 * Do not use them unless absolutely necessary!
177 * Try to use a runtime test instead.
178 * For now, only used by some DRI hardware drivers for color/texel packing.
179 */
180 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
181 #if defined(__linux__)
182 #include <byteswap.h>
183 #define CPU_TO_LE32( x ) bswap_32( x )
184 #else /*__linux__*/
185 #define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */
186 #endif /*__linux__*/
187 #define MESA_BIG_ENDIAN 1
188 #else
189 #define CPU_TO_LE32( x ) ( x )
190 #define MESA_LITTLE_ENDIAN 1
191 #endif
192 #define LE32_TO_CPU( x ) CPU_TO_LE32( x )
193
194
195 /* This is a macro on IRIX */
196 #ifdef _P
197 #undef _P
198 #endif
199
200
201
202 #include "GL/gl.h"
203 #include "GL/glext.h"
204
205
206 #ifndef CAPI
207 #if defined(WIN32) && !defined(BUILD_FOR_SNAP)
208 #define CAPI _cdecl
209 #else
210 #define CAPI
211 #endif
212 #endif
213 #include <GL/internal/glcore.h>
214
215
216 /* XXX temporary hack - remove when glext.h is updated */
217 #ifndef GL_ARB_half_float_pixel
218 #define GL_ARB_half_float_pixel 1
219 #define GL_HALF_FLOAT_ARB 0x140B
220 typedef GLushort GLhalfARB;
221 #endif
222
223 /* XXX temporary hack - remove when glext.h is updated */
224 #ifndef GL_ARB_texture_float
225 #define GL_ARB_texture_float 1
226 #define GL_TEXTURE_RED_TYPE_ARB 0x9000
227 #define GL_TEXTURE_GREEN_TYPE_ARB 0x9001
228 #define GL_TEXTURE_BLUE_TYPE_ARB 0x9002
229 #define GL_TEXTURE_ALPHA_TYPE_ARB 0x9003
230 #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x9004
231 #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x9005
232 #define GL_TEXTURE_DEPTH_TYPE_ARB 0x9006
233 #define GL_UNSIGNED_NORMALIZED_ARB 0x9007
234 #define GL_RGBA32F_ARB 0x8814
235 #define GL_RGB32F_ARB 0x8815
236 #define GL_ALPHA32F_ARB 0x8816
237 #define GL_INTENSITY32F_ARB 0x8817
238 #define GL_LUMINANCE32F_ARB 0x8818
239 #define GL_LUMINANCE_ALPHA32F_ARB 0x8819
240 #define GL_RGBA16F_ARB 0x881A
241 #define GL_RGB16F_ARB 0x881B
242 #define GL_ALPHA16F_ARB 0x881C
243 #define GL_INTENSITY16F_ARB 0x881D
244 #define GL_LUMINANCE16F_ARB 0x881E
245 #define GL_LUMINANCE_ALPHA16F_ARB 0x881F
246 #endif
247
248 /* XXX temporary hack - remove when glext.h is updated */
249 #ifndef GL_POINT_SPRITE_COORD_ORIGIN
250 #define GL_POINT_SPRITE_COORD_ORIGIN 0x10000
251 #define GL_LOWER_LEFT 0x10001
252 #define GL_UPPER_LEFT 0x10002
253 #endif
254
255
256
257 /* Disable unreachable code warnings for Watcom C++ */
258 #ifdef __WATCOMC__
259 #pragma disable_message(201)
260 #endif
261
262
263 /* Turn off macro checking systems used by other libraries */
264 #ifdef CHECK
265 #undef CHECK
266 #endif
267
268
269 /* Create a macro so that asm functions can be linked into compilers other
270 * than GNU C
271 */
272 #ifndef _ASMAPI
273 #if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
274 #define _ASMAPI __cdecl
275 #else
276 #define _ASMAPI
277 #endif
278 #ifdef PTR_DECL_IN_FRONT
279 #define _ASMAPIP * _ASMAPI
280 #else
281 #define _ASMAPIP _ASMAPI *
282 #endif
283 #endif
284
285 #ifdef USE_X86_ASM
286 #define _NORMAPI _ASMAPI
287 #define _NORMAPIP _ASMAPIP
288 #else
289 #define _NORMAPI
290 #define _NORMAPIP *
291 #endif
292
293
294 /* Function inlining */
295 #if defined(__GNUC__)
296 # define INLINE __inline__
297 #elif defined(__MSC__)
298 # define INLINE __inline
299 #elif defined(_MSC_VER)
300 # define INLINE __inline
301 #elif defined(__ICL)
302 # define INLINE __inline
303 #elif defined(__INTEL_COMPILER)
304 # define INLINE inline
305 #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
306 # define INLINE __inline
307 #else
308 # define INLINE
309 #endif
310
311
312 /* Some compilers don't like some of Mesa's const usage */
313 #ifdef NO_CONST
314 # define CONST
315 #else
316 # define CONST const
317 #endif
318
319
320 #if defined(BUILD_FOR_SNAP) && defined(CHECKED)
321 # define ASSERT(X) _CHECK(X)
322 #elif defined(DEBUG)
323 # define ASSERT(X) assert(X)
324 #else
325 # define ASSERT(X)
326 #endif
327
328
329 #if !defined __GNUC__ || __GNUC__ < 3
330 # define __builtin_expect(x, y) x
331 #endif
332
333
334
335 /**
336 * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float
337 * as a int (thereby using integer registers instead of FP registers) is
338 * a performance win. Typically, this can be done with ordinary casts.
339 * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0)
340 * these casts generate warnings.
341 * The following union typedef is used to solve that.
342 */
343 typedef union { GLfloat f; GLint i; } fi_type;
344
345
346 #include "config.h"
347
348 #endif /* GLHEADER_H */