1 /* $Id: mtypes.h,v 1.107 2003/03/19 05:34:24 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:
113 * Fixed point arithmetic macros
116 #define FIXED_ONE 0x00004000
117 #define FIXED_HALF 0x00002000
118 #define FIXED_FRAC_MASK 0x00003FFF
119 #define FIXED_SCALE 16384.0f
120 #define FIXED_SHIFT 14
122 #define FIXED_ONE 0x00000800
123 #define FIXED_HALF 0x00000400
124 #define FIXED_FRAC_MASK 0x000007FF
125 #define FIXED_SCALE 2048.0f
126 #define FIXED_SHIFT 11
128 #define FIXED_INT_MASK (~FIXED_FRAC_MASK)
129 #define FIXED_EPSILON 1
130 #define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
131 #define IntToFixed(I) ((I) << FIXED_SHIFT)
132 #define FixedToInt(X) ((X) >> FIXED_SHIFT)
133 #define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)
134 #define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
135 #define FixedFloor(X) ((X) & FIXED_INT_MASK)
136 #define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
137 #define PosFloatToFixed(X) FloatToFixed(X)
138 #define SignedFloatToFixed(X) FloatToFixed(X)
143 * Some forward type declarations
145 struct _mesa_HashTable
;
146 struct gl_texture_image
;
147 struct gl_texture_object
;
148 typedef struct __GLcontextRec GLcontext
;
149 typedef struct __GLcontextModesRec GLvisual
;
150 typedef struct gl_frame_buffer GLframebuffer
;
154 /* These define the aliases between numbered vertex attributes and
155 * conventional OpenGL vertex attributes. We use these values in
156 * quite a few places. New in Mesa 4.1.
158 #define VERT_ATTRIB_POS 0
159 #define VERT_ATTRIB_WEIGHT 1
160 #define VERT_ATTRIB_NORMAL 2
161 #define VERT_ATTRIB_COLOR0 3
162 #define VERT_ATTRIB_COLOR1 4
163 #define VERT_ATTRIB_FOG 5
164 #define VERT_ATTRIB_SIX 6
165 #define VERT_ATTRIB_SEVEN 7
166 #define VERT_ATTRIB_TEX0 8
167 #define VERT_ATTRIB_TEX1 9
168 #define VERT_ATTRIB_TEX2 10
169 #define VERT_ATTRIB_TEX3 11
170 #define VERT_ATTRIB_TEX4 12
171 #define VERT_ATTRIB_TEX5 13
172 #define VERT_ATTRIB_TEX6 14
173 #define VERT_ATTRIB_TEX7 15
174 #define VERT_ATTRIB_MAX 16
176 /* These are used in bitfields in many places */
177 #define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
178 #define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
179 #define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
180 #define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
181 #define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
182 #define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
183 #define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX)
184 #define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
185 #define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
186 #define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
187 #define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
188 #define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
189 #define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
190 #define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
191 #define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
192 #define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
194 #define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
199 * Maximum number of temporary vertices required for clipping. (Used
200 * in array_cache and tnl modules).
202 #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
205 /* Data structure for color tables */
206 struct gl_color_table
{
207 GLenum Format
; /* GL_ALPHA, GL_RGB, GL_RGB, etc */
209 GLuint Size
; /* number of entries (rows) in table */
210 GLvoid
*Table
; /* either GLfloat * or GLchan * */
211 GLboolean FloatTable
; /* are entries stored as floats? */
216 GLubyte LuminanceSize
;
217 GLubyte IntensitySize
;
222 * Bit flags used for updating material values.
224 #define FRONT_AMBIENT_BIT 0x1
225 #define BACK_AMBIENT_BIT 0x2
226 #define FRONT_DIFFUSE_BIT 0x4
227 #define BACK_DIFFUSE_BIT 0x8
228 #define FRONT_SPECULAR_BIT 0x10
229 #define BACK_SPECULAR_BIT 0x20
230 #define FRONT_EMISSION_BIT 0x40
231 #define BACK_EMISSION_BIT 0x80
232 #define FRONT_SHININESS_BIT 0x100
233 #define BACK_SHININESS_BIT 0x200
234 #define FRONT_INDEXES_BIT 0x400
235 #define BACK_INDEXES_BIT 0x800
237 #define FRONT_MATERIAL_BITS (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT | \
238 FRONT_DIFFUSE_BIT | FRONT_SPECULAR_BIT | \
239 FRONT_SHININESS_BIT | FRONT_INDEXES_BIT)
241 #define BACK_MATERIAL_BITS (BACK_EMISSION_BIT | BACK_AMBIENT_BIT | \
242 BACK_DIFFUSE_BIT | BACK_SPECULAR_BIT | \
243 BACK_SHININESS_BIT | BACK_INDEXES_BIT)
245 #define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
250 * Specular exponent and material shininess lookup table sizes:
252 #define EXP_TABLE_SIZE 512
253 #define SHINE_TABLE_SIZE 256
255 struct gl_shine_tab
{
256 struct gl_shine_tab
*next
, *prev
;
257 GLfloat tab
[SHINE_TABLE_SIZE
+1];
264 struct gl_light
*next
; /* double linked list with sentinel */
265 struct gl_light
*prev
;
267 GLfloat Ambient
[4]; /* ambient color */
268 GLfloat Diffuse
[4]; /* diffuse color */
269 GLfloat Specular
[4]; /* specular color */
270 GLfloat EyePosition
[4]; /* position in eye coordinates */
271 GLfloat EyeDirection
[4]; /* spotlight dir in eye coordinates */
272 GLfloat SpotExponent
;
273 GLfloat SpotCutoff
; /* in degress */
274 GLfloat _CosCutoff
; /* = MAX(0, cos(SpotCutoff)) */
275 GLfloat ConstantAttenuation
;
276 GLfloat LinearAttenuation
;
277 GLfloat QuadraticAttenuation
;
278 GLboolean Enabled
; /* On/off flag */
281 GLuint _Flags
; /* State */
283 GLfloat _Position
[4]; /* position in eye/obj coordinates */
284 GLfloat _VP_inf_norm
[3]; /* Norm direction to infinite light */
285 GLfloat _h_inf_norm
[3]; /* Norm( _VP_inf_norm + <0,0,1> ) */
286 GLfloat _NormDirection
[4]; /* normalized spotlight direction */
287 GLfloat _VP_inf_spot_attenuation
;
289 GLfloat _SpotExpTable
[EXP_TABLE_SIZE
][2]; /* to replace a pow() call */
290 GLfloat _MatAmbient
[2][3]; /* material ambient * light ambient */
291 GLfloat _MatDiffuse
[2][3]; /* material diffuse * light diffuse */
292 GLfloat _MatSpecular
[2][3]; /* material spec * light specular */
293 GLfloat _dli
; /* CI diffuse light intensity */
294 GLfloat _sli
; /* CI specular light intensity */
298 struct gl_lightmodel
{
299 GLfloat Ambient
[4]; /* ambient color */
300 GLboolean LocalViewer
; /* Local (or infinite) view point? */
301 GLboolean TwoSide
; /* Two (or one) sided lighting? */
302 GLenum ColorControl
; /* either GL_SINGLE_COLOR */
303 /* or GL_SEPARATE_SPECULAR_COLOR */
314 GLfloat AmbientIndex
; /* for color index lighting */
315 GLfloat DiffuseIndex
; /* for color index lighting */
316 GLfloat SpecularIndex
; /* for color index lighting */
321 * Attribute structures:
322 * We define a struct for each attribute group to make pushing and
323 * popping attributes easy. Also it's a good organization.
325 struct gl_accum_attrib
{
326 GLfloat ClearColor
[4]; /* Accumulation buffer clear color */
331 * Used in _DrawDestMask and _ReadSrcMask below to identify color buffers.
333 #define FRONT_LEFT_BIT 0x1
334 #define FRONT_RIGHT_BIT 0x2
335 #define BACK_LEFT_BIT 0x4
336 #define BACK_RIGHT_BIT 0x8
337 #define AUX0_BIT 0x10
338 #define AUX1_BIT 0x20
339 #define AUX2_BIT 0x40
340 #define AUX3_BIT 0x80
342 struct gl_colorbuffer_attrib
{
343 GLuint ClearIndex
; /* Index to use for glClear */
344 GLclampf ClearColor
[4]; /* Color to use for glClear */
346 GLuint IndexMask
; /* Color index write mask */
347 GLubyte ColorMask
[4]; /* Each flag is 0xff or 0x0 */
349 GLenum DrawBuffer
; /* Which buffer to draw into */
350 GLubyte _DrawDestMask
; /* bitwise-OR of FRONT/BACK_LEFT/RIGHT_BITs */
353 GLboolean AlphaEnabled
; /* Alpha test enabled flag */
354 GLenum AlphaFunc
; /* Alpha test function */
358 GLboolean BlendEnabled
; /* Blending enabled flag */
359 GLenum BlendSrcRGB
; /* Blending source operator */
360 GLenum BlendDstRGB
; /* Blending destination operator */
361 GLenum BlendSrcA
; /* GL_INGR_blend_func_separate */
362 GLenum BlendDstA
; /* GL_INGR_blend_func_separate */
363 GLenum BlendEquation
;
364 GLfloat BlendColor
[4];
367 GLenum LogicOp
; /* Logic operator */
368 GLboolean IndexLogicOpEnabled
; /* Color index logic op enabled flag */
369 GLboolean ColorLogicOpEnabled
; /* RGBA logic op enabled flag */
371 GLboolean DitherFlag
; /* Dither enable flag */
375 struct gl_current_attrib
{
376 /* These values valid only when FLUSH_VERTICES has been called.
378 GLfloat Attrib
[VERT_ATTRIB_MAX
][4]; /* Current vertex attributes */
379 /* indexed by VERT_ATTRIB_* */
380 GLuint Index
; /* Current color index */
381 GLboolean EdgeFlag
; /* Current edge flag */
383 /* These values are always valid. BTW, note how similar this set of
384 * attributes is to the SWvertex datatype in the software rasterizer...
386 GLfloat RasterPos
[4]; /* Current raster position */
387 GLfloat RasterDistance
; /* Current raster distance */
388 GLfloat RasterColor
[4]; /* Current raster color */
389 GLfloat RasterSecondaryColor
[4]; /* Current rast 2ndary color */
390 GLuint RasterIndex
; /* Current raster index */
391 GLfloat RasterTexCoords
[MAX_TEXTURE_COORD_UNITS
][4];
392 GLboolean RasterPosValid
; /* Raster pos valid flag */
396 struct gl_depthbuffer_attrib
{
397 GLenum Func
; /* Function for depth buffer compare */
398 GLfloat Clear
; /* Value to clear depth buffer to */
399 GLboolean Test
; /* Depth buffering enabled flag */
400 GLboolean Mask
; /* Depth buffer writable? */
401 GLboolean OcclusionTest
; /* GL_HP_occlusion_test */
405 struct gl_enable_attrib
{
407 GLboolean AutoNormal
;
410 GLboolean ColorMaterial
;
411 GLboolean ColorTable
; /* SGI_color_table */
412 GLboolean PostColorMatrixColorTable
; /* SGI_color_table */
413 GLboolean PostConvolutionColorTable
; /* SGI_color_table */
414 GLboolean Convolution1D
;
415 GLboolean Convolution2D
;
416 GLboolean Separable2D
;
422 GLboolean Light
[MAX_LIGHTS
];
424 GLboolean LineSmooth
;
425 GLboolean LineStipple
;
426 GLboolean IndexLogicOp
;
427 GLboolean ColorLogicOp
;
428 GLboolean Map1Color4
;
430 GLboolean Map1Normal
;
431 GLboolean Map1TextureCoord1
;
432 GLboolean Map1TextureCoord2
;
433 GLboolean Map1TextureCoord3
;
434 GLboolean Map1TextureCoord4
;
435 GLboolean Map1Vertex3
;
436 GLboolean Map1Vertex4
;
437 GLboolean Map1Attrib
[16]; /* GL_NV_vertex_program */
438 GLboolean Map2Color4
;
440 GLboolean Map2Normal
;
441 GLboolean Map2TextureCoord1
;
442 GLboolean Map2TextureCoord2
;
443 GLboolean Map2TextureCoord3
;
444 GLboolean Map2TextureCoord4
;
445 GLboolean Map2Vertex3
;
446 GLboolean Map2Vertex4
;
447 GLboolean Map2Attrib
[16]; /* GL_NV_vertex_program */
450 GLboolean PixelTexture
;
451 GLboolean PointSmooth
;
452 GLboolean PolygonOffsetPoint
;
453 GLboolean PolygonOffsetLine
;
454 GLboolean PolygonOffsetFill
;
455 GLboolean PolygonSmooth
;
456 GLboolean PolygonStipple
;
457 GLboolean RescaleNormals
;
460 GLboolean MultisampleEnabled
; /* GL_ARB_multisample */
461 GLboolean SampleAlphaToCoverage
; /* GL_ARB_multisample */
462 GLboolean SampleAlphaToOne
; /* GL_ARB_multisample */
463 GLboolean SampleCoverage
; /* GL_ARB_multisample */
464 GLboolean SampleCoverageInvert
; /* GL_ARB_multisample */
465 GLboolean RasterPositionUnclipped
; /* GL_IBM_rasterpos_clip */
466 GLuint Texture
[MAX_TEXTURE_IMAGE_UNITS
];
467 GLuint TexGen
[MAX_TEXTURE_COORD_UNITS
];
468 /* SGI_texture_color_table */
469 GLboolean TextureColorTable
[MAX_TEXTURE_IMAGE_UNITS
];
470 /* GL_NV_vertex_program */
471 GLboolean VertexProgram
;
472 GLboolean VertexProgramPointSize
;
473 GLboolean VertexProgramTwoSide
;
474 /* GL_NV_point_sprite */
475 GLboolean PointSprite
;
479 struct gl_eval_attrib
{
481 GLboolean Map1Color4
;
483 GLboolean Map1Normal
;
484 GLboolean Map1TextureCoord1
;
485 GLboolean Map1TextureCoord2
;
486 GLboolean Map1TextureCoord3
;
487 GLboolean Map1TextureCoord4
;
488 GLboolean Map1Vertex3
;
489 GLboolean Map1Vertex4
;
490 GLboolean Map1Attrib
[16]; /* GL_NV_vertex_program */
491 GLboolean Map2Color4
;
493 GLboolean Map2Normal
;
494 GLboolean Map2TextureCoord1
;
495 GLboolean Map2TextureCoord2
;
496 GLboolean Map2TextureCoord3
;
497 GLboolean Map2TextureCoord4
;
498 GLboolean Map2Vertex3
;
499 GLboolean Map2Vertex4
;
500 GLboolean Map2Attrib
[16]; /* GL_NV_vertex_program */
501 GLboolean AutoNormal
;
502 /* Map Grid endpoints and divisions and calculated du values */
504 GLfloat MapGrid1u1
, MapGrid1u2
, MapGrid1du
;
505 GLint MapGrid2un
, MapGrid2vn
;
506 GLfloat MapGrid2u1
, MapGrid2u2
, MapGrid2du
;
507 GLfloat MapGrid2v1
, MapGrid2v2
, MapGrid2dv
;
511 struct gl_fog_attrib
{
512 GLboolean Enabled
; /* Fog enabled flag */
513 GLfloat Color
[4]; /* Fog color */
514 GLfloat Density
; /* Density >= 0.0 */
515 GLfloat Start
; /* Start distance in eye coords */
516 GLfloat End
; /* End distance in eye coords */
517 GLfloat Index
; /* Fog index */
518 GLenum Mode
; /* Fog mode */
519 GLboolean ColorSumEnabled
;
520 GLenum FogCoordinateSource
; /* GL_EXT_fog_coord */
524 struct gl_hint_attrib
{
525 /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */
526 GLenum PerspectiveCorrection
;
529 GLenum PolygonSmooth
;
531 GLenum ClipVolumeClipping
; /* GL_EXT_clip_volume_hint */
532 GLenum TextureCompression
; /* GL_ARB_texture_compression */
533 GLenum GenerateMipmap
; /* GL_SGIS_generate_mipmap */
537 struct gl_histogram_attrib
{
538 GLuint Width
; /* number of table entries */
539 GLint Format
; /* GL_ALPHA, GL_RGB, etc */
540 GLuint Count
[HISTOGRAM_TABLE_SIZE
][4]; /* the histogram */
541 GLboolean Sink
; /* terminate image transfer? */
542 GLubyte RedSize
; /* Bits per counter */
546 GLubyte LuminanceSize
;
550 struct gl_minmax_attrib
{
553 GLfloat Min
[4], Max
[4]; /* RGBA */
557 struct gl_convolution_attrib
{
559 GLenum InternalFormat
;
562 GLfloat Filter
[MAX_CONVOLUTION_WIDTH
* MAX_CONVOLUTION_HEIGHT
* 4];
566 #define LIGHT_SPOT 0x1
567 #define LIGHT_LOCAL_VIEWER 0x2
568 #define LIGHT_POSITIONAL 0x4
569 #define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
571 struct gl_light_attrib
{
572 struct gl_light Light
[MAX_LIGHTS
]; /* Array of lights */
573 struct gl_lightmodel Model
; /* Lighting model */
575 /* Must flush FLUSH_VERTICES before referencing:
577 struct gl_material Material
[2]; /* Material 0=front, 1=back */
579 GLboolean Enabled
; /* Lighting enabled flag */
580 GLenum ShadeModel
; /* GL_FLAT or GL_SMOOTH */
581 GLenum ColorMaterialFace
; /* GL_FRONT, BACK or FRONT_AND_BACK */
582 GLenum ColorMaterialMode
; /* GL_AMBIENT, GL_DIFFUSE, etc */
583 GLuint ColorMaterialBitmask
; /* bitmask formed from Face and Mode */
584 GLboolean ColorMaterialEnabled
;
586 struct gl_light EnabledList
; /* List sentinel */
588 /* Derived for optimizations: */
589 GLboolean _NeedVertices
; /* Use fast shader? */
590 GLuint _Flags
; /* LIGHT_* flags, see above */
591 GLfloat _BaseColor
[2][3];
595 struct gl_line_attrib
{
596 GLboolean SmoothFlag
; /* GL_LINE_SMOOTH enabled? */
597 GLboolean StippleFlag
; /* GL_LINE_STIPPLE enabled? */
598 GLushort StipplePattern
; /* Stipple pattern */
599 GLint StippleFactor
; /* Stipple repeat factor */
600 GLfloat Width
; /* Line width */
601 GLfloat _Width
; /* Clamped Line width */
605 struct gl_list_attrib
{
610 struct gl_list_opcode
{
612 void (*execute
)( GLcontext
*ctx
, void *data
);
613 void (*destroy
)( GLcontext
*ctx
, void *data
);
614 void (*print
)( GLcontext
*ctx
, void *data
);
617 #define GL_MAX_EXT_OPCODES 16
619 struct gl_list_extensions
{
620 struct gl_list_opcode opcode
[GL_MAX_EXT_OPCODES
];
625 struct gl_multisample_attrib
{
627 GLboolean SampleAlphaToCoverage
;
628 GLboolean SampleAlphaToOne
;
629 GLboolean SampleCoverage
;
630 GLfloat SampleCoverageValue
;
631 GLboolean SampleCoverageInvert
;
635 struct gl_pixel_attrib
{
636 GLenum ReadBuffer
; /* src buffer for glRead/CopyPixels */
637 GLubyte _ReadSrcMask
; /* Not really a mask, but like _DrawDestMask */
638 /* May be: FRONT_LEFT_BIT, BACK_LEFT_BIT, */
639 /* FRONT_RIGHT_BIT or BACK_RIGHT_BIT. */
640 GLfloat RedBias
, RedScale
;
641 GLfloat GreenBias
, GreenScale
;
642 GLfloat BlueBias
, BlueScale
;
643 GLfloat AlphaBias
, AlphaScale
;
644 GLfloat DepthBias
, DepthScale
;
645 GLint IndexShift
, IndexOffset
;
646 GLboolean MapColorFlag
;
647 GLboolean MapStencilFlag
;
648 GLfloat ZoomX
, ZoomY
;
649 /* XXX move these out of gl_pixel_attrib */
650 GLint MapStoSsize
; /* Size of each pixel map */
660 GLint MapStoS
[MAX_PIXEL_MAP_TABLE
]; /* Pixel map tables */
661 GLint MapItoI
[MAX_PIXEL_MAP_TABLE
];
662 GLfloat MapItoR
[MAX_PIXEL_MAP_TABLE
];
663 GLfloat MapItoG
[MAX_PIXEL_MAP_TABLE
];
664 GLfloat MapItoB
[MAX_PIXEL_MAP_TABLE
];
665 GLfloat MapItoA
[MAX_PIXEL_MAP_TABLE
];
666 GLubyte MapItoR8
[MAX_PIXEL_MAP_TABLE
]; /* converted to 8-bit color */
667 GLubyte MapItoG8
[MAX_PIXEL_MAP_TABLE
];
668 GLubyte MapItoB8
[MAX_PIXEL_MAP_TABLE
];
669 GLubyte MapItoA8
[MAX_PIXEL_MAP_TABLE
];
670 GLfloat MapRtoR
[MAX_PIXEL_MAP_TABLE
];
671 GLfloat MapGtoG
[MAX_PIXEL_MAP_TABLE
];
672 GLfloat MapBtoB
[MAX_PIXEL_MAP_TABLE
];
673 GLfloat MapAtoA
[MAX_PIXEL_MAP_TABLE
];
674 /* GL_EXT_histogram */
675 GLboolean HistogramEnabled
;
676 GLboolean MinMaxEnabled
;
677 /* GL_SGIS_pixel_texture */
678 GLboolean PixelTextureEnabled
;
679 GLenum FragmentRgbSource
;
680 GLenum FragmentAlphaSource
;
681 /* GL_SGI_color_matrix */
682 GLfloat PostColorMatrixScale
[4]; /* RGBA */
683 GLfloat PostColorMatrixBias
[4]; /* RGBA */
684 /* GL_SGI_color_table */
685 GLfloat ColorTableScale
[4];
686 GLfloat ColorTableBias
[4];
687 GLboolean ColorTableEnabled
;
688 GLfloat PCCTscale
[4];
690 GLboolean PostConvolutionColorTableEnabled
;
691 GLfloat PCMCTscale
[4];
692 GLfloat PCMCTbias
[4];
693 GLboolean PostColorMatrixColorTableEnabled
;
694 /* GL_SGI_texture_color_table */
695 GLfloat TextureColorTableScale
[4];
696 GLfloat TextureColorTableBias
[4];
698 GLboolean Convolution1DEnabled
;
699 GLboolean Convolution2DEnabled
;
700 GLboolean Separable2DEnabled
;
701 GLfloat ConvolutionBorderColor
[3][4];
702 GLenum ConvolutionBorderMode
[3];
703 GLfloat ConvolutionFilterScale
[3][4];
704 GLfloat ConvolutionFilterBias
[3][4];
705 GLfloat PostConvolutionScale
[4]; /* RGBA */
706 GLfloat PostConvolutionBias
[4]; /* RGBA */
710 struct gl_point_attrib
{
711 GLboolean SmoothFlag
; /* True if GL_POINT_SMOOTH is enabled */
712 GLfloat Size
; /* User-specified point size */
713 GLfloat _Size
; /* Size clamped to Const.Min/MaxPointSize */
714 GLfloat Params
[3]; /* GL_EXT_point_parameters */
715 GLfloat MinSize
, MaxSize
; /* GL_EXT_point_parameters */
716 GLfloat Threshold
; /* GL_EXT_point_parameters */
717 GLboolean _Attenuated
; /* True if Params != [1, 0, 0] */
718 GLboolean PointSprite
; /* GL_NV_point_sprite */
719 GLboolean CoordReplace
[MAX_TEXTURE_COORD_UNITS
]; /* GL_NV_point_sprite */
720 GLenum SpriteRMode
; /* GL_NV_point_sprite */
724 struct gl_polygon_attrib
{
725 GLenum FrontFace
; /* Either GL_CW or GL_CCW */
726 GLenum FrontMode
; /* Either GL_POINT, GL_LINE or GL_FILL */
727 GLenum BackMode
; /* Either GL_POINT, GL_LINE or GL_FILL */
728 GLboolean _FrontBit
; /* 0=GL_CCW, 1=GL_CW */
729 GLboolean CullFlag
; /* Culling on/off flag */
730 GLboolean SmoothFlag
; /* True if GL_POLYGON_SMOOTH is enabled */
731 GLboolean StippleFlag
; /* True if GL_POLYGON_STIPPLE is enabled */
732 GLenum CullFaceMode
; /* Culling mode GL_FRONT or GL_BACK */
733 GLfloat OffsetFactor
; /* Polygon offset factor, from user */
734 GLfloat OffsetUnits
; /* Polygon offset units, from user */
735 GLboolean OffsetPoint
; /* Offset in GL_POINT mode */
736 GLboolean OffsetLine
; /* Offset in GL_LINE mode */
737 GLboolean OffsetFill
; /* Offset in GL_FILL mode */
741 struct gl_scissor_attrib
{
742 GLboolean Enabled
; /* Scissor test enabled? */
743 GLint X
, Y
; /* Lower left corner of box */
744 GLsizei Width
, Height
; /* Size of box */
748 struct gl_stencil_attrib
{
749 GLboolean Enabled
; /* Enabled flag */
750 GLboolean TestTwoSide
; /* GL_EXT_stencil_two_side */
751 GLubyte ActiveFace
; /* GL_EXT_stencil_two_side (0 or 1) */
752 GLenum Function
[2]; /* Stencil function */
753 GLenum FailFunc
[2]; /* Fail function */
754 GLenum ZPassFunc
[2]; /* Depth buffer pass function */
755 GLenum ZFailFunc
[2]; /* Depth buffer fail function */
756 GLstencil Ref
[2]; /* Reference value */
757 GLstencil ValueMask
[2]; /* Value mask */
758 GLstencil WriteMask
[2]; /* Write mask */
759 GLstencil Clear
; /* Clear value */
763 #define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */
765 #define TEXTURE_1D_INDEX 0
766 #define TEXTURE_2D_INDEX 1
767 #define TEXTURE_3D_INDEX 2
768 #define TEXTURE_CUBE_INDEX 3
769 #define TEXTURE_RECT_INDEX 4
771 /* Texture.Unit[]._ReallyEnabled flags: */
772 #define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX)
773 #define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX)
774 #define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX)
775 #define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
776 #define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX)
779 /* TexGenEnabled flags */
785 /* Bitmap versions of the GL_ constants. */
786 #define TEXGEN_SPHERE_MAP 0x1
787 #define TEXGEN_OBJ_LINEAR 0x2
788 #define TEXGEN_EYE_LINEAR 0x4
789 #define TEXGEN_REFLECTION_MAP_NV 0x8
790 #define TEXGEN_NORMAL_MAP_NV 0x10
792 #define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
793 TEXGEN_REFLECTION_MAP_NV | \
794 TEXGEN_NORMAL_MAP_NV)
795 #define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
796 TEXGEN_REFLECTION_MAP_NV | \
797 TEXGEN_NORMAL_MAP_NV | \
800 /* A selection of state flags to make driver and module's lives easier. */
801 #define ENABLE_TEXGEN0 0x1
802 #define ENABLE_TEXGEN1 0x2
803 #define ENABLE_TEXGEN2 0x4
804 #define ENABLE_TEXGEN3 0x8
805 #define ENABLE_TEXGEN4 0x10
806 #define ENABLE_TEXGEN5 0x20
807 #define ENABLE_TEXGEN6 0x40
808 #define ENABLE_TEXGEN7 0x80
810 #define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */
811 #define ENABLE_TEXMAT1 0x2
812 #define ENABLE_TEXMAT2 0x4
813 #define ENABLE_TEXMAT3 0x8
814 #define ENABLE_TEXMAT4 0x10
815 #define ENABLE_TEXMAT5 0x20
816 #define ENABLE_TEXMAT6 0x40
817 #define ENABLE_TEXMAT7 0x80
819 #define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
820 #define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
823 * If teximage is color-index, texelOut returns GLchan[1].
824 * If teximage is depth, texelOut returns GLfloat[1].
825 * Otherwise, texelOut returns GLchan[4].
827 typedef void (*FetchTexelFunc
)( const struct gl_texture_image
*texImage
,
828 GLint col
, GLint row
, GLint img
,
831 /* Texture format record */
832 struct gl_texture_format
{
833 GLint MesaFormat
; /* One of the MESA_FORMAT_* values */
835 GLenum BaseFormat
; /* Either GL_ALPHA, GL_INTENSITY, GL_LUMINANCE,
836 * GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA,
837 * GL_COLOR_INDEX or GL_DEPTH_COMPONENT.
839 GLubyte RedBits
; /* Bits per texel component */
840 GLubyte GreenBits
; /* These are just rough approximations for */
841 GLubyte BlueBits
; /* compressed texture formats. */
843 GLubyte LuminanceBits
;
844 GLubyte IntensityBits
;
848 GLint TexelBytes
; /* Bytes per texel (0 for compressed formats */
850 FetchTexelFunc FetchTexel1D
; /* Texel fetch function pointers */
851 FetchTexelFunc FetchTexel2D
;
852 FetchTexelFunc FetchTexel3D
;
856 /* Texture image record */
857 struct gl_texture_image
{
858 GLenum Format
; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
859 * GL_INTENSITY, GL_RGB, GL_RGBA,
860 * GL_COLOR_INDEX or GL_DEPTH_COMPONENT only.
861 * Used for choosing TexEnv arithmetic.
863 GLint IntFormat
; /* Internal format as given by the user */
864 GLuint Border
; /* 0 or 1 */
865 GLuint Width
; /* = 2^WidthLog2 + 2*Border */
866 GLuint Height
; /* = 2^HeightLog2 + 2*Border */
867 GLuint Depth
; /* = 2^DepthLog2 + 2*Border */
868 GLuint RowStride
; /* == Width unless IsClientData and padded */
869 GLuint Width2
; /* = Width - 2*Border */
870 GLuint Height2
; /* = Height - 2*Border */
871 GLuint Depth2
; /* = Depth - 2*Border */
872 GLuint WidthLog2
; /* = log2(Width2) */
873 GLuint HeightLog2
; /* = log2(Height2) */
874 GLuint DepthLog2
; /* = log2(Depth2) */
875 GLuint MaxLog2
; /* = MAX(WidthLog2, HeightLog2) */
876 GLfloat WidthScale
; /* used for mipmap lod computation */
877 GLfloat HeightScale
; /* used for mipmap lod computation */
878 GLfloat DepthScale
; /* used for mipmap lod computation */
879 GLvoid
*Data
; /* Image data, accessed via FetchTexel() */
880 GLboolean IsClientData
; /* Data owned by client? */
883 const struct gl_texture_format
*TexFormat
;
885 FetchTexelFunc FetchTexel
; /* Texel fetch function pointer */
887 GLboolean IsCompressed
; /* GL_ARB_texture_compression */
888 GLuint CompressedSize
; /* GL_ARB_texture_compression */
890 /* For device driver: */
891 void *DriverData
; /* Arbitrary device driver data */
895 /* Texture object record */
896 struct gl_texture_object
{
897 _glthread_Mutex Mutex
; /* for thread safety */
898 GLint RefCount
; /* reference count */
899 GLuint Name
; /* an unsigned integer */
900 GLenum Target
; /* GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
901 GLfloat Priority
; /* in [0,1] */
902 GLfloat BorderColor
[4]; /* unclamped */
903 GLchan _BorderChan
[4]; /* clamped, as GLchan */
904 GLenum WrapS
; /* Wrap modes are: GL_CLAMP, REPEAT */
905 GLenum WrapT
; /* GL_CLAMP_TO_EDGE, and */
906 GLenum WrapR
; /* GL_CLAMP_TO_BORDER_ARB */
907 GLenum MinFilter
; /* minification filter */
908 GLenum MagFilter
; /* magnification filter */
909 GLfloat MinLod
; /* min lambda, OpenGL 1.2 */
910 GLfloat MaxLod
; /* max lambda, OpenGL 1.2 */
911 GLint BaseLevel
; /* min mipmap level, OpenGL 1.2 */
912 GLint MaxLevel
; /* max mipmap level, OpenGL 1.2 */
913 GLfloat MaxAnisotropy
; /* GL_EXT_texture_filter_anisotropic */
914 GLboolean CompareFlag
; /* GL_SGIX_shadow */
915 GLenum CompareOperator
; /* GL_SGIX_shadow */
916 GLfloat ShadowAmbient
;
917 GLenum CompareMode
; /* GL_ARB_shadow */
918 GLenum CompareFunc
; /* GL_ARB_shadow */
919 GLenum DepthMode
; /* GL_ARB_depth_texture */
920 GLint _MaxLevel
; /* actual max mipmap level (q in the spec) */
921 GLfloat _MaxLambda
; /* = _MaxLevel - BaseLevel (q - b in spec) */
922 GLboolean GenerateMipmap
; /* GL_SGIS_generate_mipmap */
924 struct gl_texture_image
*Image
[MAX_TEXTURE_LEVELS
];
926 /* Texture cube faces */
927 /* Image[] is alias for *PosX[MAX_TEXTURE_LEVELS]; */
928 struct gl_texture_image
*NegX
[MAX_TEXTURE_LEVELS
];
929 struct gl_texture_image
*PosY
[MAX_TEXTURE_LEVELS
];
930 struct gl_texture_image
*NegY
[MAX_TEXTURE_LEVELS
];
931 struct gl_texture_image
*PosZ
[MAX_TEXTURE_LEVELS
];
932 struct gl_texture_image
*NegZ
[MAX_TEXTURE_LEVELS
];
934 /* GL_EXT_paletted_texture */
935 struct gl_color_table Palette
;
937 GLboolean Complete
; /* Is texture object complete? */
938 struct gl_texture_object
*Next
; /* Next in linked list */
940 /* For device driver: */
941 void *DriverData
; /* Arbitrary device driver data */
945 /* Texture unit record */
946 struct gl_texture_unit
{
947 GLuint Enabled
; /* bitmask of TEXTURE_*_BIT flags */
948 GLuint _ReallyEnabled
; /* 0 or exactly one of TEXTURE_*_BIT flags */
950 GLenum EnvMode
; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
952 GLuint TexGenEnabled
; /* Bitwise-OR of [STRQ]_BIT values */
953 GLenum GenModeS
; /* Tex coord generation mode, either */
954 GLenum GenModeT
; /* GL_OBJECT_LINEAR, or */
955 GLenum GenModeR
; /* GL_EYE_LINEAR, or */
956 GLenum GenModeQ
; /* GL_SPHERE_MAP */
961 GLuint _GenFlags
; /* bitwise or of GenBit[STRQ] */
962 GLfloat ObjectPlaneS
[4];
963 GLfloat ObjectPlaneT
[4];
964 GLfloat ObjectPlaneR
[4];
965 GLfloat ObjectPlaneQ
[4];
966 GLfloat EyePlaneS
[4];
967 GLfloat EyePlaneT
[4];
968 GLfloat EyePlaneR
[4];
969 GLfloat EyePlaneQ
[4];
970 GLfloat LodBias
; /* for biasing mipmap levels */
972 /* GL_EXT_texture_env_combine */
973 GLenum CombineModeRGB
; /* GL_REPLACE, GL_DECAL, GL_ADD, etc. */
974 GLenum CombineModeA
; /* GL_REPLACE, GL_DECAL, GL_ADD, etc. */
975 GLenum CombineSourceRGB
[3]; /* GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
976 GLenum CombineSourceA
[3]; /* GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
977 GLenum CombineOperandRGB
[3]; /* SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */
978 GLenum CombineOperandA
[3]; /* SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */
979 GLuint CombineScaleShiftRGB
; /* 0, 1 or 2 */
980 GLuint CombineScaleShiftA
; /* 0, 1 or 2 */
982 struct gl_texture_object
*Current1D
;
983 struct gl_texture_object
*Current2D
;
984 struct gl_texture_object
*Current3D
;
985 struct gl_texture_object
*CurrentCubeMap
; /* GL_ARB_texture_cube_map */
986 struct gl_texture_object
*CurrentRect
; /* GL_NV_texture_rectangle */
988 struct gl_texture_object
*_Current
; /* Points to really enabled tex obj */
990 struct gl_texture_object Saved1D
; /* only used by glPush/PopAttrib */
991 struct gl_texture_object Saved2D
;
992 struct gl_texture_object Saved3D
;
993 struct gl_texture_object SavedCubeMap
;
994 struct gl_texture_object SavedRect
;
996 /* GL_SGI_texture_color_table */
997 struct gl_color_table ColorTable
;
998 struct gl_color_table ProxyColorTable
;
999 GLboolean ColorTableEnabled
;
1003 /* The texture attribute group */
1004 struct gl_texture_attrib
{
1006 GLuint CurrentUnit
; /* Active texture unit */
1008 GLuint _EnabledUnits
; /* one bit set for each really-enabled unit */
1009 GLuint _GenFlags
; /* for texgen */
1010 GLuint _TexGenEnabled
;
1011 GLuint _TexMatEnabled
;
1013 struct gl_texture_unit Unit
[MAX_TEXTURE_UNITS
];
1015 struct gl_texture_object
*Proxy1D
;
1016 struct gl_texture_object
*Proxy2D
;
1017 struct gl_texture_object
*Proxy3D
;
1018 struct gl_texture_object
*ProxyCubeMap
;
1019 struct gl_texture_object
*ProxyRect
;
1021 /* GL_EXT_shared_texture_palette */
1022 GLboolean SharedPalette
;
1023 struct gl_color_table Palette
;
1027 struct gl_transform_attrib
{
1028 GLenum MatrixMode
; /* Matrix mode */
1029 GLfloat EyeUserPlane
[MAX_CLIP_PLANES
][4];
1030 GLfloat _ClipUserPlane
[MAX_CLIP_PLANES
][4]; /* derived */
1031 GLuint ClipPlanesEnabled
; /* on/off bitmask */
1032 GLboolean Normalize
; /* Normalize all normals? */
1033 GLboolean RescaleNormals
; /* GL_EXT_rescale_normal */
1034 GLboolean RasterPositionUnclipped
; /* GL_IBM_rasterpos_clip */
1038 struct gl_viewport_attrib
{
1039 GLint X
, Y
; /* position */
1040 GLsizei Width
, Height
; /* size */
1041 GLfloat Near
, Far
; /* Depth buffer range */
1042 GLmatrix _WindowMap
; /* Mapping transformation as a matrix. */
1046 /* For the attribute stack: */
1047 struct gl_attrib_node
{
1050 struct gl_attrib_node
*next
;
1055 * Client pixel packing/unpacking attributes
1057 struct gl_pixelstore_attrib
{
1062 GLint ImageHeight
; /* for GL_EXT_texture3D */
1063 GLint SkipImages
; /* for GL_EXT_texture3D */
1064 GLboolean SwapBytes
;
1066 GLboolean ClientStorage
; /* GL_APPLE_client_storage */
1067 GLboolean Invert
; /* GL_MESA_pack_invert */
1071 #define CA_CLIENT_DATA 0x1 /* Data not alloced by mesa */
1075 * Client vertex array attributes
1077 struct gl_client_array
{
1080 GLsizei Stride
; /* user-specified stride */
1081 GLsizei StrideB
; /* actual stride in bytes */
1084 GLuint Enabled
; /* one of the _NEW_ARRAY_ bits */
1088 struct gl_array_attrib
{
1089 struct gl_client_array Vertex
; /* client data descriptors */
1090 struct gl_client_array Normal
;
1091 struct gl_client_array Color
;
1092 struct gl_client_array SecondaryColor
;
1093 struct gl_client_array FogCoord
;
1094 struct gl_client_array Index
;
1095 struct gl_client_array TexCoord
[MAX_TEXTURE_COORD_UNITS
];
1096 struct gl_client_array EdgeFlag
;
1098 struct gl_client_array VertexAttrib
[16]; /* GL_NV_vertex_program */
1100 GLint TexCoordInterleaveFactor
;
1101 GLint ActiveTexture
; /* Client Active Texture */
1105 GLuint _Enabled
; /* _NEW_ARRAY_* - bit set if array enabled */
1106 GLuint NewState
; /* _NEW_ARRAY_* */
1110 struct gl_feedback
{
1112 GLuint _Mask
; /* FB_* bits */
1119 struct gl_selection
{
1121 GLuint BufferSize
; /* size of SelectBuffer */
1122 GLuint BufferCount
; /* number of values in SelectBuffer */
1123 GLuint Hits
; /* number of records in SelectBuffer */
1124 GLuint NameStackDepth
;
1125 GLuint NameStack
[MAX_NAME_STACK_DEPTH
];
1127 GLfloat HitMinZ
, HitMaxZ
;
1132 * 1-D Evaluator control points
1135 GLuint Order
; /* Number of control points */
1136 GLfloat u1
, u2
, du
; /* u1, u2, 1.0/(u2-u1) */
1137 GLfloat
*Points
; /* Points to contiguous control points */
1142 * 2-D Evaluator control points
1145 GLuint Uorder
; /* Number of control points in U dimension */
1146 GLuint Vorder
; /* Number of control points in V dimension */
1149 GLfloat
*Points
; /* Points to contiguous control points */
1154 * All evalutator control points
1156 struct gl_evaluators
{
1158 struct gl_1d_map Map1Vertex3
;
1159 struct gl_1d_map Map1Vertex4
;
1160 struct gl_1d_map Map1Index
;
1161 struct gl_1d_map Map1Color4
;
1162 struct gl_1d_map Map1Normal
;
1163 struct gl_1d_map Map1Texture1
;
1164 struct gl_1d_map Map1Texture2
;
1165 struct gl_1d_map Map1Texture3
;
1166 struct gl_1d_map Map1Texture4
;
1167 struct gl_1d_map Map1Attrib
[16]; /* GL_NV_vertex_program */
1170 struct gl_2d_map Map2Vertex3
;
1171 struct gl_2d_map Map2Vertex4
;
1172 struct gl_2d_map Map2Index
;
1173 struct gl_2d_map Map2Color4
;
1174 struct gl_2d_map Map2Normal
;
1175 struct gl_2d_map Map2Texture1
;
1176 struct gl_2d_map Map2Texture2
;
1177 struct gl_2d_map Map2Texture3
;
1178 struct gl_2d_map Map2Texture4
;
1179 struct gl_2d_map Map2Attrib
[16]; /* GL_NV_vertex_program */
1184 /* NV_vertex_program runtime state */
1187 GLfloat Registers
[MAX_NV_VERTEX_PROGRAM_TEMPS
1188 + MAX_NV_VERTEX_PROGRAM_PARAMS
1189 + MAX_NV_VERTEX_PROGRAM_INPUTS
1190 + MAX_NV_VERTEX_PROGRAM_OUTPUTS
][4];
1191 GLint AddressReg
; /* might someday be a 4-vector */
1195 /* NV_fragment_program runtime state */
1198 GLfloat Registers
[MAX_NV_FRAGMENT_PROGRAM_TEMPS
1199 + MAX_NV_FRAGMENT_PROGRAM_PARAMS
1200 + MAX_NV_FRAGMENT_PROGRAM_INPUTS
1201 + MAX_NV_FRAGMENT_PROGRAM_OUTPUTS
1202 + MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS
][4];
1203 GLuint CondCodes
[4];
1207 /* Vertex and fragment instructions */
1208 struct vp_instruction
;
1209 struct fp_instruction
;
1211 /* Program parameters */
1212 struct program_parameter
1219 /* Base class for any kind of program object */
1223 GLubyte
*String
; /* Null-terminated program text */
1230 /* Vertex program object */
1231 struct vertex_program
1233 struct program Base
; /* base class */
1234 struct vp_instruction
*Instructions
; /* Compiled instructions */
1235 GLboolean IsPositionInvariant
; /* GL_NV_vertex_program1_1 */
1236 GLuint InputsRead
; /* Bitmask of which input regs are read */
1237 GLuint OutputsWritten
; /* Bitmask of which output regs are written to */
1241 /* Fragment program object */
1242 struct fragment_program
1244 struct program Base
; /* base class */
1245 struct fp_instruction
*Instructions
; /* Compiled instructions */
1246 GLuint InputsRead
; /* Bitmask of which input regs are read */
1247 GLuint OutputsWritten
; /* Bitmask of which output regs are written to */
1248 GLuint TexturesUsed
[MAX_TEXTURE_IMAGE_UNITS
]; /* TEXTURE_x_INDEX bitmask */
1249 GLfloat LocalParams
[MAX_NV_FRAGMENT_PROGRAM_PARAMS
][4];
1250 GLuint NumParameters
;
1251 struct program_parameter
*Parameters
; /* array [NumParameters] */
1256 * State common to vertex and fragment programs.
1258 struct program_state
{
1259 GLint ErrorPos
; /* GL_PROGRAM_ERROR_POSITION_NV */
1260 const char *ErrorString
; /* GL_PROGRAM_ERROR_STRING_NV */
1265 * State for GL_NV_vertex_program
1267 struct vertex_program_state
1269 GLboolean Enabled
; /* GL_VERTEX_PROGRAM_NV */
1270 GLboolean PointSizeEnabled
; /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
1271 GLboolean TwoSideEnabled
; /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
1272 struct vertex_program
*Current
; /* ptr to currently bound program */
1273 struct vp_machine Machine
; /* machine state */
1275 GLenum TrackMatrix
[MAX_NV_VERTEX_PROGRAM_PARAMS
/ 4];
1276 GLenum TrackMatrixTransform
[MAX_NV_VERTEX_PROGRAM_PARAMS
/ 4];
1281 * State for GL_NV_fragment_program
1283 struct fragment_program_state
1285 GLboolean Enabled
; /* GL_VERTEX_PROGRAM_NV */
1286 struct fragment_program
*Current
; /* ptr to currently bound program */
1287 struct fp_machine Machine
; /* machine state */
1292 * State which can be shared by multiple contexts:
1294 struct gl_shared_state
{
1295 _glthread_Mutex Mutex
; /* for thread safety */
1296 GLint RefCount
; /* Reference count */
1297 struct _mesa_HashTable
*DisplayList
; /* Display lists hash table */
1298 struct _mesa_HashTable
*TexObjects
; /* Texture objects hash table */
1299 struct gl_texture_object
*TexObjectList
;/* Linked list of texture objects */
1301 /* Default texture objects (shared by all multi-texture units) */
1302 struct gl_texture_object
*Default1D
;
1303 struct gl_texture_object
*Default2D
;
1304 struct gl_texture_object
*Default3D
;
1305 struct gl_texture_object
*DefaultCubeMap
;
1306 struct gl_texture_object
*DefaultRect
;
1308 /* GL_NV_vertex/_program */
1309 struct _mesa_HashTable
*Programs
;
1311 void *DriverData
; /* Device driver shared state */
1316 * A "frame buffer" is a color buffer and its optional ancillary buffers:
1317 * depth, accum, stencil, and software-simulated alpha buffers.
1318 * In C++ terms, think of this as a base class from which device drivers
1319 * will make derived classes.
1321 struct gl_frame_buffer
{
1322 GLvisual Visual
; /* The corresponding visual */
1324 GLuint Width
, Height
; /* size of frame buffer in pixels */
1326 GLboolean UseSoftwareDepthBuffer
;
1327 GLboolean UseSoftwareAccumBuffer
;
1328 GLboolean UseSoftwareStencilBuffer
;
1329 GLboolean UseSoftwareAlphaBuffers
;
1331 /* Software depth (aka Z) buffer */
1332 GLvoid
*DepthBuffer
; /* array [Width*Height] of GLushort or GLuint*/
1334 /* Software stencil buffer */
1335 GLstencil
*Stencil
; /* array [Width*Height] of GLstencil values */
1337 /* Software accumulation buffer */
1338 GLaccum
*Accum
; /* array [4*Width*Height] of GLaccum values */
1340 /* Software alpha planes */
1341 GLvoid
*FrontLeftAlpha
; /* array [Width*Height] of GLubyte */
1342 GLvoid
*BackLeftAlpha
; /* array [Width*Height] of GLubyte */
1343 GLvoid
*FrontRightAlpha
; /* array [Width*Height] of GLubyte */
1344 GLvoid
*BackRightAlpha
; /* array [Width*Height] of GLubyte */
1346 /* Drawing bounds: intersection of window size and scissor box */
1347 GLint _Xmin
, _Ymin
; /* inclusive */
1348 GLint _Xmax
, _Ymax
; /* exclusive */
1353 * Constants which may be overriden by device driver during context creation
1354 * but are never changed after that.
1356 struct gl_constants
{
1357 GLint MaxTextureLevels
;
1358 GLint Max3DTextureLevels
;
1359 GLint MaxCubeTextureLevels
; /* GL_ARB_texture_cube_map */
1360 GLint MaxTextureRectSize
; /* GL_NV_texture_rectangle */
1361 GLuint MaxTextureUnits
;
1362 GLuint MaxTextureCoordUnits
;
1363 GLuint MaxTextureImageUnits
;
1364 GLfloat MaxTextureMaxAnisotropy
; /* GL_EXT_texture_filter_anisotropic */
1365 GLfloat MaxTextureLodBias
; /* GL_EXT_texture_lod_bias */
1366 GLuint MaxArrayLockSize
;
1368 GLfloat MinPointSize
, MaxPointSize
; /* aliased */
1369 GLfloat MinPointSizeAA
, MaxPointSizeAA
; /* antialiased */
1370 GLfloat PointSizeGranularity
;
1371 GLfloat MinLineWidth
, MaxLineWidth
; /* aliased */
1372 GLfloat MinLineWidthAA
, MaxLineWidthAA
; /* antialiased */
1373 GLfloat LineWidthGranularity
;
1374 GLuint NumAuxBuffers
;
1375 GLuint MaxColorTableSize
;
1376 GLuint MaxConvolutionWidth
;
1377 GLuint MaxConvolutionHeight
;
1378 GLuint MaxClipPlanes
;
1384 * List of extensions.
1387 struct gl_extensions
{
1389 struct extension
*ext_list
;
1390 /* Flags to quickly test if certain extensions are available.
1391 * Not every extension needs to have such a flag, but it's encouraged.
1393 GLboolean ARB_depth_texture
;
1394 GLboolean ARB_imaging
;
1395 GLboolean ARB_multisample
;
1396 GLboolean ARB_multitexture
;
1397 GLboolean ARB_shadow
;
1398 GLboolean ARB_texture_border_clamp
;
1399 GLboolean ARB_texture_compression
;
1400 GLboolean ARB_texture_cube_map
;
1401 GLboolean ARB_texture_env_combine
;
1402 GLboolean ARB_texture_env_crossbar
;
1403 GLboolean ARB_texture_env_dot3
;
1404 GLboolean ARB_texture_mirrored_repeat
;
1405 GLboolean ARB_window_pos
;
1406 GLboolean ATI_texture_mirror_once
;
1407 GLboolean ATI_texture_env_combine3
;
1408 GLboolean EXT_blend_color
;
1409 GLboolean EXT_blend_func_separate
;
1410 GLboolean EXT_blend_logic_op
;
1411 GLboolean EXT_blend_minmax
;
1412 GLboolean EXT_blend_subtract
;
1413 GLboolean EXT_clip_volume_hint
;
1414 GLboolean EXT_convolution
;
1415 GLboolean EXT_compiled_vertex_array
;
1416 GLboolean EXT_fog_coord
;
1417 GLboolean EXT_histogram
;
1418 GLboolean EXT_multi_draw_arrays
;
1419 GLboolean EXT_packed_pixels
;
1420 GLboolean EXT_paletted_texture
;
1421 GLboolean EXT_point_parameters
;
1422 GLboolean EXT_polygon_offset
;
1423 GLboolean EXT_rescale_normal
;
1424 GLboolean EXT_shadow_funcs
;
1425 GLboolean EXT_secondary_color
;
1426 GLboolean EXT_shared_texture_palette
;
1427 GLboolean EXT_stencil_wrap
;
1428 GLboolean EXT_stencil_two_side
;
1429 GLboolean EXT_texture3D
;
1430 GLboolean EXT_texture_compression_s3tc
;
1431 GLboolean EXT_texture_env_add
;
1432 GLboolean EXT_texture_env_combine
;
1433 GLboolean EXT_texture_env_dot3
;
1434 GLboolean EXT_texture_filter_anisotropic
;
1435 GLboolean EXT_texture_object
;
1436 GLboolean EXT_texture_lod_bias
;
1437 GLboolean EXT_vertex_array_set
;
1438 GLboolean HP_occlusion_test
;
1439 GLboolean IBM_rasterpos_clip
;
1440 GLboolean INGR_blend_func_separate
;
1441 GLboolean MESA_pack_invert
;
1442 GLboolean MESA_window_pos
;
1443 GLboolean MESA_resize_buffers
;
1444 GLboolean MESA_ycbcr_texture
;
1445 GLboolean NV_blend_square
;
1446 GLboolean NV_fragment_program
;
1447 GLboolean NV_point_sprite
;
1448 GLboolean NV_texture_rectangle
;
1449 GLboolean NV_texgen_reflection
;
1450 GLboolean NV_vertex_program
;
1451 GLboolean NV_vertex_program1_1
;
1452 GLboolean SGI_color_matrix
;
1453 GLboolean SGI_color_table
;
1454 GLboolean SGI_texture_color_table
;
1455 GLboolean SGIS_generate_mipmap
;
1456 GLboolean SGIS_pixel_texture
;
1457 GLboolean SGIS_texture_edge_clamp
;
1458 GLboolean SGIX_depth_texture
;
1459 GLboolean SGIX_pixel_texture
;
1460 GLboolean SGIX_shadow
;
1461 GLboolean SGIX_shadow_ambient
; /* or GL_ARB_shadow_ambient */
1462 GLboolean TDFX_texture_compression_FXT1
;
1463 GLboolean APPLE_client_storage
;
1468 * A stack of matrices (projection, modelview, color, texture, etc).
1472 GLmatrix
*Top
; /* points into Stack */
1473 GLmatrix
*Stack
; /* array [MaxDepth] of GLmatrix */
1474 GLuint Depth
; /* 0 <= Depth < MaxDepth */
1475 GLuint MaxDepth
; /* size of Stack[] array */
1476 GLuint DirtyFlag
; /* _NEW_MODELVIEW or _NEW_PROJECTION, for example */
1481 * Bits for image transfer operations (ctx->ImageTransferState).
1483 #define IMAGE_SCALE_BIAS_BIT 0x1
1484 #define IMAGE_SHIFT_OFFSET_BIT 0x2
1485 #define IMAGE_MAP_COLOR_BIT 0x4
1486 #define IMAGE_COLOR_TABLE_BIT 0x8
1487 #define IMAGE_CONVOLUTION_BIT 0x10
1488 #define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
1489 #define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40
1490 #define IMAGE_COLOR_MATRIX_BIT 0x80
1491 #define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100
1492 #define IMAGE_HISTOGRAM_BIT 0x200
1493 #define IMAGE_MIN_MAX_BIT 0x400
1495 /* transfer ops up to convolution: */
1496 #define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \
1497 IMAGE_SHIFT_OFFSET_BIT | \
1498 IMAGE_MAP_COLOR_BIT | \
1499 IMAGE_COLOR_TABLE_BIT)
1501 /* transfer ops after convolution: */
1502 #define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \
1503 IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \
1504 IMAGE_COLOR_MATRIX_BIT | \
1505 IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\
1506 IMAGE_HISTOGRAM_BIT | \
1511 * Bits to indicate what state has changed. 6 unused flags.
1513 #define _NEW_MODELVIEW 0x1 /* ctx->ModelView */
1514 #define _NEW_PROJECTION 0x2 /* ctx->Projection */
1515 #define _NEW_TEXTURE_MATRIX 0x4 /* ctx->TextureMatrix */
1516 #define _NEW_COLOR_MATRIX 0x8 /* ctx->ColorMatrix */
1517 #define _NEW_ACCUM 0x10 /* ctx->Accum */
1518 #define _NEW_COLOR 0x20 /* ctx->Color */
1519 #define _NEW_DEPTH 0x40 /* ctx->Depth */
1520 #define _NEW_EVAL 0x80 /* ctx->Eval, ctx->EvalMap */
1521 #define _NEW_FOG 0x100 /* ctx->Fog */
1522 #define _NEW_HINT 0x200 /* ctx->Hint */
1523 #define _NEW_LIGHT 0x400 /* ctx->Light */
1524 #define _NEW_LINE 0x800 /* ctx->Line */
1525 #define _NEW_PIXEL 0x1000 /* ctx->Pixel */
1526 #define _NEW_POINT 0x2000 /* ctx->Point */
1527 #define _NEW_POLYGON 0x4000 /* ctx->Polygon */
1528 #define _NEW_POLYGONSTIPPLE 0x8000 /* ctx->PolygonStipple */
1529 #define _NEW_SCISSOR 0x10000 /* ctx->Scissor */
1530 #define _NEW_STENCIL 0x20000 /* ctx->Stencil */
1531 #define _NEW_TEXTURE 0x40000 /* ctx->Texture */
1532 #define _NEW_TRANSFORM 0x80000 /* ctx->Transform */
1533 #define _NEW_VIEWPORT 0x100000 /* ctx->Viewport */
1534 #define _NEW_PACKUNPACK 0x200000 /* ctx->Pack, ctx->Unpack */
1535 #define _NEW_ARRAY 0x400000 /* ctx->Array */
1536 #define _NEW_RENDERMODE 0x800000 /* RenderMode, Feedback, Select */
1537 #define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */
1538 #define _NEW_MULTISAMPLE 0x2000000 /* ctx->Multisample */
1539 #define _NEW_TRACK_MATRIX 0x4000000 /* ctx->VertexProgram */
1540 #define _NEW_PROGRAM 0x8000000 /* ctx->VertexProgram */
1545 /* Bits to track array state changes (also used to summarize array enabled)
1547 #define _NEW_ARRAY_VERTEX VERT_BIT_POS
1548 #define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT
1549 #define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL
1550 #define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
1551 #define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
1552 #define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
1553 #define _NEW_ARRAY_INDEX VERT_BIT_SIX
1554 #define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
1555 #define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
1556 #define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
1557 #define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
1558 #define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3
1559 #define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4
1560 #define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
1561 #define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
1562 #define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
1563 #define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
1564 #define _NEW_ARRAY_ALL 0xffffffff
1567 #define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i))
1568 #define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i))
1571 /* A bunch of flags that we think might be useful to drivers.
1572 * Set in the ctx->_TriangleCaps bitfield.
1574 #define DD_FLATSHADE 0x1
1575 #define DD_SEPARATE_SPECULAR 0x2
1576 #define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */
1577 #define DD_TRI_LIGHT_TWOSIDE 0x8
1578 #define DD_TRI_UNFILLED 0x10
1579 #define DD_TRI_SMOOTH 0x20
1580 #define DD_TRI_STIPPLE 0x40
1581 #define DD_TRI_OFFSET 0x80
1582 #define DD_LINE_SMOOTH 0x100
1583 #define DD_LINE_STIPPLE 0x200
1584 #define DD_LINE_WIDTH 0x400
1585 #define DD_POINT_SMOOTH 0x800
1586 #define DD_POINT_SIZE 0x1000
1587 #define DD_POINT_ATTEN 0x2000
1590 /* Define the state changes under which each of these bits might change
1592 #define _DD_NEW_FLATSHADE _NEW_LIGHT
1593 #define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG)
1594 #define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
1595 #define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT
1596 #define _DD_NEW_TRI_UNFILLED _NEW_POLYGON
1597 #define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
1598 #define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
1599 #define _DD_NEW_TRI_OFFSET _NEW_POLYGON
1600 #define _DD_NEW_LINE_SMOOTH _NEW_LINE
1601 #define _DD_NEW_LINE_STIPPLE _NEW_LINE
1602 #define _DD_NEW_LINE_WIDTH _NEW_LINE
1603 #define _DD_NEW_POINT_SMOOTH _NEW_POINT
1604 #define _DD_NEW_POINT_SIZE _NEW_POINT
1605 #define _DD_NEW_POINT_ATTEN _NEW_POINT
1607 #define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
1612 #define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
1615 #define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX)
1618 /* Bits for ctx->_NeedNormals */
1619 #define NEED_NORMALS_TEXGEN 0x1
1620 #define NEED_NORMALS_LIGHT 0x2
1622 /* Bits for ctx->_NeedEyeCoords */
1623 #define NEED_EYE_TEXGEN 0x1
1624 #define NEED_EYE_LIGHT 0x2
1625 #define NEED_EYE_LIGHT_MODELVIEW 0x4
1626 #define NEED_EYE_POINT_ATTEN 0x8
1627 #define NEED_EYE_DRIVER 0x10
1631 * Forward declaration of display list datatypes:
1634 typedef union node Node
;
1637 /* This has to be included here. */
1642 * Core Mesa's support for tnl modules:
1644 #define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *))
1646 struct gl_tnl_module
{
1647 /* Vertex format to be lazily swapped into current dispatch.
1649 GLvertexformat
*Current
;
1651 /* Record of functions swapped out. On restore, only need to swap
1652 * these functions back in.
1654 void *Swapped
[NUM_VERTEX_FORMAT_ENTRIES
][2];
1660 * This is the central context data structure for Mesa. Almost all
1661 * OpenGL state is contained in this structure.
1662 * Think of this as a base class from which device drivers will derive
1665 struct __GLcontextRec
{
1667 * OS related interfaces; these *must* be the first members of this
1668 * structure, because they are exposed to the outside world (i.e. GLX
1671 __GLimports imports
;
1672 __GLexports exports
;
1674 /* State possibly shared with other contexts in the address space */
1675 struct gl_shared_state
*Shared
;
1677 /* API function pointer tables */
1678 struct _glapi_table
*Save
; /**< Display list save funcs */
1679 struct _glapi_table
*Exec
; /**< Execute funcs */
1680 struct _glapi_table
*CurrentDispatch
; /**< == Save or Exec !! */
1682 GLboolean ExecPrefersFloat
; /**< What preference for color conversion? */
1683 GLboolean SavePrefersFloat
;
1686 GLframebuffer
*DrawBuffer
; /**< buffer for writing */
1687 GLframebuffer
*ReadBuffer
; /**< buffer for reading */
1690 * Device driver function pointer table
1692 struct dd_function_table Driver
;
1694 void *DriverCtx
; /**< Points to device driver context/state */
1695 void *DriverMgrCtx
; /**< Points to device driver manager (optional)*/
1697 /* Core/Driver constants */
1698 struct gl_constants Const
;
1700 /* The various 4x4 matrix stacks */
1701 struct matrix_stack ModelviewMatrixStack
;
1702 struct matrix_stack ProjectionMatrixStack
;
1703 struct matrix_stack ColorMatrixStack
;
1704 struct matrix_stack TextureMatrixStack
[MAX_TEXTURE_COORD_UNITS
];
1705 struct matrix_stack ProgramMatrixStack
[MAX_PROGRAM_MATRICES
];
1706 struct matrix_stack
*CurrentStack
; /* Points to one of the above stacks */
1708 /* Combined modelview and projection matrix */
1709 GLmatrix _ModelProjectMatrix
;
1712 GLuint CallDepth
; /* Current recursion calling depth */
1713 GLboolean ExecuteFlag
; /* Execute GL commands? */
1714 GLboolean CompileFlag
; /* Compile GL commands into display list? */
1715 Node
*CurrentListPtr
; /* Head of list being compiled */
1716 GLuint CurrentListNum
; /* Number of the list being compiled */
1717 Node
*CurrentBlock
; /* Pointer to current block of nodes */
1718 GLuint CurrentPos
; /* Index into current block of nodes */
1721 struct gl_extensions Extensions
;
1723 /* Renderer attribute stack */
1724 GLuint AttribStackDepth
;
1725 struct gl_attrib_node
*AttribStack
[MAX_ATTRIB_STACK_DEPTH
];
1727 /* Renderer attribute groups */
1728 struct gl_accum_attrib Accum
;
1729 struct gl_colorbuffer_attrib Color
;
1730 struct gl_current_attrib Current
;
1731 struct gl_depthbuffer_attrib Depth
;
1732 struct gl_eval_attrib Eval
;
1733 struct gl_fog_attrib Fog
;
1734 struct gl_hint_attrib Hint
;
1735 struct gl_light_attrib Light
;
1736 struct gl_line_attrib Line
;
1737 struct gl_list_attrib List
;
1738 struct gl_multisample_attrib Multisample
;
1739 struct gl_pixel_attrib Pixel
;
1740 struct gl_point_attrib Point
;
1741 struct gl_polygon_attrib Polygon
;
1742 GLuint PolygonStipple
[32];
1743 struct gl_scissor_attrib Scissor
;
1744 struct gl_stencil_attrib Stencil
;
1745 struct gl_texture_attrib Texture
;
1746 struct gl_transform_attrib Transform
;
1747 struct gl_viewport_attrib Viewport
;
1749 /* Other attribute groups */
1750 struct gl_histogram_attrib Histogram
;
1751 struct gl_minmax_attrib MinMax
;
1752 struct gl_convolution_attrib Convolution1D
;
1753 struct gl_convolution_attrib Convolution2D
;
1754 struct gl_convolution_attrib Separable2D
;
1756 /* Client attribute stack */
1757 GLuint ClientAttribStackDepth
;
1758 struct gl_attrib_node
*ClientAttribStack
[MAX_CLIENT_ATTRIB_STACK_DEPTH
];
1760 /* Client attribute groups */
1761 struct gl_array_attrib Array
; /* Vertex arrays */
1762 struct gl_pixelstore_attrib Pack
; /* Pixel packing */
1763 struct gl_pixelstore_attrib Unpack
; /* Pixel unpacking */
1765 struct gl_evaluators EvalMap
; /* All evaluators */
1766 struct gl_feedback Feedback
; /* Feedback */
1767 struct gl_selection Select
; /* Selection */
1769 struct gl_color_table ColorTable
; /* Pre-convolution */
1770 struct gl_color_table ProxyColorTable
; /* Pre-convolution */
1771 struct gl_color_table PostConvolutionColorTable
;
1772 struct gl_color_table ProxyPostConvolutionColorTable
;
1773 struct gl_color_table PostColorMatrixColorTable
;
1774 struct gl_color_table ProxyPostColorMatrixColorTable
;
1776 struct program_state Program
; /* for vertex or fragment progs */
1777 struct vertex_program_state VertexProgram
; /* GL_NV_vertex_program */
1778 struct fragment_program_state FragmentProgram
; /* GL_NV_fragment_program */
1780 GLenum ErrorValue
; /* Last error code */
1781 GLenum RenderMode
; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
1782 GLuint NewState
; /* bitwise-or of _NEW_* flags */
1785 GLuint _TriangleCaps
; /* bitwise-or of DD_* flags */
1786 GLuint _ImageTransferState
;/* bitwise-or of IMAGE_*_BIT flags */
1787 GLfloat _EyeZDir
[3];
1788 GLfloat _ModelViewInvScale
;
1789 GLuint _NeedEyeCoords
;
1790 GLuint _NeedNormals
; /* Are vertex normal vectors needed? */
1792 struct gl_shine_tab
*_ShineTable
[2]; /* Active shine tables */
1793 struct gl_shine_tab
*_ShineTabList
; /* Mru list of inactive shine tables */
1795 struct gl_list_extensions listext
; /* driver dlist extensions */
1798 GLboolean OcclusionResult
; /**< for GL_HP_occlusion_test */
1799 GLboolean OcclusionResultSaved
; /**< for GL_HP_occlusion_test */
1800 GLuint _Facing
; /* This is a hack for 2-sided stencil test. We don't */
1801 /* have a better way to communicate this value from */
1802 /* swrast_setup to swrast. */
1805 /* Z buffer stuff */
1806 GLuint DepthMax
; /**< Max depth buffer value */
1807 GLfloat DepthMaxF
; /**< Float max depth buffer value */
1808 GLfloat MRD
; /**< minimum resolvable difference in Z values */
1810 /** Should 3Dfx Glide driver catch signals? */
1811 GLboolean CatchSignals
;
1813 /** For debugging/development only */
1815 GLboolean FirstTimeCurrent
;
1817 /** Dither disable via MESA_NO_DITHER env var */
1820 GLboolean Rendering
;
1822 #if defined(MESA_TRACE)
1823 struct _glapi_table
*TraceDispatch
;
1824 trace_context_t
*TraceCtx
;
1826 void *TraceDispatch
;
1830 /* Core tnl module support */
1831 struct gl_tnl_module TnlModule
;
1833 /* Hooks for module contexts. These will eventually live
1834 * in the driver or elsewhere.
1836 void *swrast_context
;
1837 void *swsetup_context
;
1838 void *swtnl_context
;
1840 void *acache_context
;
1845 /* The string names for GL_POINT, GL_LINE_LOOP, etc */
1846 extern const char *_mesa_prim_name
[GL_POLYGON
+4];
1850 extern int MESA_VERBOSE
;
1851 extern int MESA_DEBUG_FLAGS
;
1853 # define MESA_VERBOSE 0
1854 # define MESA_DEBUG_FLAGS 0
1862 VERBOSE_VARRAY
= 0x0001,
1863 VERBOSE_TEXTURE
= 0x0002,
1864 VERBOSE_IMMEDIATE
= 0x0004,
1865 VERBOSE_PIPELINE
= 0x0008,
1866 VERBOSE_DRIVER
= 0x0010,
1867 VERBOSE_STATE
= 0x0020,
1868 VERBOSE_API
= 0x0040,
1869 VERBOSE_DISPLAY_LIST
= 0x0100,
1870 VERBOSE_LIGHTING
= 0x0200,
1871 VERBOSE_PRIMS
= 0x0400,
1872 VERBOSE_VERTS
= 0x0800
1877 DEBUG_ALWAYS_FLUSH
= 0x1
1882 #define Elements(x) sizeof(x)/sizeof(*(x))
1885 /* Eventually let the driver specify what statechanges require a flush:
1887 #define FLUSH_VERTICES(ctx, newstate) \
1889 if (MESA_VERBOSE & VERBOSE_STATE) \
1890 _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __FUNCTION__); \
1891 if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
1892 ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
1893 ctx->NewState |= newstate; \
1896 #define FLUSH_CURRENT(ctx, newstate) \
1898 if (MESA_VERBOSE & VERBOSE_STATE) \
1899 _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \
1900 if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
1901 ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
1902 ctx->NewState |= newstate; \
1905 #define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
1907 if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
1908 _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
1913 #define ASSERT_OUTSIDE_BEGIN_END(ctx) \
1915 if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
1916 _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
1921 #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
1923 ASSERT_OUTSIDE_BEGIN_END(ctx); \
1924 FLUSH_VERTICES(ctx, 0); \
1927 #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
1929 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
1930 FLUSH_VERTICES(ctx, 0); \
1936 #endif /* TYPES_H */