Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file glheader.h |
| 3 | * Top-most include file. |
Kendall Bennett | b29b8ca | 2003-09-12 22:01:01 +0000 | [diff] [blame] | 4 | * |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 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]. |
Kendall Bennett | b29b8ca | 2003-09-12 22:01:01 +0000 | [diff] [blame] | 12 | * |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 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 | */ |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 20 | |
| 21 | /* |
| 22 | * Mesa 3-D graphics library |
Brian Paul | 5e83c2a | 2004-01-28 22:01:47 +0000 | [diff] [blame] | 23 | * Version: 6.1 |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 24 | * |
Brian Paul | 5e83c2a | 2004-01-28 22:01:47 +0000 | [diff] [blame] | 25 | * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 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 | |
Brian Paul | 9dc11a3 | 2002-10-30 19:44:41 +0000 | [diff] [blame] | 50 | #if defined(XFree86LOADER) && defined(IN_MODULE) |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 51 | #include "xf86_ansic.h" |
| 52 | #else |
| 53 | #include <assert.h> |
| 54 | #include <ctype.h> |
Brian Paul | f7a4bca | 2000-09-15 15:42:45 +0000 | [diff] [blame] | 55 | /* If we can use Compaq's Fast Math Library on Alpha */ |
| 56 | #if defined(__alpha__) && defined(CCPML) |
| 57 | #include <cpml.h> |
| 58 | #else |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 59 | #include <math.h> |
Brian Paul | f7a4bca | 2000-09-15 15:42:45 +0000 | [diff] [blame] | 60 | #endif |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 61 | #include <limits.h> |
| 62 | #include <stdlib.h> |
| 63 | #include <stdio.h> |
| 64 | #include <string.h> |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 65 | #if defined(__linux__) && defined(__i386__) |
Brian Paul | 780c4e0 | 2000-03-22 23:20:12 +0000 | [diff] [blame] | 66 | #include <fpu_control.h> |
| 67 | #endif |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 68 | #endif |
Brian Paul | e39ed58 | 2000-02-12 15:55:34 +0000 | [diff] [blame] | 69 | #include <float.h> |
Brian Paul | 4753d60 | 2002-06-15 02:38:15 +0000 | [diff] [blame] | 70 | #include <stdarg.h> |
Brian Paul | e39ed58 | 2000-02-12 15:55:34 +0000 | [diff] [blame] | 71 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 72 | |
| 73 | #ifdef HAVE_CONFIG_H |
| 74 | #include "conf.h" |
| 75 | #endif |
| 76 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 77 | |
Kendall Bennett | 2cdd699 | 2003-10-08 01:53:30 +0000 | [diff] [blame] | 78 | #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 79 | # define __WIN32__ |
Karl Schultz | 2391f4c | 2001-12-20 18:59:39 +0000 | [diff] [blame] | 80 | # define finite _finite |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 81 | #endif |
| 82 | |
Kendall Bennett | 2cdd699 | 2003-10-08 01:53:30 +0000 | [diff] [blame] | 83 | #if defined(__WATCOMC__) |
| 84 | # define finite _finite |
| 85 | #endif |
| 86 | |
| 87 | #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 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 */ |
| 98 | # endif |
| 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 |
Karl Schultz | 9b9a57a | 2003-12-04 20:55:58 +0000 | [diff] [blame] | 110 | # define GLAPIENTRYP GLAPIENTRY * |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 111 | # define GLCALLBACK __stdcall |
Karl Schultz | 9b9a57a | 2003-12-04 20:55:58 +0000 | [diff] [blame] | 112 | # define GLCALLBACKP GLCALLBACK * |
Brian Paul | df54463 | 2000-05-22 19:41:34 +0000 | [diff] [blame] | 113 | # if defined(__CYGWIN__) |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 114 | # define GLCALLBACKPCAST * |
| 115 | # else |
| 116 | # define GLCALLBACKPCAST __stdcall * |
| 117 | # endif |
| 118 | # define GLWINAPI __stdcall |
| 119 | # define GLWINAPIV __cdecl |
Kendall Bennett | 2cdd699 | 2003-10-08 01:53:30 +0000 | [diff] [blame] | 120 | #elif !defined(BUILD_FOR_SNAP) |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 121 | /* non-Windows compilation */ |
| 122 | # define GLAPI extern |
| 123 | # define GLAPIENTRY |
Brian Paul | 8172cec | 2003-12-06 17:58:30 +0000 | [diff] [blame] | 124 | # ifndef GLAPIENTRYP |
| 125 | # define GLAPIENTRYP * |
| 126 | # endif |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 127 | # define GLCALLBACK |
| 128 | # define GLCALLBACKP * |
| 129 | # define GLCALLBACKPCAST * |
| 130 | # define GLWINAPI |
| 131 | # define GLWINAPIV |
Brian Paul | df54463 | 2000-05-22 19:41:34 +0000 | [diff] [blame] | 132 | #endif /* WIN32 / CYGWIN bracket */ |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 133 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 134 | /* compatibility guard so we don't need to change client code */ |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 135 | |
Kendall Bennett | 2cdd699 | 2003-10-08 01:53:30 +0000 | [diff] [blame] | 136 | #if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) |
Brian Paul | 1e01632 | 2000-05-26 15:52:06 +0000 | [diff] [blame] | 137 | #if 0 |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 138 | # define CALLBACK GLCALLBACK |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 139 | typedef void *HGLRC; |
| 140 | typedef void *HDC; |
Brian Paul | 8f39dd1 | 2000-09-12 15:41:46 +0000 | [diff] [blame] | 141 | #endif |
| 142 | typedef int (GLAPIENTRY *PROC)(); |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 143 | typedef unsigned long COLORREF; |
| 144 | #endif |
| 145 | |
Brian Paul | 00277e8 | 2000-08-02 00:41:21 +0000 | [diff] [blame] | 146 | |
| 147 | /* Make sure we include glext.h from gl.h */ |
| 148 | #define GL_GLEXT_PROTOTYPES |
| 149 | |
| 150 | |
Kendall Bennett | 2cdd699 | 2003-10-08 01:53:30 +0000 | [diff] [blame] | 151 | #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP) |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 152 | # define WGL_FONT_LINES 0 |
| 153 | # define WGL_FONT_POLYGONS 1 |
| 154 | #ifndef _GNU_H_WINDOWS32_FUNCTIONS |
| 155 | # ifdef UNICODE |
| 156 | # define wglUseFontBitmaps wglUseFontBitmapsW |
| 157 | # define wglUseFontOutlines wglUseFontOutlinesW |
| 158 | # else |
| 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; |
Brian Paul | 15bf1cd | 2001-02-09 23:39:02 +0000 | [diff] [blame] | 166 | #if !defined(GLX_USE_MESA) |
Brian Paul | c3fb255 | 2003-12-11 23:55:55 +0000 | [diff] [blame] | 167 | #include <GL/mesa_wgl.h> |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 168 | #endif |
Brian Paul | 15bf1cd | 2001-02-09 23:39:02 +0000 | [diff] [blame] | 169 | #endif |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 170 | |
| 171 | |
Brian Paul | 1013e46 | 2002-06-12 00:52:50 +0000 | [diff] [blame] | 172 | /* |
| 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. |
| 177 | */ |
| 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 ) |
| 182 | #else /*__linux__*/ |
| 183 | #define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */ |
| 184 | #endif /*__linux__*/ |
| 185 | #define MESA_BIG_ENDIAN 1 |
| 186 | #else |
| 187 | #define CPU_TO_LE32( x ) ( x ) |
| 188 | #define MESA_LITTLE_ENDIAN 1 |
| 189 | #endif |
| 190 | #define LE32_TO_CPU( x ) CPU_TO_LE32( x ) |
| 191 | |
| 192 | |
Brian Paul | ee403ff | 2001-03-29 16:50:31 +0000 | [diff] [blame] | 193 | /* This is a macro on IRIX */ |
| 194 | #ifdef _P |
| 195 | #undef _P |
| 196 | #endif |
| 197 | |
Brian Paul | 87a7897 | 2000-05-22 16:30:47 +0000 | [diff] [blame] | 198 | |
| 199 | |
Brian Paul | 1e01632 | 2000-05-26 15:52:06 +0000 | [diff] [blame] | 200 | #include "GL/gl.h" |
| 201 | #include "GL/glext.h" |
| 202 | |
| 203 | |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 204 | #ifndef CAPI |
Kendall Bennett | 2cdd699 | 2003-10-08 01:53:30 +0000 | [diff] [blame] | 205 | #if defined(WIN32) && !defined(BUILD_FOR_SNAP) |
Brian Paul | a1503b0 | 2001-07-16 15:54:23 +0000 | [diff] [blame] | 206 | #define CAPI _cdecl |
| 207 | #else |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 208 | #define CAPI |
| 209 | #endif |
Brian Paul | a1503b0 | 2001-07-16 15:54:23 +0000 | [diff] [blame] | 210 | #endif |
Keith Whitwell | b980b2e | 2001-01-08 04:09:41 +0000 | [diff] [blame] | 211 | #include <GL/internal/glcore.h> |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 212 | |
| 213 | |
Brian Paul | 7a6b71e | 2004-03-13 18:21:40 +0000 | [diff] [blame] | 214 | /* XXX temporary hack */ |
| 215 | #ifndef GL_PIXEL_PACK_BUFFER_EXT |
| 216 | #define GL_PIXEL_PACK_BUFFER_EXT 0x88EB |
| 217 | #define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC |
| 218 | #define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED |
| 219 | #define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF |
| 220 | #endif |
| 221 | |
Brian Paul | 1e01632 | 2000-05-26 15:52:06 +0000 | [diff] [blame] | 222 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 223 | /* XXX temporary hack */ |
| 224 | #ifndef GL_ARB_half_float_pixel |
| 225 | #define GL_ARB_half_float_pixel 1 |
| 226 | #define GL_HALF_FLOAT_ARB 0x140B |
| 227 | typedef GLushort GLhalfARB; |
| 228 | #endif |
| 229 | |
| 230 | |
| 231 | /* XXX temporary hack */ |
| 232 | #ifndef GL_ARB_texture_float |
| 233 | #define GL_ARB_texture_float 1 |
| 234 | #define GL_TEXTURE_RED_TYPE_ARB 0x9000 |
| 235 | #define GL_TEXTURE_GREEN_TYPE_ARB 0x9001 |
| 236 | #define GL_TEXTURE_BLUE_TYPE_ARB 0x9002 |
| 237 | #define GL_TEXTURE_ALPHA_TYPE_ARB 0x9003 |
| 238 | #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x9004 |
| 239 | #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x9005 |
| 240 | #define GL_TEXTURE_DEPTH_TYPE_ARB 0x9006 |
| 241 | #define GL_UNSIGNED_NORMALIZED_ARB 0x9007 |
| 242 | #define GL_RGBA32F_ARB 0x8814 |
| 243 | #define GL_RGB32F_ARB 0x8815 |
| 244 | #define GL_ALPHA32F_ARB 0x8816 |
| 245 | #define GL_INTENSITY32F_ARB 0x8817 |
| 246 | #define GL_LUMINANCE32F_ARB 0x8818 |
| 247 | #define GL_LUMINANCE_ALPHA32F_ARB 0x8819 |
| 248 | #define GL_RGBA16F_ARB 0x881A |
| 249 | #define GL_RGB16F_ARB 0x881B |
| 250 | #define GL_ALPHA16F_ARB 0x881C |
| 251 | #define GL_INTENSITY16F_ARB 0x881D |
| 252 | #define GL_LUMINANCE16F_ARB 0x881E |
| 253 | #define GL_LUMINANCE_ALPHA16F_ARB 0x881F |
| 254 | #endif |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
Brian Paul | 2da507d | 1999-11-12 18:23:47 +0000 | [diff] [blame] | 259 | /* Disable unreachable code warnings for Watcom C++ */ |
Kendall Bennett | be599f8 | 1999-11-12 16:46:56 +0000 | [diff] [blame] | 260 | #ifdef __WATCOMC__ |
| 261 | #pragma disable_message(201) |
| 262 | #endif |
| 263 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 264 | |
Brian Paul | 2da507d | 1999-11-12 18:23:47 +0000 | [diff] [blame] | 265 | /* Turn off macro checking systems used by other libraries */ |
| 266 | #ifdef CHECK |
| 267 | #undef CHECK |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 268 | #endif |
Brian Paul | 2da507d | 1999-11-12 18:23:47 +0000 | [diff] [blame] | 269 | |
| 270 | |
| 271 | /* Create a macro so that asm functions can be linked into compilers other |
| 272 | * than GNU C |
| 273 | */ |
| 274 | #ifndef _ASMAPI |
Brian Paul | 5e83c2a | 2004-01-28 22:01:47 +0000 | [diff] [blame] | 275 | #if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/ |
Brian Paul | 2da507d | 1999-11-12 18:23:47 +0000 | [diff] [blame] | 276 | #define _ASMAPI __cdecl |
| 277 | #else |
| 278 | #define _ASMAPI |
| 279 | #endif |
| 280 | #ifdef PTR_DECL_IN_FRONT |
| 281 | #define _ASMAPIP * _ASMAPI |
| 282 | #else |
| 283 | #define _ASMAPIP _ASMAPI * |
| 284 | #endif |
| 285 | #endif |
| 286 | |
| 287 | #ifdef USE_X86_ASM |
| 288 | #define _NORMAPI _ASMAPI |
| 289 | #define _NORMAPIP _ASMAPIP |
| 290 | #else |
| 291 | #define _NORMAPI |
| 292 | #define _NORMAPIP * |
| 293 | #endif |
| 294 | |
| 295 | |
Brian Paul | 0ab16e0 | 2001-05-14 23:11:12 +0000 | [diff] [blame] | 296 | /* Function inlining */ |
| 297 | #if defined(__GNUC__) |
| 298 | # define INLINE __inline__ |
| 299 | #elif defined(__MSC__) |
| 300 | # define INLINE __inline |
Brian Paul | a1503b0 | 2001-07-16 15:54:23 +0000 | [diff] [blame] | 301 | #elif defined(_MSC_VER) |
| 302 | # define INLINE __inline |
| 303 | #elif defined(__ICL) |
| 304 | # define INLINE __inline |
Eric Anholt | 527078a | 2003-12-09 23:59:16 +0000 | [diff] [blame] | 305 | #elif defined(__INTEL_COMPILER) |
| 306 | # define INLINE inline |
Kendall Bennett | b29b8ca | 2003-09-12 22:01:01 +0000 | [diff] [blame] | 307 | #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) |
| 308 | # define INLINE __inline |
Brian Paul | 0ab16e0 | 2001-05-14 23:11:12 +0000 | [diff] [blame] | 309 | #else |
| 310 | # define INLINE |
| 311 | #endif |
| 312 | |
| 313 | |
| 314 | /* Some compilers don't like some of Mesa's const usage */ |
| 315 | #ifdef NO_CONST |
| 316 | # define CONST |
| 317 | #else |
| 318 | # define CONST const |
| 319 | #endif |
| 320 | |
| 321 | |
Kendall Bennett | 2cdd699 | 2003-10-08 01:53:30 +0000 | [diff] [blame] | 322 | #if defined(BUILD_FOR_SNAP) && defined(CHECKED) |
Kendall Bennett | adbbea9 | 2003-10-02 23:50:44 +0000 | [diff] [blame] | 323 | # define ASSERT(X) _CHECK(X) |
| 324 | #elif defined(DEBUG) |
Brian Paul | 0ab16e0 | 2001-05-14 23:11:12 +0000 | [diff] [blame] | 325 | # define ASSERT(X) assert(X) |
| 326 | #else |
| 327 | # define ASSERT(X) |
| 328 | #endif |
| 329 | |
| 330 | |
Ian Romanick | 8e77da1 | 2004-06-29 19:08:20 +0000 | [diff] [blame^] | 331 | #if !defined __GNUC__ || __GNUC__ < 3 |
| 332 | # define __builtin_expect(x, y) x |
| 333 | #endif |
| 334 | |
| 335 | |
| 336 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 337 | /** |
Brian Paul | 24ae7c4 | 2001-06-15 15:22:07 +0000 | [diff] [blame] | 338 | * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 339 | * as a int (thereby using integer registers instead of FP registers) is |
Brian Paul | 24ae7c4 | 2001-06-15 15:22:07 +0000 | [diff] [blame] | 340 | * a performance win. Typically, this can be done with ordinary casts. |
| 341 | * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0) |
| 342 | * these casts generate warnings. |
| 343 | * The following union typedef is used to solve that. |
| 344 | */ |
| 345 | typedef union { GLfloat f; GLint i; } fi_type; |
| 346 | |
Brian Paul | 2da507d | 1999-11-12 18:23:47 +0000 | [diff] [blame] | 347 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 348 | #include "config.h" |
| 349 | |
Brian Paul | 2da507d | 1999-11-12 18:23:47 +0000 | [diff] [blame] | 350 | #endif /* GLHEADER_H */ |