1 /* $Id: mtypes.h,v 1.58 2002/01/05 21:53:20 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 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.
33 #include "config.h" /* Hardwired parameters */
34 #include "glapitable.h"
37 #include "math/m_matrix.h" /* GLmatrix */
39 #if defined(MESA_TRACE)
40 #include "Trace/tr_context.h"
44 /* Please try to mark derived values with a leading underscore ('_').
48 * Color channel data type:
51 typedef GLubyte GLchan
;
53 #define CHAN_MAXF 255.0F
54 #define CHAN_TYPE GL_UNSIGNED_BYTE
56 typedef GLushort GLchan
;
57 #define CHAN_MAX 65535
58 #define CHAN_MAXF 65535.0F
59 #define CHAN_TYPE GL_UNSIGNED_SHORT
61 typedef GLfloat GLchan
;
63 #define CHAN_MAXF 1.0F
64 #define CHAN_TYPE GL_FLOAT
66 #error "illegal number of color channel bits"
71 * Accumulation buffer data type:
74 typedef GLbyte GLaccum
;
76 typedef GLshort GLaccum
;
78 typedef GLfloat GLaccum
;
80 # error "illegal number of accumulation bits"
85 * Stencil buffer data type:
88 typedef GLubyte GLstencil
;
89 # define STENCIL_MAX 0xff
90 #elif STENCIL_BITS==16
91 typedef GLushort GLstencil
;
92 # define STENCIL_MAX 0xffff
94 # error "illegal number of stencil bits"
99 * Depth buffer data type:
101 typedef GLuint GLdepth
; /* Must be 32-bits! */
105 * Fixed point data type:
112 * Some forward type declarations
114 struct _mesa_HashTable
;
115 struct gl_texture_image
;
116 struct gl_texture_object
;
117 typedef struct __GLcontextRec GLcontext
;
118 typedef struct __GLcontextModesRec GLvisual
;
119 typedef struct gl_frame_buffer GLframebuffer
;
123 /* Maximum number of temporary vertices required for clipping. (Used
124 * in array_cache and tnl modules).
126 #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
129 /* Data structure for color tables */
130 struct gl_color_table
{
131 GLenum Format
; /* GL_ALPHA, GL_RGB, GL_RGB, etc */
133 GLuint Size
; /* number of entries (rows) in table */
134 GLvoid
*Table
; /* either GLfloat * or GLchan * */
135 GLboolean FloatTable
; /* are entries stored as floats? */
140 GLubyte LuminanceSize
;
141 GLubyte IntensitySize
;
146 * Bit flags used for updating material values.
148 #define FRONT_AMBIENT_BIT 0x1
149 #define BACK_AMBIENT_BIT 0x2
150 #define FRONT_DIFFUSE_BIT 0x4
151 #define BACK_DIFFUSE_BIT 0x8
152 #define FRONT_SPECULAR_BIT 0x10
153 #define BACK_SPECULAR_BIT 0x20
154 #define FRONT_EMISSION_BIT 0x40
155 #define BACK_EMISSION_BIT 0x80
156 #define FRONT_SHININESS_BIT 0x100
157 #define BACK_SHININESS_BIT 0x200
158 #define FRONT_INDEXES_BIT 0x400
159 #define BACK_INDEXES_BIT 0x800
161 #define FRONT_MATERIAL_BITS (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT | \
162 FRONT_DIFFUSE_BIT | FRONT_SPECULAR_BIT | \
163 FRONT_SHININESS_BIT | FRONT_INDEXES_BIT)
165 #define BACK_MATERIAL_BITS (BACK_EMISSION_BIT | BACK_AMBIENT_BIT | \
166 BACK_DIFFUSE_BIT | BACK_SPECULAR_BIT | \
167 BACK_SHININESS_BIT | BACK_INDEXES_BIT)
169 #define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
174 * Specular exponent and material shininess lookup table sizes:
176 #define EXP_TABLE_SIZE 512
177 #define SHINE_TABLE_SIZE 256
179 struct gl_shine_tab
{
180 struct gl_shine_tab
*next
, *prev
;
181 GLfloat tab
[SHINE_TABLE_SIZE
+1];
188 struct gl_light
*next
; /* double linked list with sentinel */
189 struct gl_light
*prev
;
191 GLfloat Ambient
[4]; /* ambient color */
192 GLfloat Diffuse
[4]; /* diffuse color */
193 GLfloat Specular
[4]; /* specular color */
194 GLfloat EyePosition
[4]; /* position in eye coordinates */
195 GLfloat EyeDirection
[4]; /* spotlight dir in eye coordinates */
196 GLfloat SpotExponent
;
197 GLfloat SpotCutoff
; /* in degress */
198 GLfloat _CosCutoff
; /* = MAX(0, cos(SpotCutoff)) */
199 GLfloat ConstantAttenuation
;
200 GLfloat LinearAttenuation
;
201 GLfloat QuadraticAttenuation
;
202 GLboolean Enabled
; /* On/off flag */
205 GLuint _Flags
; /* State */
207 GLfloat _Position
[4]; /* position in eye/obj coordinates */
208 GLfloat _VP_inf_norm
[3]; /* Norm direction to infinite light */
209 GLfloat _h_inf_norm
[3]; /* Norm( _VP_inf_norm + <0,0,1> ) */
210 GLfloat _NormDirection
[4]; /* normalized spotlight direction */
211 GLfloat _VP_inf_spot_attenuation
;
213 GLfloat _SpotExpTable
[EXP_TABLE_SIZE
][2]; /* to replace a pow() call */
214 GLfloat _MatAmbient
[2][3]; /* material ambient * light ambient */
215 GLfloat _MatDiffuse
[2][3]; /* material diffuse * light diffuse */
216 GLfloat _MatSpecular
[2][3]; /* material spec * light specular */
217 GLfloat _dli
; /* CI diffuse light intensity */
218 GLfloat _sli
; /* CI specular light intensity */
222 struct gl_lightmodel
{
223 GLfloat Ambient
[4]; /* ambient color */
224 GLboolean LocalViewer
; /* Local (or infinite) view point? */
225 GLboolean TwoSide
; /* Two (or one) sided lighting? */
226 GLenum ColorControl
; /* either GL_SINGLE_COLOR */
227 /* or GL_SEPARATE_SPECULAR_COLOR */
238 GLfloat AmbientIndex
; /* for color index lighting */
239 GLfloat DiffuseIndex
; /* for color index lighting */
240 GLfloat SpecularIndex
; /* for color index lighting */
245 * Attribute structures:
246 * We define a struct for each attribute group to make pushing and
247 * popping attributes easy. Also it's a good organization.
249 struct gl_accum_attrib
{
250 GLfloat ClearColor
[4]; /* Accumulation buffer clear color */
255 * Used in DrawDestMask below
257 #define FRONT_LEFT_BIT 1
258 #define FRONT_RIGHT_BIT 2
259 #define BACK_LEFT_BIT 4
260 #define BACK_RIGHT_BIT 8
263 struct gl_colorbuffer_attrib
{
264 GLuint ClearIndex
; /* Index to use for glClear */
265 GLchan ClearColor
[4]; /* Color to use for glClear */
267 GLuint IndexMask
; /* Color index write mask */
268 GLubyte ColorMask
[4]; /* Each flag is 0xff or 0x0 */
270 GLenum DrawBuffer
; /* Which buffer to draw into */
271 GLenum DriverDrawBuffer
; /* Current device driver dest buffer */
272 GLboolean MultiDrawBuffer
; /* Drawing to multiple buffers? */
273 GLubyte DrawDestMask
; /* bitwise-OR of bitflags above */
276 GLboolean AlphaEnabled
; /* Alpha test enabled flag */
277 GLenum AlphaFunc
; /* Alpha test function */
278 GLchan AlphaRef
; /* Alpha ref value as GLchan */
281 GLboolean BlendEnabled
; /* Blending enabled flag */
282 GLenum BlendSrcRGB
; /* Blending source operator */
283 GLenum BlendDstRGB
; /* Blending destination operator */
284 GLenum BlendSrcA
; /* GL_INGR_blend_func_separate */
285 GLenum BlendDstA
; /* GL_INGR_blend_func_separate */
286 GLenum BlendEquation
;
287 GLfloat BlendColor
[4];
290 GLenum LogicOp
; /* Logic operator */
291 GLboolean IndexLogicOpEnabled
; /* Color index logic op enabled flag */
292 GLboolean ColorLogicOpEnabled
; /* RGBA logic op enabled flag */
294 GLboolean DitherFlag
; /* Dither enable flag */
298 /* These define the aliases between numbered vertex attributes and
299 * conventional OpenGL vertex attributes.
301 #define VERT_ATTRIB_POS 0
302 #define VERT_ATTRIB_WEIGHT 1
303 #define VERT_ATTRIB_NORMAL 2
304 #define VERT_ATTRIB_COLOR0 3
305 #define VERT_ATTRIB_COLOR1 4
306 #define VERT_ATTRIB_FOG 5
307 #define VERT_ATTRIB_SIX 6
308 #define VERT_ATTRIB_SEVEN 7
309 #define VERT_ATTRIB_TEX0 8
310 #define VERT_ATTRIB_TEX1 9
311 #define VERT_ATTRIB_TEX2 10
312 #define VERT_ATTRIB_TEX3 11
313 #define VERT_ATTRIB_TEX4 12
314 #define VERT_ATTRIB_TEX5 13
315 #define VERT_ATTRIB_TEX6 14
316 #define VERT_ATTRIB_TEX7 15
317 #define VERT_ATTRIB_MAX 16
319 struct gl_current_attrib
{
320 /* These values valid only when FLUSH_VERTICES has been called.
322 GLfloat Attrib
[VERT_ATTRIB_MAX
][4]; /* Current vertex attributes */
323 /* indexed by VERT_ATTRIB_* */
324 GLuint Index
; /* Current color index */
325 GLboolean EdgeFlag
; /* Current edge flag */
327 /* These values are always valid. BTW, note how similar this set of
328 * attributes is to the SWvertex datatype in the software rasterizer...
330 GLfloat RasterPos
[4]; /* Current raster position */
331 GLfloat RasterDistance
; /* Current raster distance */
332 GLfloat RasterColor
[4]; /* Current raster color */
333 GLfloat RasterSecondaryColor
[4]; /* Current rast 2ndary color */
334 GLuint RasterIndex
; /* Current raster index */
335 GLfloat
*RasterTexCoord
; /* Current raster texcoord */
336 GLfloat RasterMultiTexCoord
[MAX_TEXTURE_UNITS
][4];
337 GLfloat RasterFogCoord
;
338 GLboolean RasterPosValid
; /* Raster pos valid flag */
342 struct gl_depthbuffer_attrib
{
343 GLenum Func
; /* Function for depth buffer compare */
344 GLfloat Clear
; /* Value to clear depth buffer to */
345 GLboolean Test
; /* Depth buffering enabled flag */
346 GLboolean Mask
; /* Depth buffer writable? */
347 GLboolean OcclusionTest
; /* GL_HP_occlusion_test */
351 struct gl_enable_attrib
{
353 GLboolean AutoNormal
;
355 GLboolean ClipPlane
[MAX_CLIP_PLANES
];
356 GLboolean ColorMaterial
;
357 GLboolean Convolution1D
;
358 GLboolean Convolution2D
;
359 GLboolean Separable2D
;
365 GLboolean Light
[MAX_LIGHTS
];
367 GLboolean LineSmooth
;
368 GLboolean LineStipple
;
369 GLboolean IndexLogicOp
;
370 GLboolean ColorLogicOp
;
371 GLboolean Map1Color4
;
373 GLboolean Map1Normal
;
374 GLboolean Map1TextureCoord1
;
375 GLboolean Map1TextureCoord2
;
376 GLboolean Map1TextureCoord3
;
377 GLboolean Map1TextureCoord4
;
378 GLboolean Map1Vertex3
;
379 GLboolean Map1Vertex4
;
380 GLboolean Map1Attrib
[16]; /* GL_NV_vertex_program */
381 GLboolean Map2Color4
;
383 GLboolean Map2Normal
;
384 GLboolean Map2TextureCoord1
;
385 GLboolean Map2TextureCoord2
;
386 GLboolean Map2TextureCoord3
;
387 GLboolean Map2TextureCoord4
;
388 GLboolean Map2Vertex3
;
389 GLboolean Map2Vertex4
;
390 GLboolean Map2Attrib
[16]; /* GL_NV_vertex_program */
393 GLboolean PixelTexture
;
394 GLboolean PointSmooth
;
395 GLboolean PolygonOffsetPoint
;
396 GLboolean PolygonOffsetLine
;
397 GLboolean PolygonOffsetFill
;
398 GLboolean PolygonSmooth
;
399 GLboolean PolygonStipple
;
400 GLboolean RescaleNormals
;
403 GLboolean MultisampleEnabled
; /* GL_ARB_multisample */
404 GLboolean SampleAlphaToCoverage
; /* GL_ARB_multisample */
405 GLboolean SampleAlphaToOne
; /* GL_ARB_multisample */
406 GLboolean SampleCoverage
; /* GL_ARB_multisample */
407 GLboolean SampleCoverageInvert
; /* GL_ARB_multisample */
408 GLboolean RasterPositionUnclipped
; /* GL_IBM_rasterpos_clip */
409 GLuint Texture
[MAX_TEXTURE_UNITS
];
410 GLuint TexGen
[MAX_TEXTURE_UNITS
];
411 /* GL_NV_vertex_program */
412 GLboolean VertexProgram
;
413 GLboolean VertexProgramPointSize
;
414 GLboolean VertexProgramTwoSide
;
418 struct gl_eval_attrib
{
420 GLboolean Map1Color4
;
422 GLboolean Map1Normal
;
423 GLboolean Map1TextureCoord1
;
424 GLboolean Map1TextureCoord2
;
425 GLboolean Map1TextureCoord3
;
426 GLboolean Map1TextureCoord4
;
427 GLboolean Map1Vertex3
;
428 GLboolean Map1Vertex4
;
429 GLboolean Map1Attrib
[16]; /* GL_NV_vertex_program */
430 GLboolean Map2Color4
;
432 GLboolean Map2Normal
;
433 GLboolean Map2TextureCoord1
;
434 GLboolean Map2TextureCoord2
;
435 GLboolean Map2TextureCoord3
;
436 GLboolean Map2TextureCoord4
;
437 GLboolean Map2Vertex3
;
438 GLboolean Map2Vertex4
;
439 GLboolean Map2Attrib
[16]; /* GL_NV_vertex_program */
440 GLboolean AutoNormal
;
441 /* Map Grid endpoints and divisions and calculated du values */
443 GLfloat MapGrid1u1
, MapGrid1u2
, MapGrid1du
;
444 GLint MapGrid2un
, MapGrid2vn
;
445 GLfloat MapGrid2u1
, MapGrid2u2
, MapGrid2du
;
446 GLfloat MapGrid2v1
, MapGrid2v2
, MapGrid2dv
;
450 struct gl_fog_attrib
{
451 GLboolean Enabled
; /* Fog enabled flag */
452 GLfloat Color
[4]; /* Fog color */
453 GLfloat Density
; /* Density >= 0.0 */
454 GLfloat Start
; /* Start distance in eye coords */
455 GLfloat End
; /* End distance in eye coords */
456 GLfloat Index
; /* Fog index */
457 GLenum Mode
; /* Fog mode */
458 GLboolean ColorSumEnabled
;
459 GLenum FogCoordinateSource
; /* GL_EXT_fog_coord */
463 struct gl_hint_attrib
{
464 /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */
465 GLenum PerspectiveCorrection
;
468 GLenum PolygonSmooth
;
470 GLenum ClipVolumeClipping
; /* GL_EXT_clip_volume_hint */
471 GLenum TextureCompression
; /* GL_ARB_texture_compression */
472 GLenum GenerateMipmap
; /* GL_SGIS_generate_mipmap */
476 struct gl_histogram_attrib
{
477 GLuint Width
; /* number of table entries */
478 GLint Format
; /* GL_ALPHA, GL_RGB, etc */
479 GLuint Count
[HISTOGRAM_TABLE_SIZE
][4]; /* the histogram */
480 GLboolean Sink
; /* terminate image transfer? */
481 GLubyte RedSize
; /* Bits per counter */
485 GLubyte LuminanceSize
;
489 struct gl_minmax_attrib
{
492 GLfloat Min
[4], Max
[4]; /* RGBA */
496 struct gl_convolution_attrib
{
498 GLenum InternalFormat
;
501 GLfloat Filter
[MAX_CONVOLUTION_WIDTH
* MAX_CONVOLUTION_HEIGHT
* 4];
505 #define LIGHT_SPOT 0x1
506 #define LIGHT_LOCAL_VIEWER 0x2
507 #define LIGHT_POSITIONAL 0x4
508 #define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
510 struct gl_light_attrib
{
511 struct gl_light Light
[MAX_LIGHTS
]; /* Array of lights */
512 struct gl_lightmodel Model
; /* Lighting model */
514 /* Must flush FLUSH_VERTICES before referencing:
516 struct gl_material Material
[2]; /* Material 0=front, 1=back */
518 GLboolean Enabled
; /* Lighting enabled flag */
519 GLenum ShadeModel
; /* GL_FLAT or GL_SMOOTH */
520 GLenum ColorMaterialFace
; /* GL_FRONT, BACK or FRONT_AND_BACK */
521 GLenum ColorMaterialMode
; /* GL_AMBIENT, GL_DIFFUSE, etc */
522 GLuint ColorMaterialBitmask
; /* bitmask formed from Face and Mode */
523 GLboolean ColorMaterialEnabled
;
525 struct gl_light EnabledList
; /* List sentinel */
527 /* Derived for optimizations: */
528 GLboolean _NeedVertices
; /* Use fast shader? */
529 GLuint _Flags
; /* LIGHT_* flags, see above */
530 GLfloat _BaseColor
[2][3];
534 struct gl_line_attrib
{
535 GLboolean SmoothFlag
; /* GL_LINE_SMOOTH enabled? */
536 GLboolean StippleFlag
; /* GL_LINE_STIPPLE enabled? */
537 GLushort StipplePattern
; /* Stipple pattern */
538 GLint StippleFactor
; /* Stipple repeat factor */
539 GLfloat Width
; /* Line width */
540 GLfloat _Width
; /* Clamped Line width */
544 struct gl_list_attrib
{
549 struct gl_list_opcode
{
551 void (*execute
)( GLcontext
*ctx
, void *data
);
552 void (*destroy
)( GLcontext
*ctx
, void *data
);
553 void (*print
)( GLcontext
*ctx
, void *data
);
556 #define GL_MAX_EXT_OPCODES 16
558 struct gl_list_extensions
{
559 struct gl_list_opcode opcode
[GL_MAX_EXT_OPCODES
];
564 struct gl_multisample_attrib
{
566 GLboolean SampleAlphaToCoverage
;
567 GLboolean SampleAlphaToOne
;
568 GLboolean SampleCoverage
;
569 GLfloat SampleCoverageValue
;
570 GLboolean SampleCoverageInvert
;
574 struct gl_pixel_attrib
{
575 GLenum ReadBuffer
; /* src buffer for glRead/CopyPixels */
576 GLenum DriverReadBuffer
; /* Driver's current source buffer */
577 GLfloat RedBias
, RedScale
;
578 GLfloat GreenBias
, GreenScale
;
579 GLfloat BlueBias
, BlueScale
;
580 GLfloat AlphaBias
, AlphaScale
;
581 GLfloat DepthBias
, DepthScale
;
582 GLint IndexShift
, IndexOffset
;
583 GLboolean MapColorFlag
;
584 GLboolean MapStencilFlag
;
585 GLfloat ZoomX
, ZoomY
;
586 /* XXX move these out of gl_pixel_attrib */
587 GLint MapStoSsize
; /* Size of each pixel map */
597 GLint MapStoS
[MAX_PIXEL_MAP_TABLE
]; /* Pixel map tables */
598 GLint MapItoI
[MAX_PIXEL_MAP_TABLE
];
599 GLfloat MapItoR
[MAX_PIXEL_MAP_TABLE
];
600 GLfloat MapItoG
[MAX_PIXEL_MAP_TABLE
];
601 GLfloat MapItoB
[MAX_PIXEL_MAP_TABLE
];
602 GLfloat MapItoA
[MAX_PIXEL_MAP_TABLE
];
603 GLubyte MapItoR8
[MAX_PIXEL_MAP_TABLE
]; /* converted to 8-bit color */
604 GLubyte MapItoG8
[MAX_PIXEL_MAP_TABLE
];
605 GLubyte MapItoB8
[MAX_PIXEL_MAP_TABLE
];
606 GLubyte MapItoA8
[MAX_PIXEL_MAP_TABLE
];
607 GLfloat MapRtoR
[MAX_PIXEL_MAP_TABLE
];
608 GLfloat MapGtoG
[MAX_PIXEL_MAP_TABLE
];
609 GLfloat MapBtoB
[MAX_PIXEL_MAP_TABLE
];
610 GLfloat MapAtoA
[MAX_PIXEL_MAP_TABLE
];
611 /* GL_EXT_histogram */
612 GLboolean HistogramEnabled
;
613 GLboolean MinMaxEnabled
;
614 /* GL_SGIS_pixel_texture */
615 GLboolean PixelTextureEnabled
;
616 GLenum FragmentRgbSource
;
617 GLenum FragmentAlphaSource
;
618 /* GL_SGI_color_matrix */
619 GLfloat PostColorMatrixScale
[4]; /* RGBA */
620 GLfloat PostColorMatrixBias
[4]; /* RGBA */
621 /* GL_SGI_color_table */
622 GLfloat ColorTableScale
[4];
623 GLfloat ColorTableBias
[4];
624 GLboolean ColorTableEnabled
;
625 GLfloat PCCTscale
[4];
627 GLboolean PostConvolutionColorTableEnabled
;
628 GLfloat PCMCTscale
[4];
629 GLfloat PCMCTbias
[4];
630 GLboolean PostColorMatrixColorTableEnabled
;
632 GLboolean Convolution1DEnabled
;
633 GLboolean Convolution2DEnabled
;
634 GLboolean Separable2DEnabled
;
635 GLfloat ConvolutionBorderColor
[3][4];
636 GLenum ConvolutionBorderMode
[3];
637 GLfloat ConvolutionFilterScale
[3][4];
638 GLfloat ConvolutionFilterBias
[3][4];
639 GLfloat PostConvolutionScale
[4]; /* RGBA */
640 GLfloat PostConvolutionBias
[4]; /* RGBA */
644 struct gl_point_attrib
{
645 GLboolean SmoothFlag
; /* True if GL_POINT_SMOOTH is enabled */
646 GLboolean SpriteMode
; /* GL_MESA_sprite_point extension */
647 GLfloat Size
; /* User-specified point size */
648 GLfloat _Size
; /* Size clamped to Const.Min/MaxPointSize */
649 GLfloat Params
[3]; /* GL_EXT_point_parameters */
650 GLfloat MinSize
, MaxSize
; /* GL_EXT_point_parameters */
651 GLfloat Threshold
; /* GL_EXT_point_parameters */
652 GLboolean _Attenuated
; /* True if Params != [1, 0, 0] */
656 struct gl_polygon_attrib
{
657 GLenum FrontFace
; /* Either GL_CW or GL_CCW */
658 GLenum FrontMode
; /* Either GL_POINT, GL_LINE or GL_FILL */
659 GLenum BackMode
; /* Either GL_POINT, GL_LINE or GL_FILL */
660 GLboolean _FrontBit
; /* */
661 GLboolean CullFlag
; /* Culling on/off flag */
662 GLboolean SmoothFlag
; /* True if GL_POLYGON_SMOOTH is enabled */
663 GLboolean StippleFlag
; /* True if GL_POLYGON_STIPPLE is enabled */
664 GLenum CullFaceMode
; /* Culling mode GL_FRONT or GL_BACK */
665 GLfloat OffsetFactor
; /* Polygon offset factor, from user */
666 GLfloat OffsetUnits
; /* Polygon offset units, from user */
667 GLfloat OffsetMRD
; /* = OffsetUnits * visual->MRD */
668 GLboolean OffsetPoint
; /* Offset in GL_POINT mode */
669 GLboolean OffsetLine
; /* Offset in GL_LINE mode */
670 GLboolean OffsetFill
; /* Offset in GL_FILL mode */
671 GLboolean _OffsetAny
;
675 struct gl_scissor_attrib
{
676 GLboolean Enabled
; /* Scissor test enabled? */
677 GLint X
, Y
; /* Lower left corner of box */
678 GLsizei Width
, Height
; /* Size of box */
682 struct gl_stencil_attrib
{
683 GLboolean Enabled
; /* Enabled flag */
684 GLenum Function
; /* Stencil function */
685 GLenum FailFunc
; /* Fail function */
686 GLenum ZPassFunc
; /* Depth buffer pass function */
687 GLenum ZFailFunc
; /* Depth buffer fail function */
688 GLstencil Ref
; /* Reference value */
689 GLstencil ValueMask
; /* Value mask */
690 GLstencil Clear
; /* Clear value */
691 GLstencil WriteMask
; /* Write mask */
695 /* TexGenEnabled flags */
701 /* Texture Enabled flags */
702 #define TEXTURE0_1D 0x1 /* Texture unit 0 (default) */
703 #define TEXTURE0_2D 0x2
704 #define TEXTURE0_3D 0x4
705 #define TEXTURE0_CUBE 0x8
706 #define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE)
707 #define TEXTURE1_1D (TEXTURE0_1D << 4) /* Texture unit 1 */
708 #define TEXTURE1_2D (TEXTURE0_2D << 4)
709 #define TEXTURE1_3D (TEXTURE0_3D << 4)
710 #define TEXTURE1_CUBE (TEXTURE0_CUBE << 4)
711 #define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D | TEXTURE1_CUBE)
712 #define TEXTURE2_1D (TEXTURE0_1D << 8) /* Texture unit 2 */
713 #define TEXTURE2_2D (TEXTURE0_2D << 8)
714 #define TEXTURE2_3D (TEXTURE0_3D << 8)
715 #define TEXTURE2_CUBE (TEXTURE0_CUBE << 8)
716 #define TEXTURE2_ANY (TEXTURE2_1D | TEXTURE2_2D | TEXTURE2_3D | TEXTURE2_CUBE)
717 #define TEXTURE3_1D (TEXTURE0_1D << 12) /* Texture unit 3 */
718 #define TEXTURE3_2D (TEXTURE0_2D << 12)
719 #define TEXTURE3_3D (TEXTURE0_3D << 12)
720 #define TEXTURE3_CUBE (TEXTURE0_CUBE << 12)
721 #define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
722 #define TEXTURE4_1D (TEXTURE0_1D << 16) /* Texture unit 4 */
723 #define TEXTURE4_2D (TEXTURE0_2D << 16)
724 #define TEXTURE4_3D (TEXTURE0_3D << 16)
725 #define TEXTURE4_CUBE (TEXTURE0_CUBE << 16)
726 #define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
727 #define TEXTURE5_1D (TEXTURE0_1D << 20) /* Texture unit 5 */
728 #define TEXTURE5_2D (TEXTURE0_2D << 20)
729 #define TEXTURE5_3D (TEXTURE0_3D << 20)
730 #define TEXTURE5_CUBE (TEXTURE0_CUBE << 20)
731 #define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
732 #define TEXTURE6_1D (TEXTURE0_1D << 24) /* Texture unit 6 */
733 #define TEXTURE6_2D (TEXTURE0_2D << 24)
734 #define TEXTURE6_3D (TEXTURE0_3D << 24)
735 #define TEXTURE6_CUBE (TEXTURE0_CUBE << 24)
736 #define TEXTURE6_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
737 #define TEXTURE7_1D (TEXTURE0_1D << 28) /* Texture unit 7 */
738 #define TEXTURE7_2D (TEXTURE0_2D << 28)
739 #define TEXTURE7_3D (TEXTURE0_3D << 28)
740 #define TEXTURE7_CUBE (TEXTURE0_CUBE << 28)
741 #define TEXTURE7_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
743 /* Bitmap versions of the GL_ constants.
745 #define TEXGEN_SPHERE_MAP 0x1
746 #define TEXGEN_OBJ_LINEAR 0x2
747 #define TEXGEN_EYE_LINEAR 0x4
748 #define TEXGEN_REFLECTION_MAP_NV 0x8
749 #define TEXGEN_NORMAL_MAP_NV 0x10
751 #define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
752 TEXGEN_REFLECTION_MAP_NV | \
753 TEXGEN_NORMAL_MAP_NV)
754 #define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
755 TEXGEN_REFLECTION_MAP_NV | \
756 TEXGEN_NORMAL_MAP_NV | \
761 /* A selection of state flags to make driver and module's lives easier.
763 #define ENABLE_TEXGEN0 0x1
764 #define ENABLE_TEXGEN1 0x2
765 #define ENABLE_TEXGEN2 0x4
766 #define ENABLE_TEXGEN3 0x8
767 #define ENABLE_TEXGEN4 0x10
768 #define ENABLE_TEXGEN5 0x20
769 #define ENABLE_TEXGEN6 0x40
770 #define ENABLE_TEXGEN7 0x80
772 #define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */
773 #define ENABLE_TEXMAT1 0x2
774 #define ENABLE_TEXMAT2 0x4
775 #define ENABLE_TEXMAT3 0x8
776 #define ENABLE_TEXMAT4 0x10
777 #define ENABLE_TEXMAT5 0x20
778 #define ENABLE_TEXMAT6 0x40
779 #define ENABLE_TEXMAT7 0x80
781 #define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
782 #define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
785 * If teximage is color-index, texelOut returns GLchan[1].
786 * If teximage is depth, texelOut returns GLfloat[1].
787 * Otherwise, texelOut returns GLchan[4].
789 typedef void (*FetchTexelFunc
)( const struct gl_texture_image
*texImage
,
790 GLint col
, GLint row
, GLint img
,
793 /* Texture format record */
794 struct gl_texture_format
{
795 GLint MesaFormat
; /* One of the MESA_FORMAT_* values */
797 GLenum BaseFormat
; /* Either GL_ALPHA, GL_INTENSITY, GL_LUMINANCE,
798 * GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA,
799 * GL_COLOR_INDEX or GL_DEPTH_COMPONENT.
801 GLenum Type
; /* Internal type as GL enum value */
803 GLubyte RedBits
; /* Bits per texel component */
807 GLubyte LuminanceBits
;
808 GLubyte IntensityBits
;
814 FetchTexelFunc FetchTexel1D
; /* Texel fetch function pointers */
815 FetchTexelFunc FetchTexel2D
;
816 FetchTexelFunc FetchTexel3D
;
819 /* Texture image record */
820 struct gl_texture_image
{
821 GLenum Format
; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
822 * GL_INTENSITY, GL_RGB, GL_RGBA,
823 * GL_COLOR_INDEX or GL_DEPTH_COMPONENT only.
825 GLint IntFormat
; /* Internal format as given by the user */
826 GLuint Border
; /* 0 or 1 */
827 GLuint Width
; /* = 2^WidthLog2 + 2*Border */
828 GLuint Height
; /* = 2^HeightLog2 + 2*Border */
829 GLuint Depth
; /* = 2^DepthLog2 + 2*Border */
830 GLuint Width2
; /* = Width - 2*Border */
831 GLuint Height2
; /* = Height - 2*Border */
832 GLuint Depth2
; /* = Depth - 2*Border */
833 GLuint WidthLog2
; /* = log2(Width2) */
834 GLuint HeightLog2
; /* = log2(Height2) */
835 GLuint DepthLog2
; /* = log2(Depth2) */
836 GLuint MaxLog2
; /* = MAX(WidthLog2, HeightLog2) */
837 GLvoid
*Data
; /* Image data, accessed via FetchTexel() */
839 const struct gl_texture_format
*TexFormat
;
841 FetchTexelFunc FetchTexel
; /* Texel fetch function pointer */
843 GLboolean IsCompressed
; /* GL_ARB_texture_compression */
844 GLuint CompressedSize
; /* GL_ARB_texture_compression */
846 /* For device driver: */
847 void *DriverData
; /* Arbitrary device driver data */
851 /* Texture object record */
852 struct gl_texture_object
{
853 _glthread_Mutex Mutex
; /* for thread safety */
854 GLint RefCount
; /* reference count */
855 GLuint Name
; /* an unsigned integer */
856 GLuint Dimensions
; /* 1 or 2 or 3 or 6 (cube map) */
857 GLfloat Priority
; /* in [0,1] */
858 GLfloat BorderValues
[4]; /* unclamped */
859 GLchan BorderColor
[4]; /* clamped, as GLchan */
860 GLenum WrapS
; /* Wrap modes are: GL_CLAMP, REPEAT */
861 GLenum WrapT
; /* GL_CLAMP_TO_EDGE, and */
862 GLenum WrapR
; /* GL_CLAMP_TO_BORDER_ARB */
863 GLenum MinFilter
; /* minification filter */
864 GLenum MagFilter
; /* magnification filter */
865 GLfloat MinLod
; /* min lambda, OpenGL 1.2 */
866 GLfloat MaxLod
; /* max lambda, OpenGL 1.2 */
867 GLint BaseLevel
; /* min mipmap level, OpenGL 1.2 */
868 GLint MaxLevel
; /* max mipmap level, OpenGL 1.2 */
869 GLfloat MaxAnisotropy
; /* GL_EXT_texture_filter_anisotropic */
870 GLboolean CompareFlag
; /* GL_SGIX_shadow */
871 GLenum CompareOperator
; /* GL_SGIX_shadow */
872 GLchan ShadowAmbient
; /* GL_SGIX/ARB_shadow_ambient */
873 GLenum CompareMode
; /* GL_ARB_shadow */
874 GLenum CompareFunc
; /* GL_ARB_shadow */
875 GLenum CompareResult
; /* GL_ARB_shadow */
876 GLint _MaxLevel
; /* actual max mipmap level (q in the spec) */
877 GLfloat _MaxLambda
; /* = _MaxLevel - BaseLevel (q - b in spec) */
878 GLboolean GenerateMipmap
; /* GL_SGIS_generate_mipmap */
880 struct gl_texture_image
*Image
[MAX_TEXTURE_LEVELS
];
882 /* Texture cube faces */
883 /* Image[] is alias for *PosX[MAX_TEXTURE_LEVELS]; */
884 struct gl_texture_image
*NegX
[MAX_TEXTURE_LEVELS
];
885 struct gl_texture_image
*PosY
[MAX_TEXTURE_LEVELS
];
886 struct gl_texture_image
*NegY
[MAX_TEXTURE_LEVELS
];
887 struct gl_texture_image
*PosZ
[MAX_TEXTURE_LEVELS
];
888 struct gl_texture_image
*NegZ
[MAX_TEXTURE_LEVELS
];
890 /* GL_EXT_paletted_texture */
891 struct gl_color_table Palette
;
893 GLboolean Complete
; /* Is texture object complete? */
894 struct gl_texture_object
*Next
; /* Next in linked list */
896 /* For device driver: */
897 void *DriverData
; /* Arbitrary device driver data */
903 * Texture units are new with the multitexture extension.
905 struct gl_texture_unit
{
906 GLuint Enabled
; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE */
907 GLuint _ReallyEnabled
; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
909 GLenum EnvMode
; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
911 GLuint TexGenEnabled
; /* Bitwise-OR of [STRQ]_BIT values */
912 GLenum GenModeS
; /* Tex coord generation mode, either */
913 GLenum GenModeT
; /* GL_OBJECT_LINEAR, or */
914 GLenum GenModeR
; /* GL_EYE_LINEAR, or */
915 GLenum GenModeQ
; /* GL_SPHERE_MAP */
920 GLuint _GenFlags
; /* bitwise or of GenBit[STRQ] */
921 GLfloat ObjectPlaneS
[4];
922 GLfloat ObjectPlaneT
[4];
923 GLfloat ObjectPlaneR
[4];
924 GLfloat ObjectPlaneQ
[4];
925 GLfloat EyePlaneS
[4];
926 GLfloat EyePlaneT
[4];
927 GLfloat EyePlaneR
[4];
928 GLfloat EyePlaneQ
[4];
929 GLfloat LodBias
; /* for biasing mipmap levels */
931 /* GL_EXT_texture_env_combine */
932 GLenum CombineModeRGB
; /* GL_REPLACE, GL_DECAL, GL_ADD, etc. */
933 GLenum CombineModeA
; /* GL_REPLACE, GL_DECAL, GL_ADD, etc. */
934 GLenum CombineSourceRGB
[3]; /* GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
935 GLenum CombineSourceA
[3]; /* GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
936 GLenum CombineOperandRGB
[3]; /* SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */
937 GLenum CombineOperandA
[3]; /* SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */
938 GLuint CombineScaleShiftRGB
; /* 0, 1 or 2 */
939 GLuint CombineScaleShiftA
; /* 0, 1 or 2 */
941 struct gl_texture_object
*Current1D
;
942 struct gl_texture_object
*Current2D
;
943 struct gl_texture_object
*Current3D
;
944 struct gl_texture_object
*CurrentCubeMap
; /* GL_ARB_texture_cube_map */
946 struct gl_texture_object
*_Current
; /* Points to really enabled tex obj */
948 struct gl_texture_object Saved1D
; /* only used by glPush/PopAttrib */
949 struct gl_texture_object Saved2D
;
950 struct gl_texture_object Saved3D
;
951 struct gl_texture_object SavedCubeMap
;
955 struct gl_texture_attrib
{
957 GLuint CurrentUnit
; /* Active texture unit */
959 GLuint _ReallyEnabled
; /* enables for all texture units: */
960 /* = (Unit[0]._ReallyEnabled << 0) | */
961 /* (Unit[1]._ReallyEnabled << 4) | */
962 /* (Unit[2]._ReallyEnabled << 8) | etc... */
964 GLuint _GenFlags
; /* for texgen */
965 GLuint _TexGenEnabled
;
966 GLuint _TexMatEnabled
;
968 struct gl_texture_unit Unit
[MAX_TEXTURE_UNITS
];
970 struct gl_texture_object
*Proxy1D
;
971 struct gl_texture_object
*Proxy2D
;
972 struct gl_texture_object
*Proxy3D
;
973 struct gl_texture_object
*ProxyCubeMap
;
975 /* GL_EXT_shared_texture_palette */
976 GLboolean SharedPalette
;
977 struct gl_color_table Palette
;
981 struct gl_transform_attrib
{
982 GLenum MatrixMode
; /* Matrix mode */
983 GLfloat EyeUserPlane
[MAX_CLIP_PLANES
][4];
984 GLfloat _ClipUserPlane
[MAX_CLIP_PLANES
][4]; /* derived */
985 GLboolean ClipEnabled
[MAX_CLIP_PLANES
];
986 GLubyte _AnyClip
; /* How many ClipEnabled? */
987 GLboolean Normalize
; /* Normalize all normals? */
988 GLboolean RescaleNormals
; /* GL_EXT_rescale_normal */
989 GLboolean RasterPositionUnclipped
; /* GL_IBM_rasterpos_clip */
993 struct gl_viewport_attrib
{
994 GLint X
, Y
; /* position */
995 GLsizei Width
, Height
; /* size */
996 GLfloat Near
, Far
; /* Depth buffer range */
997 GLmatrix _WindowMap
; /* Mapping transformation as a matrix. */
1001 /* For the attribute stack: */
1002 struct gl_attrib_node
{
1005 struct gl_attrib_node
*next
;
1010 * Client pixel packing/unpacking attributes
1012 struct gl_pixelstore_attrib
{
1017 GLint ImageHeight
; /* for GL_EXT_texture3D */
1018 GLint SkipImages
; /* for GL_EXT_texture3D */
1019 GLboolean SwapBytes
;
1024 #define CA_CLIENT_DATA 0x1 /* Data not alloced by mesa */
1028 * Client vertex array attributes
1030 struct gl_client_array
{
1033 GLsizei Stride
; /* user-specified stride */
1034 GLsizei StrideB
; /* actual stride in bytes */
1041 struct gl_array_attrib
{
1042 struct gl_client_array Vertex
; /* client data descriptors */
1043 struct gl_client_array Normal
;
1044 struct gl_client_array Color
;
1045 struct gl_client_array SecondaryColor
;
1046 struct gl_client_array FogCoord
;
1047 struct gl_client_array Index
;
1048 struct gl_client_array TexCoord
[MAX_TEXTURE_UNITS
];
1049 struct gl_client_array EdgeFlag
;
1051 struct gl_client_array VertexAttrib
[16]; /* GL_NV_vertex_program */
1053 GLint TexCoordInterleaveFactor
;
1054 GLint ActiveTexture
; /* Client Active Texture */
1058 GLuint _Enabled
; /* _NEW_ARRAY_* - bit set if array enabled */
1059 GLuint NewState
; /* _NEW_ARRAY_* */
1063 struct gl_feedback
{
1065 GLuint _Mask
; /* FB_* bits */
1072 struct gl_selection
{
1074 GLuint BufferSize
; /* size of SelectBuffer */
1075 GLuint BufferCount
; /* number of values in SelectBuffer */
1076 GLuint Hits
; /* number of records in SelectBuffer */
1077 GLuint NameStackDepth
;
1078 GLuint NameStack
[MAX_NAME_STACK_DEPTH
];
1080 GLfloat HitMinZ
, HitMaxZ
;
1085 * 1-D Evaluator control points
1088 GLuint Order
; /* Number of control points */
1089 GLfloat u1
, u2
, du
; /* u1, u2, 1.0/(u2-u1) */
1090 GLfloat
*Points
; /* Points to contiguous control points */
1095 * 2-D Evaluator control points
1098 GLuint Uorder
; /* Number of control points in U dimension */
1099 GLuint Vorder
; /* Number of control points in V dimension */
1102 GLfloat
*Points
; /* Points to contiguous control points */
1107 * All evalutator control points
1109 struct gl_evaluators
{
1111 struct gl_1d_map Map1Vertex3
;
1112 struct gl_1d_map Map1Vertex4
;
1113 struct gl_1d_map Map1Index
;
1114 struct gl_1d_map Map1Color4
;
1115 struct gl_1d_map Map1Normal
;
1116 struct gl_1d_map Map1Texture1
;
1117 struct gl_1d_map Map1Texture2
;
1118 struct gl_1d_map Map1Texture3
;
1119 struct gl_1d_map Map1Texture4
;
1120 struct gl_1d_map Map1Attrib
[16]; /* GL_NV_vertex_program */
1123 struct gl_2d_map Map2Vertex3
;
1124 struct gl_2d_map Map2Vertex4
;
1125 struct gl_2d_map Map2Index
;
1126 struct gl_2d_map Map2Color4
;
1127 struct gl_2d_map Map2Normal
;
1128 struct gl_2d_map Map2Texture1
;
1129 struct gl_2d_map Map2Texture2
;
1130 struct gl_2d_map Map2Texture3
;
1131 struct gl_2d_map Map2Texture4
;
1132 struct gl_2d_map Map2Attrib
[16]; /* GL_NV_vertex_program */
1137 * Vertex program tokens and datatypes
1140 #define VP_MAX_INSTRUCTIONS 128
1142 #define VP_NUM_INPUT_REGS VERT_ATTRIB_MAX
1143 #define VP_NUM_OUTPUT_REGS 15
1144 #define VP_NUM_TEMP_REGS 12
1145 #define VP_NUM_PROG_REGS 96
1147 #define VP_NUM_TOTAL_REGISTERS (VP_NUM_INPUT_REGS + VP_NUM_OUTPUT_REGS + VP_NUM_TEMP_REGS + VP_NUM_PROG_REGS)
1149 /* Location of register sets within the whole register file */
1150 #define VP_INPUT_REG_START 0
1151 #define VP_INPUT_REG_END (VP_INPUT_REG_START + VP_NUM_INPUT_REGS - 1)
1152 #define VP_OUTPUT_REG_START (VP_INPUT_REG_END + 1)
1153 #define VP_OUTPUT_REG_END (VP_OUTPUT_REG_START + VP_NUM_OUTPUT_REGS - 1)
1154 #define VP_TEMP_REG_START (VP_OUTPUT_REG_END + 1)
1155 #define VP_TEMP_REG_END (VP_TEMP_REG_START + VP_NUM_TEMP_REGS - 1)
1156 #define VP_PROG_REG_START (VP_TEMP_REG_END + 1)
1157 #define VP_PROG_REG_END (VP_PROG_REG_START + VP_NUM_PROG_REGS - 1)
1159 /* Input register names */
1160 #define VP_IN_OPOS (VP_INPUT_REG_START + 0)
1161 #define VP_IN_WGHT (VP_INPUT_REG_START + 1)
1162 #define VP_IN_NRML (VP_INPUT_REG_START + 2)
1163 #define VP_IN_COL0 (VP_INPUT_REG_START + 3)
1164 #define VP_IN_COL1 (VP_INPUT_REG_START + 4)
1165 #define VP_IN_FOGC (VP_INPUT_REG_START + 5)
1166 #define VP_IN_TEX0 (VP_INPUT_REG_START + 8)
1167 #define VP_IN_TEX1 (VP_INPUT_REG_START + 9)
1168 #define VP_IN_TEX2 (VP_INPUT_REG_START + 10)
1169 #define VP_IN_TEX3 (VP_INPUT_REG_START + 11)
1170 #define VP_IN_TEX4 (VP_INPUT_REG_START + 12)
1171 #define VP_IN_TEX5 (VP_INPUT_REG_START + 13)
1172 #define VP_IN_TEX6 (VP_INPUT_REG_START + 14)
1173 #define VP_IN_TEX7 (VP_INPUT_REG_START + 15)
1175 /* Output register names */
1176 #define VP_OUT_HPOS (VP_OUTPUT_REG_START + 0)
1177 #define VP_OUT_COL0 (VP_OUTPUT_REG_START + 1)
1178 #define VP_OUT_COL1 (VP_OUTPUT_REG_START + 2)
1179 #define VP_OUT_BFC0 (VP_OUTPUT_REG_START + 3)
1180 #define VP_OUT_BFC1 (VP_OUTPUT_REG_START + 4)
1181 #define VP_OUT_FOGC (VP_OUTPUT_REG_START + 5)
1182 #define VP_OUT_PSIZ (VP_OUTPUT_REG_START + 6)
1183 #define VP_OUT_TEX0 (VP_OUTPUT_REG_START + 7)
1184 #define VP_OUT_TEX1 (VP_OUTPUT_REG_START + 8)
1185 #define VP_OUT_TEX2 (VP_OUTPUT_REG_START + 9)
1186 #define VP_OUT_TEX3 (VP_OUTPUT_REG_START + 10)
1187 #define VP_OUT_TEX4 (VP_OUTPUT_REG_START + 11)
1188 #define VP_OUT_TEX5 (VP_OUTPUT_REG_START + 12)
1189 #define VP_OUT_TEX6 (VP_OUTPUT_REG_START + 13)
1190 #define VP_OUT_TEX7 (VP_OUTPUT_REG_START + 14)
1194 /* Machine state (i.e. the register file) */
1197 GLfloat Registers
[VP_NUM_TOTAL_REGISTERS
][4];
1198 GLint AddressReg
; /* might someday be a 4-vector */
1202 /* Vertex program opcodes */
1226 /* Instruction source register */
1227 struct vp_src_register
1229 GLint Register
; /* or the offset from the address register */
1236 /* Instruction destination register */
1237 struct vp_dst_register
1240 GLboolean WriteMask
[4];
1244 /* Vertex program instruction */
1245 struct vp_instruction
1247 enum vp_opcode Opcode
;
1248 struct vp_src_register SrcReg
[3];
1249 struct vp_dst_register DstReg
;
1253 /* The actual vertex program, stored in the hash table */
1256 GLubyte
*String
; /* Original user code */
1257 struct vp_instruction
*Instructions
; /* Compiled instructions */
1258 GLenum Target
; /* GL_VERTEX_PROGRAM_NV or GL_VERTEX_STATE_PROGRAM_NV */
1259 GLint ErrorPos
; /* Position in string where error was detected */
1260 GLint RefCount
; /* Since programs can be shared among contexts */
1266 * State vars for GL_NV_vertex_program
1268 struct vertex_program_state
1270 GLboolean Enabled
; /* GL_VERTEX_PROGRAM_NV */
1271 GLboolean PointSizeEnabled
; /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
1272 GLboolean TwoSideEnabled
; /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
1273 GLuint CurrentID
; /* currently bound program's ID */
1274 struct vp_program
*Current
; /* ptr to currently bound program */
1275 struct vp_machine Machine
; /* machine state */
1277 GLenum TrackMatrix
[VP_NUM_PROG_REGS
/ 4];
1278 GLenum TrackMatrixTransform
[VP_NUM_PROG_REGS
/ 4];
1284 * State which can be shared by multiple contexts:
1286 struct gl_shared_state
{
1287 _glthread_Mutex Mutex
; /* for thread safety */
1288 GLint RefCount
; /* Reference count */
1289 struct _mesa_HashTable
*DisplayList
; /* Display lists hash table */
1290 struct _mesa_HashTable
*TexObjects
; /* Texture objects hash table */
1291 struct gl_texture_object
*TexObjectList
;/* Linked list of texture objects */
1293 /* Default texture objects (shared by all multi-texture units) */
1294 struct gl_texture_object
*Default1D
;
1295 struct gl_texture_object
*Default2D
;
1296 struct gl_texture_object
*Default3D
;
1297 struct gl_texture_object
*DefaultCubeMap
;
1299 /* GL_NV_vertex_program */
1300 struct _mesa_HashTable
*VertexPrograms
;
1302 void *DriverData
; /* Device driver shared state */
1307 * A "frame buffer" is a color buffer and its optional ancillary buffers:
1308 * depth, accum, stencil, and software-simulated alpha buffers.
1309 * In C++ terms, think of this as a base class from which device drivers
1310 * will make derived classes.
1312 struct gl_frame_buffer
{
1313 GLvisual Visual
; /* The corresponding visual */
1315 GLint Width
, Height
; /* size of frame buffer in pixels */
1317 GLboolean UseSoftwareDepthBuffer
;
1318 GLboolean UseSoftwareAccumBuffer
;
1319 GLboolean UseSoftwareStencilBuffer
;
1320 GLboolean UseSoftwareAlphaBuffers
;
1322 /* Software depth (aka Z) buffer */
1323 GLvoid
*DepthBuffer
; /* array [Width*Height] of GLushort or GLuint*/
1325 /* Software stencil buffer */
1326 GLstencil
*Stencil
; /* array [Width*Height] of GLstencil values */
1328 /* Software accumulation buffer */
1329 GLaccum
*Accum
; /* array [4*Width*Height] of GLaccum values */
1331 /* Software alpha planes */
1332 GLchan
*FrontLeftAlpha
; /* array [Width*Height] of GLubyte */
1333 GLchan
*BackLeftAlpha
; /* array [Width*Height] of GLubyte */
1334 GLchan
*FrontRightAlpha
; /* array [Width*Height] of GLubyte */
1335 GLchan
*BackRightAlpha
; /* array [Width*Height] of GLubyte */
1336 GLchan
*Alpha
; /* Points to current alpha buffer */
1338 /* Drawing bounds: intersection of window size and scissor box */
1339 GLint _Xmin
, _Ymin
; /* inclusive */
1340 GLint _Xmax
, _Ymax
; /* exclusive */
1345 * Constants which may be overriden by device driver during context creation
1346 * but are never changed after that.
1348 struct gl_constants
{
1349 GLint MaxTextureLevels
;
1350 GLint Max3DTextureLevels
;
1351 GLint MaxCubeTextureLevels
;
1352 GLuint MaxTextureUnits
;
1353 GLfloat MaxTextureMaxAnisotropy
; /* GL_EXT_texture_filter_anisotropic */
1354 GLfloat MaxTextureLodBias
; /* GL_EXT_texture_lod_bias */
1355 GLuint MaxArrayLockSize
;
1357 GLfloat MinPointSize
, MaxPointSize
; /* aliased */
1358 GLfloat MinPointSizeAA
, MaxPointSizeAA
; /* antialiased */
1359 GLfloat PointSizeGranularity
;
1360 GLfloat MinLineWidth
, MaxLineWidth
; /* aliased */
1361 GLfloat MinLineWidthAA
, MaxLineWidthAA
; /* antialiased */
1362 GLfloat LineWidthGranularity
;
1363 GLuint NumAuxBuffers
;
1364 GLuint MaxColorTableSize
;
1365 GLuint MaxConvolutionWidth
;
1366 GLuint MaxConvolutionHeight
;
1367 GLuint NumCompressedTextureFormats
; /* GL_ARB_texture_compression */
1368 GLenum CompressedTextureFormats
[MAX_COMPRESSED_TEXTURE_FORMATS
];
1369 GLuint MaxClipPlanes
;
1375 * List of extensions.
1378 struct gl_extensions
{
1380 struct extension
*ext_list
;
1381 /* Flags to quickly test if certain extensions are available.
1382 * Not every extension needs to have such a flag, but it's encouraged.
1384 GLboolean ARB_imaging
;
1385 GLboolean ARB_multisample
;
1386 GLboolean ARB_multitexture
;
1387 GLboolean ARB_shadow
;
1388 GLboolean ARB_texture_border_clamp
;
1389 GLboolean ARB_texture_compression
;
1390 GLboolean ARB_texture_cube_map
;
1391 GLboolean ARB_texture_env_combine
;
1392 GLboolean ARB_texture_env_dot3
;
1393 GLboolean ARB_texture_mirrored_repeat
;
1394 GLboolean ARB_window_pos
;
1395 GLboolean EXT_blend_color
;
1396 GLboolean EXT_blend_func_separate
;
1397 GLboolean EXT_blend_logic_op
;
1398 GLboolean EXT_blend_minmax
;
1399 GLboolean EXT_blend_subtract
;
1400 GLboolean EXT_clip_volume_hint
;
1401 GLboolean EXT_convolution
;
1402 GLboolean EXT_compiled_vertex_array
;
1403 GLboolean EXT_fog_coord
;
1404 GLboolean EXT_histogram
;
1405 GLboolean EXT_packed_pixels
;
1406 GLboolean EXT_paletted_texture
;
1407 GLboolean EXT_point_parameters
;
1408 GLboolean EXT_polygon_offset
;
1409 GLboolean EXT_rescale_normal
;
1410 GLboolean EXT_secondary_color
;
1411 GLboolean EXT_shared_texture_palette
;
1412 GLboolean EXT_stencil_wrap
;
1413 GLboolean EXT_texture3D
;
1414 GLboolean EXT_texture_compression_s3tc
;
1415 GLboolean EXT_texture_env_add
;
1416 GLboolean EXT_texture_env_combine
;
1417 GLboolean EXT_texture_env_dot3
;
1418 GLboolean EXT_texture_filter_anisotropic
;
1419 GLboolean EXT_texture_object
;
1420 GLboolean EXT_texture_lod_bias
;
1421 GLboolean EXT_vertex_array_set
;
1422 GLboolean HP_occlusion_test
;
1423 GLboolean IBM_rasterpos_clip
;
1424 GLboolean INGR_blend_func_separate
;
1425 GLboolean MESA_window_pos
;
1426 GLboolean MESA_resize_buffers
;
1427 GLboolean MESA_sprite_point
;
1428 GLboolean NV_blend_square
;
1429 GLboolean NV_texgen_reflection
;
1430 GLboolean NV_vertex_program
;
1431 GLboolean SGI_color_matrix
;
1432 GLboolean SGI_color_table
;
1433 GLboolean SGIS_generate_mipmap
;
1434 GLboolean SGIS_pixel_texture
;
1435 GLboolean SGIS_texture_edge_clamp
;
1436 GLboolean SGIX_depth_texture
; /* or GL_ARB_depth_texture */
1437 GLboolean SGIX_pixel_texture
;
1438 GLboolean SGIX_shadow
;
1439 GLboolean SGIX_shadow_ambient
; /* or GL_ARB_shadow_ambient */
1440 GLboolean _3DFX_texture_compression_FXT1
;
1444 /* XXX just an idea */
1447 GLmatrix
*Top
; /* points into Stack */
1448 GLmatrix
*Stack
; /* array [MaxDepth] of GLmatrix */
1449 GLuint Depth
; /* 0 <= Depth < MaxDepth */
1450 GLuint MaxDepth
; /* size of Stack[] array */
1451 GLuint DirtyFlag
; /* _NEW_MODELVIEW or _NEW_PROJECTION, for example */
1456 * Bits for image transfer operations (ctx->ImageTransferState).
1458 #define IMAGE_SCALE_BIAS_BIT 0x1
1459 #define IMAGE_SHIFT_OFFSET_BIT 0x2
1460 #define IMAGE_MAP_COLOR_BIT 0x4
1461 #define IMAGE_COLOR_TABLE_BIT 0x8
1462 #define IMAGE_CONVOLUTION_BIT 0x10
1463 #define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
1464 #define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40
1465 #define IMAGE_COLOR_MATRIX_BIT 0x80
1466 #define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100
1467 #define IMAGE_HISTOGRAM_BIT 0x200
1468 #define IMAGE_MIN_MAX_BIT 0x400
1470 /* transfer ops up to convolution: */
1471 #define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \
1472 IMAGE_SHIFT_OFFSET_BIT | \
1473 IMAGE_MAP_COLOR_BIT | \
1474 IMAGE_COLOR_TABLE_BIT)
1476 /* transfer ops after convolution: */
1477 #define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \
1478 IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \
1479 IMAGE_COLOR_MATRIX_BIT | \
1480 IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\
1481 IMAGE_HISTOGRAM_BIT | \
1486 * Bits to indicate what state has changed. 6 unused flags.
1488 #define _NEW_MODELVIEW 0x1 /* ctx->ModelView */
1489 #define _NEW_PROJECTION 0x2 /* ctx->Projection */
1490 #define _NEW_TEXTURE_MATRIX 0x4 /* ctx->TextureMatrix */
1491 #define _NEW_COLOR_MATRIX 0x8 /* ctx->ColorMatrix */
1492 #define _NEW_ACCUM 0x10 /* ctx->Accum */
1493 #define _NEW_COLOR 0x20 /* ctx->Color */
1494 #define _NEW_DEPTH 0x40 /* ctx->Depth */
1495 #define _NEW_EVAL 0x80 /* ctx->Eval, ctx->EvalMap */
1496 #define _NEW_FOG 0x100 /* ctx->Fog */
1497 #define _NEW_HINT 0x200 /* ctx->Hint */
1498 #define _NEW_LIGHT 0x400 /* ctx->Light */
1499 #define _NEW_LINE 0x800 /* ctx->Line */
1500 #define _NEW_PIXEL 0x1000 /* ctx->Pixel */
1501 #define _NEW_POINT 0x2000 /* ctx->Point */
1502 #define _NEW_POLYGON 0x4000 /* ctx->Polygon */
1503 #define _NEW_POLYGONSTIPPLE 0x8000 /* ctx->PolygonStipple */
1504 #define _NEW_SCISSOR 0x10000 /* ctx->Scissor */
1505 #define _NEW_STENCIL 0x20000 /* ctx->Stencil */
1506 #define _NEW_TEXTURE 0x40000 /* ctx->Texture */
1507 #define _NEW_TRANSFORM 0x80000 /* ctx->Transform */
1508 #define _NEW_VIEWPORT 0x100000 /* ctx->Viewport */
1509 #define _NEW_PACKUNPACK 0x200000 /* ctx->Pack, ctx->Unpack */
1510 #define _NEW_ARRAY 0x400000 /* ctx->Array */
1511 #define _NEW_RENDERMODE 0x800000 /* RenderMode, Feedback, Select */
1512 #define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */
1513 #define _NEW_MULTISAMPLE 0x2000000 /* ctx->Multisample */
1514 #define _NEW_TRACK_MATRIX 0x4000000 /* ctx->VertexProgram */
1519 /* Bits to track array state changes (also used to summarize array enabled)
1521 #define _NEW_ARRAY_VERTEX (1 << VERT_ATTRIB_POS)
1522 #define _NEW_ARRAY_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
1523 #define _NEW_ARRAY_NORMAL (1 << VERT_ATTRIB_NORMAL)
1524 #define _NEW_ARRAY_COLOR0 (1 << VERT_ATTRIB_COLOR0)
1525 #define _NEW_ARRAY_COLOR1 (1 << VERT_ATTRIB_COLOR1)
1526 #define _NEW_ARRAY_FOGCOORD (1 << VERT_ATTRIB_FOG)
1527 #define _NEW_ARRAY_INDEX (1 << VERT_ATTRIB_SIX)
1528 #define _NEW_ARRAY_EDGEFLAG (1 << VERT_ATTRIB_SEVEN)
1529 #define _NEW_ARRAY_TEXCOORD_0 (1 << VERT_ATTRIB_TEX0)
1530 #define _NEW_ARRAY_TEXCOORD_1 (1 << VERT_ATTRIB_TEX1)
1531 #define _NEW_ARRAY_TEXCOORD_2 (1 << VERT_ATTRIB_TEX2)
1532 #define _NEW_ARRAY_TEXCOORD_3 (1 << VERT_ATTRIB_TEX3)
1533 #define _NEW_ARRAY_TEXCOORD_4 (1 << VERT_ATTRIB_TEX4)
1534 #define _NEW_ARRAY_TEXCOORD_5 (1 << VERT_ATTRIB_TEX5)
1535 #define _NEW_ARRAY_TEXCOORD_6 (1 << VERT_ATTRIB_TEX6)
1536 #define _NEW_ARRAY_TEXCOORD_7 (1 << VERT_ATTRIB_TEX7)
1537 #define _NEW_ARRAY_ALL 0xffff
1538 #define _NEW_ARRAY_VERT_ATTRIB0 0x10000
1541 #define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i))
1543 /* A bunch of flags that we think might be useful to drivers.
1545 #define DD_FLATSHADE 0x1
1546 #define DD_SEPARATE_SPECULAR 0x2
1547 #define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */
1548 #define DD_TRI_LIGHT_TWOSIDE 0x8
1549 #define DD_TRI_UNFILLED 0x10
1550 #define DD_TRI_SMOOTH 0x20
1551 #define DD_TRI_STIPPLE 0x40
1552 #define DD_TRI_OFFSET 0x80
1553 #define DD_LINE_SMOOTH 0x100
1554 #define DD_LINE_STIPPLE 0x200
1555 #define DD_LINE_WIDTH 0x400
1556 #define DD_POINT_SMOOTH 0x800
1557 #define DD_POINT_SIZE 0x1000
1558 #define DD_POINT_ATTEN 0x2000
1560 /* Define the state changes under which each of these bits might change
1562 #define _DD_NEW_FLATSHADE _NEW_LIGHT
1563 #define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG)
1564 #define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
1565 #define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT
1566 #define _DD_NEW_TRI_UNFILLED _NEW_POLYGON
1567 #define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
1568 #define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
1569 #define _DD_NEW_TRI_OFFSET _NEW_POLYGON
1570 #define _DD_NEW_LINE_SMOOTH _NEW_LINE
1571 #define _DD_NEW_LINE_STIPPLE _NEW_LINE
1572 #define _DD_NEW_LINE_WIDTH _NEW_LINE
1573 #define _DD_NEW_POINT_SMOOTH _NEW_POINT
1574 #define _DD_NEW_POINT_SIZE _NEW_POINT
1575 #define _DD_NEW_POINT_ATTEN _NEW_POINT
1577 #define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
1582 #define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
1585 #define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX)
1588 #define NEED_NORMALS_TEXGEN 0x1
1589 #define NEED_NORMALS_LIGHT 0x2
1591 #define NEED_EYE_TEXGEN 0x1
1592 #define NEED_EYE_LIGHT 0x2
1593 #define NEED_EYE_LIGHT_MODELVIEW 0x4
1594 #define NEED_EYE_POINT_ATTEN 0x8
1598 * Forward declaration of display list datatypes:
1601 typedef union node Node
;
1604 /* This has to be included here. */
1609 * Core Mesa's support for tnl modules:
1611 #define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *))
1613 struct gl_tnl_module
{
1614 /* Vertex format to be lazily swapped into current dispatch.
1616 GLvertexformat
*Current
;
1618 /* Record of functions swapped out. On restore, only need to swap
1619 * these functions back in.
1621 void *Swapped
[NUM_VERTEX_FORMAT_ENTRIES
][2];
1627 * The library context:
1629 struct __GLcontextRec
{
1631 ** Os related interfaces; these *must* be the first members of this
1632 ** structure, because they are exposed to the outside world (i.e. GLX
1635 __GLimports imports
;
1636 __GLexports exports
;
1638 /* State possibly shared with other contexts in the address space */
1639 struct gl_shared_state
*Shared
;
1641 /* API function pointer tables */
1642 struct _glapi_table
*Save
; /* Display list save funcs */
1643 struct _glapi_table
*Exec
; /* Execute funcs */
1644 struct _glapi_table
*CurrentDispatch
; /* == Save or Exec !! */
1646 GLboolean ExecPrefersFloat
; /* What preference for color conversion? */
1647 GLboolean SavePrefersFloat
;
1650 GLframebuffer
*DrawBuffer
; /* buffer for writing */
1651 GLframebuffer
*ReadBuffer
; /* buffer for reading */
1653 /* Driver function pointer table */
1654 struct dd_function_table Driver
;
1656 void *DriverCtx
; /* Points to device driver context/state */
1657 void *DriverMgrCtx
; /* Points to device driver manager (optional)*/
1659 /* Core/Driver constants */
1660 struct gl_constants Const
;
1662 /* The various 4x4 matrix stacks */
1663 struct matrix_stack ModelviewMatrixStack
;
1664 struct matrix_stack ProjectionMatrixStack
;
1665 struct matrix_stack ColorMatrixStack
;
1666 struct matrix_stack TextureMatrixStack
[MAX_TEXTURE_UNITS
];
1667 struct matrix_stack ProgramMatrixStack
[MAX_PROGRAM_MATRICES
];
1668 struct matrix_stack
*CurrentStack
; /* Points to one of the above stacks */
1670 /* Combined modelview and projection matrix */
1671 GLmatrix _ModelProjectMatrix
;
1674 GLuint CallDepth
; /* Current recursion calling depth */
1675 GLboolean ExecuteFlag
; /* Execute GL commands? */
1676 GLboolean CompileFlag
; /* Compile GL commands into display list? */
1677 Node
*CurrentListPtr
; /* Head of list being compiled */
1678 GLuint CurrentListNum
; /* Number of the list being compiled */
1679 Node
*CurrentBlock
; /* Pointer to current block of nodes */
1680 GLuint CurrentPos
; /* Index into current block of nodes */
1683 struct gl_extensions Extensions
;
1685 /* Renderer attribute stack */
1686 GLuint AttribStackDepth
;
1687 struct gl_attrib_node
*AttribStack
[MAX_ATTRIB_STACK_DEPTH
];
1689 /* Renderer attribute groups */
1690 struct gl_accum_attrib Accum
;
1691 struct gl_colorbuffer_attrib Color
;
1692 struct gl_current_attrib Current
;
1693 struct gl_depthbuffer_attrib Depth
;
1694 struct gl_eval_attrib Eval
;
1695 struct gl_fog_attrib Fog
;
1696 struct gl_hint_attrib Hint
;
1697 struct gl_light_attrib Light
;
1698 struct gl_line_attrib Line
;
1699 struct gl_list_attrib List
;
1700 struct gl_multisample_attrib Multisample
;
1701 struct gl_pixel_attrib Pixel
;
1702 struct gl_point_attrib Point
;
1703 struct gl_polygon_attrib Polygon
;
1704 GLuint PolygonStipple
[32];
1705 struct gl_scissor_attrib Scissor
;
1706 struct gl_stencil_attrib Stencil
;
1707 struct gl_texture_attrib Texture
;
1708 struct gl_transform_attrib Transform
;
1709 struct gl_viewport_attrib Viewport
;
1711 /* Other attribute groups */
1712 struct gl_histogram_attrib Histogram
;
1713 struct gl_minmax_attrib MinMax
;
1714 struct gl_convolution_attrib Convolution1D
;
1715 struct gl_convolution_attrib Convolution2D
;
1716 struct gl_convolution_attrib Separable2D
;
1718 /* Client attribute stack */
1719 GLuint ClientAttribStackDepth
;
1720 struct gl_attrib_node
*ClientAttribStack
[MAX_CLIENT_ATTRIB_STACK_DEPTH
];
1722 /* Client attribute groups */
1723 struct gl_array_attrib Array
; /* Vertex arrays */
1724 struct gl_pixelstore_attrib Pack
; /* Pixel packing */
1725 struct gl_pixelstore_attrib Unpack
; /* Pixel unpacking */
1727 struct gl_evaluators EvalMap
; /* All evaluators */
1728 struct gl_feedback Feedback
; /* Feedback */
1729 struct gl_selection Select
; /* Selection */
1731 struct gl_color_table ColorTable
; /* Pre-convolution */
1732 struct gl_color_table ProxyColorTable
; /* Pre-convolution */
1733 struct gl_color_table PostConvolutionColorTable
;
1734 struct gl_color_table ProxyPostConvolutionColorTable
;
1735 struct gl_color_table PostColorMatrixColorTable
;
1736 struct gl_color_table ProxyPostColorMatrixColorTable
;
1738 struct vertex_program_state VertexProgram
; /* GL_NV_vertex_program */
1740 GLenum ErrorValue
; /* Last error code */
1741 GLenum RenderMode
; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
1742 GLuint NewState
; /* bitwise-or of _NEW_* flags */
1745 GLuint _TriangleCaps
; /* bitwise-or of DD_* flags */
1746 GLuint _ImageTransferState
;/* bitwise-or of IMAGE_*_BIT flags */
1747 GLfloat _EyeZDir
[3];
1748 GLfloat _ModelViewInvScale
;
1749 GLuint _NeedEyeCoords
;
1750 GLuint _NeedNormals
; /* Are vertex normal vectors needed? */
1752 struct gl_shine_tab
*_ShineTable
[2]; /* Active shine tables */
1753 struct gl_shine_tab
*_ShineTabList
; /* Mru list of inactive shine tables */
1755 struct gl_list_extensions listext
; /* driver dlist extensions */
1758 GLboolean OcclusionResult
; /* GL_HP_occlusion_test */
1759 GLboolean OcclusionResultSaved
; /* GL_HP_occlusion_test */
1761 /* Z buffer stuff */
1762 GLuint DepthMax
; /* Max depth buffer value */
1763 GLfloat DepthMaxF
; /* Float max depth buffer value */
1764 GLfloat MRD
; /* minimum resolvable difference in Z values */
1766 /* Should 3Dfx Glide driver catch signals? */
1767 GLboolean CatchSignals
;
1769 /* For debugging/development only */
1771 GLboolean FirstTimeCurrent
;
1773 /* Dither disable via MESA_NO_DITHER env var */
1776 GLboolean Rendering
;
1778 #if defined(MESA_TRACE)
1779 struct _glapi_table
*TraceDispatch
;
1780 trace_context_t
*TraceCtx
;
1782 void *TraceDispatch
;
1786 /* Core tnl module support */
1787 struct gl_tnl_module TnlModule
;
1789 /* Hooks for module contexts. These will eventually live
1790 * in the driver or elsewhere.
1792 void *swrast_context
;
1793 void *swsetup_context
;
1794 void *swtnl_context
;
1796 void *acache_context
;
1801 /* The string names for GL_POINT, GL_LINE_LOOP, etc */
1802 extern const char *_mesa_prim_name
[GL_POLYGON
+4];
1806 extern int MESA_VERBOSE
;
1807 extern int MESA_DEBUG_FLAGS
;
1809 # define MESA_VERBOSE 0
1810 # define MESA_DEBUG_FLAGS 0
1818 VERBOSE_VARRAY
= 0x0001,
1819 VERBOSE_TEXTURE
= 0x0002,
1820 VERBOSE_IMMEDIATE
= 0x0004,
1821 VERBOSE_PIPELINE
= 0x0008,
1822 VERBOSE_DRIVER
= 0x0010,
1823 VERBOSE_STATE
= 0x0020,
1824 VERBOSE_API
= 0x0040,
1825 VERBOSE_DISPLAY_LIST
= 0x0200,
1826 VERBOSE_LIGHTING
= 0x0400
1831 DEBUG_ALWAYS_FLUSH
= 0x1
1836 #define Elements(x) sizeof(x)/sizeof(*(x))
1840 /* Eventually let the driver specify what statechanges require a flush:
1842 #define FLUSH_VERTICES(ctx, newstate) \
1844 if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
1845 ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
1846 ctx->NewState |= newstate; \
1849 #define FLUSH_CURRENT(ctx, newstate) \
1851 if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
1852 ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
1853 ctx->NewState |= newstate; \
1856 #define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
1858 if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
1859 _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
1864 #define ASSERT_OUTSIDE_BEGIN_END(ctx) \
1866 if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
1867 _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
1872 #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
1874 ASSERT_OUTSIDE_BEGIN_END(ctx); \
1875 FLUSH_VERTICES(ctx, 0); \
1878 #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
1880 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
1881 FLUSH_VERTICES(ctx, 0); \
1887 #endif /* TYPES_H */