additional work on GL_EXT_framebuffer_object
[profile/ivi/mesa.git] / src / mesa / 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.3
24  *
25  * Copyright (C) 1999-2005  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 /* This is no longer uses since we dumped autoconf/automake! */
74 #ifdef HAVE_CONFIG_H
75 #include "conf.h"
76 #endif
77
78
79 #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
80 #  define __WIN32__
81 #  define finite _finite
82 #endif
83
84 #if defined(__WATCOMC__)
85 #  define finite _finite
86 #  pragma disable_message(201) /* Disable unreachable code warnings */
87 #endif
88
89
90 #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
91 #  if !defined(__GNUC__) /* mingw environment */
92 #    pragma warning( disable : 4068 ) /* unknown pragma */
93 #    pragma warning( disable : 4710 ) /* function 'foo' not inlined */
94 #    pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
95 #    pragma warning( disable : 4127 ) /* conditional expression is constant */
96 #    if defined(MESA_MINWARN)
97 #      pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
98 #      pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
99 #      pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
100 #      pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
101 #      pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
102 #    endif
103 #  endif
104 #  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
105 #    define WGLAPI __declspec(dllexport)
106 #  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
107 #    define WGLAPI __declspec(dllimport)
108 #  else /* for use with static link lib build of Win32 edition only */
109 #    define WGLAPI __declspec(dllimport)
110 #  endif /* _STATIC_MESA support */
111 #endif /* WIN32 / CYGWIN bracket */
112
113
114 #ifndef __MINGW32__
115 /* XXX why is this here?
116  * It should probaby be somewhere in src/mesa/drivers/windows/
117  */
118 /* compatibility guard so we don't need to change client code */
119 #if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
120 typedef int (GLAPIENTRY *PROC)();
121 typedef unsigned long COLORREF;
122 #endif
123
124
125 /* XXX why is this here?
126  * It should probaby be somewhere in src/mesa/drivers/windows/
127  */
128 #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP) 
129 #       define WGL_FONT_LINES      0
130 #       define WGL_FONT_POLYGONS   1
131 #ifndef _GNU_H_WINDOWS32_FUNCTIONS
132 #       ifdef UNICODE
133 #               define wglUseFontBitmaps  wglUseFontBitmapsW
134 #               define wglUseFontOutlines  wglUseFontOutlinesW
135 #       else
136 #               define wglUseFontBitmaps  wglUseFontBitmapsA
137 #               define wglUseFontOutlines  wglUseFontOutlinesA
138 #       endif /* !UNICODE */
139 #endif /* _GNU_H_WINDOWS32_FUNCTIONS */
140 typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
141 typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
142 typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
143 #if !defined(GLX_USE_MESA)
144 #include <GL/mesa_wgl.h>
145 #endif
146 #endif
147 #endif /* !__MINGW32__ */
148
149
150 /*
151  * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
152  * Do not use them unless absolutely necessary!
153  * Try to use a runtime test instead.
154  * For now, only used by some DRI hardware drivers for color/texel packing.
155  */
156 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
157 #if defined(__linux__)
158 #include <byteswap.h>
159 #define CPU_TO_LE32( x )        bswap_32( x )
160 #else /*__linux__*/
161 #define CPU_TO_LE32( x )        ( x )  /* fix me for non-Linux big-endian! */
162 #endif /*__linux__*/
163 #define MESA_BIG_ENDIAN 1
164 #else
165 #define CPU_TO_LE32( x )        ( x )
166 #define MESA_LITTLE_ENDIAN 1
167 #endif
168 #define LE32_TO_CPU( x )        CPU_TO_LE32( x )
169
170
171 #define GL_GLEXT_PROTOTYPES
172 #include "GL/gl.h"
173 #include "GL/glext.h"
174
175
176 #if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
177 #define CAPI _cdecl
178 #endif
179 #include <GL/internal/glcore.h>
180
181
182 /* This is a macro on IRIX */
183 #ifdef _P
184 #undef _P
185 #endif
186
187
188 /* Turn off macro checking systems used by other libraries */
189 #ifdef CHECK
190 #undef CHECK
191 #endif
192
193
194 /* Create a macro so that asm functions can be linked into compilers other
195  * than GNU C
196  */
197 #ifndef _ASMAPI
198 #if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
199 #define _ASMAPI __cdecl
200 #else
201 #define _ASMAPI
202 #endif
203 #ifdef  PTR_DECL_IN_FRONT
204 #define _ASMAPIP * _ASMAPI
205 #else
206 #define _ASMAPIP _ASMAPI *
207 #endif
208 #endif
209
210 #ifdef USE_X86_ASM
211 #define _NORMAPI _ASMAPI
212 #define _NORMAPIP _ASMAPIP
213 #else
214 #define _NORMAPI
215 #define _NORMAPIP *
216 #endif
217
218
219 /* Function inlining */
220 #if defined(__GNUC__)
221 #  define INLINE __inline__
222 #elif defined(__MSC__)
223 #  define INLINE __inline
224 #elif defined(_MSC_VER)
225 #  define INLINE __inline
226 #elif defined(__ICL)
227 #  define INLINE __inline
228 #elif defined(__INTEL_COMPILER)
229 #  define INLINE inline
230 #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
231 #  define INLINE __inline
232 #else
233 #  define INLINE
234 #endif
235
236
237 /* If we build the library with gcc's -fvisibility=hidden flag, we'll
238  * use the PUBLIC macro to mark functions that are to be exported.
239  *
240  * We also need to define a USED attribute, so the optimizer doesn't 
241  * inline a static function that we later use in an alias. - ajax
242  */
243 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
244 #  define PUBLIC __attribute__((visibility("default")))
245 #  define USED __attribute__((used))
246 #else
247 #  define PUBLIC
248 #  define USED
249 #endif
250
251
252 /* Some compilers don't like some of Mesa's const usage */
253 #ifdef NO_CONST
254 #  define CONST
255 #else
256 #  define CONST const
257 #endif
258
259
260 #if defined(BUILD_FOR_SNAP) && defined(CHECKED)
261 #  define ASSERT(X)   _CHECK(X) 
262 #elif defined(DEBUG)
263 #  define ASSERT(X)   assert(X)
264 #else
265 #  define ASSERT(X)
266 #endif
267
268
269 #if !defined __GNUC__ || __GNUC__ < 3
270 #  define __builtin_expect(x, y) x
271 #endif
272
273
274
275 /* XXX these are temporary here! */
276 #define GL_FRAMEBUFFER_EXT                     0x8D40
277 #define GL_RENDERBUFFER_EXT                    0x8D41
278 #define GL_STENCIL_INDEX_EXT                   0x8D45
279 #define GL_STENCIL_INDEX1_EXT                  0x8D46
280 #define GL_STENCIL_INDEX4_EXT                  0x8D47
281 #define GL_STENCIL_INDEX8_EXT                  0x8D48
282 #define GL_STENCIL_INDEX16_EXT                 0x8D49
283 #define GL_RENDERBUFFER_WIDTH_EXT              0x8D42
284 #define GL_RENDERBUFFER_HEIGHT_EXT             0x8D43
285 #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT    0x8D44
286 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT            0x8CD0
287 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT            0x8CD1
288 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT          0x8CD2
289 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT  0x8CD3
290 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT     0x8CD4
291 #define GL_COLOR_ATTACHMENT0_EXT                0x8CE0
292 #define GL_COLOR_ATTACHMENT1_EXT                0x8CE1
293 #define GL_COLOR_ATTACHMENT2_EXT                0x8CE2
294 #define GL_COLOR_ATTACHMENT3_EXT                0x8CE3
295 #define GL_COLOR_ATTACHMENT4_EXT                0x8CE4
296 #define GL_COLOR_ATTACHMENT5_EXT                0x8CE5
297 #define GL_COLOR_ATTACHMENT6_EXT                0x8CE6
298 #define GL_COLOR_ATTACHMENT7_EXT                0x8CE7
299 #define GL_COLOR_ATTACHMENT8_EXT                0x8CE8
300 #define GL_COLOR_ATTACHMENT9_EXT                0x8CE9
301 #define GL_COLOR_ATTACHMENT10_EXT               0x8CEA
302 #define GL_COLOR_ATTACHMENT11_EXT               0x8CEB
303 #define GL_COLOR_ATTACHMENT12_EXT               0x8CEC
304 #define GL_COLOR_ATTACHMENT13_EXT               0x8CED
305 #define GL_COLOR_ATTACHMENT14_EXT               0x8CEE
306 #define GL_COLOR_ATTACHMENT15_EXT               0x8CEF
307 #define GL_DEPTH_ATTACHMENT_EXT                 0x8D00
308 #define GL_STENCIL_ATTACHMENT_EXT               0x8D20
309 #define GL_FRAMEBUFFER_COMPLETE_EXT                          0x8CD5
310 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT             0x8CD6
311 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT     0x8CD7
312 #define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT   0x8CD8
313 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT             0x8CD9
314 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT                0x8CDA
315 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT            0x8CDB
316 #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT            0x8CDC
317 #define GL_FRAMEBUFFER_UNSUPPORTED_EXT                       0x8CDD
318 #define GL_FRAMEBUFFER_STATUS_ERROR_EXT                      0x8CDE
319 #define GL_FRAMEBUFFER_BINDING_EXT             0x8CA6
320 #define GL_RENDERBUFFER_BINDING_EXT            0x8CA7
321 #define GL_MAX_COLOR_ATTACHMENTS_EXT           0x8CDF
322 #define GL_MAX_RENDERBUFFER_SIZE_EXT           0x84E8
323 #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT   0x0506
324
325
326 #include "config.h"
327
328 #endif /* GLHEADER_H */