Subversion Repositories shark

Rev

Rev 433 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
433 giacomo 1
/* $Id: glheader.h,v 1.3 2004-01-29 12:17:37 giacomo Exp $ */
55 pj 2
 
3
/*
4
 * Mesa 3-D graphics library
5
 * Version:  5.0
6
 *
7
 * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a
10
 * copy of this software and associated documentation files (the "Software"),
11
 * to deal in the Software without restriction, including without limitation
12
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
 * and/or sell copies of the Software, and to permit persons to whom the
14
 * Software is furnished to do so, subject to the following conditions:
15
 *
16
 * The above copyright notice and this permission notice shall be included
17
 * in all copies or substantial portions of the Software.
18
 *
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
 */
26
 
27
 
28
#ifndef GLHEADER_H
29
#define GLHEADER_H
30
 
31
 
32
/*
33
 * This is the top-most include file of the Mesa sources.
34
 * It includes gl.h and all system headers which are needed.
35
 * Other Mesa source files should _not_ directly include any system
36
 * headers.  This allows Mesa to be integrated into XFree86 and
37
 * allows system-dependent hacks/work-arounds to be collected in one place.
38
 *
39
 * If you touch this file, everything gets recompiled!
40
 *
41
 * This file should be included before any other header in the .c files.
42
 *
43
 * Put compiler/OS/assembly pragmas and macros here to avoid
44
 * cluttering other source files.
45
 */
46
 
47
 
48
 
49
#if defined(XFree86LOADER) && defined(IN_MODULE)
50
#include "xf86_ansic.h"
51
#else
52
#include <assert.h>
53
#include <ctype.h>
54
/* If we can use Compaq's Fast Math Library on Alpha */
55
#if defined(__alpha__) && defined(CCPML)
56
#include <cpml.h>
57
#else
58
#include <math.h>
59
#endif
60
#include <limits.h>
61
#include <stdlib.h>
62
#include <stdio.h>
63
#include <string.h>
64
#if defined(__linux__) && defined(__i386__)
65
#endif
66
#endif
67
#include <float.h>
68
#include <stdarg.h>
69
 
70
 
71
#ifdef HAVE_CONFIG_H
72
#include "conf.h"
73
#endif
74
 
75
 
76
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
77
#       define __WIN32__
78
#       define finite _finite
79
#endif
80
 
81
#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__))
82
#  pragma warning( disable : 4068 ) /* unknown pragma */
83
#  pragma warning( disable : 4710 ) /* function 'foo' not inlined */
84
#  pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
85
#  pragma warning( disable : 4127 ) /* conditional expression is constant */
86
#  if defined(MESA_MINWARN)
87
#    pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
88
#    pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
89
#    pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
90
#    pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
91
#    pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
92
#  endif
93
#  if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
94
#    define GLAPI __declspec(dllexport)
95
#    define WGLAPI __declspec(dllexport)
96
#  elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
97
#    define GLAPI __declspec(dllimport)
98
#    define WGLAPI __declspec(dllimport)
99
#  else /* for use with static link lib build of Win32 edition only */
100
#    define GLAPI extern
101
#    define WGLAPI __declspec(dllimport)
102
#  endif /* _STATIC_MESA support */
103
#  define GLAPIENTRY __stdcall
104
#  define GLAPIENTRYP __stdcall *
105
#  define GLCALLBACK __stdcall
106
#  define GLCALLBACKP __stdcall *
107
#  if defined(__CYGWIN__)
108
#    define GLCALLBACKPCAST *
109
#  else
110
#    define GLCALLBACKPCAST __stdcall *
111
#  endif
112
#  define GLWINAPI __stdcall
113
#  define GLWINAPIV __cdecl
114
#else
115
/* non-Windows compilation */
116
#  define GLAPI extern
117
#  define GLAPIENTRY
118
#  define GLAPIENTRYP *
119
#  define GLCALLBACK
120
#  define GLCALLBACKP *
121
#  define GLCALLBACKPCAST *
122
#  define GLWINAPI
123
#  define GLWINAPIV
124
#endif /* WIN32 / CYGWIN bracket */
125
 
126
/* compatability guard so we don't need to change client code */
127
 
128
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__)
129
#if 0
130
#       define CALLBACK GLCALLBACK
131
typedef void *HGLRC;
132
typedef void *HDC;
133
#endif
134
typedef int (GLAPIENTRY *PROC)();
135
typedef unsigned long COLORREF;
136
#endif
137
 
138
 
139
/* Make sure we include glext.h from gl.h */
140
#define GL_GLEXT_PROTOTYPES
141
 
142
 
143
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
144
#       define WGL_FONT_LINES      0
145
#       define WGL_FONT_POLYGONS   1
146
#ifndef _GNU_H_WINDOWS32_FUNCTIONS
147
#       ifdef UNICODE
148
#               define wglUseFontBitmaps  wglUseFontBitmapsW
149
#               define wglUseFontOutlines  wglUseFontOutlinesW
150
#       else
151
#               define wglUseFontBitmaps  wglUseFontBitmapsA
152
#               define wglUseFontOutlines  wglUseFontOutlinesA
153
#       endif /* !UNICODE */
154
#endif /* _GNU_H_WINDOWS32_FUNCTIONS */
155
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
156
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
157
typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
158
#if !defined(GLX_USE_MESA)
159
#include <gl/mesa_wgl.h>
160
#endif
161
#endif
162
 
163
 
164
/*
165
 * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
166
 * Do not use them unless absolutely necessary!
167
 * Try to use a runtime test instead.
168
 * For now, only used by some DRI hardware drivers for color/texel packing.
169
 */
170
#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
171
#if defined(__linux__)
172
#include <byteswap.h>
173
#define CPU_TO_LE32( x )        bswap_32( x )
174
#else /*__linux__*/
175
#define CPU_TO_LE32( x )        ( x )  /* fix me for non-Linux big-endian! */
176
#endif /*__linux__*/
177
#define MESA_BIG_ENDIAN 1
178
#else
179
#define CPU_TO_LE32( x )        ( x )
180
#define MESA_LITTLE_ENDIAN 1
181
#endif
182
#define LE32_TO_CPU( x )        CPU_TO_LE32( x )
183
 
184
 
185
/* This is a macro on IRIX */
186
#ifdef _P
187
#undef _P
188
#endif
189
 
190
 
191
 
192
#include "GL/gl.h"
193
#include "GL/glext.h"
194
 
195
 
196
#ifndef CAPI
197
#ifdef WIN32
198
#define CAPI _cdecl
199
#else
200
#define CAPI
201
#endif
202
#endif
203
#include <GL/internal/glcore.h>
204
 
205
 
206
 
207
/* Disable unreachable code warnings for Watcom C++ */
208
#ifdef  __WATCOMC__
209
#pragma disable_message(201)
210
#endif
211
 
212
 
213
/* Turn off macro checking systems used by other libraries */
214
#ifdef CHECK
215
#undef CHECK
216
#endif
217
 
218
 
219
/* Create a macro so that asm functions can be linked into compilers other
220
 * than GNU C
221
 */
222
#ifndef _ASMAPI
223
#if !defined( __GNUC__ ) && !defined( VMS )
224
#define _ASMAPI __cdecl
225
#else
226
#define _ASMAPI
227
#endif
228
#ifdef  PTR_DECL_IN_FRONT
229
#define _ASMAPIP * _ASMAPI
230
#else
231
#define _ASMAPIP _ASMAPI *
232
#endif
233
#endif
234
 
235
#ifdef USE_X86_ASM
236
#define _NORMAPI _ASMAPI
237
#define _NORMAPIP _ASMAPIP
238
#else
239
#define _NORMAPI
240
#define _NORMAPIP *
241
#endif
242
 
243
 
244
/* Function inlining */
245
#if defined(__GNUC__)
246
#  define INLINE __inline__
247
#elif defined(__MSC__)
248
#  define INLINE __inline
249
#elif defined(_MSC_VER)
250
#  define INLINE __inline
251
#elif defined(__ICL)
252
#  define INLINE __inline
253
#else
254
#  define INLINE
255
#endif
256
 
257
 
258
/*
259
 * Provide a reasonable replacement for __FUNCTION__ when using
260
 * non-GNU C compilers.
261
 */
262
#if !defined(__GNUC__)
263
#define STRINGIZE(x) #x
264
#define STRINGIZE_EVAL(x) STRINGIZE(x)
265
#define __FUNCTION__ STRINGIZE_EVAL(__FILE__) ", line " STRINGIZE_EVAL(__LINE__)
266
#endif
267
 
268
 
269
/* Some compilers don't like some of Mesa's const usage */
270
#ifdef NO_CONST
271
#  define CONST
272
#else
273
#  define CONST const
274
#endif
275
 
276
 
277
#ifdef DEBUG
278
#  define ASSERT(X)   assert(X)
279
#else
280
#  define ASSERT(X)
281
#endif
282
 
283
 
284
/*
285
 * Sometimes we treat GLfloats as GLints.  On x86 systems, moving a float
286
 * as a int (thereby using integer registers instead of fp registers) is
287
 * a performance win.  Typically, this can be done with ordinary casts.
288
 * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0)
289
 * these casts generate warnings.
290
 * The following union typedef is used to solve that.
291
 */
292
typedef union { GLfloat f; GLint i; } fi_type;
293
 
294
 
295
#endif /* GLHEADER_H */