1 /* $Id: mtypes.h,v 1.103 2003/02/16 23:07:34 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
29 * \brief Main Mesa data structures.
37 #include "config.h" /* Hardwired parameters */
38 #include "glapitable.h"
41 #include "math/m_matrix.h" /* GLmatrix */
43 #if defined(MESA_TRACE)
44 #include "Trace/tr_context.h"
48 /* Please try to mark derived values with a leading underscore ('_').
52 * Color channel data type:
55 typedef GLubyte GLchan
;
57 #define CHAN_MAXF 255.0F
58 #define CHAN_TYPE GL_UNSIGNED_BYTE
60 typedef GLushort GLchan
;
61 #define CHAN_MAX 65535
62 #define CHAN_MAXF 65535.0F
63 #define CHAN_TYPE GL_UNSIGNED_SHORT
65 typedef GLfloat GLchan
;
67 #define CHAN_MAXF 1.0F
68 #define CHAN_TYPE GL_FLOAT
70 #error "illegal number of color channel bits"
75 * Accumulation buffer data type:
78 typedef GLbyte GLaccum
;
80 typedef GLshort GLaccum
;
82 typedef GLfloat GLaccum
;
84 # error "illegal number of accumulation bits"
89 * Stencil buffer data type:
92 typedef GLubyte GLstencil
;
93 # define STENCIL_MAX 0xff
94 #elif STENCIL_BITS==16
95 typedef GLushort GLstencil
;
96 # define STENCIL_MAX 0xffff
98 # error "illegal number of stencil bits"
103 * Depth buffer data type:
105 typedef GLuint GLdepth
; /* Must be 32-bits! */
109 * Fixed point data type:
116 * Some forward type declarations
118 struct _mesa_HashTable
;
119 struct gl_texture_image
;
120 struct gl_texture_object
;
121 typedef struct __GLcontextRec GLcontext
;
122 typedef struct __GLcontextModesRec GLvisual
;
123 typedef struct gl_frame_buffer GLframebuffer
;
127 /* These define the aliases between numbered vertex attributes and
128 * conventional OpenGL vertex attributes. We use these values in
129 * quite a few places. New in Mesa 4.1.
131 #define VERT_ATTRIB_POS 0
132 #define VERT_ATTRIB_WEIGHT 1
133 #define VERT_ATTRIB_NORMAL 2
134 #define VERT_ATTRIB_COLOR0 3
135 #define VERT_ATTRIB_COLOR1 4
136 #define VERT_ATTRIB_FOG 5
137 #define VERT_ATTRIB_SIX 6
138 #define VERT_ATTRIB_SEVEN 7
139 #define VERT_ATTRIB_TEX0 8
140 #define VERT_ATTRIB_TEX1 9
141 #define VERT_ATTRIB_TEX2 10
142 #define VERT_ATTRIB_TEX3 11
143 #define VERT_ATTRIB_TEX4 12
144 #define VERT_ATTRIB_TEX5 13
145 #define VERT_ATTRIB_TEX6 14
146 #define VERT_ATTRIB_TEX7 15
147 #define VERT_ATTRIB_MAX 16
149 /* These are used in bitfields in many places */
150 #define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
151 #define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
152 #define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
153 #define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
154 #define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
155 #define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
156 #define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX)
157 #define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
158 #define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
159 #define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
160 #define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
161 #define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
162 #define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
163 #define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
164 #define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
165 #define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
167 #define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
172 * Maximum number of temporary vertices required for clipping. (Used
173 * in array_cache and tnl modules).
175 #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
178 /* Data structure for color tables */
179 struct gl_color_table
{
180 GLenum Format
; /* GL_ALPHA, GL_RGB, GL_RGB, etc */
182 GLuint Size
; /* number of entries (rows) in table */
183 GLvoid
*Table
; /* either GLfloat * or GLchan * */
184 GLboolean FloatTable
; /* are entries stored as floats? */
189 GLubyte LuminanceSize
;
190 GLubyte IntensitySize
;
195 * Bit flags used for updating material values.
197 #define FRONT_AMBIENT_BIT 0x1
198 #define BACK_AMBIENT_BIT 0x2
199 #define FRONT_DIFFUSE_BIT 0x4
200 #define BACK_DIFFUSE_BIT 0x8
201 #define FRONT_SPECULAR_BIT 0x10
202 #define BACK_SPECULAR_BIT 0x20
203 #define FRONT_EMISSION_BIT 0x40
204 #define BACK_EMISSION_BIT 0x80
205 #define FRONT_SHININESS_BIT 0x100
206 #define BACK_SHININESS_BIT 0x200
207 #define FRONT_INDEXES_BIT 0x400
208 #define BACK_INDEXES_BIT 0x800
210 #define FRONT_MATERIAL_BITS (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT | \
211 FRONT_DIFFUSE_BIT | FRONT_SPECULAR_BIT | \
212 FRONT_SHININESS_BIT | FRONT_INDEXES_BIT)
214 #define BACK_MATERIAL_BITS (BACK_EMISSION_BIT | BACK_AMBIENT_BIT | \
215 BACK_DIFFUSE_BIT | BACK_SPECULAR_BIT | \
216 BACK_SHININESS_BIT | BACK_INDEXES_BIT)
218 #define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
223 * Specular exponent and material shininess lookup table sizes:
225 #define EXP_TABLE_SIZE 512
226 #define SHINE_TABLE_SIZE 256
228 struct gl_shine_tab
{
229 struct gl_shine_tab
*next
, *prev
;
230 GLfloat tab
[SHINE_TABLE_SIZE
+1];
237 struct gl_light
*next
; /* double linked list with sentinel */
238 struct gl_light
*prev
;
240 GLfloat Ambient
[4]; /* ambient color */
241 GLfloat Diffuse
[4]; /* diffuse color */
242 GLfloat Specular
[4]; /* specular color */
243 GLfloat EyePosition
[4]; /* position in eye coordinates */
244 GLfloat EyeDirection
[4]; /* spotlight dir in eye coordinates */
245 GLfloat SpotExponent
;
246 GLfloat SpotCutoff
; /* in degress */
247 GLfloat _CosCutoff
; /* = MAX(0, cos(SpotCutoff)) */
248 GLfloat ConstantAttenuation
;
249 GLfloat LinearAttenuation
;
250 GLfloat QuadraticAttenuation
;
251 GLboolean Enabled
; /* On/off flag */
254 GLuint _Flags
; /* State */
256 GLfloat _Position
[4]; /* position in eye/obj coordinates */
257 GLfloat _VP_inf_norm
[3]; /* Norm direction to infinite light */
258 GLfloat _h_inf_norm
[3]; /* Norm( _VP_inf_norm + <0,0,1> ) */
259 GLfloat _NormDirection
[4]; /* normalized spotlight direction */
260 GLfloat _VP_inf_spot_attenuation
;
262 GLfloat _SpotExpTable
[EXP_TABLE_SIZE
][2]; /* to replace a pow() call */
263 GLfloat _MatAmbient
[2][3]; /* material ambient * light ambient */
264 GLfloat _MatDiffuse
[2][3]; /* material diffuse * light diffuse */
265 GLfloat _MatSpecular
[2][3]; /* material spec * light specular */
266 GLfloat _dli
; /* CI diffuse light intensity */
267 GLfloat _sli
; /* CI specular light intensity */
271 struct gl_lightmodel
{
272 GLfloat Ambient
[4]; /* ambient color */
273 GLboolean LocalViewer
; /* Local (or infinite) view point? */
274 GLboolean TwoSide
; /* Two (or one) sided lighting? */
275 GLenum ColorControl
; /* either GL_SINGLE_COLOR */
276 /* or GL_SEPARATE_SPECULAR_COLOR */
287 GLfloat AmbientIndex
; /* for color index lighting */
288 GLfloat DiffuseIndex
; /* for color index lighting */
289 GLfloat SpecularIndex
; /* for color index lighting */
294 * Attribute structures:
295 * We define a struct for each attribute group to make pushing and
296 * popping attributes easy. Also it's a good organization.
298 struct gl_accum_attrib
{
299 GLfloat ClearColor
[4]; /* Accumulation buffer clear color */
304 * Used in _DrawDestMask and _ReadSrcMask below to identify color buffers.
306 #define FRONT_LEFT_BIT 0x1
307 #define FRONT_RIGHT_BIT 0x2
308 #define BACK_LEFT_BIT 0x4
309 #define BACK_RIGHT_BIT 0x8
310 #define AUX0_BIT 0x10
311 #define AUX1_BIT 0x20
312 #define AUX2_BIT 0x40
313 #define AUX3_BIT 0x80
315 struct gl_colorbuffer_attrib
{
316 GLuint ClearIndex
; /* Index to use for glClear */
317 GLclampf ClearColor
[4]; /* Color to use for glClear */
319 GLuint IndexMask
; /* Color index write mask */
320 GLubyte ColorMask
[4]; /* Each flag is 0xff or 0x0 */
322 GLenum DrawBuffer
; /* Which buffer to draw into */
323 GLubyte _DrawDestMask
; /* bitwise-OR of FRONT/BACK_LEFT/RIGHT_BITs */
326 GLboolean AlphaEnabled
; /* Alpha test enabled flag */
327 GLenum AlphaFunc
; /* Alpha test function */
331 GLboolean BlendEnabled
; /* Blending enabled flag */
332 GLenum BlendSrcRGB
; /* Blending source operator */
333 GLenum BlendDstRGB
; /* Blending destination operator */
334 GLenum BlendSrcA
; /* GL_INGR_blend_func_separate */
335 GLenum BlendDstA
; /* GL_INGR_blend_func_separate */
336 GLenum BlendEquation
;
337 GLfloat BlendColor
[4];
340 GLenum LogicOp
; /* Logic operator */
341 GLboolean IndexLogicOpEnabled
; /* Color index logic op enabled flag */
342 GLboolean ColorLogicOpEnabled
; /* RGBA logic op enabled flag */
344 GLboolean DitherFlag
; /* Dither enable flag */
348 struct gl_current_attrib
{
349 /* These values valid only when FLUSH_VERTICES has been called.
351 GLfloat Attrib
[VERT_ATTRIB_MAX
][4]; /* Current vertex attributes */
352 /* indexed by VERT_ATTRIB_* */
353 GLuint Index
; /* Current color index */
354 GLboolean EdgeFlag
; /* Current edge flag */
356 /* These values are always valid. BTW, note how similar this set of
357 * attributes is to the SWvertex datatype in the software rasterizer...
359 GLfloat RasterPos
[4]; /* Current raster position */
360 GLfloat RasterDistance
; /* Current raster distance */
361 GLfloat RasterColor
[4]; /* Current raster color */
362 GLfloat RasterSecondaryColor
[4]; /* Current rast 2ndary color */
363 GLuint RasterIndex
; /* Current raster index */
364 GLfloat RasterTexCoords
[MAX_TEXTURE_COORD_UNITS
][4];
365 GLboolean RasterPosValid
; /* Raster pos valid flag */
369 struct gl_depthbuffer_attrib
{
370 GLenum Func
; /* Function for depth buffer compare */
371 GLfloat Clear
; /* Value to clear depth buffer to */
372 GLboolean Test
; /* Depth buffering enabled flag */
373 GLboolean Mask
; /* Depth buffer writable? */
374 GLboolean OcclusionTest
; /* GL_HP_occlusion_test */
378 struct gl_enable_attrib
{
380 GLboolean AutoNormal
;
383 GLboolean ColorMaterial
;
384 GLboolean ColorTable
; /* SGI_color_table */
385 GLboolean PostColorMatrixColorTable
; /* SGI_color_table */
386 GLboolean PostConvolutionColorTable
; /* SGI_color_table */
387 GLboolean Convolution1D
;
388 GLboolean Convolution2D
;
389 GLboolean Separable2D
;
395 GLboolean Light
[MAX_LIGHTS
];
397 GLboolean LineSmooth
;
398 GLboolean LineStipple
;
399 GLboolean IndexLogicOp
;
400 GLboolean ColorLogicOp
;
401 GLboolean Map1Color4
;
403 GLboolean Map1Normal
;
404 GLboolean Map1TextureCoord1
;
405 GLboolean Map1TextureCoord2
;
406 GLboolean Map1TextureCoord3
;
407 GLboolean Map1TextureCoord4
;
408 GLboolean Map1Vertex3
;
409 GLboolean Map1Vertex4
;
410 GLboolean Map1Attrib
[16]; /* GL_NV_vertex_program */
411 GLboolean Map2Color4
;
413 GLboolean Map2Normal
;
414 GLboolean Map2TextureCoord1
;
415 GLboolean Map2TextureCoord2
;
416 GLboolean Map2TextureCoord3
;
417 GLboolean Map2TextureCoord4
;
418 GLboolean Map2Vertex3
;
419 GLboolean Map2Vertex4
;
420 GLboolean Map2Attrib
[16]; /* GL_NV_vertex_program */
423 GLboolean PixelTexture
;
424 GLboolean PointSmooth
;
425 GLboolean PolygonOffsetPoint
;
426 GLboolean PolygonOffsetLine
;
427 GLboolean PolygonOffsetFill
;
428 GLboolean PolygonSmooth
;
429 GLboolean PolygonStipple
;
430 GLboolean RescaleNormals
;
433 GLboolean MultisampleEnabled
; /* GL_ARB_multisample */
434 GLboolean SampleAlphaToCoverage
; /* GL_ARB_multisample */
435 GLboolean SampleAlphaToOne
; /* GL_ARB_multisample */
436 GLboolean SampleCoverage
; /* GL_ARB_multisample */
437 GLboolean SampleCoverageInvert
; /* GL_ARB_multisample */
438 GLboolean RasterPositionUnclipped
; /* GL_IBM_rasterpos_clip */
439 GLuint Texture
[MAX_TEXTURE_IMAGE_UNITS
];
440 GLuint TexGen
[MAX_TEXTURE_COORD_UNITS
];
441 /* SGI_texture_color_table */
442 GLboolean TextureColorTable
[MAX_TEXTURE_IMAGE_UNITS
];
443 /* GL_NV_vertex_program */
444 GLboolean VertexProgram
;
445 GLboolean VertexProgramPointSize
;
446 GLboolean VertexProgramTwoSide
;
447 /* GL_NV_point_sprite */
448 GLboolean PointSprite
;
452 struct gl_eval_attrib
{
454 GLboolean Map1Color4
;
456 GLboolean Map1Normal
;
457 GLboolean Map1TextureCoord1
;
458 GLboolean Map1TextureCoord2
;
459 GLboolean Map1TextureCoord3
;
460 GLboolean Map1TextureCoord4
;
461 GLboolean Map1Vertex3
;
462 GLboolean Map1Vertex4
;
463 GLboolean Map1Attrib
[16]; /* GL_NV_vertex_program */
464 GLboolean Map2Color4
;
466 GLboolean Map2Normal
;
467 GLboolean Map2TextureCoord1
;
468 GLboolean Map2TextureCoord2
;
469 GLboolean Map2TextureCoord3
;
470 GLboolean Map2TextureCoord4
;
471 GLboolean Map2Vertex3
;
472 GLboolean Map2Vertex4
;
473 GLboolean Map2Attrib
[16]; /* GL_NV_vertex_program */
474 GLboolean AutoNormal
;
475 /* Map Grid endpoints and divisions and calculated du values */
477 GLfloat MapGrid1u1
, MapGrid1u2
, MapGrid1du
;
478 GLint MapGrid2un
, MapGrid2vn
;
479 GLfloat MapGrid2u1
, MapGrid2u2
, MapGrid2du
;
480 GLfloat MapGrid2v1
, MapGrid2v2
, MapGrid2dv
;
484 struct gl_fog_attrib
{
485 GLboolean Enabled
; /* Fog enabled flag */
486 GLfloat Color
[4]; /* Fog color */
487 GLfloat Density
; /* Density >= 0.0 */
488 GLfloat Start
; /* Start distance in eye coords */
489 GLfloat End
; /* End distance in eye coords */
490 GLfloat Index
; /* Fog index */
491 GLenum Mode
; /* Fog mode */
492 GLboolean ColorSumEnabled
;
493 GLenum FogCoordinateSource
; /* GL_EXT_fog_coord */
497 struct gl_hint_attrib
{
498 /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */
499 GLenum PerspectiveCorrection
;
502 GLenum PolygonSmooth
;
504 GLenum ClipVolumeClipping
; /* GL_EXT_clip_volume_hint */
505 GLenum TextureCompression
; /* GL_ARB_texture_compression */
506 GLenum GenerateMipmap
; /* GL_SGIS_generate_mipmap */
510 struct gl_histogram_attrib
{
511 GLuint Width
; /* number of table entries */
512 GLint Format
; /* GL_ALPHA, GL_RGB, etc */
513 GLuint Count
[HISTOGRAM_TABLE_SIZE
][4]; /* the histogram */
514 GLboolean Sink
; /* terminate image transfer? */
515 GLubyte RedSize
; /* Bits per counter */
519 GLubyte LuminanceSize
;
523 struct gl_minmax_attrib
{
526 GLfloat Min
[4], Max
[4]; /* RGBA */
530 struct gl_convolution_attrib
{
532 GLenum InternalFormat
;
535 GLfloat Filter
[MAX_CONVOLUTION_WIDTH
* MAX_CONVOLUTION_HEIGHT
* 4];
539 #define LIGHT_SPOT 0x1
540 #define LIGHT_LOCAL_VIEWER 0x2
541 #define LIGHT_POSITIONAL 0x4
542 #define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
544 struct gl_light_attrib
{
545 struct gl_light Light
[MAX_LIGHTS
]; /* Array of lights */
546 struct gl_lightmodel Model
; /* Lighting model */
548 /* Must flush FLUSH_VERTICES before referencing:
550 struct gl_material Material
[2]; /* Material 0=front, 1=back */
552 GLboolean Enabled
; /* Lighting enabled flag */
553 GLenum ShadeModel
; /* GL_FLAT or GL_SMOOTH */
554 GLenum ColorMaterialFace
; /* GL_FRONT, BACK or FRONT_AND_BACK */
555 GLenum ColorMaterialMode
; /* GL_AMBIENT, GL_DIFFUSE, etc */
556 GLuint ColorMaterialBitmask
; /* bitmask formed from Face and Mode */
557 GLboolean ColorMaterialEnabled
;
559 struct gl_light EnabledList
; /* List sentinel */
561 /* Derived for optimizations: */
562 GLboolean _NeedVertices
; /* Use fast shader? */
563 GLuint _Flags
; /* LIGHT_* flags, see above */
564 GLfloat _BaseColor
[2][3];
568 struct gl_line_attrib
{
569 GLboolean SmoothFlag
; /* GL_LINE_SMOOTH enabled? */
570 GLboolean StippleFlag
; /* GL_LINE_STIPPLE enabled? */
571 GLushort StipplePattern
; /* Stipple pattern */
572 GLint StippleFactor
; /* Stipple repeat factor */
573 GLfloat Width
; /* Line width */
574 GLfloat _Width
; /* Clamped Line width */
578 struct gl_list_attrib
{
583 struct gl_list_opcode
{
585 void (*execute
)( GLcontext
*ctx
, void *data
);
586 void (*destroy
)( GLcontext
*ctx
, void *data
);
587 void (*print
)( GLcontext
*ctx
, void *data
);
590 #define GL_MAX_EXT_OPCODES 16
592 struct gl_list_extensions
{
593 struct gl_list_opcode opcode
[GL_MAX_EXT_OPCODES
];
598 struct gl_multisample_attrib
{
600 GLboolean SampleAlphaToCoverage
;
601 GLboolean SampleAlphaToOne
;
602 GLboolean SampleCoverage
;
603 GLfloat SampleCoverageValue
;
604 GLboolean SampleCoverageInvert
;
608 struct gl_pixel_attrib
{
609 GLenum ReadBuffer
; /* src buffer for glRead/CopyPixels */
610 GLubyte _ReadSrcMask
; /* Not really a mask, but like _DrawDestMask */
611 /* May be: FRONT_LEFT_BIT, BACK_LEFT_BIT, */
612 /* FRONT_RIGHT_BIT or BACK_RIGHT_BIT. */
613 GLfloat RedBias
, RedScale
;
614 GLfloat GreenBias
, GreenScale
;
615 GLfloat BlueBias
, BlueScale
;
616 GLfloat AlphaBias
, AlphaScale
;
617 GLfloat DepthBias
, DepthScale
;
618 GLint IndexShift
, IndexOffset
;
619 GLboolean MapColorFlag
;
620 GLboolean MapStencilFlag
;
621 GLfloat ZoomX
, ZoomY
;
622 /* XXX move these out of gl_pixel_attrib */
623 GLint MapStoSsize
; /* Size of each pixel map */
633 GLint MapStoS
[MAX_PIXEL_MAP_TABLE
]; /* Pixel map tables */
634 GLint MapItoI
[MAX_PIXEL_MAP_TABLE
];
635 GLfloat MapItoR
[MAX_PIXEL_MAP_TABLE
];
636 GLfloat MapItoG
[MAX_PIXEL_MAP_TABLE
];
637 GLfloat MapItoB
[MAX_PIXEL_MAP_TABLE
];
638 GLfloat MapItoA
[MAX_PIXEL_MAP_TABLE
];
639 GLubyte MapItoR8
[MAX_PIXEL_MAP_TABLE
]; /* converted to 8-bit color */
640 GLubyte MapItoG8
[MAX_PIXEL_MAP_TABLE
];
641 GLubyte MapItoB8
[MAX_PIXEL_MAP_TABLE
];
642 GLubyte MapItoA8
[MAX_PIXEL_MAP_TABLE
];
643 GLfloat MapRtoR
[MAX_PIXEL_MAP_TABLE
];
644 GLfloat MapGtoG
[MAX_PIXEL_MAP_TABLE
];
645 GLfloat MapBtoB
[MAX_PIXEL_MAP_TABLE
];
646 GLfloat MapAtoA
[MAX_PIXEL_MAP_TABLE
];
647 /* GL_EXT_histogram */
648 GLboolean HistogramEnabled
;
649 GLboolean MinMaxEnabled
;
650 /* GL_SGIS_pixel_texture */
651 GLboolean PixelTextureEnabled
;
652 GLenum FragmentRgbSource
;
653 GLenum FragmentAlphaSource
;
654 /* GL_SGI_color_matrix */
655 GLfloat PostColorMatrixScale
[4]; /* RGBA */
656 GLfloat PostColorMatrixBias
[4]; /* RGBA */
657 /* GL_SGI_color_table */
658 GLfloat ColorTableScale
[4];
659 GLfloat ColorTableBias
[4];
660 GLboolean ColorTableEnabled
;
661 GLfloat PCCTscale
[4];
663 GLboolean PostConvolutionColorTableEnabled
;
664 GLfloat PCMCTscale
[4];
665 GLfloat PCMCTbias
[4];
666 GLboolean PostColorMatrixColorTableEnabled
;
667 /* GL_SGI_texture_color_table */
668 GLfloat TextureColorTableScale
[4];
669 GLfloat TextureColorTableBias
[4];
671 GLboolean Convolution1DEnabled
;
672 GLboolean Convolution2DEnabled
;
673 GLboolean Separable2DEnabled
;
674 GLfloat ConvolutionBorderColor
[3][4];
675 GLenum ConvolutionBorderMode
[3];
676 GLfloat ConvolutionFilterScale
[3][4];
677 GLfloat ConvolutionFilterBias
[3][4];
678 GLfloat PostConvolutionScale
[4]; /* RGBA */
679 GLfloat PostConvolutionBias
[4]; /* RGBA */
683 struct gl_point_attrib
{
684 GLboolean SmoothFlag
; /* True if GL_POINT_SMOOTH is enabled */
685 GLfloat Size
; /* User-specified point size */
686 GLfloat _Size
; /* Size clamped to Const.Min/MaxPointSize */
687 GLfloat Params
[3]; /* GL_EXT_point_parameters */
688 GLfloat MinSize
, MaxSize
; /* GL_EXT_point_parameters */
689 GLfloat Threshold
; /* GL_EXT_point_parameters */
690 GLboolean _Attenuated
; /* True if Params != [1, 0, 0] */
691 GLboolean PointSprite
; /* GL_NV_point_sprite */
692 GLboolean CoordReplace
[MAX_TEXTURE_COORD_UNITS
]; /* GL_NV_point_sprite */
693 GLenum SpriteRMode
; /* GL_NV_point_sprite */
697 struct gl_polygon_attrib
{
698 GLenum FrontFace
; /* Either GL_CW or GL_CCW */
699 GLenum FrontMode
; /* Either GL_POINT, GL_LINE or GL_FILL */
700 GLenum BackMode
; /* Either GL_POINT, GL_LINE or GL_FILL */
701 GLboolean _FrontBit
; /* 0=GL_CCW, 1=GL_CW */
702 GLboolean CullFlag
; /* Culling on/off flag */
703 GLboolean SmoothFlag
; /* True if GL_POLYGON_SMOOTH is enabled */
704 GLboolean StippleFlag
; /* True if GL_POLYGON_STIPPLE is enabled */
705 GLenum CullFaceMode
; /* Culling mode GL_FRONT or GL_BACK */
706 GLfloat OffsetFactor
; /* Polygon offset factor, from user */
707 GLfloat OffsetUnits
; /* Polygon offset units, from user */
708 GLboolean OffsetPoint
; /* Offset in GL_POINT mode */
709 GLboolean OffsetLine
; /* Offset in GL_LINE mode */
710 GLboolean OffsetFill
; /* Offset in GL_FILL mode */
714 struct gl_scissor_attrib
{
715 GLboolean Enabled
; /* Scissor test enabled? */
716 GLint X
, Y
; /* Lower left corner of box */
717 GLsizei Width
, Height
; /* Size of box */
721 struct gl_stencil_attrib
{
722 GLboolean Enabled
; /* Enabled flag */
723 GLboolean TestTwoSide
; /* GL_EXT_stencil_two_side */
724 GLubyte ActiveFace
; /* GL_EXT_stencil_two_side (0 or 1) */
725 GLenum Function
[2]; /* Stencil function */
726 GLenum FailFunc
[2]; /* Fail function */
727 GLenum ZPassFunc
[2]; /* Depth buffer pass function */
728 GLenum ZFailFunc
[2]; /* Depth buffer fail function */
729 GLstencil Ref
[2]; /* Reference value */
730 GLstencil ValueMask
[2]; /* Value mask */
731 GLstencil WriteMask
[2]; /* Write mask */
732 GLstencil Clear
; /* Clear value */
736 /* TexGenEnabled flags */
742 /* Texture.Unit[]._ReallyEnabled flags: */
743 #define TEXTURE_1D_BIT 0x01
744 #define TEXTURE_2D_BIT 0x02
745 #define TEXTURE_3D_BIT 0x04
746 #define TEXTURE_CUBE_BIT 0x08
747 #define TEXTURE_RECT_BIT 0x10
749 #define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */
752 /* Bitmap versions of the GL_ constants. */
753 #define TEXGEN_SPHERE_MAP 0x1
754 #define TEXGEN_OBJ_LINEAR 0x2
755 #define TEXGEN_EYE_LINEAR 0x4
756 #define TEXGEN_REFLECTION_MAP_NV 0x8
757 #define TEXGEN_NORMAL_MAP_NV 0x10
759 #define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
760 TEXGEN_REFLECTION_MAP_NV | \
761 TEXGEN_NORMAL_MAP_NV)
762 #define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
763 TEXGEN_REFLECTION_MAP_NV | \
764 TEXGEN_NORMAL_MAP_NV | \
769 /* A selection of state flags to make driver and module's lives easier. */
770 #define ENABLE_TEXGEN0 0x1
771 #define ENABLE_TEXGEN1 0x2
772 #define ENABLE_TEXGEN2 0x4
773 #define ENABLE_TEXGEN3 0x8
774 #define ENABLE_TEXGEN4 0x10
775 #define ENABLE_TEXGEN5 0x20
776 #define ENABLE_TEXGEN6 0x40
777 #define ENABLE_TEXGEN7 0x80
779 #define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */
780 #define ENABLE_TEXMAT1 0x2
781 #define ENABLE_TEXMAT2 0x4
782 #define ENABLE_TEXMAT3 0x8
783 #define ENABLE_TEXMAT4 0x10
784 #define ENABLE_TEXMAT5 0x20
785 #define ENABLE_TEXMAT6 0x40
786 #define ENABLE_TEXMAT7 0x80
788 #define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
789 #define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
792 * If teximage is color-index, texelOut returns GLchan[1].
793 * If teximage is depth, texelOut returns GLfloat[1].
794 * Otherwise, texelOut returns GLchan[4].
796 typedef void (*FetchTexelFunc
)( const struct gl_texture_image
*texImage
,
797 GLint col
, GLint row
, GLint img
,
800 /* Texture format record */
801 struct gl_texture_format
{
802 GLint MesaFormat
; /* One of the MESA_FORMAT_* values */
804 GLenum BaseFormat
; /* Either GL_ALPHA, GL_INTENSITY, GL_LUMINANCE,
805 * GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA,
806 * GL_COLOR_INDEX or GL_DEPTH_COMPONENT.
808 GLubyte RedBits
; /* Bits per texel component */
809 GLubyte GreenBits
; /* These are just rough approximations for */
810 GLubyte BlueBits
; /* compressed texture formats. */
812 GLubyte LuminanceBits
;
813 GLubyte IntensityBits
;
817 GLint TexelBytes
; /* Bytes per texel (0 for compressed formats */
819 FetchTexelFunc FetchTexel1D
; /* Texel fetch function pointers */
820 FetchTexelFunc FetchTexel2D
;
821 FetchTexelFunc FetchTexel3D
;
825 /* Texture image record */
826 struct gl_texture_image
{
827 GLenum Format
; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
828 * GL_INTENSITY, GL_RGB, GL_RGBA,
829 * GL_COLOR_INDEX or GL_DEPTH_COMPONENT only.
830 * Used for choosing TexEnv arithmetic.
832 GLint IntFormat
; /* Internal format as given by the user */
833 GLuint Border
; /* 0 or 1 */
834 GLuint Width
; /* = 2^WidthLog2 + 2*Border */
835 GLuint Height
; /* = 2^HeightLog2 + 2*Border */
836 GLuint Depth
; /* = 2^DepthLog2 + 2*Border */
837 GLuint RowStride
; /* == Width unless IsClientData and padded */
838 GLuint Width2
; /* = Width - 2*Border */
839 GLuint Height2
; /* = Height - 2*Border */
840 GLuint Depth2
; /* = Depth - 2*Border */
841 GLuint WidthLog2
; /* = log2(Width2) */
842 GLuint HeightLog2
; /* = log2(Height2) */
843 GLuint DepthLog2
; /* = log2(Depth2) */
844 GLuint MaxLog2
; /* = MAX(WidthLog2, HeightLog2) */
845 GLfloat WidthScale
; /* used for mipmap lod computation */
846 GLfloat HeightScale
; /* used for mipmap lod computation */
847 GLfloat DepthScale
; /* used for mipmap lod computation */
848 GLvoid
*Data
; /* Image data, accessed via FetchTexel() */
849 GLboolean IsClientData
; /* Data owned by client? */
852 const struct gl_texture_format
*TexFormat
;
854 FetchTexelFunc FetchTexel
; /* Texel fetch function pointer */
856 GLboolean IsCompressed
; /* GL_ARB_texture_compression */
857 GLuint CompressedSize
; /* GL_ARB_texture_compression */
859 /* For device driver: */
860 void *DriverData
; /* Arbitrary device driver data */
864 /* Texture object record */
865 struct gl_texture_object
{
866 _glthread_Mutex Mutex
; /* for thread safety */
867 GLint RefCount
; /* reference count */
868 GLuint Name
; /* an unsigned integer */
869 GLenum Target
; /* GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
870 GLfloat Priority
; /* in [0,1] */
871 GLfloat BorderColor
[4]; /* unclamped */
872 GLchan _BorderChan
[4]; /* clamped, as GLchan */
873 GLenum WrapS
; /* Wrap modes are: GL_CLAMP, REPEAT */
874 GLenum WrapT
; /* GL_CLAMP_TO_EDGE, and */
875 GLenum WrapR
; /* GL_CLAMP_TO_BORDER_ARB */
876 GLenum MinFilter
; /* minification filter */
877 GLenum MagFilter
; /* magnification filter */
878 GLfloat MinLod
; /* min lambda, OpenGL 1.2 */
879 GLfloat MaxLod
; /* max lambda, OpenGL 1.2 */
880 GLint BaseLevel
; /* min mipmap level, OpenGL 1.2 */
881 GLint MaxLevel
; /* max mipmap level, OpenGL 1.2 */
882 GLfloat MaxAnisotropy
; /* GL_EXT_texture_filter_anisotropic */
883 GLboolean CompareFlag
; /* GL_SGIX_shadow */
884 GLenum CompareOperator
; /* GL_SGIX_shadow */
885 GLfloat ShadowAmbient
;
886 GLenum CompareMode
; /* GL_ARB_shadow */
887 GLenum CompareFunc
; /* GL_ARB_shadow */
888 GLenum DepthMode
; /* GL_ARB_depth_texture */
889 GLint _MaxLevel
; /* actual max mipmap level (q in the spec) */
890 GLfloat _MaxLambda
; /* = _MaxLevel - BaseLevel (q - b in spec) */
891 GLboolean GenerateMipmap
; /* GL_SGIS_generate_mipmap */
893 struct gl_texture_image
*Image
[MAX_TEXTURE_LEVELS
];
895 /* Texture cube faces */
896 /* Image[] is alias for *PosX[MAX_TEXTURE_LEVELS]; */
897 struct gl_texture_image
*NegX
[MAX_TEXTURE_LEVELS
];
898 struct gl_texture_image
*PosY
[MAX_TEXTURE_LEVELS
];
899 struct gl_texture_image
*NegY
[MAX_TEXTURE_LEVELS
];
900 struct gl_texture_image
*PosZ
[MAX_TEXTURE_LEVELS
];
901 struct gl_texture_image
*NegZ
[MAX_TEXTURE_LEVELS
];
903 /* GL_EXT_paletted_texture */
904 struct gl_color_table Palette
;
906 GLboolean Complete
; /* Is texture object complete? */
907 struct gl_texture_object
*Next
; /* Next in linked list */
909 /* For device driver: */
910 void *DriverData
; /* Arbitrary device driver data */
914 /* Texture unit record */
915 struct gl_texture_unit
{
916 GLuint Enabled
; /* bitmask of TEXTURE_*_BIT flags */
917 GLuint _ReallyEnabled
; /* 0 or exactly one of TEXTURE_*_BIT flags */
919 GLenum EnvMode
; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
921 GLuint TexGenEnabled
; /* Bitwise-OR of [STRQ]_BIT values */
922 GLenum GenModeS
; /* Tex coord generation mode, either */
923 GLenum GenModeT
; /* GL_OBJECT_LINEAR, or */
924 GLenum GenModeR
; /* GL_EYE_LINEAR, or */
925 GLenum GenModeQ
; /* GL_SPHERE_MAP */
930 GLuint _GenFlags
; /* bitwise or of GenBit[STRQ] */
931 GLfloat ObjectPlaneS
[4];
932 GLfloat ObjectPlaneT
[4];
933 GLfloat ObjectPlaneR
[4];
934 GLfloat ObjectPlaneQ
[4];
935 GLfloat EyePlaneS
[4];
936 GLfloat EyePlaneT
[4];
937 GLfloat EyePlaneR
[4];
938 GLfloat EyePlaneQ
[4];
939 GLfloat LodBias
; /* for biasing mipmap levels */
941 /* GL_EXT_texture_env_combine */
942 GLenum CombineModeRGB
; /* GL_REPLACE, GL_DECAL, GL_ADD, etc. */
943 GLenum CombineModeA
; /* GL_REPLACE, GL_DECAL, GL_ADD, etc. */
944 GLenum CombineSourceRGB
[3]; /* GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
945 GLenum CombineSourceA
[3]; /* GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
946 GLenum CombineOperandRGB
[3]; /* SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */
947 GLenum CombineOperandA
[3]; /* SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */
948 GLuint CombineScaleShiftRGB
; /* 0, 1 or 2 */
949 GLuint CombineScaleShiftA
; /* 0, 1 or 2 */
951 struct gl_texture_object
*Current1D
;
952 struct gl_texture_object
*Current2D
;
953 struct gl_texture_object
*Current3D
;
954 struct gl_texture_object
*CurrentCubeMap
; /* GL_ARB_texture_cube_map */
955 struct gl_texture_object
*CurrentRect
; /* GL_NV_texture_rectangle */
957 struct gl_texture_object
*_Current
; /* Points to really enabled tex obj */
959 struct gl_texture_object Saved1D
; /* only used by glPush/PopAttrib */
960 struct gl_texture_object Saved2D
;
961 struct gl_texture_object Saved3D
;
962 struct gl_texture_object SavedCubeMap
;
963 struct gl_texture_object SavedRect
;
965 /* GL_SGI_texture_color_table */
966 struct gl_color_table ColorTable
;
967 struct gl_color_table ProxyColorTable
;
968 GLboolean ColorTableEnabled
;
972 /* The texture attribute group */
973 struct gl_texture_attrib
{
975 GLuint CurrentUnit
; /* Active texture unit */
977 GLuint _EnabledUnits
; /* one bit set for each really-enabled unit */
978 GLuint _GenFlags
; /* for texgen */
979 GLuint _TexGenEnabled
;
980 GLuint _TexMatEnabled
;
982 struct gl_texture_unit Unit
[MAX_TEXTURE_UNITS
];
984 struct gl_texture_object
*Proxy1D
;
985 struct gl_texture_object
*Proxy2D
;
986 struct gl_texture_object
*Proxy3D
;
987 struct gl_texture_object
*ProxyCubeMap
;
988 struct gl_texture_object
*ProxyRect
;
990 /* GL_EXT_shared_texture_palette */
991 GLboolean SharedPalette
;
992 struct gl_color_table Palette
;
996 struct gl_transform_attrib
{
997 GLenum MatrixMode
; /* Matrix mode */
998 GLfloat EyeUserPlane
[MAX_CLIP_PLANES
][4];
999 GLfloat _ClipUserPlane
[MAX_CLIP_PLANES
][4]; /* derived */
1000 GLuint ClipPlanesEnabled
; /* on/off bitmask */
1001 GLboolean Normalize
; /* Normalize all normals? */
1002 GLboolean RescaleNormals
; /* GL_EXT_rescale_normal */
1003 GLboolean RasterPositionUnclipped
; /* GL_IBM_rasterpos_clip */
1007 struct gl_viewport_attrib
{
1008 GLint X
, Y
; /* position */
1009 GLsizei Width
, Height
; /* size */
1010 GLfloat Near
, Far
; /* Depth buffer range */
1011 GLmatrix _WindowMap
; /* Mapping transformation as a matrix. */
1015 /* For the attribute stack: */
1016 struct gl_attrib_node
{
1019 struct gl_attrib_node
*next
;
1024 * Client pixel packing/unpacking attributes
1026 struct gl_pixelstore_attrib
{
1031 GLint ImageHeight
; /* for GL_EXT_texture3D */
1032 GLint SkipImages
; /* for GL_EXT_texture3D */
1033 GLboolean SwapBytes
;
1035 GLboolean ClientStorage
; /* GL_APPLE_client_storage */
1036 GLboolean Invert
; /* GL_MESA_pack_invert */
1040 #define CA_CLIENT_DATA 0x1 /* Data not alloced by mesa */
1044 * Client vertex array attributes
1046 struct gl_client_array
{
1049 GLsizei Stride
; /* user-specified stride */
1050 GLsizei StrideB
; /* actual stride in bytes */
1053 GLuint Enabled
; /* one of the _NEW_ARRAY_ bits */
1057 struct gl_array_attrib
{
1058 struct gl_client_array Vertex
; /* client data descriptors */
1059 struct gl_client_array Normal
;
1060 struct gl_client_array Color
;
1061 struct gl_client_array SecondaryColor
;
1062 struct gl_client_array FogCoord
;
1063 struct gl_client_array Index
;
1064 struct gl_client_array TexCoord
[MAX_TEXTURE_COORD_UNITS
];
1065 struct gl_client_array EdgeFlag
;
1067 struct gl_client_array VertexAttrib
[16]; /* GL_NV_vertex_program */
1069 GLint TexCoordInterleaveFactor
;
1070 GLint ActiveTexture
; /* Client Active Texture */
1074 GLuint _Enabled
; /* _NEW_ARRAY_* - bit set if array enabled */
1075 GLuint NewState
; /* _NEW_ARRAY_* */
1079 struct gl_feedback
{
1081 GLuint _Mask
; /* FB_* bits */
1088 struct gl_selection
{
1090 GLuint BufferSize
; /* size of SelectBuffer */
1091 GLuint BufferCount
; /* number of values in SelectBuffer */
1092 GLuint Hits
; /* number of records in SelectBuffer */
1093 GLuint NameStackDepth
;
1094 GLuint NameStack
[MAX_NAME_STACK_DEPTH
];
1096 GLfloat HitMinZ
, HitMaxZ
;
1101 * 1-D Evaluator control points
1104 GLuint Order
; /* Number of control points */
1105 GLfloat u1
, u2
, du
; /* u1, u2, 1.0/(u2-u1) */
1106 GLfloat
*Points
; /* Points to contiguous control points */
1111 * 2-D Evaluator control points
1114 GLuint Uorder
; /* Number of control points in U dimension */
1115 GLuint Vorder
; /* Number of control points in V dimension */
1118 GLfloat
*Points
; /* Points to contiguous control points */
1123 * All evalutator control points
1125 struct gl_evaluators
{
1127 struct gl_1d_map Map1Vertex3
;
1128 struct gl_1d_map Map1Vertex4
;
1129 struct gl_1d_map Map1Index
;
1130 struct gl_1d_map Map1Color4
;
1131 struct gl_1d_map Map1Normal
;
1132 struct gl_1d_map Map1Texture1
;
1133 struct gl_1d_map Map1Texture2
;
1134 struct gl_1d_map Map1Texture3
;
1135 struct gl_1d_map Map1Texture4
;
1136 struct gl_1d_map Map1Attrib
[16]; /* GL_NV_vertex_program */
1139 struct gl_2d_map Map2Vertex3
;
1140 struct gl_2d_map Map2Vertex4
;
1141 struct gl_2d_map Map2Index
;
1142 struct gl_2d_map Map2Color4
;
1143 struct gl_2d_map Map2Normal
;
1144 struct gl_2d_map Map2Texture1
;
1145 struct gl_2d_map Map2Texture2
;
1146 struct gl_2d_map Map2Texture3
;
1147 struct gl_2d_map Map2Texture4
;
1148 struct gl_2d_map Map2Attrib
[16]; /* GL_NV_vertex_program */
1153 /* NV_vertex_program runtime state */
1156 GLfloat Registers
[MAX_NV_VERTEX_PROGRAM_TEMPS
1157 + MAX_NV_VERTEX_PROGRAM_PARAMS
1158 + MAX_NV_VERTEX_PROGRAM_INPUTS
1159 + MAX_NV_VERTEX_PROGRAM_OUTPUTS
][4];
1160 GLint AddressReg
; /* might someday be a 4-vector */
1164 /* NV_fragment_program runtime state */
1167 GLfloat Registers
[MAX_NV_FRAGMENT_PROGRAM_TEMPS
1168 + MAX_NV_FRAGMENT_PROGRAM_PARAMS
1169 + MAX_NV_FRAGMENT_PROGRAM_INPUTS
1170 + MAX_NV_FRAGMENT_PROGRAM_OUTPUTS
1171 + MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS
][4];
1172 GLuint CondCodes
[4];
1176 /* Vertex and fragment instructions */
1177 struct vp_instruction
;
1178 struct fp_instruction
;
1182 struct symbol
*Head
;
1186 /* Base class for any kind of program object */
1190 GLubyte
*String
; /* Null-terminated program text */
1197 /* Vertex program object */
1198 struct vertex_program
1200 struct program Base
; /* base class */
1201 struct vp_instruction
*Instructions
; /* Compiled instructions */
1202 GLboolean IsPositionInvariant
; /* GL_NV_vertex_program1_1 */
1203 GLuint InputsRead
; /* Bitmask of which input regs are read */
1204 GLuint OutputsWritten
; /* Bitmask of which output regs are written to */
1208 /* Fragment program object */
1209 struct fragment_program
1211 struct program Base
; /* base class */
1212 struct fp_instruction
*Instructions
; /* Compiled instructions */
1213 GLuint InputsRead
; /* Bitmask of which input regs are read */
1214 GLuint OutputsWritten
; /* Bitmask of which output regs are written to */
1215 GLfloat LocalParams
[MAX_NV_FRAGMENT_PROGRAM_PARAMS
][4];
1216 struct symbol_table SymbolTable
;
1221 * State common to vertex and fragment programs.
1223 struct program_state
{
1224 GLint ErrorPos
; /* GL_PROGRAM_ERROR_POSITION_NV */
1225 const char *ErrorString
; /* GL_PROGRAM_ERROR_STRING_NV */
1230 * State for GL_NV_vertex_program
1232 struct vertex_program_state
1234 GLboolean Enabled
; /* GL_VERTEX_PROGRAM_NV */
1235 GLboolean PointSizeEnabled
; /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
1236 GLboolean TwoSideEnabled
; /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
1237 struct vertex_program
*Current
; /* ptr to currently bound program */
1238 struct vp_machine Machine
; /* machine state */
1240 GLenum TrackMatrix
[MAX_NV_VERTEX_PROGRAM_PARAMS
/ 4];
1241 GLenum TrackMatrixTransform
[MAX_NV_VERTEX_PROGRAM_PARAMS
/ 4];
1246 * State for GL_NV_fragment_program
1248 struct fragment_program_state
1250 GLboolean Enabled
; /* GL_VERTEX_PROGRAM_NV */
1251 struct fragment_program
*Current
; /* ptr to currently bound program */
1252 struct fp_machine Machine
; /* machine state */
1257 * State which can be shared by multiple contexts:
1259 struct gl_shared_state
{
1260 _glthread_Mutex Mutex
; /* for thread safety */
1261 GLint RefCount
; /* Reference count */
1262 struct _mesa_HashTable
*DisplayList
; /* Display lists hash table */
1263 struct _mesa_HashTable
*TexObjects
; /* Texture objects hash table */
1264 struct gl_texture_object
*TexObjectList
;/* Linked list of texture objects */
1266 /* Default texture objects (shared by all multi-texture units) */
1267 struct gl_texture_object
*Default1D
;
1268 struct gl_texture_object
*Default2D
;
1269 struct gl_texture_object
*Default3D
;
1270 struct gl_texture_object
*DefaultCubeMap
;
1271 struct gl_texture_object
*DefaultRect
;
1273 /* GL_NV_vertex/_program */
1274 struct _mesa_HashTable
*Programs
;
1276 void *DriverData
; /* Device driver shared state */
1281 * A "frame buffer" is a color buffer and its optional ancillary buffers:
1282 * depth, accum, stencil, and software-simulated alpha buffers.
1283 * In C++ terms, think of this as a base class from which device drivers
1284 * will make derived classes.
1286 struct gl_frame_buffer
{
1287 GLvisual Visual
; /* The corresponding visual */
1289 GLuint Width
, Height
; /* size of frame buffer in pixels */
1291 GLboolean UseSoftwareDepthBuffer
;
1292 GLboolean UseSoftwareAccumBuffer
;
1293 GLboolean UseSoftwareStencilBuffer
;
1294 GLboolean UseSoftwareAlphaBuffers
;
1296 /* Software depth (aka Z) buffer */
1297 GLvoid
*DepthBuffer
; /* array [Width*Height] of GLushort or GLuint*/
1299 /* Software stencil buffer */
1300 GLstencil
*Stencil
; /* array [Width*Height] of GLstencil values */
1302 /* Software accumulation buffer */
1303 GLaccum
*Accum
; /* array [4*Width*Height] of GLaccum values */
1305 /* Software alpha planes */
1306 GLvoid
*FrontLeftAlpha
; /* array [Width*Height] of GLubyte */
1307 GLvoid
*BackLeftAlpha
; /* array [Width*Height] of GLubyte */
1308 GLvoid
*FrontRightAlpha
; /* array [Width*Height] of GLubyte */
1309 GLvoid
*BackRightAlpha
; /* array [Width*Height] of GLubyte */
1311 /* Drawing bounds: intersection of window size and scissor box */
1312 GLint _Xmin
, _Ymin
; /* inclusive */
1313 GLint _Xmax
, _Ymax
; /* exclusive */
1318 * Constants which may be overriden by device driver during context creation
1319 * but are never changed after that.
1321 struct gl_constants
{
1322 GLint MaxTextureLevels
;
1323 GLint Max3DTextureLevels
;
1324 GLint MaxCubeTextureLevels
; /* GL_ARB_texture_cube_map */
1325 GLint MaxTextureRectSize
; /* GL_NV_texture_rectangle */
1326 GLuint MaxTextureUnits
;
1327 GLuint MaxTextureCoordUnits
;
1328 GLuint MaxTextureImageUnits
;
1329 GLfloat MaxTextureMaxAnisotropy
; /* GL_EXT_texture_filter_anisotropic */
1330 GLfloat MaxTextureLodBias
; /* GL_EXT_texture_lod_bias */
1331 GLuint MaxArrayLockSize
;
1333 GLfloat MinPointSize
, MaxPointSize
; /* aliased */
1334 GLfloat MinPointSizeAA
, MaxPointSizeAA
; /* antialiased */
1335 GLfloat PointSizeGranularity
;
1336 GLfloat MinLineWidth
, MaxLineWidth
; /* aliased */
1337 GLfloat MinLineWidthAA
, MaxLineWidthAA
; /* antialiased */
1338 GLfloat LineWidthGranularity
;
1339 GLuint NumAuxBuffers
;
1340 GLuint MaxColorTableSize
;
1341 GLuint MaxConvolutionWidth
;
1342 GLuint MaxConvolutionHeight
;
1343 GLuint MaxClipPlanes
;
1349 * List of extensions.
1352 struct gl_extensions
{
1354 struct extension
*ext_list
;
1355 /* Flags to quickly test if certain extensions are available.
1356 * Not every extension needs to have such a flag, but it's encouraged.
1358 GLboolean ARB_depth_texture
;
1359 GLboolean ARB_imaging
;
1360 GLboolean ARB_multisample
;
1361 GLboolean ARB_multitexture
;
1362 GLboolean ARB_shadow
;
1363 GLboolean ARB_texture_border_clamp
;
1364 GLboolean ARB_texture_compression
;
1365 GLboolean ARB_texture_cube_map
;
1366 GLboolean ARB_texture_env_combine
;
1367 GLboolean ARB_texture_env_crossbar
;
1368 GLboolean ARB_texture_env_dot3
;
1369 GLboolean ARB_texture_mirrored_repeat
;
1370 GLboolean ARB_window_pos
;
1371 GLboolean ATI_texture_mirror_once
;
1372 GLboolean ATI_texture_env_combine3
;
1373 GLboolean EXT_blend_color
;
1374 GLboolean EXT_blend_func_separate
;
1375 GLboolean EXT_blend_logic_op
;
1376 GLboolean EXT_blend_minmax
;
1377 GLboolean EXT_blend_subtract
;
1378 GLboolean EXT_clip_volume_hint
;
1379 GLboolean EXT_convolution
;
1380 GLboolean EXT_compiled_vertex_array
;
1381 GLboolean EXT_fog_coord
;
1382 GLboolean EXT_histogram
;
1383 GLboolean EXT_multi_draw_arrays
;
1384 GLboolean EXT_packed_pixels
;
1385 GLboolean EXT_paletted_texture
;
1386 GLboolean EXT_point_parameters
;
1387 GLboolean EXT_polygon_offset
;
1388 GLboolean EXT_rescale_normal
;
1389 GLboolean EXT_shadow_funcs
;
1390 GLboolean EXT_secondary_color
;
1391 GLboolean EXT_shared_texture_palette
;
1392 GLboolean EXT_stencil_wrap
;
1393 GLboolean EXT_stencil_two_side
;
1394 GLboolean EXT_texture3D
;
1395 GLboolean EXT_texture_compression_s3tc
;
1396 GLboolean EXT_texture_env_add
;
1397 GLboolean EXT_texture_env_combine
;
1398 GLboolean EXT_texture_env_dot3
;
1399 GLboolean EXT_texture_filter_anisotropic
;
1400 GLboolean EXT_texture_object
;
1401 GLboolean EXT_texture_lod_bias
;
1402 GLboolean EXT_vertex_array_set
;
1403 GLboolean HP_occlusion_test
;
1404 GLboolean IBM_rasterpos_clip
;
1405 GLboolean INGR_blend_func_separate
;
1406 GLboolean MESA_pack_invert
;
1407 GLboolean MESA_window_pos
;
1408 GLboolean MESA_resize_buffers
;
1409 GLboolean MESA_ycbcr_texture
;
1410 GLboolean NV_blend_square
;
1411 GLboolean NV_fragment_program
;
1412 GLboolean NV_point_sprite
;
1413 GLboolean NV_texture_rectangle
;
1414 GLboolean NV_texgen_reflection
;
1415 GLboolean NV_vertex_program
;
1416 GLboolean NV_vertex_program1_1
;
1417 GLboolean SGI_color_matrix
;
1418 GLboolean SGI_color_table
;
1419 GLboolean SGI_texture_color_table
;
1420 GLboolean SGIS_generate_mipmap
;
1421 GLboolean SGIS_pixel_texture
;
1422 GLboolean SGIS_texture_edge_clamp
;
1423 GLboolean SGIX_depth_texture
;
1424 GLboolean SGIX_pixel_texture
;
1425 GLboolean SGIX_shadow
;
1426 GLboolean SGIX_shadow_ambient
; /* or GL_ARB_shadow_ambient */
1427 GLboolean TDFX_texture_compression_FXT1
;
1428 GLboolean APPLE_client_storage
;
1433 * A stack of matrices (projection, modelview, color, texture, etc).
1437 GLmatrix
*Top
; /* points into Stack */
1438 GLmatrix
*Stack
; /* array [MaxDepth] of GLmatrix */
1439 GLuint Depth
; /* 0 <= Depth < MaxDepth */
1440 GLuint MaxDepth
; /* size of Stack[] array */
1441 GLuint DirtyFlag
; /* _NEW_MODELVIEW or _NEW_PROJECTION, for example */
1446 * Bits for image transfer operations (ctx->ImageTransferState).
1448 #define IMAGE_SCALE_BIAS_BIT 0x1
1449 #define IMAGE_SHIFT_OFFSET_BIT 0x2
1450 #define IMAGE_MAP_COLOR_BIT 0x4
1451 #define IMAGE_COLOR_TABLE_BIT 0x8
1452 #define IMAGE_CONVOLUTION_BIT 0x10
1453 #define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
1454 #define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40
1455 #define IMAGE_COLOR_MATRIX_BIT 0x80
1456 #define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100
1457 #define IMAGE_HISTOGRAM_BIT 0x200
1458 #define IMAGE_MIN_MAX_BIT 0x400
1460 /* transfer ops up to convolution: */
1461 #define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \
1462 IMAGE_SHIFT_OFFSET_BIT | \
1463 IMAGE_MAP_COLOR_BIT | \
1464 IMAGE_COLOR_TABLE_BIT)
1466 /* transfer ops after convolution: */
1467 #define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \
1468 IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \
1469 IMAGE_COLOR_MATRIX_BIT | \
1470 IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\
1471 IMAGE_HISTOGRAM_BIT | \
1476 * Bits to indicate what state has changed. 6 unused flags.
1478 #define _NEW_MODELVIEW 0x1 /* ctx->ModelView */
1479 #define _NEW_PROJECTION 0x2 /* ctx->Projection */
1480 #define _NEW_TEXTURE_MATRIX 0x4 /* ctx->TextureMatrix */
1481 #define _NEW_COLOR_MATRIX 0x8 /* ctx->ColorMatrix */
1482 #define _NEW_ACCUM 0x10 /* ctx->Accum */
1483 #define _NEW_COLOR 0x20 /* ctx->Color */
1484 #define _NEW_DEPTH 0x40 /* ctx->Depth */
1485 #define _NEW_EVAL 0x80 /* ctx->Eval, ctx->EvalMap */
1486 #define _NEW_FOG 0x100 /* ctx->Fog */
1487 #define _NEW_HINT 0x200 /* ctx->Hint */
1488 #define _NEW_LIGHT 0x400 /* ctx->Light */
1489 #define _NEW_LINE 0x800 /* ctx->Line */
1490 #define _NEW_PIXEL 0x1000 /* ctx->Pixel */
1491 #define _NEW_POINT 0x2000 /* ctx->Point */
1492 #define _NEW_POLYGON 0x4000 /* ctx->Polygon */
1493 #define _NEW_POLYGONSTIPPLE 0x8000 /* ctx->PolygonStipple */
1494 #define _NEW_SCISSOR 0x10000 /* ctx->Scissor */
1495 #define _NEW_STENCIL 0x20000 /* ctx->Stencil */
1496 #define _NEW_TEXTURE 0x40000 /* ctx->Texture */
1497 #define _NEW_TRANSFORM 0x80000 /* ctx->Transform */
1498 #define _NEW_VIEWPORT 0x100000 /* ctx->Viewport */
1499 #define _NEW_PACKUNPACK 0x200000 /* ctx->Pack, ctx->Unpack */
1500 #define _NEW_ARRAY 0x400000 /* ctx->Array */
1501 #define _NEW_RENDERMODE 0x800000 /* RenderMode, Feedback, Select */
1502 #define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */
1503 #define _NEW_MULTISAMPLE 0x2000000 /* ctx->Multisample */
1504 #define _NEW_TRACK_MATRIX 0x4000000 /* ctx->VertexProgram */
1505 #define _NEW_PROGRAM 0x8000000 /* ctx->VertexProgram */
1510 /* Bits to track array state changes (also used to summarize array enabled)
1512 #define _NEW_ARRAY_VERTEX VERT_BIT_POS
1513 #define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT
1514 #define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL
1515 #define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
1516 #define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
1517 #define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
1518 #define _NEW_ARRAY_INDEX VERT_BIT_SIX
1519 #define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
1520 #define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
1521 #define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
1522 #define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
1523 #define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3
1524 #define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4
1525 #define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
1526 #define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
1527 #define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
1528 #define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
1529 #define _NEW_ARRAY_ALL 0xffffffff
1532 #define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i))
1533 #define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i))
1536 /* A bunch of flags that we think might be useful to drivers.
1537 * Set in the ctx->_TriangleCaps bitfield.
1539 #define DD_FLATSHADE 0x1
1540 #define DD_SEPARATE_SPECULAR 0x2
1541 #define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */
1542 #define DD_TRI_LIGHT_TWOSIDE 0x8
1543 #define DD_TRI_UNFILLED 0x10
1544 #define DD_TRI_SMOOTH 0x20
1545 #define DD_TRI_STIPPLE 0x40
1546 #define DD_TRI_OFFSET 0x80
1547 #define DD_LINE_SMOOTH 0x100
1548 #define DD_LINE_STIPPLE 0x200
1549 #define DD_LINE_WIDTH 0x400
1550 #define DD_POINT_SMOOTH 0x800
1551 #define DD_POINT_SIZE 0x1000
1552 #define DD_POINT_ATTEN 0x2000
1555 /* Define the state changes under which each of these bits might change
1557 #define _DD_NEW_FLATSHADE _NEW_LIGHT
1558 #define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG)
1559 #define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
1560 #define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT
1561 #define _DD_NEW_TRI_UNFILLED _NEW_POLYGON
1562 #define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
1563 #define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
1564 #define _DD_NEW_TRI_OFFSET _NEW_POLYGON
1565 #define _DD_NEW_LINE_SMOOTH _NEW_LINE
1566 #define _DD_NEW_LINE_STIPPLE _NEW_LINE
1567 #define _DD_NEW_LINE_WIDTH _NEW_LINE
1568 #define _DD_NEW_POINT_SMOOTH _NEW_POINT
1569 #define _DD_NEW_POINT_SIZE _NEW_POINT
1570 #define _DD_NEW_POINT_ATTEN _NEW_POINT
1572 #define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
1577 #define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
1580 #define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX)
1583 /* Bits for ctx->_NeedNormals */
1584 #define NEED_NORMALS_TEXGEN 0x1
1585 #define NEED_NORMALS_LIGHT 0x2
1587 /* Bits for ctx->_NeedEyeCoords */
1588 #define NEED_EYE_TEXGEN 0x1
1589 #define NEED_EYE_LIGHT 0x2
1590 #define NEED_EYE_LIGHT_MODELVIEW 0x4
1591 #define NEED_EYE_POINT_ATTEN 0x8
1592 #define NEED_EYE_DRIVER 0x10
1596 * Forward declaration of display list datatypes:
1599 typedef union node Node
;
1602 /* This has to be included here. */
1607 * Core Mesa's support for tnl modules:
1609 #define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *))
1611 struct gl_tnl_module
{
1612 /* Vertex format to be lazily swapped into current dispatch.
1614 GLvertexformat
*Current
;
1616 /* Record of functions swapped out. On restore, only need to swap
1617 * these functions back in.
1619 void *Swapped
[NUM_VERTEX_FORMAT_ENTRIES
][2];
1625 * This is the central context data structure for Mesa. Almost all
1626 * OpenGL state is contained in this structure.
1627 * Think of this as a base class from which device drivers will derive
1630 struct __GLcontextRec
{
1632 * OS related interfaces; these *must* be the first members of this
1633 * structure, because they are exposed to the outside world (i.e. GLX
1636 __GLimports imports
;
1637 __GLexports exports
;
1639 /* State possibly shared with other contexts in the address space */
1640 struct gl_shared_state
*Shared
;
1642 /* API function pointer tables */
1643 struct _glapi_table
*Save
; /**< Display list save funcs */
1644 struct _glapi_table
*Exec
; /**< Execute funcs */
1645 struct _glapi_table
*CurrentDispatch
; /**< == Save or Exec !! */
1647 GLboolean ExecPrefersFloat
; /**< What preference for color conversion? */
1648 GLboolean SavePrefersFloat
;
1651 GLframebuffer
*DrawBuffer
; /**< buffer for writing */
1652 GLframebuffer
*ReadBuffer
; /**< buffer for reading */
1655 * Device driver function pointer table
1657 struct dd_function_table Driver
;
1659 void *DriverCtx
; /**< Points to device driver context/state */
1660 void *DriverMgrCtx
; /**< Points to device driver manager (optional)*/
1662 /* Core/Driver constants */
1663 struct gl_constants Const
;
1665 /* The various 4x4 matrix stacks */
1666 struct matrix_stack ModelviewMatrixStack
;
1667 struct matrix_stack ProjectionMatrixStack
;
1668 struct matrix_stack ColorMatrixStack
;
1669 struct matrix_stack TextureMatrixStack
[MAX_TEXTURE_COORD_UNITS
];
1670 struct matrix_stack ProgramMatrixStack
[MAX_PROGRAM_MATRICES
];
1671 struct matrix_stack
*CurrentStack
; /* Points to one of the above stacks */
1673 /* Combined modelview and projection matrix */
1674 GLmatrix _ModelProjectMatrix
;
1677 GLuint CallDepth
; /* Current recursion calling depth */
1678 GLboolean ExecuteFlag
; /* Execute GL commands? */
1679 GLboolean CompileFlag
; /* Compile GL commands into display list? */
1680 Node
*CurrentListPtr
; /* Head of list being compiled */
1681 GLuint CurrentListNum
; /* Number of the list being compiled */
1682 Node
*CurrentBlock
; /* Pointer to current block of nodes */
1683 GLuint CurrentPos
; /* Index into current block of nodes */
1686 struct gl_extensions Extensions
;
1688 /* Renderer attribute stack */
1689 GLuint AttribStackDepth
;
1690 struct gl_attrib_node
*AttribStack
[MAX_ATTRIB_STACK_DEPTH
];
1692 /* Renderer attribute groups */
1693 struct gl_accum_attrib Accum
;
1694 struct gl_colorbuffer_attrib Color
;
1695 struct gl_current_attrib Current
;
1696 struct gl_depthbuffer_attrib Depth
;
1697 struct gl_eval_attrib Eval
;
1698 struct gl_fog_attrib Fog
;
1699 struct gl_hint_attrib Hint
;
1700 struct gl_light_attrib Light
;
1701 struct gl_line_attrib Line
;
1702 struct gl_list_attrib List
;
1703 struct gl_multisample_attrib Multisample
;
1704 struct gl_pixel_attrib Pixel
;
1705 struct gl_point_attrib Point
;
1706 struct gl_polygon_attrib Polygon
;
1707 GLuint PolygonStipple
[32];
1708 struct gl_scissor_attrib Scissor
;
1709 struct gl_stencil_attrib Stencil
;
1710 struct gl_texture_attrib Texture
;
1711 struct gl_transform_attrib Transform
;
1712 struct gl_viewport_attrib Viewport
;
1714 /* Other attribute groups */
1715 struct gl_histogram_attrib Histogram
;
1716 struct gl_minmax_attrib MinMax
;
1717 struct gl_convolution_attrib Convolution1D
;
1718 struct gl_convolution_attrib Convolution2D
;
1719 struct gl_convolution_attrib Separable2D
;
1721 /* Client attribute stack */
1722 GLuint ClientAttribStackDepth
;
1723 struct gl_attrib_node
*ClientAttribStack
[MAX_CLIENT_ATTRIB_STACK_DEPTH
];
1725 /* Client attribute groups */
1726 struct gl_array_attrib Array
; /* Vertex arrays */
1727 struct gl_pixelstore_attrib Pack
; /* Pixel packing */
1728 struct gl_pixelstore_attrib Unpack
; /* Pixel unpacking */
1730 struct gl_evaluators EvalMap
; /* All evaluators */
1731 struct gl_feedback Feedback
; /* Feedback */
1732 struct gl_selection Select
; /* Selection */
1734 struct gl_color_table ColorTable
; /* Pre-convolution */
1735 struct gl_color_table ProxyColorTable
; /* Pre-convolution */
1736 struct gl_color_table PostConvolutionColorTable
;
1737 struct gl_color_table ProxyPostConvolutionColorTable
;
1738 struct gl_color_table PostColorMatrixColorTable
;
1739 struct gl_color_table ProxyPostColorMatrixColorTable
;
1741 struct program_state Program
; /* for vertex or fragment progs */
1742 struct vertex_program_state VertexProgram
; /* GL_NV_vertex_program */
1743 struct fragment_program_state FragmentProgram
; /* GL_NV_fragment_program */
1745 GLenum ErrorValue
; /* Last error code */
1746 GLenum RenderMode
; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
1747 GLuint NewState
; /* bitwise-or of _NEW_* flags */
1750 GLuint _TriangleCaps
; /* bitwise-or of DD_* flags */
1751 GLuint _ImageTransferState
;/* bitwise-or of IMAGE_*_BIT flags */
1752 GLfloat _EyeZDir
[3];
1753 GLfloat _ModelViewInvScale
;
1754 GLuint _NeedEyeCoords
;
1755 GLuint _NeedNormals
; /* Are vertex normal vectors needed? */
1757 struct gl_shine_tab
*_ShineTable
[2]; /* Active shine tables */
1758 struct gl_shine_tab
*_ShineTabList
; /* Mru list of inactive shine tables */
1760 struct gl_list_extensions listext
; /* driver dlist extensions */
1763 GLboolean OcclusionResult
; /**< for GL_HP_occlusion_test */
1764 GLboolean OcclusionResultSaved
; /**< for GL_HP_occlusion_test */
1765 GLuint _Facing
; /* This is a hack for 2-sided stencil test. We don't */
1766 /* have a better way to communicate this value from */
1767 /* swrast_setup to swrast. */
1770 /* Z buffer stuff */
1771 GLuint DepthMax
; /**< Max depth buffer value */
1772 GLfloat DepthMaxF
; /**< Float max depth buffer value */
1773 GLfloat MRD
; /**< minimum resolvable difference in Z values */
1775 /** Should 3Dfx Glide driver catch signals? */
1776 GLboolean CatchSignals
;
1778 /** For debugging/development only */
1780 GLboolean FirstTimeCurrent
;
1782 /** Dither disable via MESA_NO_DITHER env var */
1785 GLboolean Rendering
;
1787 #if defined(MESA_TRACE)
1788 struct _glapi_table
*TraceDispatch
;
1789 trace_context_t
*TraceCtx
;
1791 void *TraceDispatch
;
1795 /* Core tnl module support */
1796 struct gl_tnl_module TnlModule
;
1798 /* Hooks for module contexts. These will eventually live
1799 * in the driver or elsewhere.
1801 void *swrast_context
;
1802 void *swsetup_context
;
1803 void *swtnl_context
;
1805 void *acache_context
;
1810 /* The string names for GL_POINT, GL_LINE_LOOP, etc */
1811 extern const char *_mesa_prim_name
[GL_POLYGON
+4];
1818 extern int MESA_VERBOSE
;
1819 extern int MESA_DEBUG_FLAGS
;
1821 # define MESA_VERBOSE 0
1822 # define MESA_DEBUG_FLAGS 0
1830 VERBOSE_VARRAY
= 0x0001,
1831 VERBOSE_TEXTURE
= 0x0002,
1832 VERBOSE_IMMEDIATE
= 0x0004,
1833 VERBOSE_PIPELINE
= 0x0008,
1834 VERBOSE_DRIVER
= 0x0010,
1835 VERBOSE_STATE
= 0x0020,
1836 VERBOSE_API
= 0x0040,
1837 VERBOSE_DISPLAY_LIST
= 0x0100,
1838 VERBOSE_LIGHTING
= 0x0200,
1839 VERBOSE_PRIMS
= 0x0400,
1840 VERBOSE_VERTS
= 0x0800
1845 DEBUG_ALWAYS_FLUSH
= 0x1
1850 #define Elements(x) sizeof(x)/sizeof(*(x))
1853 /* Eventually let the driver specify what statechanges require a flush:
1855 #define FLUSH_VERTICES(ctx, newstate) \
1857 if (MESA_VERBOSE & VERBOSE_STATE) \
1858 _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __FUNCTION__); \
1859 if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
1860 ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
1861 ctx->NewState |= newstate; \
1864 #define FLUSH_CURRENT(ctx, newstate) \
1866 if (MESA_VERBOSE & VERBOSE_STATE) \
1867 _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \
1868 if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
1869 ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
1870 ctx->NewState |= newstate; \
1873 #define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
1875 if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
1876 _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
1881 #define ASSERT_OUTSIDE_BEGIN_END(ctx) \
1883 if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
1884 _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
1889 #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
1891 ASSERT_OUTSIDE_BEGIN_END(ctx); \
1892 FLUSH_VERTICES(ctx, 0); \
1895 #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
1897 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
1898 FLUSH_VERTICES(ctx, 0); \
1904 #endif /* TYPES_H */