[OPENGL32][MESA] Downgrade Mesa library to version 2.6
[reactos.git] / dll / opengl / mesa / types.h
1 /* $Id: types.h,v 1.50 1998/02/03 23:45:36 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 2.6
6 * Copyright (C) 1995-1997 Brian Paul
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23
24 /*
25 * $Log: types.h,v $
26 * Revision 1.50 1998/02/03 23:45:36 brianp
27 * added space parameter to clip interpolation functions
28 *
29 * Revision 1.49 1998/01/06 02:40:52 brianp
30 * added DavidB's clipping interpolation optimization
31 *
32 * Revision 1.48 1997/12/31 06:10:03 brianp
33 * added Henk Kok's texture validation optimization (AnyDirty flag)
34 *
35 * Revision 1.47 1997/12/06 18:06:50 brianp
36 * moved several static display list vars into GLcontext
37 *
38 * Revision 1.46 1997/10/29 01:33:29 brianp
39 * added DriverMgrCtx field to gl_context struct
40 *
41 * Revision 1.45 1997/10/29 01:29:09 brianp
42 * added GL_EXT_point_parameters extension from Daniel Barrero
43 *
44 * Revision 1.44 1997/10/16 01:59:08 brianp
45 * added GL_EXT_shared_texture_palette extension
46 *
47 * Revision 1.43 1997/10/16 01:13:03 brianp
48 * removed teximage Dirty, DirtyPalette flags, mondello code
49 *
50 * Revision 1.42 1997/09/29 23:27:08 brianp
51 * added Dirty and DriverData fields for texturing
52 *
53 * Revision 1.41 1997/09/27 00:13:44 brianp
54 * added GL_EXT_paletted_texture extension
55 *
56 * Revision 1.40 1997/09/23 00:57:38 brianp
57 * now using hash table for texture objects
58 *
59 * Revision 1.39 1997/09/22 02:33:58 brianp
60 * display lists now implemented with hash table
61 *
62 * Revision 1.38 1997/08/13 01:30:55 brianp
63 * LightTwoSide is now a GLboolean
64 *
65 * Revision 1.37 1997/08/01 02:23:27 brianp
66 * removed unused gl_list_group struct
67 *
68 * Revision 1.36 1997/06/20 02:07:50 brianp
69 * replaced Current.IntColor with Current.ByteColor
70 * removed ColorShift field
71 *
72 * Revision 1.35 1997/06/20 02:02:37 brianp
73 * added Color4ubv API pointer
74 *
75 * Revision 1.34 1997/05/31 16:57:14 brianp
76 * added MESA_NO_RASTER env var support
77 *
78 * Revision 1.33 1997/05/28 04:06:03 brianp
79 * implemented projection near/far value stack for Driver.NearFar() function
80 *
81 * Revision 1.32 1997/05/26 21:15:13 brianp
82 * added Red/Green/Blue/AlphaBits to GLvisual struct
83 *
84 * Revision 1.31 1997/05/03 00:49:31 brianp
85 * added SampleFunc, Current, and Dirty to gl_texture_object
86 *
87 * Revision 1.30 1997/05/01 02:07:35 brianp
88 * added shared state variable NextFreeTextureName
89 *
90 * Revision 1.29 1997/04/24 01:50:53 brianp
91 * optimized glColor3f, glColor3fv, glColor4fv
92 *
93 * Revision 1.28 1997/04/21 01:20:41 brianp
94 * added MATRIX_2D_NO_ROT
95 *
96 * Revision 1.27 1997/04/20 16:18:15 brianp
97 * added glOrtho and glFrustum API pointers
98 *
99 * Revision 1.26 1997/04/16 23:55:33 brianp
100 * added optimized glTexCoord2f code
101 *
102 * Revision 1.25 1997/04/14 22:18:23 brianp
103 * added optimized glVertex3fv code
104 *
105 * Revision 1.24 1997/04/14 02:03:05 brianp
106 * added MinMagThresh to texture object
107 *
108 * Revision 1.23 1997/04/12 16:54:05 brianp
109 * new NEW_POLYGON state flag
110 *
111 * Revision 1.22 1997/04/12 12:26:39 brianp
112 * added quad_func and rect_func, removed polygon_func
113 *
114 * Revision 1.21 1997/04/07 02:57:13 brianp
115 * added API.Vertex[23] functions
116 *
117 * Revision 1.20 1997/04/01 04:19:37 brianp
118 * added API pointer for glLoadIdentity
119 * added matrix type constants and fields
120 *
121 * Revision 1.19 1997/03/13 03:05:54 brianp
122 * changed AlphaRefInt to AlphaRefUbyte
123 *
124 * Revision 1.18 1997/03/04 19:17:38 brianp
125 * added a few members to gl_texture_image struct
126 *
127 * Revision 1.17 1997/02/10 19:49:29 brianp
128 * added glResizeBuffersMESA() code
129 *
130 * Revision 1.16 1997/02/09 19:53:43 brianp
131 * now use TEXTURE_xD enable constants
132 *
133 * Revision 1.15 1997/02/09 18:42:41 brianp
134 * added GL_EXT_texture3D support
135 *
136 * Revision 1.14 1997/01/28 22:14:36 brianp
137 * now there's separate state for CI and RGBA logic op enabled
138 *
139 * Revision 1.13 1997/01/21 03:09:41 brianp
140 * added definition: union node;
141 *
142 * Revision 1.12 1997/01/09 21:26:23 brianp
143 * added RefCount to gl_image struct
144 *
145 * Revision 1.11 1996/12/18 20:01:39 brianp
146 * added material bitmask constants and ColorMaterialBitmask
147 *
148 * Revision 1.10 1996/12/11 20:16:30 brianp
149 * changed GLaccum types to signed
150 *
151 * Revision 1.9 1996/11/08 02:21:04 brianp
152 * added NoRaster flag to context
153 *
154 * Revision 1.8 1996/11/07 04:11:34 brianp
155 * now pass gl_image struct pointer to glTexImage[12]D()
156 *
157 * Revision 1.7 1996/11/06 04:21:58 brianp
158 * added Format to struct gl_image
159 *
160 * Revision 1.6 1996/10/11 03:41:12 brianp
161 * removed OffsetBias field
162 *
163 * Revision 1.5 1996/10/11 00:23:04 brianp
164 * changed Polygon/Line/PointZoffset to GLfloat
165 *
166 * Revision 1.4 1996/09/25 03:22:53 brianp
167 * added NO_DRAW_BIT for glDrawBuffer(GL_NONE)
168 *
169 * Revision 1.3 1996/09/19 03:17:56 brianp
170 * removed Window field from struct gl_frame_buffer
171 *
172 * Revision 1.2 1996/09/15 14:20:54 brianp
173 * added GLframebuffer and GLvisual datatypes
174 *
175 * Revision 1.1 1996/09/13 01:38:16 brianp
176 * Initial revision
177 *
178 */
179
180
181 #ifndef TYPES_H
182 #define TYPES_H
183
184
185 #include "GL/gl.h"
186 #include "config.h"
187
188
189 struct HashTable;
190
191
192 /*
193 * Accumulation buffer data type:
194 */
195 #if ACCUM_BITS==8
196 typedef GLbyte GLaccum;
197 #elif ACCUM_BITS==16
198 typedef GLshort GLaccum;
199 #else
200 illegal number of accumulation bits
201 #endif
202
203
204 /*
205 * Stencil buffer data type:
206 */
207 #if STENCIL_BITS==8
208 typedef GLubyte GLstencil;
209 #else
210 illegal number of stencil bits
211 #endif
212
213
214
215 /*
216 * Depth buffer data type:
217 */
218 typedef GLint GLdepth;
219
220
221
222 #include "fixed.h"
223
224
225
226 typedef struct gl_visual GLvisual;
227
228 typedef struct gl_context GLcontext;
229
230 typedef struct gl_frame_buffer GLframebuffer;
231
232
233
234 /*
235 * Point, line, triangle, quadrilateral and rectangle rasterizer functions:
236 */
237 typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
238
239 typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
240
241 typedef void (*triangle_func)( GLcontext *ctx,
242 GLuint v1, GLuint v2, GLuint v3, GLuint pv );
243
244 typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
245 GLuint v3, GLuint v4, GLuint pv );
246
247 typedef void (*rect_func)( GLcontext *ctx, GLint x, GLint y,
248 GLint width, GLint height );
249
250 /*
251 * The auxiliary interpolation function for clipping
252 */
253 typedef void (* interp_func)(GLcontext *, GLuint, GLuint, GLfloat, GLuint, GLuint);
254
255
256 /*
257 * For texture sampling:
258 */
259 struct gl_texture_object;
260
261 typedef void (*TextureSampleFunc)( const struct gl_texture_object *tObj,
262 GLuint n,
263 const GLfloat s[], const GLfloat t[],
264 const GLfloat u[], const GLfloat lambda[],
265 GLubyte r[], GLubyte g[],
266 GLubyte b[],GLubyte a[] );
267
268
269 /* Generic internal image format */
270 struct gl_image {
271 GLint Width;
272 GLint Height;
273 GLint Components; /* 1, 2, 3 or 4 */
274 GLenum Format; /* GL_COLOR_INDEX, GL_RED, GL_RGB, etc */
275 GLenum Type; /* GL_UNSIGNED_BYTE or GL_FLOAT or GL_BITMAP */
276 GLvoid *Data;
277 GLboolean Interleaved; /* If TRUE and Format==GL_RGB, GL_RGBA or
278 * GL_LUMINANCE_ALPHA then each row is
279 * stored as RRR..RGGG..GBBB.B instead of
280 * RGBRGBRGBRGB..RGB. This is only used
281 * for glDrawPixels.
282 */
283 GLint RefCount;
284 };
285
286
287
288 /* Texture image record */
289 struct gl_texture_image {
290 GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
291 * GL_INTENSITY, GL_RGB, GL_RGBA, or
292 * GL_COLOR_INDEX
293 */
294 GLenum IntFormat; /* Internal format as given by the user */
295 GLuint Border; /* 0 or 1 */
296 GLuint Width; /* = 2^WidthLog2 + 2*Border */
297 GLuint Height; /* = 2^HeightLog2 + 2*Border */
298 GLuint Width2; /* = Width - 2*Border */
299 GLuint Height2; /* = Height - 2*Border */
300 GLuint WidthLog2; /* = log2(Width2) */
301 GLuint HeightLog2; /* = log2(Height2) */
302 GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */
303 GLubyte *Data; /* Image data as unsigned bytes */
304
305 /* For device driver: */
306 void *DriverData; /* Arbitrary device driver data */
307 };
308
309
310
311 /*
312 * All gl* API functions in api.c jump through pointers in this struct.
313 */
314 struct gl_api_table {
315 void (*Accum)( GLcontext *, GLenum, GLfloat );
316 void (*AlphaFunc)( GLcontext *, GLenum, GLclampf );
317 GLboolean (*AreTexturesResident)( GLcontext *, GLsizei,
318 const GLuint *, GLboolean * );
319 void (*ArrayElement)( GLcontext *, GLint );
320 void (*Begin)( GLcontext *, GLenum );
321 void (*BindTexture)( GLcontext *, GLenum, GLuint );
322 void (*Bitmap)( GLcontext *, GLsizei, GLsizei, GLfloat, GLfloat,
323 GLfloat, GLfloat, const struct gl_image *bitmap );
324 void (*BlendFunc)( GLcontext *, GLenum, GLenum );
325 void (*CallList)( GLcontext *, GLuint list );
326 void (*CallLists)( GLcontext *, GLsizei, GLenum, const GLvoid * );
327 void (*Clear)( GLcontext *, GLbitfield );
328 void (*ClearAccum)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
329 void (*ClearColor)( GLcontext *, GLclampf, GLclampf, GLclampf, GLclampf );
330 void (*ClearDepth)( GLcontext *, GLclampd );
331 void (*ClearIndex)( GLcontext *, GLfloat );
332 void (*ClearStencil)( GLcontext *, GLint );
333 void (*ClipPlane)( GLcontext *, GLenum, const GLfloat * );
334 void (*Color3f)( GLcontext *, GLfloat, GLfloat, GLfloat );
335 void (*Color3fv)( GLcontext *, const GLfloat * );
336 void (*Color4f)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
337 void (*Color4fv)( GLcontext *, const GLfloat * );
338 void (*Color4ub)( GLcontext *, GLubyte, GLubyte, GLubyte, GLubyte );
339 void (*Color4ubv)( GLcontext *, const GLubyte * );
340 void (*ColorMask)( GLcontext *,
341 GLboolean, GLboolean, GLboolean, GLboolean );
342 void (*ColorMaterial)( GLcontext *, GLenum, GLenum );
343 void (*ColorPointer)( GLcontext *, GLint, GLenum, GLsizei, const GLvoid * );
344 void (*ColorTable)( GLcontext *, GLenum, GLenum, struct gl_image * );
345 void (*ColorSubTable)( GLcontext *, GLenum, GLsizei, struct gl_image * );
346 void (*CopyPixels)( GLcontext *, GLint, GLint, GLsizei, GLsizei, GLenum );
347 void (*CopyTexImage1D)( GLcontext *, GLenum, GLint, GLenum,
348 GLint, GLint, GLsizei, GLint );
349 void (*CopyTexImage2D)( GLcontext *, GLenum, GLint, GLenum,
350 GLint, GLint, GLsizei, GLsizei, GLint );
351 void (*CopyTexSubImage1D)( GLcontext *, GLenum, GLint, GLint,
352 GLint, GLint, GLsizei );
353 void (*CopyTexSubImage2D)( GLcontext *, GLenum, GLint, GLint, GLint,
354 GLint, GLint, GLsizei, GLsizei );
355 void (*CullFace)( GLcontext *, GLenum );
356 void (*DeleteLists)( GLcontext *, GLuint, GLsizei );
357 void (*DeleteTextures)( GLcontext *, GLsizei, const GLuint *);
358 void (*DepthFunc)( GLcontext *, GLenum );
359 void (*DepthMask)( GLcontext *, GLboolean );
360 void (*DepthRange)( GLcontext *, GLclampd, GLclampd );
361 void (*Disable)( GLcontext *, GLenum );
362 void (*DisableClientState)( GLcontext *, GLenum );
363 void (*DrawArrays)( GLcontext *, GLenum, GLint, GLsizei );
364 void (*DrawBuffer)( GLcontext *, GLenum );
365 void (*DrawElements)( GLcontext *, GLenum, GLsizei, GLenum, const GLvoid *);
366 void (*DrawPixels)( GLcontext *,
367 GLsizei, GLsizei, GLenum, GLenum, const GLvoid * );
368 void (*EdgeFlag)( GLcontext *, GLboolean );
369 void (*EdgeFlagPointer)( GLcontext *, GLsizei, const GLboolean * );
370 void (*Enable)( GLcontext *, GLenum );
371 void (*EnableClientState)( GLcontext *, GLenum );
372 void (*End)( GLcontext * );
373 void (*EndList)( GLcontext * );
374 void (*EvalCoord1f)( GLcontext *, GLfloat );
375 void (*EvalCoord2f)( GLcontext *, GLfloat , GLfloat );
376 void (*EvalMesh1)( GLcontext *, GLenum, GLint, GLint );
377 void (*EvalMesh2)( GLcontext *, GLenum, GLint, GLint, GLint, GLint );
378 void (*EvalPoint1)( GLcontext *, GLint );
379 void (*EvalPoint2)( GLcontext *, GLint, GLint );
380 void (*FeedbackBuffer)( GLcontext *, GLsizei, GLenum, GLfloat * );
381 void (*Finish)( GLcontext * );
382 void (*Flush)( GLcontext * );
383 void (*Fogfv)( GLcontext *, GLenum, const GLfloat * );
384 void (*FrontFace)( GLcontext *, GLenum );
385 void (*Frustum)( GLcontext *, GLdouble, GLdouble, GLdouble, GLdouble,
386 GLdouble, GLdouble );
387 GLuint (*GenLists)( GLcontext *, GLsizei );
388 void (*GenTextures)( GLcontext *, GLsizei, GLuint * );
389 void (*GetBooleanv)( GLcontext *, GLenum, GLboolean * );
390 void (*GetClipPlane)( GLcontext *, GLenum, GLdouble * );
391 void (*GetColorTable)( GLcontext *, GLenum, GLenum, GLenum, GLvoid *);
392 void (*GetColorTableParameteriv)( GLcontext *, GLenum, GLenum, GLint *);
393 void (*GetDoublev)( GLcontext *, GLenum, GLdouble * );
394 GLenum (*GetError)( GLcontext * );
395 void (*GetFloatv)( GLcontext *, GLenum, GLfloat * );
396 void (*GetIntegerv)( GLcontext *, GLenum, GLint * );
397 const GLubyte* (*GetString)( GLcontext *, GLenum name );
398 void (*GetLightfv)( GLcontext *, GLenum light, GLenum, GLfloat * );
399 void (*GetLightiv)( GLcontext *, GLenum light, GLenum, GLint * );
400 void (*GetMapdv)( GLcontext *, GLenum, GLenum, GLdouble * );
401 void (*GetMapfv)( GLcontext *, GLenum, GLenum, GLfloat * );
402 void (*GetMapiv)( GLcontext *, GLenum, GLenum, GLint * );
403 void (*GetMaterialfv)( GLcontext *, GLenum, GLenum, GLfloat * );
404 void (*GetMaterialiv)( GLcontext *, GLenum, GLenum, GLint * );
405 void (*GetPixelMapfv)( GLcontext *, GLenum, GLfloat * );
406 void (*GetPixelMapuiv)( GLcontext *, GLenum, GLuint * );
407 void (*GetPixelMapusv)( GLcontext *, GLenum, GLushort * );
408 void (*GetPointerv)( GLcontext *, GLenum, GLvoid ** );
409 void (*GetPolygonStipple)( GLcontext *, GLubyte * );
410 void (*PrioritizeTextures)( GLcontext *, GLsizei, const GLuint *,
411 const GLclampf * );
412 void (*GetTexEnvfv)( GLcontext *, GLenum, GLenum, GLfloat * );
413 void (*GetTexEnviv)( GLcontext *, GLenum, GLenum, GLint * );
414 void (*GetTexGendv)( GLcontext *, GLenum coord, GLenum, GLdouble * );
415 void (*GetTexGenfv)( GLcontext *, GLenum coord, GLenum, GLfloat * );
416 void (*GetTexGeniv)( GLcontext *, GLenum coord, GLenum, GLint * );
417 void (*GetTexImage)( GLcontext *, GLenum, GLint level, GLenum, GLenum,
418 GLvoid * );
419 void (*GetTexLevelParameterfv)( GLcontext *,
420 GLenum, GLint, GLenum, GLfloat * );
421 void (*GetTexLevelParameteriv)( GLcontext *,
422 GLenum, GLint, GLenum, GLint * );
423 void (*GetTexParameterfv)( GLcontext *, GLenum, GLenum, GLfloat *);
424 void (*GetTexParameteriv)( GLcontext *, GLenum, GLenum, GLint * );
425 void (*Hint)( GLcontext *, GLenum, GLenum );
426 void (*IndexMask)( GLcontext *, GLuint );
427 void (*Indexf)( GLcontext *, GLfloat c );
428 void (*Indexi)( GLcontext *, GLint c );
429 void (*IndexPointer)( GLcontext *, GLenum, GLsizei, const GLvoid * );
430 void (*InitNames)( GLcontext * );
431 void (*InterleavedArrays)( GLcontext *, GLenum, GLsizei, const GLvoid * );
432 GLboolean (*IsEnabled)( GLcontext *, GLenum );
433 GLboolean (*IsList)( GLcontext *, GLuint );
434 GLboolean (*IsTexture)( GLcontext *, GLuint );
435 void (*LightModelfv)( GLcontext *, GLenum, const GLfloat * );
436 void (*Lightfv)( GLcontext *, GLenum light, GLenum, const GLfloat *, GLint);
437 void (*LineStipple)( GLcontext *, GLint factor, GLushort );
438 void (*LineWidth)( GLcontext *, GLfloat );
439 void (*ListBase)( GLcontext *, GLuint );
440 void (*LoadIdentity)( GLcontext * );
441 /* LoadMatrixd implemented with glLoadMatrixf */
442 void (*LoadMatrixf)( GLcontext *, const GLfloat * );
443 void (*LoadName)( GLcontext *, GLuint );
444 void (*LogicOp)( GLcontext *, GLenum );
445 void (*Map1f)( GLcontext *, GLenum, GLfloat, GLfloat, GLint, GLint,
446 const GLfloat *, GLboolean );
447 void (*Map2f)( GLcontext *, GLenum, GLfloat, GLfloat, GLint, GLint,
448 GLfloat, GLfloat, GLint, GLint, const GLfloat *,
449 GLboolean );
450 void (*MapGrid1f)( GLcontext *, GLint, GLfloat, GLfloat );
451 void (*MapGrid2f)( GLcontext *, GLint, GLfloat, GLfloat,
452 GLint, GLfloat, GLfloat );
453 void (*Materialfv)( GLcontext *, GLenum, GLenum, const GLfloat * );
454 void (*MatrixMode)( GLcontext *, GLenum );
455 /* MultMatrixd implemented with glMultMatrixf */
456 void (*MultMatrixf)( GLcontext *, const GLfloat * );
457 void (*NewList)( GLcontext *, GLuint list, GLenum );
458 void (*Normal3f)( GLcontext *, GLfloat, GLfloat, GLfloat );
459 void (*Normal3fv)( GLcontext *, const GLfloat * );
460 void (*NormalPointer)( GLcontext *, GLenum, GLsizei, const GLvoid * );
461 void (*Ortho)( GLcontext *, GLdouble, GLdouble, GLdouble, GLdouble,
462 GLdouble, GLdouble );
463 void (*PassThrough)( GLcontext *, GLfloat );
464 void (*PixelMapfv)( GLcontext *, GLenum, GLint, const GLfloat * );
465 void (*PixelStorei)( GLcontext *, GLenum, GLint );
466 void (*PixelTransferf)( GLcontext *, GLenum, GLfloat );
467 void (*PixelZoom)( GLcontext *, GLfloat, GLfloat );
468 void (*PointSize)( GLcontext *, GLfloat );
469 void (*PolygonMode)( GLcontext *, GLenum, GLenum );
470 void (*PolygonOffset)( GLcontext *, GLfloat, GLfloat );
471 void (*PolygonStipple)( GLcontext *, const GLubyte * );
472 void (*PopAttrib)( GLcontext * );
473 void (*PopClientAttrib)( GLcontext * );
474 void (*PopMatrix)( GLcontext * );
475 void (*PopName)( GLcontext * );
476 void (*PushAttrib)( GLcontext *, GLbitfield );
477 void (*PushClientAttrib)( GLcontext *, GLbitfield );
478 void (*PushMatrix)( GLcontext * );
479 void (*PushName)( GLcontext *, GLuint );
480 void (*RasterPos4f)( GLcontext *,
481 GLfloat x, GLfloat y, GLfloat z, GLfloat w );
482 void (*ReadBuffer)( GLcontext *, GLenum );
483 void (*ReadPixels)( GLcontext *, GLint, GLint, GLsizei, GLsizei, GLenum,
484 GLenum, GLvoid * );
485 void (*Rectf)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
486 GLint (*RenderMode)( GLcontext *, GLenum );
487 void (*Rotatef)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
488 void (*Scalef)( GLcontext *, GLfloat, GLfloat, GLfloat );
489 void (*Scissor)( GLcontext *, GLint, GLint, GLsizei, GLsizei);
490 void (*SelectBuffer)( GLcontext *, GLsizei, GLuint * );
491 void (*ShadeModel)( GLcontext *, GLenum );
492 void (*StencilFunc)( GLcontext *, GLenum, GLint, GLuint );
493 void (*StencilMask)( GLcontext *, GLuint );
494 void (*StencilOp)( GLcontext *, GLenum, GLenum, GLenum );
495 void (*TexCoord2f)( GLcontext *, GLfloat, GLfloat );
496 void (*TexCoord4f)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
497 void (*TexCoordPointer)( GLcontext *, GLint, GLenum, GLsizei,
498 const GLvoid *);
499 void (*TexEnvfv)( GLcontext *, GLenum, GLenum, const GLfloat * );
500 void (*TexGenfv)( GLcontext *, GLenum coord, GLenum, const GLfloat * );
501 void (*TexImage1D)( GLcontext *, GLenum, GLint, GLint, GLsizei,
502 GLint, GLenum, GLenum, struct gl_image * );
503 void (*TexImage2D)( GLcontext *, GLenum, GLint, GLint, GLsizei, GLsizei,
504 GLint, GLenum, GLenum, struct gl_image * );
505 void (*TexSubImage1D)( GLcontext *, GLenum, GLint, GLint, GLsizei,
506 GLenum, GLenum, struct gl_image * );
507 void (*TexSubImage2D)( GLcontext *, GLenum, GLint, GLint, GLint,
508 GLsizei, GLsizei, GLenum, GLenum,
509 struct gl_image * );
510 void (*TexParameterfv)( GLcontext *, GLenum, GLenum, const GLfloat * );
511 /* Translated implemented by Translatef */
512 void (*Translatef)( GLcontext *, GLfloat, GLfloat, GLfloat );
513 void (*Vertex2f)( GLcontext *, GLfloat, GLfloat );
514 void (*Vertex3f)( GLcontext *, GLfloat, GLfloat, GLfloat );
515 void (*Vertex4f)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
516 void (*Vertex3fv)( GLcontext *, const GLfloat * );
517 void (*VertexPointer)( GLcontext *, GLint, GLenum, GLsizei, const GLvoid *);
518 void (*Viewport)( GLcontext *, GLint, GLint, GLsizei, GLsizei );
519 };
520
521
522
523 #include "dd.h"
524
525
526 /*
527 * Bit flags used for updating material values.
528 */
529 #define FRONT_AMBIENT_BIT 0x1
530 #define BACK_AMBIENT_BIT 0x2
531 #define FRONT_DIFFUSE_BIT 0x4
532 #define BACK_DIFFUSE_BIT 0x8
533 #define FRONT_SPECULAR_BIT 0x10
534 #define BACK_SPECULAR_BIT 0x20
535 #define FRONT_EMISSION_BIT 0x40
536 #define BACK_EMISSION_BIT 0x80
537 #define FRONT_SHININESS_BIT 0x100
538 #define BACK_SHININESS_BIT 0x200
539 #define FRONT_INDEXES_BIT 0x400
540 #define BACK_INDEXES_BIT 0x800
541
542 #define FRONT_MATERIAL_BITS (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT | \
543 FRONT_DIFFUSE_BIT | FRONT_SPECULAR_BIT | \
544 FRONT_SHININESS_BIT | FRONT_INDEXES_BIT)
545
546 #define BACK_MATERIAL_BITS (BACK_EMISSION_BIT | BACK_AMBIENT_BIT | \
547 BACK_DIFFUSE_BIT | BACK_SPECULAR_BIT | \
548 BACK_SHININESS_BIT | BACK_INDEXES_BIT)
549
550 #define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
551
552
553
554 /*
555 * Specular exponent and material shininess lookup table sizes:
556 */
557 #define EXP_TABLE_SIZE 512
558 #define SHINE_TABLE_SIZE 200
559
560 struct gl_light {
561 GLfloat Ambient[4]; /* ambient color */
562 GLfloat Diffuse[4]; /* diffuse color */
563 GLfloat Specular[4]; /* specular color */
564 GLfloat Position[4]; /* position in eye coordinates */
565 GLfloat Direction[4]; /* spotlight dir in eye coordinates */
566 GLfloat SpotExponent;
567 GLfloat SpotCutoff; /* in degress */
568 GLfloat CosCutoff; /* = cos(SpotCutoff) */
569 GLfloat ConstantAttenuation;
570 GLfloat LinearAttenuation;
571 GLfloat QuadraticAttenuation;
572 GLboolean Enabled; /* On/off flag */
573
574 struct gl_light *NextEnabled; /* Ptr to next enabled light or NULL */
575
576 /* Derived fields */
577 GLfloat VP_inf_norm[3]; /* Norm direction to infinite light */
578 GLfloat h_inf_norm[3]; /* Norm( VP_inf_norm + <0,0,1> ) */
579 GLfloat NormDirection[3]; /* normalized spotlight direction */
580 GLfloat SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */
581 GLfloat MatAmbient[2][3]; /* material ambient * light ambient */
582 GLfloat MatDiffuse[2][3]; /* material diffuse * light diffuse */
583 GLfloat MatSpecular[2][3]; /* material spec * light specular */
584 GLfloat dli; /* CI diffuse light intensity */
585 GLfloat sli; /* CI specular light intensity */
586 };
587
588
589 struct gl_lightmodel {
590 GLfloat Ambient[4]; /* ambient color */
591 GLboolean LocalViewer; /* Local (or infinite) view point? */
592 GLboolean TwoSide; /* Two (or one) sided lighting? */
593 };
594
595
596 struct gl_material {
597 GLfloat Ambient[4];
598 GLfloat Diffuse[4];
599 GLfloat Specular[4];
600 GLfloat Emission[4];
601 GLfloat Shininess;
602 GLfloat AmbientIndex; /* for color index lighting */
603 GLfloat DiffuseIndex; /* for color index lighting */
604 GLfloat SpecularIndex; /* for color index lighting */
605 GLfloat ShineTable[SHINE_TABLE_SIZE]; /* to replace a pow() call */
606 };
607
608
609
610 /*
611 * Attribute structures:
612 * We define a struct for each attribute group to make pushing and
613 * popping attributes easy. Also it's a good organization.
614 */
615
616
617 struct gl_accum_attrib {
618 GLfloat ClearColor[4]; /* Accumulation buffer clear color */
619 };
620
621
622 struct gl_colorbuffer_attrib {
623 GLuint ClearIndex; /* Index to use for glClear */
624 GLfloat ClearColor[4]; /* Color to use for glClear */
625
626 GLuint IndexMask; /* Color index write mask */
627 GLuint ColorMask; /* bit 3=red,2=green,1=blue,0=alpha*/
628 GLboolean SWmasking; /* Do color/CI masking in software? */
629
630 GLenum DrawBuffer; /* Which buffer to draw into */
631
632 /* alpha testing */
633 GLboolean AlphaEnabled; /* Alpha test enabled flag */
634 GLenum AlphaFunc; /* Alpha test function */
635 GLfloat AlphaRef; /* Alpha reference value */
636 GLubyte AlphaRefUbyte; /* AlphaRef scaled to an integer */
637
638 /* blending */
639 GLboolean BlendEnabled; /* Blending enabled flag */
640 GLenum BlendSrc; /* Blending source operator */
641 GLenum BlendDst; /* Blending destination operator */
642
643 /* logic op */
644 GLenum LogicOp; /* Logic operator */
645 GLboolean IndexLogicOpEnabled; /* Color index logic op enabled flag */
646 GLboolean ColorLogicOpEnabled; /* RGBA logic op enabled flag */
647 GLboolean SWLogicOpEnabled; /* Do logic ops in software? */
648
649 GLboolean DitherFlag; /* Dither enable flag */
650 };
651
652
653 struct gl_current_attrib {
654 GLubyte ByteColor[4]; /* Current RGBA color */
655 GLuint Index; /* Current color index */
656 GLfloat Normal[3]; /* Current normal vector */
657 GLfloat TexCoord[4]; /* Current texture coordinate */
658 GLfloat RasterPos[4]; /* Current raster position */
659 GLfloat RasterDistance; /* Current raster distance */
660 GLfloat RasterColor[4]; /* Current raster color */
661 GLuint RasterIndex; /* Current raster index */
662 GLfloat RasterTexCoord[4]; /* Current raster texture coord */
663 GLboolean RasterPosValid; /* Raster position valid flag */
664 GLboolean EdgeFlag; /* Current edge flag */
665 };
666
667
668 struct gl_depthbuffer_attrib {
669 GLenum Func; /* Function for depth buffer compare */
670 GLfloat Clear; /* Value to clear depth buffer to */
671 GLboolean Test; /* Depth buffering enabled flag */
672 GLboolean Mask; /* Depth buffer writable? */
673 };
674
675
676 struct gl_enable_attrib {
677 GLboolean AlphaTest;
678 GLboolean AutoNormal;
679 GLboolean Blend;
680 GLboolean ClipPlane[MAX_CLIP_PLANES];
681 GLboolean ColorMaterial;
682 GLboolean CullFace;
683 GLboolean DepthTest;
684 GLboolean Dither;
685 GLboolean Fog;
686 GLboolean Light[MAX_LIGHTS];
687 GLboolean Lighting;
688 GLboolean LineSmooth;
689 GLboolean LineStipple;
690 GLboolean IndexLogicOp;
691 GLboolean ColorLogicOp;
692 GLboolean Map1Color4;
693 GLboolean Map1Index;
694 GLboolean Map1Normal;
695 GLboolean Map1TextureCoord1;
696 GLboolean Map1TextureCoord2;
697 GLboolean Map1TextureCoord3;
698 GLboolean Map1TextureCoord4;
699 GLboolean Map1Vertex3;
700 GLboolean Map1Vertex4;
701 GLboolean Map2Color4;
702 GLboolean Map2Index;
703 GLboolean Map2Normal;
704 GLboolean Map2TextureCoord1;
705 GLboolean Map2TextureCoord2;
706 GLboolean Map2TextureCoord3;
707 GLboolean Map2TextureCoord4;
708 GLboolean Map2Vertex3;
709 GLboolean Map2Vertex4;
710 GLboolean Normalize;
711 GLboolean PointSmooth;
712 GLboolean PolygonOffsetPoint;
713 GLboolean PolygonOffsetLine;
714 GLboolean PolygonOffsetFill;
715 GLboolean PolygonSmooth;
716 GLboolean PolygonStipple;
717 GLboolean Scissor;
718 GLboolean Stencil;
719 GLuint Texture;
720 GLuint TexGen;
721 };
722
723
724 struct gl_eval_attrib {
725 /* Enable bits */
726 GLboolean Map1Color4;
727 GLboolean Map1Index;
728 GLboolean Map1Normal;
729 GLboolean Map1TextureCoord1;
730 GLboolean Map1TextureCoord2;
731 GLboolean Map1TextureCoord3;
732 GLboolean Map1TextureCoord4;
733 GLboolean Map1Vertex3;
734 GLboolean Map1Vertex4;
735 GLboolean Map2Color4;
736 GLboolean Map2Index;
737 GLboolean Map2Normal;
738 GLboolean Map2TextureCoord1;
739 GLboolean Map2TextureCoord2;
740 GLboolean Map2TextureCoord3;
741 GLboolean Map2TextureCoord4;
742 GLboolean Map2Vertex3;
743 GLboolean Map2Vertex4;
744 GLboolean AutoNormal;
745 /* Map Grid endpoints and divisions */
746 GLuint MapGrid1un;
747 GLfloat MapGrid1u1, MapGrid1u2;
748 GLuint MapGrid2un, MapGrid2vn;
749 GLfloat MapGrid2u1, MapGrid2u2;
750 GLfloat MapGrid2v1, MapGrid2v2;
751 };
752
753
754 struct gl_fog_attrib {
755 GLboolean Enabled; /* Fog enabled flag */
756 GLfloat Color[4]; /* Fog color */
757 GLfloat Density; /* Density >= 0.0 */
758 GLfloat Start; /* Start distance in eye coords */
759 GLfloat End; /* End distance in eye coords */
760 GLfloat Index; /* Fog index */
761 GLenum Mode; /* Fog mode */
762 };
763
764
765 struct gl_hint_attrib {
766 /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */
767 GLenum PerspectiveCorrection;
768 GLenum PointSmooth;
769 GLenum LineSmooth;
770 GLenum PolygonSmooth;
771 GLenum Fog;
772 };
773
774
775 struct gl_light_attrib {
776 struct gl_light Light[MAX_LIGHTS]; /* Array of lights */
777 struct gl_lightmodel Model; /* Lighting model */
778 struct gl_material Material[2]; /* Material 0=front, 1=back */
779 GLboolean Enabled; /* Lighting enabled flag */
780 GLenum ShadeModel; /* GL_FLAT or GL_SMOOTH */
781 GLenum ColorMaterialFace; /* GL_FRONT, BACK or FRONT_AND_BACK */
782 GLenum ColorMaterialMode; /* GL_AMBIENT, GL_DIFFUSE, etc */
783 GLuint ColorMaterialBitmask; /* bitmask formed from Face and Mode */
784 GLboolean ColorMaterialEnabled;
785
786 /* Derived for optimizations: */
787 struct gl_light *FirstEnabled; /* Ptr to 1st enabled light */
788 GLboolean Fast; /* Use fast shader? */
789 GLfloat BaseColor[2][4];
790 };
791
792
793 struct gl_line_attrib {
794 GLboolean SmoothFlag; /* GL_LINE_SMOOTH enabled? */
795 GLboolean StippleFlag; /* GL_LINE_STIPPLE enabled? */
796 GLushort StipplePattern; /* Stipple pattern */
797 GLint StippleFactor; /* Stipple repeat factor */
798 GLfloat Width; /* Line width */
799 };
800
801
802 struct gl_list_attrib {
803 GLuint ListBase;
804 };
805
806
807 struct gl_pixel_attrib {
808 GLenum ReadBuffer;
809 GLfloat RedBias, RedScale; /* Pixel xfer bias & scale values */
810 GLfloat GreenBias, GreenScale;
811 GLfloat BlueBias, BlueScale;
812 GLfloat AlphaBias, AlphaScale;
813 GLfloat DepthBias, DepthScale;
814 GLint IndexShift;
815 GLint IndexOffset;
816 GLboolean MapColorFlag;
817 GLboolean MapStencilFlag;
818 GLfloat ZoomX; /* Pixel zoom X factor */
819 GLfloat ZoomY; /* Pixel zoom Y factor */
820 /* TODO: Do the following belong here??? */
821 GLint MapStoSsize; /* Size of each pixel map */
822 GLint MapItoIsize;
823 GLint MapItoRsize;
824 GLint MapItoGsize;
825 GLint MapItoBsize;
826 GLint MapItoAsize;
827 GLint MapRtoRsize;
828 GLint MapGtoGsize;
829 GLint MapBtoBsize;
830 GLint MapAtoAsize;
831 GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /* Pixel map tables */
832 GLint MapItoI[MAX_PIXEL_MAP_TABLE];
833 GLfloat MapItoR[MAX_PIXEL_MAP_TABLE];
834 GLfloat MapItoG[MAX_PIXEL_MAP_TABLE];
835 GLfloat MapItoB[MAX_PIXEL_MAP_TABLE];
836 GLfloat MapItoA[MAX_PIXEL_MAP_TABLE];
837 GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE];
838 GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE];
839 GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE];
840 GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE];
841 };
842
843
844 struct gl_point_attrib {
845 GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */
846 GLfloat Size; /* Point size */
847 };
848
849
850 struct gl_polygon_attrib {
851 GLenum FrontFace; /* Either GL_CW or GL_CCW */
852 GLenum FrontMode; /* Either GL_POINT, GL_LINE or GL_FILL */
853 GLenum BackMode; /* Either GL_POINT, GL_LINE or GL_FILL */
854 GLboolean Unfilled; /* True if back or front mode is not GL_FILL */
855 GLboolean CullFlag; /* Culling on/off flag */
856 GLenum CullFaceMode; /* Culling mode GL_FRONT or GL_BACK */
857 GLuint CullBits; /* Used for cull testing */
858 GLboolean SmoothFlag; /* True if GL_POLYGON_SMOOTH is enabled */
859 GLboolean StippleFlag; /* True if GL_POLYGON_STIPPLE is enabled */
860 GLfloat OffsetFactor; /* Polygon offset factor */
861 GLfloat OffsetUnits; /* Polygon offset units */
862 GLboolean OffsetPoint; /* Offset in GL_POINT mode? */
863 GLboolean OffsetLine; /* Offset in GL_LINE mode? */
864 GLboolean OffsetFill; /* Offset in GL_FILL mode? */
865 GLboolean OffsetAny; /* OR of OffsetPoint, OffsetLine, OffsetFill */
866 };
867
868
869 struct gl_scissor_attrib {
870 GLboolean Enabled; /* Scissor test enabled? */
871 GLint X, Y; /* Lower left corner of box */
872 GLsizei Width, Height; /* Size of box */
873 };
874
875
876 struct gl_stencil_attrib {
877 GLboolean Enabled; /* Enabled flag */
878 GLenum Function; /* Stencil function */
879 GLenum FailFunc; /* Fail function */
880 GLenum ZPassFunc; /* Depth buffer pass function */
881 GLenum ZFailFunc; /* Depth buffer fail function */
882 GLstencil Ref; /* Reference value */
883 GLstencil ValueMask; /* Value mask */
884 GLstencil Clear; /* Clear value */
885 GLstencil WriteMask; /* Write mask */
886 };
887
888
889 #define Q_BIT 1
890 #define R_BIT 2
891 #define S_BIT 4
892 #define T_BIT 8
893
894 #define TEXTURE_1D 1
895 #define TEXTURE_2D 2
896
897
898 struct gl_texture_attrib {
899 GLuint Enabled; /* Bitwise-OR of TEXTURE_XD values */
900 GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND */
901 GLfloat EnvColor[4];
902 GLuint TexGenEnabled; /* Bitwise-OR of [QRST]_BIT values */
903 GLenum GenModeS; /* Tex coord generation mode, either */
904 GLenum GenModeT; /* GL_OBJECT_LINEAR, or */
905 GLenum GenModeR; /* GL_EYE_LINEAR, or */
906 GLenum GenModeQ; /* GL_SPHERE_MAP */
907 GLfloat ObjectPlaneS[4];
908 GLfloat ObjectPlaneT[4];
909 GLfloat ObjectPlaneR[4];
910 GLfloat ObjectPlaneQ[4];
911 GLfloat EyePlaneS[4];
912 GLfloat EyePlaneT[4];
913 GLfloat EyePlaneR[4];
914 GLfloat EyePlaneQ[4];
915 struct gl_texture_object *Current1D;
916 struct gl_texture_object *Current2D;
917 struct gl_texture_object *Current; /* = Current1D, 2D or NULL */
918 #ifdef GL_VERSION_1_1
919 struct gl_texture_object *Proxy1D;
920 struct gl_texture_object *Proxy2D;
921 #endif
922 GLboolean AnyDirty;
923 };
924
925
926 struct gl_transform_attrib {
927 GLenum MatrixMode; /* Matrix mode */
928 GLfloat ClipEquation[MAX_CLIP_PLANES][4];
929 GLboolean ClipEnabled[MAX_CLIP_PLANES];
930 GLboolean AnyClip; /* Any ClipEnabled[] true? */
931 GLboolean Normalize; /* Normalize all normals? */
932 };
933
934
935 struct gl_viewport_attrib {
936 GLint X, Y; /* position */
937 GLsizei Width, Height; /* size */
938 GLfloat Near, Far; /* Depth buffer range */
939 GLfloat Sx, Sy, Sz; /* NDC to WinCoord scaling */
940 GLfloat Tx, Ty, Tz; /* NDC to WinCoord translation */
941 };
942
943
944 /* For the attribute stack: */
945 struct gl_attrib_node {
946 GLbitfield kind;
947 void *data;
948 struct gl_attrib_node *next;
949 };
950
951
952
953 /*
954 * Client pixel packing/unpacking attributes
955 */
956 struct gl_pixelstore_attrib {
957 GLint Alignment;
958 GLint RowLength;
959 GLint SkipPixels;
960 GLint SkipRows;
961 GLboolean SwapBytes;
962 GLboolean LsbFirst;
963 };
964
965
966 /*
967 * Client vertex array attributes
968 */
969 struct gl_array_attrib {
970 GLint VertexSize;
971 GLenum VertexType;
972 GLsizei VertexStride; /* user-specified stride */
973 GLsizei VertexStrideB; /* actual stride in bytes */
974 void *VertexPtr;
975 GLboolean VertexEnabled;
976
977 GLenum NormalType;
978 GLsizei NormalStride; /* user-specified stride */
979 GLsizei NormalStrideB; /* actual stride in bytes */
980 void *NormalPtr;
981 GLboolean NormalEnabled;
982
983 GLint ColorSize;
984 GLenum ColorType;
985 GLsizei ColorStride; /* user-specified stride */
986 GLsizei ColorStrideB; /* actual stride in bytes */
987 void *ColorPtr;
988 GLboolean ColorEnabled;
989
990 GLenum IndexType;
991 GLsizei IndexStride; /* user-specified stride */
992 GLsizei IndexStrideB; /* actual stride in bytes */
993 void *IndexPtr;
994 GLboolean IndexEnabled;
995
996 GLint TexCoordSize;
997 GLenum TexCoordType;
998 GLsizei TexCoordStride; /* user-specified stride */
999 GLsizei TexCoordStrideB; /* actual stride in bytes */
1000 void *TexCoordPtr;
1001 GLboolean TexCoordEnabled;
1002
1003 GLsizei EdgeFlagStride; /* user-specified stride */
1004 GLsizei EdgeFlagStrideB; /* actual stride in bytes */
1005 GLboolean *EdgeFlagPtr;
1006 GLboolean EdgeFlagEnabled;
1007 };
1008
1009
1010
1011 struct gl_feedback {
1012 GLenum Type;
1013 GLuint Mask;
1014 GLfloat *Buffer;
1015 GLuint BufferSize;
1016 GLuint Count;
1017 };
1018
1019
1020
1021 struct gl_selection {
1022 GLuint *Buffer;
1023 GLuint BufferSize; /* size of SelectBuffer */
1024 GLuint BufferCount; /* number of values in SelectBuffer */
1025 GLuint Hits; /* number of records in SelectBuffer */
1026 GLuint NameStackDepth;
1027 GLuint NameStack[MAX_NAME_STACK_DEPTH];
1028 GLboolean HitFlag;
1029 GLfloat HitMinZ, HitMaxZ;
1030 };
1031
1032
1033
1034 /*
1035 * 1-D Evaluator control points
1036 */
1037 struct gl_1d_map {
1038 GLuint Order; /* Number of control points */
1039 GLfloat u1, u2;
1040 GLfloat *Points; /* Points to contiguous control points */
1041 GLboolean Retain; /* Reference counter */
1042 };
1043
1044
1045 /*
1046 * 2-D Evaluator control points
1047 */
1048 struct gl_2d_map {
1049 GLuint Uorder; /* Number of control points in U dimension */
1050 GLuint Vorder; /* Number of control points in V dimension */
1051 GLfloat u1, u2;
1052 GLfloat v1, v2;
1053 GLfloat *Points; /* Points to contiguous control points */
1054 GLboolean Retain; /* Reference counter */
1055 };
1056
1057
1058 /*
1059 * All evalutator control points
1060 */
1061 struct gl_evaluators {
1062 /* 1-D maps */
1063 struct gl_1d_map Map1Vertex3;
1064 struct gl_1d_map Map1Vertex4;
1065 struct gl_1d_map Map1Index;
1066 struct gl_1d_map Map1Color4;
1067 struct gl_1d_map Map1Normal;
1068 struct gl_1d_map Map1Texture1;
1069 struct gl_1d_map Map1Texture2;
1070 struct gl_1d_map Map1Texture3;
1071 struct gl_1d_map Map1Texture4;
1072
1073 /* 2-D maps */
1074 struct gl_2d_map Map2Vertex3;
1075 struct gl_2d_map Map2Vertex4;
1076 struct gl_2d_map Map2Index;
1077 struct gl_2d_map Map2Color4;
1078 struct gl_2d_map Map2Normal;
1079 struct gl_2d_map Map2Texture1;
1080 struct gl_2d_map Map2Texture2;
1081 struct gl_2d_map Map2Texture3;
1082 struct gl_2d_map Map2Texture4;
1083 };
1084
1085
1086
1087 /* Texture object record */
1088 struct gl_texture_object {
1089 GLint RefCount; /* reference count */
1090 GLuint Name; /* an unsigned integer */
1091 GLuint Dimensions; /* 1 or 2 or 3 */
1092 GLfloat Priority; /* in [0,1] */
1093 GLint BorderColor[4]; /* as integers in [0,255] */
1094 GLenum WrapS; /* GL_CLAMP or GL_REPEAT */
1095 GLenum WrapT; /* GL_CLAMP or GL_REPEAT */
1096 GLenum WrapR; /* GL_CLAMP or GL_REPEAT */
1097 GLenum MinFilter; /* minification filter */
1098 GLenum MagFilter; /* magnification filter */
1099 GLfloat MinMagThresh; /* min/mag threshold */
1100 struct gl_texture_image *Image[MAX_TEXTURE_LEVELS];
1101
1102 /* GL_EXT_paletted_texture */
1103 GLubyte Palette[MAX_TEXTURE_PALETTE_SIZE*4];
1104 GLuint PaletteSize;
1105 GLenum PaletteIntFormat;
1106 GLenum PaletteFormat;
1107
1108 /* For device driver: */
1109 GLboolean Dirty; /* Set when any texobj state changes */
1110 void *DriverData; /* Arbitrary device driver data */
1111
1112 GLboolean Complete; /* Complete set of images? */
1113 TextureSampleFunc SampleFunc;
1114 struct gl_texture_object *Next; /* Next in linked list */
1115 };
1116
1117
1118
1119 /*
1120 * State which can be shared by multiple contexts:
1121 */
1122 struct gl_shared_state {
1123 GLint RefCount; /* Reference count */
1124 struct HashTable *DisplayList; /* Display lists hash table */
1125 struct HashTable *TexObjects; /* Texture objects hash table */
1126 struct gl_texture_object *TexObjectList;/* Linked list of texture objects */
1127 struct gl_texture_object *Default1D; /* Default texture objects */
1128 struct gl_texture_object *Default2D;
1129 };
1130
1131
1132
1133 /*
1134 * Describes the color, depth, stencil and accum buffer parameters.
1135 */
1136 struct gl_visual {
1137 GLboolean RGBAflag; /* Is frame buffer in RGBA mode, not CI? */
1138 GLboolean DBflag; /* Is color buffer double buffered? */
1139
1140 GLfloat RedScale; /* These values are used to scale color */
1141 GLfloat GreenScale; /* components from the range [0,1] to */
1142 GLfloat BlueScale; /* integer values. It should be the case */
1143 GLfloat AlphaScale; /* that scale = 2^bits - 1 where bits is */
1144 /* the number of bits for the component */
1145 /* in the frame buffer. */
1146 GLboolean EightBitColor;/* TRUE if all the above scales are 255.0 */
1147
1148 GLfloat InvRedScale; /* = 1 / RedScale */
1149 GLfloat InvGreenScale; /* = 1 / GreenScale */
1150 GLfloat InvBlueScale; /* = 1 / BlueScale */
1151 GLfloat InvAlphaScale; /* = 1 / AlphaScale */
1152
1153 GLint RedBits; /* Bits per color component */
1154 GLint GreenBits;
1155 GLint BlueBits;
1156 GLint AlphaBits;
1157
1158 GLint IndexBits; /* Bits/pixel if in color index mode */
1159
1160 GLint AccumBits; /* Number of bits per color channel, or 0 */
1161 GLint DepthBits; /* Number of bits in depth buffer, or 0 */
1162 GLint StencilBits; /* Number of bits in stencil buffer, or 0 */
1163
1164 /* Software alpha planes: */
1165 GLboolean FrontAlphaEnabled;
1166 GLboolean BackAlphaEnabled;
1167 };
1168
1169
1170
1171 /*
1172 * A "frame buffer" is a color buffer and its optional ancillary buffers:
1173 * depth, accum, stencil, and software-simulated alpha buffers.
1174 */
1175 struct gl_frame_buffer {
1176 GLvisual *Visual; /* The corresponding visual */
1177
1178 GLint Width; /* Width of frame buffer in pixels */
1179 GLint Height; /* Height of frame buffer in pixels */
1180
1181 GLdepth *Depth; /* array [Width*Height] of GLdepth values */
1182
1183 /* Stencil buffer */
1184 GLstencil *Stencil; /* array [Width*Height] of GLstencil values */
1185
1186 /* Accumulation buffer */
1187 GLaccum *Accum; /* array [4*Width*Height] of GLaccum values */
1188
1189 /* Software alpha planes: */
1190 GLubyte *FrontAlpha; /* array [Width*Height] of GLubyte */
1191 GLubyte *BackAlpha; /* array [Width*Height] of GLubyte */
1192 GLubyte *Alpha; /* Points to front or back alpha buffer */
1193
1194 /* Drawing bounds: intersection of window size and scissor box */
1195 GLint Xmin, Xmax, Ymin, Ymax;
1196 };
1197
1198
1199
1200 /*
1201 * Bitmasks to indicate what auxillary information must be interpolated
1202 * when clipping (ClipMask).
1203 */
1204 #define CLIP_FCOLOR_BIT 0x01
1205 #define CLIP_BCOLOR_BIT 0x02
1206 #define CLIP_FINDEX_BIT 0x04
1207 #define CLIP_BINDEX_BIT 0x08
1208 #define CLIP_TEXTURE_BIT 0x10
1209
1210
1211
1212 /*
1213 * Bitmasks to indicate which rasterization options are enabled (RasterMask)
1214 */
1215 #define ALPHATEST_BIT 0x001 /* Alpha-test pixels */
1216 #define BLEND_BIT 0x002 /* Blend pixels */
1217 #define DEPTH_BIT 0x004 /* Depth-test pixels */
1218 #define FOG_BIT 0x008 /* Per-pixel fog */
1219 #define LOGIC_OP_BIT 0x010 /* Apply logic op in software */
1220 #define SCISSOR_BIT 0x020 /* Scissor pixels */
1221 #define STENCIL_BIT 0x040 /* Stencil pixels */
1222 #define MASKING_BIT 0x080 /* Do glColorMask() or glIndexMask() */
1223 #define ALPHABUF_BIT 0x100 /* Using software alpha buffer */
1224 #define WINCLIP_BIT 0x200 /* Clip pixels/primitives to window */
1225 #define FRONT_AND_BACK_BIT 0x400 /* Write to front and back buffers */
1226 #define NO_DRAW_BIT 0x800 /* Don't write any pixels */
1227
1228
1229 /*
1230 * Bits to indicate what state has to be updated (NewState)
1231 */
1232 #define NEW_LIGHTING 0x1
1233 #define NEW_RASTER_OPS 0x2
1234 #define NEW_TEXTURING 0x4
1235 #define NEW_POLYGON 0x8
1236 #define NEW_ALL 0xf
1237
1238
1239 /*
1240 * Different kinds of 4x4 transformation matrices:
1241 */
1242 #define MATRIX_GENERAL 0 /* general 4x4 matrix */
1243 #define MATRIX_IDENTITY 1 /* identity matrix */
1244 #define MATRIX_ORTHO 2 /* orthographic projection matrix */
1245 #define MATRIX_PERSPECTIVE 3 /* perspective projection matrix */
1246 #define MATRIX_2D 4 /* 2-D transformation */
1247 #define MATRIX_2D_NO_ROT 5 /* 2-D scale & translate only */
1248 #define MATRIX_3D 6 /* 3-D transformation */
1249
1250
1251 /*
1252 * Forward declaration of display list datatypes:
1253 */
1254 union node;
1255 typedef union node Node;
1256
1257
1258
1259 /*
1260 * The library context:
1261 */
1262
1263 struct gl_context {
1264 /* State possibly shared with other contexts in the address space */
1265 struct gl_shared_state *Shared;
1266
1267 /* API function pointer tables */
1268 struct gl_api_table API; /* For api.c */
1269 struct gl_api_table Save; /* Display list save funcs */
1270 struct gl_api_table Exec; /* Execute funcs */
1271
1272 GLvisual *Visual;
1273 GLframebuffer *Buffer;
1274
1275 /* Driver function pointer table */
1276 struct dd_function_table Driver;
1277
1278 void *DriverCtx; /* Points to device driver context/state */
1279 void *DriverMgrCtx; /* Points to device driver manager (optional)*/
1280
1281 /* Modelview matrix and stack */
1282 GLboolean NewModelViewMatrix;
1283 GLuint ModelViewMatrixType; /* = one of MATRIX_* values */
1284 GLfloat ModelViewMatrix[16];
1285 GLfloat ModelViewInv[16]; /* Inverse of ModelViewMatrix */
1286 GLuint ModelViewStackDepth;
1287 GLfloat ModelViewStack[MAX_MODELVIEW_STACK_DEPTH][16];
1288
1289 /* Projection matrix and stack */
1290 GLboolean NewProjectionMatrix;
1291 GLuint ProjectionMatrixType; /* = one of MATRIX_* values */
1292 GLfloat ProjectionMatrix[16];
1293 GLuint ProjectionStackDepth;
1294 GLfloat ProjectionStack[MAX_PROJECTION_STACK_DEPTH][16];
1295 GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH][2];
1296
1297 /* Texture matrix and stack */
1298 GLboolean NewTextureMatrix;
1299 GLuint TextureMatrixType; /* = one of MATRIX_* values */
1300 GLfloat TextureMatrix[16];
1301 GLuint TextureStackDepth;
1302 GLfloat TextureStack[MAX_TEXTURE_STACK_DEPTH][16];
1303
1304 /* Display lists */
1305 GLuint CallDepth; /* Current recursion calling depth */
1306 GLboolean ExecuteFlag; /* Execute GL commands? */
1307 GLboolean CompileFlag; /* Compile GL commands into display list? */
1308 Node *CurrentListPtr; /* Head of list being compiled */
1309 GLuint CurrentListNum; /* Number of the list being compiled */
1310 Node *CurrentBlock; /* Pointer to current block of nodes */
1311 GLuint CurrentPos; /* Index into current block of nodes */
1312
1313 /* Renderer attribute stack */
1314 GLuint AttribStackDepth;
1315 struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH];
1316
1317 /* Renderer attribute groups */
1318 struct gl_accum_attrib Accum;
1319 struct gl_colorbuffer_attrib Color;
1320 struct gl_current_attrib Current;
1321 struct gl_depthbuffer_attrib Depth;
1322 struct gl_eval_attrib Eval;
1323 struct gl_fog_attrib Fog;
1324 struct gl_hint_attrib Hint;
1325 struct gl_light_attrib Light;
1326 struct gl_line_attrib Line;
1327 struct gl_list_attrib List;
1328 struct gl_pixel_attrib Pixel;
1329 struct gl_point_attrib Point;
1330 struct gl_polygon_attrib Polygon;
1331 GLuint PolygonStipple[32];
1332 struct gl_scissor_attrib Scissor;
1333 struct gl_stencil_attrib Stencil;
1334 struct gl_texture_attrib Texture;
1335 struct gl_transform_attrib Transform;
1336 struct gl_viewport_attrib Viewport;
1337
1338 /* Client attribute stack */
1339 GLuint ClientAttribStackDepth;
1340 struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH];
1341 /* Client attribute groups */
1342 struct gl_array_attrib Array; /* Vertex arrays */
1343 struct gl_pixelstore_attrib Pack; /* Pixel packing */
1344 struct gl_pixelstore_attrib Unpack; /* Pixel unpacking */
1345
1346 struct gl_evaluators EvalMap; /* All evaluators */
1347 struct gl_feedback Feedback; /* Feedback */
1348 struct gl_selection Select; /* Selection */
1349
1350 GLenum ErrorValue; /* Last error code */
1351
1352 GLboolean DirectContext; /* Important for real GLX */
1353
1354 /* Miscellaneous */
1355 GLuint NewState; /* bitwise OR of NEW_* flags */
1356 GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
1357 GLenum Primitive; /* glBegin primitive or GL_BITMAP */
1358 GLuint StippleCounter; /* Line stipple counter */
1359 GLuint ClipMask; /* OR of CLIP_* values from above */
1360 interp_func ClipInterpAuxFunc; /* The auxiliary interpolation function */
1361 GLuint RasterMask; /* OR of rasterization flags */
1362 GLboolean LightTwoSide; /* Compute two-sided lighting? */
1363 GLboolean DirectTriangles;/* Directly call (*ctx->TriangleFunc) ? */
1364 GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */
1365 GLfloat LineZoffset; /* Z offset for GL_LINE polygons */
1366 GLfloat PointZoffset; /* Z offset for GL_POINT polygons */
1367 GLboolean NeedNormals; /* Are vertex normal vectors needed? */
1368 GLboolean FastDrawPixels;/* Use optimized glDrawPixels? */
1369 GLboolean MutablePixels; /* Can rasterization change pixel's color? */
1370 GLboolean MonoPixels; /* Are all pixels likely to be same color? */
1371
1372 /* Current Primitive functions */
1373 points_func PointsFunc;
1374 line_func LineFunc;
1375 triangle_func TriangleFunc;
1376 quad_func QuadFunc;
1377 rect_func RectFunc;
1378
1379 /* The vertex buffer being used by this context */
1380 struct vertex_buffer* VB;
1381
1382 /* The pixel buffer being used by this context */
1383 struct pixel_buffer* PB;
1384
1385 #ifdef PROFILE
1386 /* Performance measurements */
1387 GLuint BeginEndCount; /* number of glBegin/glEnd pairs */
1388 GLdouble BeginEndTime; /* seconds spent between glBegin/glEnd */
1389 GLuint VertexCount; /* number of vertices processed */
1390 GLdouble VertexTime; /* total time in seconds */
1391 GLuint PointCount; /* number of points rendered */
1392 GLdouble PointTime; /* total time in seconds */
1393 GLuint LineCount; /* number of lines rendered */
1394 GLdouble LineTime; /* total time in seconds */
1395 GLuint PolygonCount; /* number of polygons rendered */
1396 GLdouble PolygonTime; /* total time in seconds */
1397 GLuint ClearCount; /* number of glClear calls */
1398 GLdouble ClearTime; /* seconds spent in glClear */
1399 GLuint SwapCount; /* number of swap-buffer calls */
1400 GLdouble SwapTime; /* seconds spent in swap-buffers */
1401 #endif
1402
1403 /* For debugging/development only */
1404 GLboolean NoRaster;
1405
1406 /* Dither disable via MESA_NO_DITHER env var */
1407 GLboolean NoDither;
1408 };
1409
1410
1411 #endif