3 * Main Mesa data structures.
5 * Please try to mark derived values with a leading underscore ('_').
9 * Mesa 3-D graphics library
12 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
14 * Permission is hereby granted, free of charge, to any person obtaining a
15 * copy of this software and associated documentation files (the "Software"),
16 * to deal in the Software without restriction, including without limitation
17 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 * and/or sell copies of the Software, and to permit persons to whom the
19 * Software is furnished to do so, subject to the following conditions:
21 * The above copyright notice and this permission notice shall be included
22 * in all copies or substantial portions of the Software.
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
28 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39 #include "config.h" /* Hardwired parameters */
40 #include "glapitable.h"
42 #include "math/m_matrix.h" /* GLmatrix */
46 * Color channel data type.
49 typedef GLubyte GLchan
;
51 #define CHAN_MAXF 255.0F
52 #define CHAN_TYPE GL_UNSIGNED_BYTE
54 typedef GLushort GLchan
;
55 #define CHAN_MAX 65535
56 #define CHAN_MAXF 65535.0F
57 #define CHAN_TYPE GL_UNSIGNED_SHORT
59 typedef GLfloat GLchan
;
61 #define CHAN_MAXF 1.0F
62 #define CHAN_TYPE GL_FLOAT
64 #error "illegal number of color channel bits"
69 * Accumulation buffer data type.
72 typedef GLbyte GLaccum
;
74 typedef GLshort GLaccum
;
76 typedef GLfloat GLaccum
;
78 # error "illegal number of accumulation bits"
83 * Stencil buffer data type.
86 typedef GLubyte GLstencil
;
87 # define STENCIL_MAX 0xff
88 #elif STENCIL_BITS==16
89 typedef GLushort GLstencil
;
90 # define STENCIL_MAX 0xffff
92 # error "illegal number of stencil bits"
97 * Depth buffer data type.
99 * \note Must be 32-bits!
101 typedef GLuint GLdepth
;
105 * Fixed point data type.
109 * Fixed point arithmetic macros
111 #ifndef FIXED_FRAC_BITS
112 #define FIXED_FRAC_BITS 11
115 #define FIXED_SHIFT FIXED_FRAC_BITS
116 #define FIXED_ONE (1 << FIXED_SHIFT)
117 #define FIXED_HALF (1 << (FIXED_SHIFT-1))
118 #define FIXED_FRAC_MASK (FIXED_ONE - 1)
119 #define FIXED_INT_MASK (~FIXED_FRAC_MASK)
120 #define FIXED_EPSILON 1
121 #define FIXED_SCALE ((float) FIXED_ONE)
122 #define FIXED_DBL_SCALE ((double) FIXED_ONE)
123 #define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
124 #define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
125 #define IntToFixed(I) ((I) << FIXED_SHIFT)
126 #define FixedToInt(X) ((X) >> FIXED_SHIFT)
127 #define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)
128 #define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
129 #define FixedFloor(X) ((X) & FIXED_INT_MASK)
130 #define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
131 #define PosFloatToFixed(X) FloatToFixed(X)
132 #define SignedFloatToFixed(X) FloatToFixed(X)
137 * \name Some forward type declarations
140 struct _mesa_HashTable
;
141 struct gl_texture_image
;
142 struct gl_texture_object
;
143 typedef struct __GLcontextRec GLcontext
;
144 typedef struct __GLcontextModesRec GLvisual
;
145 typedef struct gl_frame_buffer GLframebuffer
;
146 struct gl_pixelstore_attrib
;
147 struct gl_texture_format
;
153 * Indexes for vertex program attributes.
154 * GL_NV_vertex_program aliases generic attributes over the conventional
155 * attributes. In GL_ARB_vertex_program shader the aliasing is optional.
156 * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the
157 * generic attributes are distinct/separate).
162 VERT_ATTRIB_WEIGHT
= 1,
163 VERT_ATTRIB_NORMAL
= 2,
164 VERT_ATTRIB_COLOR0
= 3,
165 VERT_ATTRIB_COLOR1
= 4,
168 VERT_ATTRIB_SEVEN
= 7,
169 VERT_ATTRIB_TEX0
= 8,
170 VERT_ATTRIB_TEX1
= 9,
171 VERT_ATTRIB_TEX2
= 10,
172 VERT_ATTRIB_TEX3
= 11,
173 VERT_ATTRIB_TEX4
= 12,
174 VERT_ATTRIB_TEX5
= 13,
175 VERT_ATTRIB_TEX6
= 14,
176 VERT_ATTRIB_TEX7
= 15,
177 VERT_ATTRIB_GENERIC0
= 16,
178 VERT_ATTRIB_GENERIC1
= 17,
179 VERT_ATTRIB_GENERIC2
= 18,
180 VERT_ATTRIB_GENERIC3
= 19,
185 * Bitflags for vertex attributes.
186 * These are used in bitfields in many places.
189 #define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
190 #define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
191 #define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
192 #define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
193 #define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
194 #define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
195 #define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX)
196 #define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
197 #define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
198 #define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
199 #define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
200 #define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
201 #define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
202 #define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
203 #define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
204 #define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
205 #define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0)
206 #define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
207 #define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
208 #define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
210 #define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
211 #define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g)))
216 * Indexes for fragment program input attributes.
220 FRAG_ATTRIB_WPOS
= 0,
221 FRAG_ATTRIB_COL0
= 1,
222 FRAG_ATTRIB_COL1
= 2,
223 FRAG_ATTRIB_FOGC
= 3,
224 FRAG_ATTRIB_TEX0
= 4,
225 FRAG_ATTRIB_TEX1
= 5,
226 FRAG_ATTRIB_TEX2
= 6,
227 FRAG_ATTRIB_TEX3
= 7,
228 FRAG_ATTRIB_TEX4
= 8,
229 FRAG_ATTRIB_TEX5
= 9,
230 FRAG_ATTRIB_TEX6
= 10,
231 FRAG_ATTRIB_TEX7
= 11
235 * Bitflags for fragment attributes.
238 #define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS)
239 #define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0)
240 #define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1)
241 #define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC)
242 #define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0)
243 #define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1)
244 #define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2)
245 #define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3)
246 #define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4)
247 #define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5)
248 #define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6)
249 #define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7)
251 #define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \
263 * Bits for each basic buffer in a complete framebuffer.
264 * When glDrawBuffer(GL_FRONT_AND_BACK) is called (non-stereo),
265 * _DrawDestMask will be set to (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT),
266 * for example. Also passed to ctx->Driver.Clear() to indicate which
270 #define DD_FRONT_LEFT_BIT 0x1
271 #define DD_FRONT_RIGHT_BIT 0x2
272 #define DD_BACK_LEFT_BIT 0x4
273 #define DD_BACK_RIGHT_BIT 0x8
274 #define DD_AUX0_BIT 0x10
275 #define DD_AUX1_BIT 0x20
276 #define DD_AUX2_BIT 0x40
277 #define DD_AUX3_BIT 0x80
278 #define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */
279 #define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
280 #define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
285 * Data structure for color tables
287 struct gl_color_table
289 GLenum Format
; /**< GL_ALPHA, GL_RGB, GL_RGB, etc */
291 GLuint Size
; /**< number of entries (rows) in table */
292 GLvoid
*Table
; /**< points to data of <Type> */
293 GLenum Type
; /**< GL_UNSIGNED_BYTE or GL_FLOAT */
298 GLubyte LuminanceSize
;
299 GLubyte IntensitySize
;
304 * \name Bit flags used for updating material values.
307 #define MAT_ATTRIB_FRONT_AMBIENT 0
308 #define MAT_ATTRIB_BACK_AMBIENT 1
309 #define MAT_ATTRIB_FRONT_DIFFUSE 2
310 #define MAT_ATTRIB_BACK_DIFFUSE 3
311 #define MAT_ATTRIB_FRONT_SPECULAR 4
312 #define MAT_ATTRIB_BACK_SPECULAR 5
313 #define MAT_ATTRIB_FRONT_EMISSION 6
314 #define MAT_ATTRIB_BACK_EMISSION 7
315 #define MAT_ATTRIB_FRONT_SHININESS 8
316 #define MAT_ATTRIB_BACK_SHININESS 9
317 #define MAT_ATTRIB_FRONT_INDEXES 10
318 #define MAT_ATTRIB_BACK_INDEXES 11
319 #define MAT_ATTRIB_MAX 12
321 #define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f))
322 #define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f))
323 #define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f))
324 #define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f))
325 #define MAT_ATTRIB_SHININESS(f)(MAT_ATTRIB_FRONT_SHININESS+(f))
326 #define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f))
328 #define MAT_INDEX_AMBIENT 0
329 #define MAT_INDEX_DIFFUSE 1
330 #define MAT_INDEX_SPECULAR 2
332 #define MAT_BIT_FRONT_AMBIENT (1<<MAT_ATTRIB_FRONT_AMBIENT)
333 #define MAT_BIT_BACK_AMBIENT (1<<MAT_ATTRIB_BACK_AMBIENT)
334 #define MAT_BIT_FRONT_DIFFUSE (1<<MAT_ATTRIB_FRONT_DIFFUSE)
335 #define MAT_BIT_BACK_DIFFUSE (1<<MAT_ATTRIB_BACK_DIFFUSE)
336 #define MAT_BIT_FRONT_SPECULAR (1<<MAT_ATTRIB_FRONT_SPECULAR)
337 #define MAT_BIT_BACK_SPECULAR (1<<MAT_ATTRIB_BACK_SPECULAR)
338 #define MAT_BIT_FRONT_EMISSION (1<<MAT_ATTRIB_FRONT_EMISSION)
339 #define MAT_BIT_BACK_EMISSION (1<<MAT_ATTRIB_BACK_EMISSION)
340 #define MAT_BIT_FRONT_SHININESS (1<<MAT_ATTRIB_FRONT_SHININESS)
341 #define MAT_BIT_BACK_SHININESS (1<<MAT_ATTRIB_BACK_SHININESS)
342 #define MAT_BIT_FRONT_INDEXES (1<<MAT_ATTRIB_FRONT_INDEXES)
343 #define MAT_BIT_BACK_INDEXES (1<<MAT_ATTRIB_BACK_INDEXES)
346 #define FRONT_MATERIAL_BITS (MAT_BIT_FRONT_EMISSION | \
347 MAT_BIT_FRONT_AMBIENT | \
348 MAT_BIT_FRONT_DIFFUSE | \
349 MAT_BIT_FRONT_SPECULAR | \
350 MAT_BIT_FRONT_SHININESS | \
351 MAT_BIT_FRONT_INDEXES)
353 #define BACK_MATERIAL_BITS (MAT_BIT_BACK_EMISSION | \
354 MAT_BIT_BACK_AMBIENT | \
355 MAT_BIT_BACK_DIFFUSE | \
356 MAT_BIT_BACK_SPECULAR | \
357 MAT_BIT_BACK_SHININESS | \
358 MAT_BIT_BACK_INDEXES)
360 #define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
364 #define EXP_TABLE_SIZE 512 /**< Specular exponent lookup table sizes */
365 #define SHINE_TABLE_SIZE 256 /**< Material shininess lookup table sizes */
368 * Material shininess lookup table.
372 struct gl_shine_tab
*next
, *prev
;
373 GLfloat tab
[SHINE_TABLE_SIZE
+1];
380 * Light source state.
384 struct gl_light
*next
; /**< double linked list with sentinel */
385 struct gl_light
*prev
;
387 GLfloat Ambient
[4]; /**< ambient color */
388 GLfloat Diffuse
[4]; /**< diffuse color */
389 GLfloat Specular
[4]; /**< specular color */
390 GLfloat EyePosition
[4]; /**< position in eye coordinates */
391 GLfloat EyeDirection
[4]; /**< spotlight dir in eye coordinates */
392 GLfloat SpotExponent
;
393 GLfloat SpotCutoff
; /**< in degrees */
394 GLfloat _CosCutoff
; /**< = MAX(0, cos(SpotCutoff)) */
395 GLfloat ConstantAttenuation
;
396 GLfloat LinearAttenuation
;
397 GLfloat QuadraticAttenuation
;
398 GLboolean Enabled
; /**< On/off flag */
401 * \name Derived fields
404 GLuint _Flags
; /**< State */
406 GLfloat _Position
[4]; /**< position in eye/obj coordinates */
407 GLfloat _VP_inf_norm
[3]; /**< Norm direction to infinite light */
408 GLfloat _h_inf_norm
[3]; /**< Norm( _VP_inf_norm + <0,0,1> ) */
409 GLfloat _NormDirection
[4]; /**< normalized spotlight direction */
410 GLfloat _VP_inf_spot_attenuation
;
412 GLfloat _SpotExpTable
[EXP_TABLE_SIZE
][2]; /**< to replace a pow() call */
413 GLfloat _MatAmbient
[2][3]; /**< material ambient * light ambient */
414 GLfloat _MatDiffuse
[2][3]; /**< material diffuse * light diffuse */
415 GLfloat _MatSpecular
[2][3]; /**< material spec * light specular */
416 GLfloat _dli
; /**< CI diffuse light intensity */
417 GLfloat _sli
; /**< CI specular light intensity */
427 GLfloat Ambient
[4]; /**< ambient color */
428 GLboolean LocalViewer
; /**< Local (or infinite) view point? */
429 GLboolean TwoSide
; /**< Two (or one) sided lighting? */
430 GLenum ColorControl
; /**< either GL_SINGLE_COLOR
431 * or GL_SEPARATE_SPECULAR_COLOR */
440 GLfloat Attrib
[MAT_ATTRIB_MAX
][4];
445 * Accumulation buffer attribute group (GL_ACCUM_BUFFER_BIT)
447 struct gl_accum_attrib
449 GLfloat ClearColor
[4]; /**< Accumulation buffer clear color */
454 * Color buffer attribute group (GL_COLOR_BUFFER_BIT).
456 struct gl_colorbuffer_attrib
458 GLuint ClearIndex
; /**< Index to use for glClear */
459 GLclampf ClearColor
[4]; /**< Color to use for glClear */
461 GLuint IndexMask
; /**< Color index write mask */
462 GLubyte ColorMask
[4]; /**< Each flag is 0xff or 0x0 */
464 GLenum DrawBuffer
[MAX_DRAW_BUFFERS
]; /**< Which buffer to draw into */
465 GLbitfield _DrawDestMask
[MAX_DRAW_BUFFERS
];/**< bitmask of DD_*_BIT bits */
468 * \name alpha testing
471 GLboolean AlphaEnabled
; /**< Alpha test enabled flag */
472 GLenum AlphaFunc
; /**< Alpha test function */
473 GLclampf AlphaRef
; /**< Alpha reference value */
480 GLboolean BlendEnabled
; /**< Blending enabled flag */
481 GLenum BlendSrcRGB
; /**< Blending source operator */
482 GLenum BlendDstRGB
; /**< Blending destination operator */
483 GLenum BlendSrcA
; /**< GL_INGR_blend_func_separate */
484 GLenum BlendDstA
; /**< GL_INGR_blend_func_separate */
485 GLenum BlendEquationRGB
; /**< Blending equation */
486 GLenum BlendEquationA
; /**< GL_EXT_blend_equation_separate */
487 GLfloat BlendColor
[4]; /**< Blending color */
494 GLenum LogicOp
; /**< Logic operator */
495 GLboolean IndexLogicOpEnabled
; /**< Color index logic op enabled flag */
496 GLboolean ColorLogicOpEnabled
; /**< RGBA logic op enabled flag */
497 GLboolean _LogicOpEnabled
; /**< RGBA logic op + EXT_blend_logic_op enabled flag */
500 GLboolean DitherFlag
; /**< Dither enable flag */
505 * Current attribute group (GL_CURRENT_BIT).
507 struct gl_current_attrib
510 * \name Values valid only when FLUSH_VERTICES has been called.
513 GLfloat Attrib
[VERT_ATTRIB_MAX
][4]; /**< Current vertex attributes
514 * indexed by VERT_ATTRIB_* */
515 GLfloat Index
; /**< Current color index */
516 GLboolean EdgeFlag
; /**< Current edge flag */
520 * \name Values are always valid.
522 * \note BTW, note how similar this set of attributes is to the SWvertex
523 * data type in the software rasterizer...
526 GLfloat RasterPos
[4]; /**< Current raster position */
527 GLfloat RasterDistance
; /**< Current raster distance */
528 GLfloat RasterColor
[4]; /**< Current raster color */
529 GLfloat RasterSecondaryColor
[4]; /**< Current raster secondary color */
530 GLfloat RasterIndex
; /**< Current raster index */
531 GLfloat RasterTexCoords
[MAX_TEXTURE_UNITS
][4];/**< Current raster texcoords */
532 GLboolean RasterPosValid
; /**< Raster pos valid flag */
538 * Depth buffer attribute group (GL_DEPTH_BUFFER_BIT).
540 struct gl_depthbuffer_attrib
542 GLenum Func
; /**< Function for depth buffer compare */
543 GLclampd Clear
; /**< Value to clear depth buffer to */
544 GLboolean Test
; /**< Depth buffering enabled flag */
545 GLboolean Mask
; /**< Depth buffer writable? */
546 GLboolean OcclusionTest
; /**< GL_HP_occlusion_test */
547 GLboolean BoundsTest
; /**< GL_EXT_depth_bounds_test */
548 GLfloat BoundsMin
, BoundsMax
;/**< GL_EXT_depth_bounds_test */
553 * glEnable()/glDisable() attribute group (GL_ENABLE_BIT).
555 struct gl_enable_attrib
558 GLboolean AutoNormal
;
561 GLboolean ColorMaterial
;
562 GLboolean ColorTable
; /* SGI_color_table */
563 GLboolean PostColorMatrixColorTable
; /* SGI_color_table */
564 GLboolean PostConvolutionColorTable
; /* SGI_color_table */
565 GLboolean Convolution1D
;
566 GLboolean Convolution2D
;
567 GLboolean Separable2D
;
573 GLboolean Light
[MAX_LIGHTS
];
575 GLboolean LineSmooth
;
576 GLboolean LineStipple
;
577 GLboolean IndexLogicOp
;
578 GLboolean ColorLogicOp
;
579 GLboolean Map1Color4
;
581 GLboolean Map1Normal
;
582 GLboolean Map1TextureCoord1
;
583 GLboolean Map1TextureCoord2
;
584 GLboolean Map1TextureCoord3
;
585 GLboolean Map1TextureCoord4
;
586 GLboolean Map1Vertex3
;
587 GLboolean Map1Vertex4
;
588 GLboolean Map1Attrib
[16]; /* GL_NV_vertex_program */
589 GLboolean Map2Color4
;
591 GLboolean Map2Normal
;
592 GLboolean Map2TextureCoord1
;
593 GLboolean Map2TextureCoord2
;
594 GLboolean Map2TextureCoord3
;
595 GLboolean Map2TextureCoord4
;
596 GLboolean Map2Vertex3
;
597 GLboolean Map2Vertex4
;
598 GLboolean Map2Attrib
[16]; /* GL_NV_vertex_program */
601 GLboolean PixelTexture
;
602 GLboolean PointSmooth
;
603 GLboolean PolygonOffsetPoint
;
604 GLboolean PolygonOffsetLine
;
605 GLboolean PolygonOffsetFill
;
606 GLboolean PolygonSmooth
;
607 GLboolean PolygonStipple
;
608 GLboolean RescaleNormals
;
611 GLboolean StencilTwoSide
; /* GL_EXT_stencil_two_side */
612 GLboolean MultisampleEnabled
; /* GL_ARB_multisample */
613 GLboolean SampleAlphaToCoverage
; /* GL_ARB_multisample */
614 GLboolean SampleAlphaToOne
; /* GL_ARB_multisample */
615 GLboolean SampleCoverage
; /* GL_ARB_multisample */
616 GLboolean SampleCoverageInvert
; /* GL_ARB_multisample */
617 GLboolean RasterPositionUnclipped
; /* GL_IBM_rasterpos_clip */
618 GLuint Texture
[MAX_TEXTURE_IMAGE_UNITS
];
619 GLuint TexGen
[MAX_TEXTURE_COORD_UNITS
];
620 /* SGI_texture_color_table */
621 GLboolean TextureColorTable
[MAX_TEXTURE_IMAGE_UNITS
];
622 /* GL_NV_vertex_program */
623 GLboolean VertexProgram
;
624 GLboolean VertexProgramPointSize
;
625 GLboolean VertexProgramTwoSide
;
626 /* GL_ARB_point_sprite / GL_NV_point_sprite */
627 GLboolean PointSprite
;
628 GLboolean FragmentShaderATI
;
633 * Evaluator attribute group (GL_EVAL_BIT).
635 struct gl_eval_attrib
641 GLboolean Map1Color4
;
643 GLboolean Map1Normal
;
644 GLboolean Map1TextureCoord1
;
645 GLboolean Map1TextureCoord2
;
646 GLboolean Map1TextureCoord3
;
647 GLboolean Map1TextureCoord4
;
648 GLboolean Map1Vertex3
;
649 GLboolean Map1Vertex4
;
650 GLboolean Map1Attrib
[16]; /* GL_NV_vertex_program */
651 GLboolean Map2Color4
;
653 GLboolean Map2Normal
;
654 GLboolean Map2TextureCoord1
;
655 GLboolean Map2TextureCoord2
;
656 GLboolean Map2TextureCoord3
;
657 GLboolean Map2TextureCoord4
;
658 GLboolean Map2Vertex3
;
659 GLboolean Map2Vertex4
;
660 GLboolean Map2Attrib
[16]; /* GL_NV_vertex_program */
661 GLboolean AutoNormal
;
665 * \name Map Grid endpoints and divisions and calculated du values
669 GLfloat MapGrid1u1
, MapGrid1u2
, MapGrid1du
;
670 GLint MapGrid2un
, MapGrid2vn
;
671 GLfloat MapGrid2u1
, MapGrid2u2
, MapGrid2du
;
672 GLfloat MapGrid2v1
, MapGrid2v2
, MapGrid2dv
;
678 * Fog attribute group (GL_FOG_BIT).
682 GLboolean Enabled
; /**< Fog enabled flag */
683 GLfloat Color
[4]; /**< Fog color */
684 GLfloat Density
; /**< Density >= 0.0 */
685 GLfloat Start
; /**< Start distance in eye coords */
686 GLfloat End
; /**< End distance in eye coords */
687 GLfloat Index
; /**< Fog index */
688 GLenum Mode
; /**< Fog mode */
689 GLboolean ColorSumEnabled
;
690 GLenum FogCoordinateSource
; /**< GL_EXT_fog_coord */
695 * Hint attribute group (GL_HINT_BIT).
697 * Values are always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE.
699 struct gl_hint_attrib
701 GLenum PerspectiveCorrection
;
704 GLenum PolygonSmooth
;
706 GLenum ClipVolumeClipping
; /**< GL_EXT_clip_volume_hint */
707 GLenum TextureCompression
; /**< GL_ARB_texture_compression */
708 GLenum GenerateMipmap
; /**< GL_SGIS_generate_mipmap */
713 * Histogram attributes.
715 struct gl_histogram_attrib
717 GLuint Width
; /**< number of table entries */
718 GLint Format
; /**< GL_ALPHA, GL_RGB, etc */
719 GLuint Count
[HISTOGRAM_TABLE_SIZE
][4]; /**< the histogram */
720 GLboolean Sink
; /**< terminate image transfer? */
721 GLubyte RedSize
; /**< Bits per counter */
725 GLubyte LuminanceSize
;
730 * Color Min/max state.
732 struct gl_minmax_attrib
736 GLfloat Min
[4], Max
[4]; /**< RGBA */
741 * Image convolution state.
743 struct gl_convolution_attrib
746 GLenum InternalFormat
;
749 GLfloat Filter
[MAX_CONVOLUTION_WIDTH
* MAX_CONVOLUTION_HEIGHT
* 4];
757 #define LIGHT_SPOT 0x1
758 #define LIGHT_LOCAL_VIEWER 0x2
759 #define LIGHT_POSITIONAL 0x4
760 #define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
765 * Lighting attribute group (GL_LIGHT_BIT).
767 struct gl_light_attrib
769 struct gl_light Light
[MAX_LIGHTS
]; /**< Array of light sources */
770 struct gl_lightmodel Model
; /**< Lighting model */
773 * Must flush FLUSH_VERTICES before referencing:
776 struct gl_material Material
; /**< Includes front & back values */
779 GLboolean Enabled
; /**< Lighting enabled flag */
780 GLenum ShadeModel
; /**< GL_FLAT or GL_SMOOTH */
781 GLenum ColorMaterialFace
; /**< GL_FRONT, BACK or FRONT_AND_BACK */
782 GLenum ColorMaterialMode
; /**< GL_AMBIENT, GL_DIFFUSE, etc */
783 GLuint ColorMaterialBitmask
; /**< bitmask formed from Face and Mode */
784 GLboolean ColorMaterialEnabled
;
786 struct gl_light EnabledList
; /**< List sentinel */
789 * Derived state for optimizations:
792 GLboolean _NeedEyeCoords
;
793 GLboolean _NeedVertices
; /**< Use fast shader? */
794 GLuint _Flags
; /**< LIGHT_* flags, see above */
795 GLfloat _BaseColor
[2][3];
801 * Line attribute group (GL_LINE_BIT).
803 struct gl_line_attrib
805 GLboolean SmoothFlag
; /**< GL_LINE_SMOOTH enabled? */
806 GLboolean StippleFlag
; /**< GL_LINE_STIPPLE enabled? */
807 GLushort StipplePattern
; /**< Stipple pattern */
808 GLint StippleFactor
; /**< Stipple repeat factor */
809 GLfloat Width
; /**< Line width */
810 GLfloat _Width
; /**< Clamped Line width */
815 * Display list attribute group (GL_LIST_BIT).
817 struct gl_list_attrib
824 * Used by device drivers to hook new commands into display lists.
826 struct gl_list_instruction
829 void (*Execute
)( GLcontext
*ctx
, void *data
);
830 void (*Destroy
)( GLcontext
*ctx
, void *data
);
831 void (*Print
)( GLcontext
*ctx
, void *data
);
834 #define MAX_DLIST_EXT_OPCODES 16
837 * Used by device drivers to hook new commands into display lists.
839 struct gl_list_extensions
841 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
847 * Multisample attribute group (GL_MULTISAMPLE_BIT).
849 struct gl_multisample_attrib
852 GLboolean SampleAlphaToCoverage
;
853 GLboolean SampleAlphaToOne
;
854 GLboolean SampleCoverage
;
855 GLfloat SampleCoverageValue
;
856 GLboolean SampleCoverageInvert
;
861 * Pixel attribute group (GL_PIXEL_MODE_BIT).
863 struct gl_pixel_attrib
865 GLenum ReadBuffer
; /**< source buffer for glReadPixels()/glCopyPixels() */
866 GLubyte _ReadSrcMask
; /**< Not really a mask, but like _DrawDestMask
868 * May be: FRONT_LEFT_BIT, BACK_LEFT_BIT,
869 * FRONT_RIGHT_BIT or BACK_RIGHT_BIT. */
870 GLfloat RedBias
, RedScale
;
871 GLfloat GreenBias
, GreenScale
;
872 GLfloat BlueBias
, BlueScale
;
873 GLfloat AlphaBias
, AlphaScale
;
874 GLfloat DepthBias
, DepthScale
;
875 GLint IndexShift
, IndexOffset
;
876 GLboolean MapColorFlag
;
877 GLboolean MapStencilFlag
;
878 GLfloat ZoomX
, ZoomY
;
879 /* XXX move these out of gl_pixel_attrib */
880 GLint MapStoSsize
; /**< Size of each pixel map */
890 GLint MapStoS
[MAX_PIXEL_MAP_TABLE
]; /**< Pixel map tables */
891 GLint MapItoI
[MAX_PIXEL_MAP_TABLE
];
892 GLfloat MapItoR
[MAX_PIXEL_MAP_TABLE
];
893 GLfloat MapItoG
[MAX_PIXEL_MAP_TABLE
];
894 GLfloat MapItoB
[MAX_PIXEL_MAP_TABLE
];
895 GLfloat MapItoA
[MAX_PIXEL_MAP_TABLE
];
896 GLubyte MapItoR8
[MAX_PIXEL_MAP_TABLE
]; /**< converted to 8-bit color */
897 GLubyte MapItoG8
[MAX_PIXEL_MAP_TABLE
];
898 GLubyte MapItoB8
[MAX_PIXEL_MAP_TABLE
];
899 GLubyte MapItoA8
[MAX_PIXEL_MAP_TABLE
];
900 GLfloat MapRtoR
[MAX_PIXEL_MAP_TABLE
];
901 GLfloat MapGtoG
[MAX_PIXEL_MAP_TABLE
];
902 GLfloat MapBtoB
[MAX_PIXEL_MAP_TABLE
];
903 GLfloat MapAtoA
[MAX_PIXEL_MAP_TABLE
];
904 /** GL_EXT_histogram */
905 GLboolean HistogramEnabled
;
906 GLboolean MinMaxEnabled
;
907 /** GL_SGIS_pixel_texture */
908 GLboolean PixelTextureEnabled
;
909 GLenum FragmentRgbSource
;
910 GLenum FragmentAlphaSource
;
911 /** GL_SGI_color_matrix */
912 GLfloat PostColorMatrixScale
[4]; /**< RGBA */
913 GLfloat PostColorMatrixBias
[4]; /**< RGBA */
914 /** GL_SGI_color_table */
915 GLfloat ColorTableScale
[4];
916 GLfloat ColorTableBias
[4];
917 GLboolean ColorTableEnabled
;
918 GLfloat PCCTscale
[4];
920 GLboolean PostConvolutionColorTableEnabled
;
921 GLfloat PCMCTscale
[4];
922 GLfloat PCMCTbias
[4];
923 GLboolean PostColorMatrixColorTableEnabled
;
924 /** GL_SGI_texture_color_table */
925 GLfloat TextureColorTableScale
[4];
926 GLfloat TextureColorTableBias
[4];
928 GLboolean Convolution1DEnabled
;
929 GLboolean Convolution2DEnabled
;
930 GLboolean Separable2DEnabled
;
931 GLfloat ConvolutionBorderColor
[3][4];
932 GLenum ConvolutionBorderMode
[3];
933 GLfloat ConvolutionFilterScale
[3][4];
934 GLfloat ConvolutionFilterBias
[3][4];
935 GLfloat PostConvolutionScale
[4]; /**< RGBA */
936 GLfloat PostConvolutionBias
[4]; /**< RGBA */
941 * Point attribute group (GL_POINT_BIT).
943 struct gl_point_attrib
945 GLboolean SmoothFlag
; /**< True if GL_POINT_SMOOTH is enabled */
946 GLfloat Size
; /**< User-specified point size */
947 GLfloat _Size
; /**< Size clamped to Const.Min/MaxPointSize */
948 GLfloat Params
[3]; /**< GL_EXT_point_parameters */
949 GLfloat MinSize
, MaxSize
; /**< GL_EXT_point_parameters */
950 GLfloat Threshold
; /**< GL_EXT_point_parameters */
951 GLboolean _Attenuated
; /**< True if Params != [1, 0, 0] */
952 GLboolean PointSprite
; /**< GL_NV_point_sprite / GL_NV_point_sprite */
953 GLboolean CoordReplace
[MAX_TEXTURE_UNITS
]; /**< GL_NV_point_sprite / GL_NV_point_sprite */
954 GLenum SpriteRMode
; /**< GL_NV_point_sprite (only!) */
955 GLenum SpriteOrigin
; /**< GL_ARB_point_sprite */
960 * Polygon attribute group (GL_POLYGON_BIT).
962 struct gl_polygon_attrib
964 GLenum FrontFace
; /**< Either GL_CW or GL_CCW */
965 GLenum FrontMode
; /**< Either GL_POINT, GL_LINE or GL_FILL */
966 GLenum BackMode
; /**< Either GL_POINT, GL_LINE or GL_FILL */
967 GLboolean _FrontBit
; /**< 0=GL_CCW, 1=GL_CW */
968 GLboolean CullFlag
; /**< Culling on/off flag */
969 GLboolean SmoothFlag
; /**< True if GL_POLYGON_SMOOTH is enabled */
970 GLboolean StippleFlag
; /**< True if GL_POLYGON_STIPPLE is enabled */
971 GLenum CullFaceMode
; /**< Culling mode GL_FRONT or GL_BACK */
972 GLfloat OffsetFactor
; /**< Polygon offset factor, from user */
973 GLfloat OffsetUnits
; /**< Polygon offset units, from user */
974 GLboolean OffsetPoint
; /**< Offset in GL_POINT mode */
975 GLboolean OffsetLine
; /**< Offset in GL_LINE mode */
976 GLboolean OffsetFill
; /**< Offset in GL_FILL mode */
981 * Scissor attributes (GL_SCISSOR_BIT).
983 struct gl_scissor_attrib
985 GLboolean Enabled
; /**< Scissor test enabled? */
986 GLint X
, Y
; /**< Lower left corner of box */
987 GLsizei Width
, Height
; /**< Size of box */
992 * Stencil attribute group (GL_STENCIL_BUFFER_BIT).
994 struct gl_stencil_attrib
996 GLboolean Enabled
; /**< Enabled flag */
997 GLboolean TestTwoSide
; /**< GL_EXT_stencil_two_side */
998 GLubyte ActiveFace
; /**< GL_EXT_stencil_two_side (0 or 1) */
999 GLenum Function
[2]; /**< Stencil function */
1000 GLenum FailFunc
[2]; /**< Fail function */
1001 GLenum ZPassFunc
[2]; /**< Depth buffer pass function */
1002 GLenum ZFailFunc
[2]; /**< Depth buffer fail function */
1003 GLstencil Ref
[2]; /**< Reference value */
1004 GLstencil ValueMask
[2]; /**< Value mask */
1005 GLstencil WriteMask
[2]; /**< Write mask */
1006 GLstencil Clear
; /**< Clear value */
1010 #define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */
1013 * An index for each type of texture object
1016 #define TEXTURE_1D_INDEX 0
1017 #define TEXTURE_2D_INDEX 1
1018 #define TEXTURE_3D_INDEX 2
1019 #define TEXTURE_CUBE_INDEX 3
1020 #define TEXTURE_RECT_INDEX 4
1024 * Bit flags for each type of texture object
1025 * Used for Texture.Unit[]._ReallyEnabled flags.
1028 #define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX)
1029 #define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX)
1030 #define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX)
1031 #define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
1032 #define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX)
1037 * TexGenEnabled flags.
1048 * Bit flag versions of the corresponding GL_ constants.
1051 #define TEXGEN_SPHERE_MAP 0x1
1052 #define TEXGEN_OBJ_LINEAR 0x2
1053 #define TEXGEN_EYE_LINEAR 0x4
1054 #define TEXGEN_REFLECTION_MAP_NV 0x8
1055 #define TEXGEN_NORMAL_MAP_NV 0x10
1057 #define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
1058 TEXGEN_REFLECTION_MAP_NV | \
1059 TEXGEN_NORMAL_MAP_NV)
1060 #define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
1061 TEXGEN_REFLECTION_MAP_NV | \
1062 TEXGEN_NORMAL_MAP_NV | \
1067 /* A selection of state flags to make driver and module's lives easier. */
1068 #define ENABLE_TEXGEN0 0x1
1069 #define ENABLE_TEXGEN1 0x2
1070 #define ENABLE_TEXGEN2 0x4
1071 #define ENABLE_TEXGEN3 0x8
1072 #define ENABLE_TEXGEN4 0x10
1073 #define ENABLE_TEXGEN5 0x20
1074 #define ENABLE_TEXGEN6 0x40
1075 #define ENABLE_TEXGEN7 0x80
1077 #define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */
1078 #define ENABLE_TEXMAT1 0x2
1079 #define ENABLE_TEXMAT2 0x4
1080 #define ENABLE_TEXMAT3 0x8
1081 #define ENABLE_TEXMAT4 0x10
1082 #define ENABLE_TEXMAT5 0x20
1083 #define ENABLE_TEXMAT6 0x40
1084 #define ENABLE_TEXMAT7 0x80
1086 #define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
1087 #define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
1091 * Texel fetch function prototype. We use texel fetch functions to
1092 * extract RGBA, color indexes and depth components out of 1D, 2D and 3D
1093 * texture images. These functions help to isolate us from the gritty
1094 * details of all the various texture image encodings.
1096 * \param texImage texture image.
1097 * \param col texel column.
1098 * \param row texel row.
1099 * \param img texel image level/layer.
1100 * \param texelOut output texel (up to 4 GLchans)
1102 typedef void (*FetchTexelFuncC
)( const struct gl_texture_image
*texImage
,
1103 GLint col
, GLint row
, GLint img
,
1107 * As above, but returns floats.
1108 * Used for depth component images and for upcoming signed/float
1111 typedef void (*FetchTexelFuncF
)( const struct gl_texture_image
*texImage
,
1112 GLint col
, GLint row
, GLint img
,
1113 GLfloat
*texelOut
);
1117 * TexImage store function. This is called by the glTex[Sub]Image
1118 * functions and is responsible for converting the user-specified texture
1119 * image into a specific (hardware) image format.
1121 typedef GLboolean (*StoreTexImageFunc
)(GLcontext
*ctx
, GLuint dims
,
1122 GLenum baseInternalFormat
,
1123 const struct gl_texture_format
*dstFormat
,
1125 GLint dstXoffset
, GLint dstYoffset
, GLint dstZoffset
,
1126 GLint dstRowStride
, GLint dstImageStride
,
1127 GLint srcWidth
, GLint srcHeight
, GLint srcDepth
,
1128 GLenum srcFormat
, GLenum srcType
,
1129 const GLvoid
*srcAddr
,
1130 const struct gl_pixelstore_attrib
*srcPacking
);
1135 * Texture format record
1137 struct gl_texture_format
1139 GLint MesaFormat
; /**< One of the MESA_FORMAT_* values */
1141 GLenum BaseFormat
; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
1142 * GL_LUMINANCE, GL_LUMINANCE_ALPHA,
1143 * GL_INTENSITY, GL_COLOR_INDEX or
1144 * GL_DEPTH_COMPONENT.
1146 GLenum DataType
; /**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */
1147 GLubyte RedBits
; /**< Bits per texel component */
1148 GLubyte GreenBits
; /**< These are just rough approximations for */
1149 GLubyte BlueBits
; /**< compressed texture formats. */
1151 GLubyte LuminanceBits
;
1152 GLubyte IntensityBits
;
1156 GLuint TexelBytes
; /**< Bytes per texel, 0 if compressed format */
1158 StoreTexImageFunc StoreImage
;
1161 * \name Texel fetch function pointers
1164 FetchTexelFuncC FetchTexel1D
;
1165 FetchTexelFuncC FetchTexel2D
;
1166 FetchTexelFuncC FetchTexel3D
;
1167 FetchTexelFuncF FetchTexel1Df
;
1168 FetchTexelFuncF FetchTexel2Df
;
1169 FetchTexelFuncF FetchTexel3Df
;
1175 * Texture image state. Describes the dimensions of a texture image,
1176 * the texel format and pointers to Texel Fetch functions.
1178 struct gl_texture_image
1180 GLenum Format
; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
1181 * GL_LUMINANCE, GL_LUMINANCE_ALPHA,
1182 * GL_INTENSITY, GL_COLOR_INDEX or
1183 * GL_DEPTH_COMPONENT only.
1184 * Used for choosing TexEnv arithmetic.
1186 GLint IntFormat
; /**< Internal format as given by the user */
1187 GLuint Border
; /**< 0 or 1 */
1188 GLuint Width
; /**< = 2^WidthLog2 + 2*Border */
1189 GLuint Height
; /**< = 2^HeightLog2 + 2*Border */
1190 GLuint Depth
; /**< = 2^DepthLog2 + 2*Border */
1191 GLuint RowStride
; /**< == Width unless IsClientData and padded */
1192 GLuint Width2
; /**< = Width - 2*Border */
1193 GLuint Height2
; /**< = Height - 2*Border */
1194 GLuint Depth2
; /**< = Depth - 2*Border */
1195 GLuint WidthLog2
; /**< = log2(Width2) */
1196 GLuint HeightLog2
; /**< = log2(Height2) */
1197 GLuint DepthLog2
; /**< = log2(Depth2) */
1198 GLuint MaxLog2
; /**< = MAX(WidthLog2, HeightLog2) */
1199 GLfloat WidthScale
; /**< used for mipmap LOD computation */
1200 GLfloat HeightScale
; /**< used for mipmap LOD computation */
1201 GLfloat DepthScale
; /**< used for mipmap LOD computation */
1202 GLvoid
*Data
; /**< Image data, accessed via FetchTexel() */
1203 GLboolean IsClientData
; /**< Data owned by client? */
1204 GLboolean _IsPowerOfTwo
; /**< Are all dimensions powers of two? */
1206 const struct gl_texture_format
*TexFormat
;
1208 struct gl_texture_object
*TexObject
; /**< Pointer back to parent object */
1210 FetchTexelFuncC FetchTexelc
; /**< GLchan texel fetch function pointer */
1211 FetchTexelFuncF FetchTexelf
; /**< Float texel fetch function pointer */
1213 GLboolean IsCompressed
; /**< GL_ARB_texture_compression */
1214 GLuint CompressedSize
; /**< GL_ARB_texture_compression */
1217 * \name For device driver:
1220 void *DriverData
; /**< Arbitrary device driver data */
1226 * Indexes for cube map faces.
1229 #define FACE_POS_X 0
1230 #define FACE_NEG_X 1
1231 #define FACE_POS_Y 2
1232 #define FACE_NEG_Y 3
1233 #define FACE_POS_Z 4
1234 #define FACE_NEG_Z 5
1240 * Texture object state. Contains the array of mipmap images, border color,
1241 * wrap modes, filter modes, shadow/texcompare state, and the per-texture
1244 struct gl_texture_object
1246 _glthread_Mutex Mutex
; /**< for thread safety */
1247 GLint RefCount
; /**< reference count */
1248 GLuint Name
; /**< the user-visible texture object ID */
1249 GLenum Target
; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
1250 GLfloat Priority
; /**< in [0,1] */
1251 GLfloat BorderColor
[4]; /**< unclamped */
1252 GLchan _BorderChan
[4]; /**< clamped, as GLchan */
1253 /** \name Wrap modes
1254 * Are GL_CLAMP, REPEAT, GL_CLAMP_TO_EDGE, and GL_CLAMP_TO_BORDER_ARB. */
1260 GLenum MinFilter
; /**< minification filter */
1261 GLenum MagFilter
; /**< magnification filter */
1262 GLfloat MinLod
; /**< min lambda, OpenGL 1.2 */
1263 GLfloat MaxLod
; /**< max lambda, OpenGL 1.2 */
1264 GLfloat LodBias
; /**< OpenGL 1.4 */
1265 GLint BaseLevel
; /**< min mipmap level, OpenGL 1.2 */
1266 GLint MaxLevel
; /**< max mipmap level, OpenGL 1.2 */
1267 GLfloat MaxAnisotropy
; /**< GL_EXT_texture_filter_anisotropic */
1268 GLboolean CompareFlag
; /**< GL_SGIX_shadow */
1269 GLenum CompareOperator
; /**< GL_SGIX_shadow */
1270 GLfloat ShadowAmbient
;
1271 GLenum CompareMode
; /**< GL_ARB_shadow */
1272 GLenum CompareFunc
; /**< GL_ARB_shadow */
1273 GLenum DepthMode
; /**< GL_ARB_depth_texture */
1274 GLint _MaxLevel
; /**< actual max mipmap level (q in the spec) */
1275 GLfloat _MaxLambda
; /**< = _MaxLevel - BaseLevel (q - b in spec) */
1276 GLboolean GenerateMipmap
; /**< GL_SGIS_generate_mipmap */
1277 GLboolean _IsPowerOfTwo
; /**< Are all image dimensions powers of two? */
1279 struct gl_texture_image
*Image
[MAX_FACES
][MAX_TEXTURE_LEVELS
];
1281 /** GL_EXT_paletted_texture */
1282 struct gl_color_table Palette
;
1284 GLboolean Complete
; /**< Is texture object complete? */
1285 struct gl_texture_object
*Next
; /**< Next in linked list */
1288 * \name For device driver
1291 void *DriverData
; /**< Arbitrary device driver data */
1297 * Texture combine environment state.
1300 * If GL_NV_texture_env_combine4 is ever supported, the arrays in this
1301 * structure will need to be expanded for 4 elements.
1303 struct gl_tex_env_combine_state
1305 GLenum ModeRGB
; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
1306 GLenum ModeA
; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
1307 GLenum SourceRGB
[3]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
1308 GLenum SourceA
[3]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
1309 GLenum OperandRGB
[3]; /**< SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */
1310 GLenum OperandA
[3]; /**< SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */
1311 GLuint ScaleShiftRGB
; /**< 0, 1 or 2 */
1312 GLuint ScaleShiftA
; /**< 0, 1 or 2 */
1313 GLuint _NumArgsRGB
; /**< Number of inputs used for the combine mode. */
1314 GLuint _NumArgsA
; /**< Number of inputs used for the combine mode. */
1319 * Texture unit state. Contains enable flags, texture environment/function/
1320 * combiners, texgen state, pointers to current texture objects and
1321 * post-filter color tables.
1323 struct gl_texture_unit
1325 GLuint Enabled
; /**< bitmask of TEXTURE_*_BIT flags */
1326 GLuint _ReallyEnabled
; /**< 0 or exactly one of TEXTURE_*_BIT flags */
1328 GLenum EnvMode
; /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
1329 GLfloat EnvColor
[4];
1330 GLuint TexGenEnabled
; /**< Bitwise-OR of [STRQ]_BIT values */
1331 /** \name Tex coord generation mode
1332 * Either GL_OBJECT_LINEAR, GL_EYE_LINEAR or GL_SPHERE_MAP. */
1343 GLuint _GenFlags
; /**< bitwise or of GenBit[STRQ] */
1344 GLfloat ObjectPlaneS
[4];
1345 GLfloat ObjectPlaneT
[4];
1346 GLfloat ObjectPlaneR
[4];
1347 GLfloat ObjectPlaneQ
[4];
1348 GLfloat EyePlaneS
[4];
1349 GLfloat EyePlaneT
[4];
1350 GLfloat EyePlaneR
[4];
1351 GLfloat EyePlaneQ
[4];
1352 GLfloat LodBias
; /**< for biasing mipmap levels */
1355 * \name GL_EXT_texture_env_combine
1357 struct gl_tex_env_combine_state Combine
;
1360 * Derived state based on \c EnvMode and the \c BaseFormat of the
1361 * currently enabled texture.
1363 struct gl_tex_env_combine_state _EnvMode
;
1366 * Currently enabled combiner state. This will point to either
1367 * \c Combine or \c _EnvMode.
1369 struct gl_tex_env_combine_state
*_CurrentCombine
;
1371 struct gl_texture_object
*Current1D
;
1372 struct gl_texture_object
*Current2D
;
1373 struct gl_texture_object
*Current3D
;
1374 struct gl_texture_object
*CurrentCubeMap
; /**< GL_ARB_texture_cube_map */
1375 struct gl_texture_object
*CurrentRect
; /**< GL_NV_texture_rectangle */
1377 struct gl_texture_object
*_Current
; /**< Points to really enabled tex obj */
1379 struct gl_texture_object Saved1D
; /**< only used by glPush/PopAttrib */
1380 struct gl_texture_object Saved2D
;
1381 struct gl_texture_object Saved3D
;
1382 struct gl_texture_object SavedCubeMap
;
1383 struct gl_texture_object SavedRect
;
1385 /* GL_SGI_texture_color_table */
1386 struct gl_color_table ColorTable
;
1387 struct gl_color_table ProxyColorTable
;
1388 GLboolean ColorTableEnabled
;
1393 * Texture attribute group (GL_TEXTURE_BIT).
1395 struct gl_texture_attrib
1401 GLuint CurrentUnit
; /**< Active texture unit */
1402 GLuint _EnabledUnits
; /**< one bit set for each really-enabled unit */
1403 GLuint _EnabledCoordUnits
; /**< one bit per enabled coordinate unit */
1404 GLuint _GenFlags
; /**< for texgen */
1405 GLuint _TexGenEnabled
;
1406 GLuint _TexMatEnabled
;
1409 struct gl_texture_unit Unit
[MAX_TEXTURE_UNITS
];
1411 struct gl_texture_object
*Proxy1D
;
1412 struct gl_texture_object
*Proxy2D
;
1413 struct gl_texture_object
*Proxy3D
;
1414 struct gl_texture_object
*ProxyCubeMap
;
1415 struct gl_texture_object
*ProxyRect
;
1417 /** GL_EXT_shared_texture_palette */
1418 GLboolean SharedPalette
;
1419 struct gl_color_table Palette
;
1424 * Transformation attribute group (GL_TRANSFORM_BIT).
1426 struct gl_transform_attrib
1428 GLenum MatrixMode
; /**< Matrix mode */
1429 GLfloat EyeUserPlane
[MAX_CLIP_PLANES
][4]; /**< User clip planes */
1430 GLfloat _ClipUserPlane
[MAX_CLIP_PLANES
][4]; /**< derived */
1431 GLuint ClipPlanesEnabled
; /**< on/off bitmask */
1432 GLboolean Normalize
; /**< Normalize all normals? */
1433 GLboolean RescaleNormals
; /**< GL_EXT_rescale_normal */
1434 GLboolean RasterPositionUnclipped
; /**< GL_IBM_rasterpos_clip */
1436 GLboolean CullVertexFlag
; /**< True if GL_CULL_VERTEX_EXT is enabled */
1437 GLfloat CullEyePos
[4];
1438 GLfloat CullObjPos
[4];
1443 * Viewport attribute group (GL_VIEWPORT_BIT).
1445 struct gl_viewport_attrib
1447 GLint X
, Y
; /**< position */
1448 GLsizei Width
, Height
; /**< size */
1449 GLfloat Near
, Far
; /**< Depth buffer range */
1450 GLmatrix _WindowMap
; /**< Mapping transformation as a matrix. */
1455 * Node for the attribute stack.
1457 struct gl_attrib_node
1461 struct gl_attrib_node
*next
;
1466 * GL_ARB_vertex/pixel_buffer_object buffer object
1468 struct gl_buffer_object
1474 GLvoid
*Pointer
; /**< Only valid while buffer is mapped */
1475 GLuint Size
; /**< Size of storage in bytes */
1476 GLubyte
*Data
; /**< Location of storage either in RAM or VRAM. */
1477 GLboolean OnCard
; /**< Is buffer in VRAM? (hardware drivers) */
1483 * Client pixel packing/unpacking attributes
1485 struct gl_pixelstore_attrib
1491 GLint ImageHeight
; /**< for GL_EXT_texture3D */
1492 GLint SkipImages
; /**< for GL_EXT_texture3D */
1493 GLboolean SwapBytes
;
1495 GLboolean ClientStorage
; /**< GL_APPLE_client_storage */
1496 GLboolean Invert
; /**< GL_MESA_pack_invert */
1497 struct gl_buffer_object
*BufferObj
; /**< GL_ARB_pixel_buffer_object */
1501 #define CA_CLIENT_DATA 0x1 /**< Data not allocated by mesa */
1505 * Client vertex array attributes
1507 struct gl_client_array
1509 GLint Size
; /**< components per element (1,2,3,4) */
1510 GLenum Type
; /**< datatype: GL_FLOAT, GL_INT, etc */
1511 GLsizei Stride
; /**< user-specified stride */
1512 GLsizei StrideB
; /**< actual stride in bytes */
1513 const GLubyte
*Ptr
; /**< Points to array data */
1514 GLuint Enabled
; /**< one of the _NEW_ARRAY_ bits */
1515 GLboolean Normalized
; /**< GL_ARB_vertex_program */
1517 /**< GL_ARB_vertex_buffer_object */
1518 struct gl_buffer_object
*BufferObj
;
1526 * Vertex array state
1528 struct gl_array_attrib
1530 struct gl_client_array Vertex
; /**< client data descriptors */
1531 struct gl_client_array Normal
;
1532 struct gl_client_array Color
;
1533 struct gl_client_array SecondaryColor
;
1534 struct gl_client_array FogCoord
;
1535 struct gl_client_array Index
;
1536 struct gl_client_array TexCoord
[MAX_TEXTURE_COORD_UNITS
];
1537 struct gl_client_array EdgeFlag
;
1539 struct gl_client_array VertexAttrib
[VERT_ATTRIB_MAX
]; /**< GL_NV_vertex_program */
1541 GLint ActiveTexture
; /**< Client Active Texture */
1542 GLuint LockFirst
; /**< GL_EXT_compiled_vertex_array */
1543 GLuint LockCount
; /**< GL_EXT_compiled_vertex_array */
1545 GLuint _Enabled
; /**< _NEW_ARRAY_* - bit set if array enabled */
1546 GLuint NewState
; /**< _NEW_ARRAY_* */
1548 #if FEATURE_ARB_vertex_buffer_object
1549 struct gl_buffer_object
*NullBufferObj
;
1550 struct gl_buffer_object
*ArrayBufferObj
;
1551 struct gl_buffer_object
*ElementArrayBufferObj
;
1553 GLuint _MaxElement
; /* Min of all enabled array's maxes */
1558 * Feedback buffer state
1563 GLuint _Mask
; /* FB_* bits */
1571 * Selection buffer state
1575 GLuint
*Buffer
; /**< selection buffer */
1576 GLuint BufferSize
; /**< size of the selection buffer */
1577 GLuint BufferCount
; /**< number of values in the selection buffer */
1578 GLuint Hits
; /**< number of records in the selection buffer */
1579 GLuint NameStackDepth
; /**< name stack depth */
1580 GLuint NameStack
[MAX_NAME_STACK_DEPTH
]; /**< name stack */
1581 GLboolean HitFlag
; /**< hit flag */
1582 GLfloat HitMinZ
; /**< minimum hit depth */
1583 GLfloat HitMaxZ
; /**< maximum hit depth */
1588 * 1-D Evaluator control points
1592 GLuint Order
; /**< Number of control points */
1593 GLfloat u1
, u2
, du
; /**< u1, u2, 1.0/(u2-u1) */
1594 GLfloat
*Points
; /**< Points to contiguous control points */
1599 * 2-D Evaluator control points
1603 GLuint Uorder
; /**< Number of control points in U dimension */
1604 GLuint Vorder
; /**< Number of control points in V dimension */
1607 GLfloat
*Points
; /**< Points to contiguous control points */
1612 * All evaluator control point state
1614 struct gl_evaluators
1620 struct gl_1d_map Map1Vertex3
;
1621 struct gl_1d_map Map1Vertex4
;
1622 struct gl_1d_map Map1Index
;
1623 struct gl_1d_map Map1Color4
;
1624 struct gl_1d_map Map1Normal
;
1625 struct gl_1d_map Map1Texture1
;
1626 struct gl_1d_map Map1Texture2
;
1627 struct gl_1d_map Map1Texture3
;
1628 struct gl_1d_map Map1Texture4
;
1629 struct gl_1d_map Map1Attrib
[16]; /**< GL_NV_vertex_program */
1636 struct gl_2d_map Map2Vertex3
;
1637 struct gl_2d_map Map2Vertex4
;
1638 struct gl_2d_map Map2Index
;
1639 struct gl_2d_map Map2Color4
;
1640 struct gl_2d_map Map2Normal
;
1641 struct gl_2d_map Map2Texture1
;
1642 struct gl_2d_map Map2Texture2
;
1643 struct gl_2d_map Map2Texture3
;
1644 struct gl_2d_map Map2Texture4
;
1645 struct gl_2d_map Map2Attrib
[16]; /**< GL_NV_vertex_program */
1651 * NV_fragment_program runtime state
1655 GLfloat Temporaries
[MAX_NV_FRAGMENT_PROGRAM_TEMPS
][4];
1656 GLfloat Inputs
[MAX_NV_FRAGMENT_PROGRAM_INPUTS
][4];
1657 GLfloat Outputs
[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS
][4];
1658 GLuint CondCodes
[4];
1662 * ATI_fragment_shader runtime state
1664 #define ATI_FS_INPUT_PRIMARY 0
1665 #define ATI_FS_INPUT_SECONDARY 1
1667 /* 6 register sets - 2 inputs (primary, secondary) */
1668 struct atifs_machine
1670 GLfloat Registers
[6][4];
1671 GLfloat PrevPassRegisters
[6][4];
1672 GLfloat Inputs
[2][4];
1678 * Names of the various vertex/fragment register files
1682 PROGRAM_TEMPORARY
= 10,
1685 PROGRAM_LOCAL_PARAM
,
1687 PROGRAM_NAMED_PARAM
,
1694 /** Vertex and fragment instructions */
1695 struct vp_instruction
;
1696 struct fp_instruction
;
1697 struct atifs_instruction
;
1698 struct program_parameter_list
;
1702 * Base class for any kind of program object
1707 GLubyte
*String
; /**< Null-terminated program text */
1710 GLenum Format
; /**< String encoding format */
1712 GLfloat LocalParams
[MAX_PROGRAM_LOCAL_PARAMS
][4];
1713 GLuint NumInstructions
; /* GL_ARB_vertex/fragment_program */
1714 GLuint NumTemporaries
;
1715 GLuint NumParameters
;
1716 GLuint NumAttributes
;
1717 GLuint NumAddressRegs
;
1721 /** Vertex program object */
1722 struct vertex_program
1724 struct program Base
; /* base class */
1725 struct vp_instruction
*Instructions
; /* Compiled instructions */
1726 GLboolean IsNVProgram
; /* GL_NV_vertex_program ? */
1727 GLboolean IsPositionInvariant
; /* GL_NV_vertex_program1_1 */
1728 GLuint InputsRead
; /* Bitmask of which input regs are read */
1729 GLuint OutputsWritten
; /* Bitmask of which output regs are written to */
1730 struct program_parameter_list
*Parameters
; /**< array [NumParameters] */
1734 /** Fragment program object */
1735 struct fragment_program
1737 struct program Base
; /**< base class */
1738 struct fp_instruction
*Instructions
; /**< Compiled instructions */
1739 GLuint InputsRead
; /**< Bitmask of which input regs are read */
1740 GLuint OutputsWritten
; /**< Bitmask of which output regs are written to */
1741 GLuint TexturesUsed
[MAX_TEXTURE_IMAGE_UNITS
]; /**< TEXTURE_x_INDEX bitmask */
1742 GLuint NumAluInstructions
; /**< GL_ARB_fragment_program */
1743 GLuint NumTexInstructions
;
1744 GLuint NumTexIndirections
;
1746 struct program_parameter_list
*Parameters
; /**< array [NumParameters] */
1749 char c_str
[4096]; /* experimental... */
1754 struct ati_fragment_shader
1756 struct program Base
;
1757 struct atifs_instruction
*Instructions
;
1758 GLfloat Constants
[8][4];
1764 * State common to vertex and fragment programs.
1766 struct gl_program_state
1768 GLint ErrorPos
; /* GL_PROGRAM_ERROR_POSITION_NV */
1769 const char *ErrorString
; /* GL_PROGRAM_ERROR_STRING_NV */
1774 * State vars for GL_ARB/GL_NV_vertex_program
1776 struct gl_vertex_program_state
1778 GLboolean Enabled
; /**< GL_VERTEX_PROGRAM_NV */
1779 GLboolean _Enabled
; /**< Really enabled? */
1780 GLboolean PointSizeEnabled
; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */
1781 GLboolean TwoSideEnabled
; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */
1782 struct vertex_program
*Current
; /**< ptr to currently bound program */
1784 GLenum TrackMatrix
[MAX_NV_VERTEX_PROGRAM_PARAMS
/ 4];
1785 GLenum TrackMatrixTransform
[MAX_NV_VERTEX_PROGRAM_PARAMS
/ 4];
1787 GLfloat Parameters
[MAX_NV_VERTEX_PROGRAM_PARAMS
][4]; /* Env params */
1788 /* Only used during program execution (may be moved someday): */
1789 GLfloat Temporaries
[MAX_NV_VERTEX_PROGRAM_TEMPS
][4];
1790 GLfloat Inputs
[MAX_NV_VERTEX_PROGRAM_INPUTS
][4];
1791 GLuint InputsSize
[MAX_NV_VERTEX_PROGRAM_INPUTS
];
1792 GLfloat Outputs
[MAX_NV_VERTEX_PROGRAM_OUTPUTS
][4];
1793 GLint AddressReg
[4];
1795 #if FEATURE_MESA_program_debug
1796 GLprogramcallbackMESA Callback
;
1797 GLvoid
*CallbackData
;
1798 GLboolean CallbackEnabled
;
1799 GLuint CurrentPosition
;
1805 * State for GL_ARB/NV_fragment_program
1807 struct gl_fragment_program_state
1809 GLboolean Enabled
; /* GL_VERTEX_PROGRAM_NV */
1810 GLboolean _Enabled
; /* Really enabled? */
1811 struct fragment_program
*Current
; /* ptr to currently bound program */
1812 struct fp_machine Machine
; /* machine state */
1813 GLfloat Parameters
[MAX_NV_FRAGMENT_PROGRAM_PARAMS
][4]; /* Env params */
1815 #if FEATURE_MESA_program_debug
1816 GLprogramcallbackMESA Callback
;
1817 GLvoid
*CallbackData
;
1818 GLboolean CallbackEnabled
;
1819 GLuint CurrentPosition
;
1824 * State for GL_fragment_shader
1826 struct gl_ati_fragment_shader_state
1830 GLboolean Compiling
;
1831 struct atifs_machine Machine
; /* machine state */
1832 struct ati_fragment_shader
*Current
;
1836 * State for GL_ARB_occlusion_query
1838 struct gl_occlusion_state
1841 GLuint CurrentQueryObject
;
1842 GLuint PassedCounter
;
1843 struct _mesa_HashTable
*QueryObjects
;
1847 * gl2 unique interface identifier.
1848 * Each gl2 interface has its own interface id used for object queries.
1852 UIID_UNKNOWN
, /* supported by all objects */
1853 UIID_GENERIC
, /* generic object */
1854 UIID_CONTAINER
, /* contains generic objects */
1855 UIID_SHADER
, /* shader object */
1856 UIID_FRAGMENT_SHADER
, /* fragment shader */
1857 UIID_VERTEX_SHADER
, /* vertex shader */
1858 UIID_PROGRAM
, /* program object */
1859 UIID_3DLABS_SHHANDLE
/* encapsulates 3dlabs' ShHandle */
1862 struct gl2_unknown_intf
1864 GLvoid (* AddRef
) (struct gl2_unknown_intf
**);
1865 GLvoid (* Release
) (struct gl2_unknown_intf
**);
1866 struct gl2_unknown_intf
**(* QueryInterface
) (struct gl2_unknown_intf
**, enum gl2_uiid uiid
);
1869 struct gl2_generic_intf
1871 struct gl2_unknown_intf _unknown
;
1872 GLvoid (* Delete
) (struct gl2_generic_intf
**);
1873 GLenum (* GetType
) (struct gl2_generic_intf
**);
1874 GLhandleARB (* GetName
) (struct gl2_generic_intf
**);
1875 GLboolean (* GetDeleteStatus
) (struct gl2_generic_intf
**);
1876 const GLcharARB
*(* GetInfoLog
) (struct gl2_generic_intf
**);
1879 struct gl2_container_intf
1881 struct gl2_generic_intf _generic
;
1882 GLboolean (* Attach
) (struct gl2_container_intf
**, struct gl2_generic_intf
**);
1883 GLboolean (* Detach
) (struct gl2_container_intf
**, struct gl2_generic_intf
**);
1884 GLsizei (* GetAttachedCount
) (struct gl2_container_intf
**);
1885 struct gl2_generic_intf
**(* GetAttached
) (struct gl2_container_intf
**, GLuint
);
1888 struct gl2_shader_intf
1890 struct gl2_generic_intf _generic
;
1891 GLenum (* GetSubType
) (struct gl2_shader_intf
**);
1892 GLboolean (* GetCompileStatus
) (struct gl2_shader_intf
**);
1893 GLvoid (* SetSource
) (struct gl2_shader_intf
**, GLcharARB
*, GLint
*, GLsizei
);
1894 const GLcharARB
*(* GetSource
) (struct gl2_shader_intf
**);
1895 GLvoid (* Compile
) (struct gl2_shader_intf
**);
1898 struct gl2_program_intf
1900 struct gl2_container_intf _container
;
1901 GLboolean (* GetLinkStatus
) (struct gl2_program_intf
**);
1902 GLboolean (* GetValidateStatus
) (struct gl2_program_intf
**);
1903 GLvoid (* Link
) (struct gl2_program_intf
**);
1904 GLvoid (* Validate
) (struct gl2_program_intf
**);
1907 struct gl2_fragment_shader_intf
1909 struct gl2_shader_intf _shader
;
1912 struct gl2_vertex_shader_intf
1914 struct gl2_shader_intf _shader
;
1917 struct gl2_3dlabs_shhandle_intf
1919 struct gl2_unknown_intf _unknown
;
1920 GLvoid
*(* GetShHandle
) (struct gl2_3dlabs_shhandle_intf
**);
1923 struct gl_shader_objects_state
1925 struct gl2_program_intf
**current_program
;
1930 * State which can be shared by multiple contexts:
1932 struct gl_shared_state
1934 _glthread_Mutex Mutex
; /**< for thread safety */
1935 GLint RefCount
; /**< Reference count */
1936 struct _mesa_HashTable
*DisplayList
; /**< Display lists hash table */
1937 struct _mesa_HashTable
*TexObjects
; /**< Texture objects hash table */
1938 struct gl_texture_object
*TexObjectList
;/**< Linked list of texture objects */
1941 * \name Default texture objects (shared by all multi-texture units)
1944 struct gl_texture_object
*Default1D
;
1945 struct gl_texture_object
*Default2D
;
1946 struct gl_texture_object
*Default3D
;
1947 struct gl_texture_object
*DefaultCubeMap
;
1948 struct gl_texture_object
*DefaultRect
;
1952 * \name GL_NV_vertex/_program
1955 struct _mesa_HashTable
*Programs
;
1956 #if FEATURE_ARB_vertex_program
1957 struct program
*DefaultVertexProgram
;
1959 #if FEATURE_ARB_fragment_program
1960 struct program
*DefaultFragmentProgram
;
1962 #if FEATURE_ATI_fragment_shader
1963 struct program
*DefaultFragmentShader
;
1967 #if FEATURE_ARB_vertex_buffer_object
1968 struct _mesa_HashTable
*BufferObjects
;
1971 struct _mesa_HashTable
*GL2Objects
;
1973 void *DriverData
; /**< Device driver shared state */
1980 * A "frame buffer" is a color buffer and its optional ancillary buffers:
1981 * depth, accum, stencil, and software-simulated alpha buffers.
1982 * In C++ terms, think of this as a base class from which device drivers
1983 * will make derived classes.
1985 struct gl_frame_buffer
1987 GLvisual Visual
; /**< The corresponding visual */
1989 GLuint Width
, Height
; /**< size of frame buffer in pixels */
1991 GLboolean Initialized
;
1993 GLboolean UseSoftwareDepthBuffer
;
1994 GLboolean UseSoftwareAccumBuffer
;
1995 GLboolean UseSoftwareStencilBuffer
;
1996 GLboolean UseSoftwareAlphaBuffers
;
1997 GLboolean UseSoftwareAuxBuffers
;
1999 /** \name Software depth (aka Z) buffer */
2001 GLvoid
*DepthBuffer
; /**< array [Width*Height] of GLushort or GLuint*/
2004 /** \name Software stencil buffer */
2006 GLstencil
*Stencil
; /**< array [Width*Height] of GLstencil values */
2009 /** \name Software accumulation buffer */
2011 GLaccum
*Accum
; /**< array [4*Width*Height] of GLaccum values */
2014 /** \name Software alpha planes */
2016 GLchan
*FrontLeftAlpha
; /**< array [Width*Height] of GLchan */
2017 GLchan
*BackLeftAlpha
; /**< array [Width*Height] of GLchan */
2018 GLchan
*FrontRightAlpha
; /**< array [Width*Height] of GLchan */
2019 GLchan
*BackRightAlpha
; /**< array [Width*Height] of GLchan */
2022 GLchan
*AuxBuffers
[MAX_AUX_BUFFERS
];
2025 * \name Drawing bounds
2027 * Intersection of window size and scissor box
2030 GLint _Xmin
; /**< inclusive */
2031 GLint _Ymin
; /**< inclusive */
2032 GLint _Xmax
; /**< exclusive */
2033 GLint _Ymax
; /**< exclusive */
2039 * Constants which may be overridden by device driver during context creation
2040 * but are never changed after that.
2044 GLint MaxTextureLevels
; /**< Maximum number of allowed mipmap levels. */
2045 GLint Max3DTextureLevels
; /**< Maximum number of allowed mipmap levels for 3D texture targets. */
2046 GLint MaxCubeTextureLevels
; /**< Maximum number of allowed mipmap levels for GL_ARB_texture_cube_map */
2047 GLint MaxTextureRectSize
; /* GL_NV_texture_rectangle */
2048 GLuint MaxTextureCoordUnits
;
2049 GLuint MaxTextureImageUnits
;
2050 GLuint MaxTextureUnits
; /* = MAX(CoordUnits, ImageUnits) */
2051 GLfloat MaxTextureMaxAnisotropy
; /* GL_EXT_texture_filter_anisotropic */
2052 GLfloat MaxTextureLodBias
; /* GL_EXT_texture_lod_bias */
2053 GLuint MaxArrayLockSize
;
2055 GLfloat MinPointSize
, MaxPointSize
; /* aliased */
2056 GLfloat MinPointSizeAA
, MaxPointSizeAA
; /* antialiased */
2057 GLfloat PointSizeGranularity
;
2058 GLfloat MinLineWidth
, MaxLineWidth
; /* aliased */
2059 GLfloat MinLineWidthAA
, MaxLineWidthAA
; /* antialiased */
2060 GLfloat LineWidthGranularity
;
2061 GLuint MaxColorTableSize
;
2062 GLuint MaxConvolutionWidth
;
2063 GLuint MaxConvolutionHeight
;
2064 GLuint MaxClipPlanes
;
2066 GLfloat MaxShininess
; /* GL_NV_light_max_exponent */
2067 GLfloat MaxSpotExponent
; /* GL_NV_light_max_exponent */
2068 GLuint MaxViewportWidth
, MaxViewportHeight
;
2069 /* GL_ARB_vertex_program */
2070 GLuint MaxVertexProgramInstructions
;
2071 GLuint MaxVertexProgramAttribs
;
2072 GLuint MaxVertexProgramTemps
;
2073 GLuint MaxVertexProgramLocalParams
;
2074 GLuint MaxVertexProgramEnvParams
;
2075 GLuint MaxVertexProgramAddressRegs
;
2076 /* GL_ARB_fragment_program */
2077 GLuint MaxFragmentProgramInstructions
;
2078 GLuint MaxFragmentProgramAttribs
;
2079 GLuint MaxFragmentProgramTemps
;
2080 GLuint MaxFragmentProgramLocalParams
;
2081 GLuint MaxFragmentProgramEnvParams
;
2082 GLuint MaxFragmentProgramAddressRegs
;
2083 GLuint MaxFragmentProgramAluInstructions
;
2084 GLuint MaxFragmentProgramTexInstructions
;
2085 GLuint MaxFragmentProgramTexIndirections
;
2086 /* vertex or fragment program */
2087 GLuint MaxProgramMatrices
;
2088 GLuint MaxProgramMatrixStackDepth
;
2089 /* vertex array / buffer object bounds checking */
2090 GLboolean CheckArrayBounds
;
2091 /* GL_ARB_draw_buffers */
2092 GLuint MaxDrawBuffers
;
2093 /* GL_OES_read_format */
2094 GLenum ColorReadFormat
;
2095 GLenum ColorReadType
;
2100 * Enable flag for each OpenGL extension. Different device drivers will
2101 * enable different extensions at runtime.
2103 struct gl_extensions
2106 * \name Flags to quickly test if certain extensions are available.
2108 * Not every extension needs to have such a flag, but it's encouraged.
2111 GLboolean dummy
; /* don't remove this! */
2112 GLboolean ARB_depth_texture
;
2113 GLboolean ARB_draw_buffers
;
2114 GLboolean ARB_fragment_program
;
2115 GLboolean ARB_fragment_shader
;
2116 GLboolean ARB_half_float_pixel
;
2117 GLboolean ARB_imaging
;
2118 GLboolean ARB_multisample
;
2119 GLboolean ARB_multitexture
;
2120 GLboolean ARB_occlusion_query
;
2121 GLboolean ARB_point_sprite
;
2122 GLboolean ARB_shader_objects
;
2123 GLboolean ARB_shadow
;
2124 GLboolean ARB_texture_border_clamp
;
2125 GLboolean ARB_texture_compression
;
2126 GLboolean ARB_texture_cube_map
;
2127 GLboolean ARB_texture_env_combine
;
2128 GLboolean ARB_texture_env_crossbar
;
2129 GLboolean ARB_texture_env_dot3
;
2130 GLboolean ARB_texture_float
;
2131 GLboolean ARB_texture_mirrored_repeat
;
2132 GLboolean ARB_texture_non_power_of_two
;
2133 GLboolean ARB_transpose_matrix
;
2134 GLboolean ARB_vertex_buffer_object
;
2135 GLboolean ARB_vertex_program
;
2136 GLboolean ARB_vertex_shader
;
2137 GLboolean ARB_window_pos
;
2140 GLboolean EXT_blend_color
;
2141 GLboolean EXT_blend_equation_separate
;
2142 GLboolean EXT_blend_func_separate
;
2143 GLboolean EXT_blend_logic_op
;
2144 GLboolean EXT_blend_minmax
;
2145 GLboolean EXT_blend_subtract
;
2146 GLboolean EXT_clip_volume_hint
;
2147 GLboolean EXT_cull_vertex
;
2148 GLboolean EXT_convolution
;
2149 GLboolean EXT_compiled_vertex_array
;
2150 GLboolean EXT_copy_texture
;
2151 GLboolean EXT_depth_bounds_test
;
2152 GLboolean EXT_draw_range_elements
;
2153 GLboolean EXT_fog_coord
;
2154 GLboolean EXT_histogram
;
2155 GLboolean EXT_multi_draw_arrays
;
2156 GLboolean EXT_paletted_texture
;
2157 GLboolean EXT_packed_pixels
;
2158 GLboolean EXT_pixel_buffer_object
;
2159 GLboolean EXT_point_parameters
;
2160 GLboolean EXT_polygon_offset
;
2161 GLboolean EXT_rescale_normal
;
2162 GLboolean EXT_shadow_funcs
;
2163 GLboolean EXT_secondary_color
;
2164 GLboolean EXT_separate_specular_color
;
2165 GLboolean EXT_shared_texture_palette
;
2166 GLboolean EXT_stencil_wrap
;
2167 GLboolean EXT_stencil_two_side
;
2168 GLboolean EXT_subtexture
;
2169 GLboolean EXT_texture
;
2170 GLboolean EXT_texture_object
;
2171 GLboolean EXT_texture3D
;
2172 GLboolean EXT_texture_compression_s3tc
;
2173 GLboolean EXT_texture_env_add
;
2174 GLboolean EXT_texture_env_combine
;
2175 GLboolean EXT_texture_env_dot3
;
2176 GLboolean EXT_texture_filter_anisotropic
;
2177 GLboolean EXT_texture_lod_bias
;
2178 GLboolean EXT_texture_mirror_clamp
;
2179 GLboolean EXT_vertex_array
;
2180 GLboolean EXT_vertex_array_set
;
2181 /* vendor extensions */
2182 GLboolean APPLE_client_storage
;
2183 GLboolean APPLE_packed_pixels
;
2184 GLboolean ATI_texture_mirror_once
;
2185 GLboolean ATI_texture_env_combine3
;
2186 GLboolean ATI_fragment_shader
;
2187 GLboolean HP_occlusion_test
;
2188 GLboolean IBM_rasterpos_clip
;
2189 GLboolean IBM_multimode_draw_arrays
;
2190 GLboolean MESA_pack_invert
;
2191 GLboolean MESA_packed_depth_stencil
;
2192 GLboolean MESA_program_debug
;
2193 GLboolean MESA_resize_buffers
;
2194 GLboolean MESA_ycbcr_texture
;
2195 GLboolean NV_blend_square
;
2196 GLboolean NV_fragment_program
;
2197 GLboolean NV_light_max_exponent
;
2198 GLboolean NV_point_sprite
;
2199 GLboolean NV_texgen_reflection
;
2200 GLboolean NV_texture_rectangle
;
2201 GLboolean NV_vertex_program
;
2202 GLboolean NV_vertex_program1_1
;
2203 GLboolean OES_read_format
;
2204 GLboolean SGI_color_matrix
;
2205 GLboolean SGI_color_table
;
2206 GLboolean SGI_texture_color_table
;
2207 GLboolean SGIS_generate_mipmap
;
2208 GLboolean SGIS_pixel_texture
;
2209 GLboolean SGIS_texture_edge_clamp
;
2210 GLboolean SGIS_texture_lod
;
2211 GLboolean SGIX_depth_texture
;
2212 GLboolean SGIX_pixel_texture
;
2213 GLboolean SGIX_shadow
;
2214 GLboolean SGIX_shadow_ambient
; /* or GL_ARB_shadow_ambient */
2215 GLboolean TDFX_texture_compression_FXT1
;
2218 /* The extension string */
2219 const GLubyte
*String
;
2224 * A stack of matrices (projection, modelview, color, texture, etc).
2228 GLmatrix
*Top
; /**< points into Stack */
2229 GLmatrix
*Stack
; /**< array [MaxDepth] of GLmatrix */
2230 GLuint Depth
; /**< 0 <= Depth < MaxDepth */
2231 GLuint MaxDepth
; /**< size of Stack[] array */
2232 GLuint DirtyFlag
; /**< _NEW_MODELVIEW or _NEW_PROJECTION, for example */
2237 * \name Bits for image transfer operations
2239 * \sa __GLcontextRec::ImageTransferState.
2242 #define IMAGE_SCALE_BIAS_BIT 0x1
2243 #define IMAGE_SHIFT_OFFSET_BIT 0x2
2244 #define IMAGE_MAP_COLOR_BIT 0x4
2245 #define IMAGE_COLOR_TABLE_BIT 0x8
2246 #define IMAGE_CONVOLUTION_BIT 0x10
2247 #define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
2248 #define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40
2249 #define IMAGE_COLOR_MATRIX_BIT 0x80
2250 #define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100
2251 #define IMAGE_HISTOGRAM_BIT 0x200
2252 #define IMAGE_MIN_MAX_BIT 0x400
2253 #define IMAGE_CLAMP_BIT 0x800 /* extra */
2256 /** Pixel Transfer ops up to convolution */
2257 #define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \
2258 IMAGE_SHIFT_OFFSET_BIT | \
2259 IMAGE_MAP_COLOR_BIT | \
2260 IMAGE_COLOR_TABLE_BIT)
2262 /** Pixel transfer ops after convolution */
2263 #define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \
2264 IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \
2265 IMAGE_COLOR_MATRIX_BIT | \
2266 IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\
2267 IMAGE_HISTOGRAM_BIT | \
2273 * \name Bits to indicate what state has changed.
2278 #define _NEW_MODELVIEW 0x1 /**< __GLcontextRec::ModelView */
2279 #define _NEW_PROJECTION 0x2 /**< __GLcontextRec::Projection */
2280 #define _NEW_TEXTURE_MATRIX 0x4 /**< __GLcontextRec::TextureMatrix */
2281 #define _NEW_COLOR_MATRIX 0x8 /**< __GLcontextRec::ColorMatrix */
2282 #define _NEW_ACCUM 0x10 /**< __GLcontextRec::Accum */
2283 #define _NEW_COLOR 0x20 /**< __GLcontextRec::Color */
2284 #define _NEW_DEPTH 0x40 /**< __GLcontextRec::Depth */
2285 #define _NEW_EVAL 0x80 /**< __GLcontextRec::Eval, __GLcontextRec::EvalMap */
2286 #define _NEW_FOG 0x100 /**< __GLcontextRec::Fog */
2287 #define _NEW_HINT 0x200 /**< __GLcontextRec::Hint */
2288 #define _NEW_LIGHT 0x400 /**< __GLcontextRec::Light */
2289 #define _NEW_LINE 0x800 /**< __GLcontextRec::Line */
2290 #define _NEW_PIXEL 0x1000 /**< __GLcontextRec::Pixel */
2291 #define _NEW_POINT 0x2000 /**< __GLcontextRec::Point */
2292 #define _NEW_POLYGON 0x4000 /**< __GLcontextRec::Polygon */
2293 #define _NEW_POLYGONSTIPPLE 0x8000 /**< __GLcontextRec::PolygonStipple */
2294 #define _NEW_SCISSOR 0x10000 /**< __GLcontextRec::Scissor */
2295 #define _NEW_STENCIL 0x20000 /**< __GLcontextRec::Stencil */
2296 #define _NEW_TEXTURE 0x40000 /**< __GLcontextRec::Texture */
2297 #define _NEW_TRANSFORM 0x80000 /**< __GLcontextRec::Transform */
2298 #define _NEW_VIEWPORT 0x100000 /**< __GLcontextRec::Viewport */
2299 #define _NEW_PACKUNPACK 0x200000 /**< __GLcontextRec::Pack, __GLcontextRec::Unpack */
2300 #define _NEW_ARRAY 0x400000 /**< __GLcontextRec::Array */
2301 #define _NEW_RENDERMODE 0x800000 /**< __GLcontextRec::RenderMode, __GLcontextRec::Feedback, __GLcontextRec::Select */
2302 #define _NEW_BUFFERS 0x1000000 /**< __GLcontextRec::Visual, __GLcontextRec::DrawBuffer, */
2303 #define _NEW_MULTISAMPLE 0x2000000 /**< __GLcontextRec::Multisample */
2304 #define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */
2305 #define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */
2311 * \name Bits to track array state changes
2313 * Also used to summarize array enabled.
2316 #define _NEW_ARRAY_VERTEX VERT_BIT_POS
2317 #define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT
2318 #define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL
2319 #define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
2320 #define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
2321 #define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
2322 #define _NEW_ARRAY_INDEX VERT_BIT_SIX
2323 #define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
2324 #define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
2325 #define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
2326 #define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
2327 #define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3
2328 #define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4
2329 #define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
2330 #define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
2331 #define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
2332 #define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
2333 #define _NEW_ARRAY_ALL 0xffffffff
2336 #define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i))
2337 #define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i))
2342 * \name A bunch of flags that we think might be useful to drivers.
2344 * Set in the __GLcontextRec::_TriangleCaps bitfield.
2347 #define DD_FLATSHADE 0x1
2348 #define DD_SEPARATE_SPECULAR 0x2
2349 #define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */
2350 #define DD_TRI_LIGHT_TWOSIDE 0x8
2351 #define DD_TRI_UNFILLED 0x10
2352 #define DD_TRI_SMOOTH 0x20
2353 #define DD_TRI_STIPPLE 0x40
2354 #define DD_TRI_OFFSET 0x80
2355 #define DD_LINE_SMOOTH 0x100
2356 #define DD_LINE_STIPPLE 0x200
2357 #define DD_LINE_WIDTH 0x400
2358 #define DD_POINT_SMOOTH 0x800
2359 #define DD_POINT_SIZE 0x1000
2360 #define DD_POINT_ATTEN 0x2000
2361 #define DD_TRI_TWOSTENCIL 0x4000
2366 * \name Define the state changes under which each of these bits might change
2369 #define _DD_NEW_FLATSHADE _NEW_LIGHT
2370 #define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG | _NEW_PROGRAM)
2371 #define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
2372 #define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT
2373 #define _DD_NEW_TRI_UNFILLED _NEW_POLYGON
2374 #define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
2375 #define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
2376 #define _DD_NEW_TRI_OFFSET _NEW_POLYGON
2377 #define _DD_NEW_LINE_SMOOTH _NEW_LINE
2378 #define _DD_NEW_LINE_STIPPLE _NEW_LINE
2379 #define _DD_NEW_LINE_WIDTH _NEW_LINE
2380 #define _DD_NEW_POINT_SMOOTH _NEW_POINT
2381 #define _DD_NEW_POINT_SIZE _NEW_POINT
2382 #define _DD_NEW_POINT_ATTEN _NEW_POINT
2386 #define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
2391 #define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
2394 #define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX)
2400 * Forward declaration of display list data types:
2403 typedef union node Node
;
2406 /* This has to be included here. */
2410 #define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *))
2413 * Core Mesa's support for tnl modules:
2415 struct gl_tnl_module
2418 * Vertex format to be lazily swapped into current dispatch.
2420 const GLvertexformat
*Current
;
2423 * \name Record of functions swapped out.
2424 * On restore, only need to swap these functions back in.
2427 void *Swapped
[NUM_VERTEX_FORMAT_ENTRIES
][2];
2432 /* Strictly this is a tnl/ private concept, but it doesn't seem
2433 * worthwhile adding a tnl private structure just to hold this one bit
2436 #define MESA_DLIST_DANGLING_REFS 0x1
2438 /* Provide a location where information about a display list can be
2439 * collected. Could be extended with driverPrivate structures,
2440 * etc. in the future.
2442 struct mesa_display_list
2451 * State used during display list compilation and execution.
2453 struct mesa_list_state
2455 struct mesa_display_list
*CallStack
[MAX_LIST_NESTING
];
2456 GLuint CallDepth
; /**< Current recursion calling depth */
2458 struct mesa_display_list
*CurrentList
;
2459 Node
*CurrentListPtr
; /**< Head of list being compiled */
2460 GLuint CurrentListNum
; /**< Number of the list being compiled */
2461 Node
*CurrentBlock
; /**< Pointer to current block of nodes */
2462 GLuint CurrentPos
; /**< Index into current block of nodes */
2464 GLvertexformat ListVtxfmt
;
2466 GLubyte ActiveAttribSize
[VERT_ATTRIB_MAX
];
2467 GLfloat CurrentAttrib
[VERT_ATTRIB_MAX
][4];
2469 GLubyte ActiveMaterialSize
[MAT_ATTRIB_MAX
];
2470 GLfloat CurrentMaterial
[MAT_ATTRIB_MAX
][4];
2472 GLubyte ActiveIndex
;
2473 GLfloat CurrentIndex
;
2475 GLubyte ActiveEdgeFlag
;
2476 GLboolean CurrentEdgeFlag
;
2481 * Mesa rendering context.
2483 * This is the central context data structure for Mesa. Almost all
2484 * OpenGL state is contained in this structure.
2485 * Think of this as a base class from which device drivers will derive
2488 * The GLcontext typedef names this structure.
2490 struct __GLcontextRec
2493 * \name OS related interfaces.
2495 * These \b must be the first members of this structure, because they are
2496 * exposed to the outside world (i.e. GLX extension).
2499 __GLimports imports
;
2500 __GLexports exports
;
2503 /** State possibly shared with other contexts in the address space */
2504 struct gl_shared_state
*Shared
;
2506 /** \name API function pointer tables */
2508 struct _glapi_table
*Save
; /**< Display list save functions */
2509 struct _glapi_table
*Exec
; /**< Execute functions */
2510 struct _glapi_table
*CurrentDispatch
; /**< == Save or Exec !! */
2514 GLframebuffer
*DrawBuffer
; /**< buffer for writing */
2515 GLframebuffer
*ReadBuffer
; /**< buffer for reading */
2518 * Device driver function pointer table
2520 struct dd_function_table Driver
;
2522 void *DriverCtx
; /**< Points to device driver context/state */
2523 void *DriverMgrCtx
; /**< Points to device driver manager (optional)*/
2525 /** Core/Driver constants */
2526 struct gl_constants Const
;
2528 /** \name The various 4x4 matrix stacks */
2530 struct matrix_stack ModelviewMatrixStack
;
2531 struct matrix_stack ProjectionMatrixStack
;
2532 struct matrix_stack ColorMatrixStack
;
2533 struct matrix_stack TextureMatrixStack
[MAX_TEXTURE_COORD_UNITS
];
2534 struct matrix_stack ProgramMatrixStack
[MAX_PROGRAM_MATRICES
];
2535 struct matrix_stack
*CurrentStack
; /**< Points to one of the above stacks */
2538 /** Combined modelview and projection matrix */
2539 GLmatrix _ModelProjectMatrix
;
2541 /** \name Display lists */
2542 struct mesa_list_state ListState
;
2544 GLboolean ExecuteFlag
; /**< Execute GL commands? */
2545 GLboolean CompileFlag
; /**< Compile GL commands into display list? */
2548 struct gl_extensions Extensions
;
2550 /** \name Renderer attribute stack */
2552 GLuint AttribStackDepth
;
2553 struct gl_attrib_node
*AttribStack
[MAX_ATTRIB_STACK_DEPTH
];
2556 /** \name Renderer attribute groups
2558 * We define a struct for each attribute group to make pushing and popping
2559 * attributes easy. Also it's a good organization.
2562 struct gl_accum_attrib Accum
; /**< Accumulation buffer attributes */
2563 struct gl_colorbuffer_attrib Color
; /**< Color buffers attributes */
2564 struct gl_current_attrib Current
; /**< Current attributes */
2565 struct gl_depthbuffer_attrib Depth
; /**< Depth buffer attributes */
2566 struct gl_eval_attrib Eval
; /**< Eval attributes */
2567 struct gl_fog_attrib Fog
; /**< Fog attributes */
2568 struct gl_hint_attrib Hint
; /**< Hint attributes */
2569 struct gl_light_attrib Light
; /**< Light attributes */
2570 struct gl_line_attrib Line
; /**< Line attributes */
2571 struct gl_list_attrib List
; /**< List attributes */
2572 struct gl_multisample_attrib Multisample
;
2573 struct gl_pixel_attrib Pixel
; /**< Pixel attributes */
2574 struct gl_point_attrib Point
; /**< Point attributes */
2575 struct gl_polygon_attrib Polygon
; /**< Polygon attributes */
2576 GLuint PolygonStipple
[32]; /**< Polygon stipple */
2577 struct gl_scissor_attrib Scissor
; /**< Scissor attributes */
2578 struct gl_stencil_attrib Stencil
; /**< Stencil buffer attributes */
2579 struct gl_texture_attrib Texture
; /**< Texture attributes */
2580 struct gl_transform_attrib Transform
; /**< Transformation attributes */
2581 struct gl_viewport_attrib Viewport
; /**< Viewport attributes */
2584 /** \name Client attribute stack */
2586 GLuint ClientAttribStackDepth
;
2587 struct gl_attrib_node
*ClientAttribStack
[MAX_CLIENT_ATTRIB_STACK_DEPTH
];
2590 /** \name Client attribute groups */
2592 struct gl_array_attrib Array
; /**< Vertex arrays */
2593 struct gl_pixelstore_attrib Pack
; /**< Pixel packing */
2594 struct gl_pixelstore_attrib Unpack
; /**< Pixel unpacking */
2595 struct gl_pixelstore_attrib DefaultPacking
; /**< Default params */
2598 /** \name Other assorted state (not pushed/popped on attribute stack) */
2600 struct gl_histogram_attrib Histogram
;
2601 struct gl_minmax_attrib MinMax
;
2602 struct gl_convolution_attrib Convolution1D
;
2603 struct gl_convolution_attrib Convolution2D
;
2604 struct gl_convolution_attrib Separable2D
;
2606 struct gl_evaluators EvalMap
; /**< All evaluators */
2607 struct gl_feedback Feedback
; /**< Feedback */
2608 struct gl_selection Select
; /**< Selection */
2610 struct gl_color_table ColorTable
; /**< Pre-convolution */
2611 struct gl_color_table ProxyColorTable
; /**< Pre-convolution */
2612 struct gl_color_table PostConvolutionColorTable
;
2613 struct gl_color_table ProxyPostConvolutionColorTable
;
2614 struct gl_color_table PostColorMatrixColorTable
;
2615 struct gl_color_table ProxyPostColorMatrixColorTable
;
2617 struct gl_program_state Program
; /**< for vertex or fragment progs */
2618 struct gl_vertex_program_state VertexProgram
; /**< GL_NV_vertex_program */
2619 struct gl_fragment_program_state FragmentProgram
; /**< GL_NV_fragment_program */
2620 struct gl_ati_fragment_shader_state ATIFragmentShader
; /**< GL_ATI_fragment_shader */
2622 struct gl_occlusion_state Occlusion
; /**< GL_ARB_occlusion_query */
2624 struct gl_shader_objects_state ShaderObjects
; /* GL_ARB_shader_objects */
2627 GLenum ErrorValue
; /**< Last error code */
2628 GLenum RenderMode
; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
2629 GLuint NewState
; /**< bitwise-or of _NEW_* flags */
2631 /** \name Derived state */
2633 GLuint _TriangleCaps
; /**< bitwise-or of DD_* flags */
2634 GLuint _ImageTransferState
;/**< bitwise-or of IMAGE_*_BIT flags */
2635 GLfloat _EyeZDir
[3];
2636 GLfloat _ModelViewInvScale
;
2637 GLuint _NeedEyeCoords
;
2638 GLuint _ForceEyeCoords
;
2639 GLboolean _RotateMode
;
2640 GLenum _CurrentProgram
; /* currently executing program */
2642 struct gl_shine_tab
*_ShineTable
[2]; /**< Active shine tables */
2643 struct gl_shine_tab
*_ShineTabList
; /**< MRU list of inactive shine tables */
2646 struct gl_list_extensions ListExt
; /**< driver dlist extensions */
2649 GLboolean OcclusionResult
; /**< for GL_HP_occlusion_test */
2650 GLboolean OcclusionResultSaved
; /**< for GL_HP_occlusion_test */
2651 GLuint _Facing
; /**< This is a hack for 2-sided stencil test.
2653 * We don't have a better way to communicate this value from
2654 * swrast_setup to swrast. */
2657 /** \name Z buffer stuff */
2659 GLuint DepthMax
; /**< Max depth buffer value */
2660 GLfloat DepthMaxF
; /**< Float max depth buffer value */
2661 GLfloat MRD
; /**< minimum resolvable difference in Z values */
2664 /** \name Color clamping (tentative part of GL_ARB_color_clamp_control) */
2666 GLboolean ClampFragmentColors
;
2667 GLboolean ClampVertexColors
;
2670 /** \name For debugging/development only */
2672 GLboolean FirstTimeCurrent
;
2675 /** Dither disable via MESA_NO_DITHER env var */
2678 /** software compression/decompression supported or not */
2679 GLboolean Mesa_DXTn
;
2681 /** Core tnl module support */
2682 struct gl_tnl_module TnlModule
;
2685 * \name Hooks for module contexts.
2687 * These will eventually live in the driver or elsewhere.
2690 void *swrast_context
;
2691 void *swsetup_context
;
2692 void *swtnl_context
;
2694 void *acache_context
;
2700 /** The string names for GL_POINT, GL_LINE_LOOP, etc */
2701 extern const char *_mesa_prim_name
[GL_POLYGON
+4];
2705 extern int MESA_VERBOSE
;
2706 extern int MESA_DEBUG_FLAGS
;
2707 # define MESA_FUNCTION __FUNCTION__
2709 # define MESA_VERBOSE 0
2710 # define MESA_DEBUG_FLAGS 0
2711 # define MESA_FUNCTION "a function"
2720 VERBOSE_VARRAY
= 0x0001,
2721 VERBOSE_TEXTURE
= 0x0002,
2722 VERBOSE_IMMEDIATE
= 0x0004,
2723 VERBOSE_PIPELINE
= 0x0008,
2724 VERBOSE_DRIVER
= 0x0010,
2725 VERBOSE_STATE
= 0x0020,
2726 VERBOSE_API
= 0x0040,
2727 VERBOSE_DISPLAY_LIST
= 0x0100,
2728 VERBOSE_LIGHTING
= 0x0200,
2729 VERBOSE_PRIMS
= 0x0400,
2730 VERBOSE_VERTS
= 0x0800
2736 DEBUG_ALWAYS_FLUSH
= 0x1
2741 #define Elements(x) sizeof(x)/sizeof(*(x))
2744 #endif /* TYPES_H */