#ifndef TYPES_H
#define TYPES_H
#include "glheader.h"
#include "config.h"
#include "glapitable.h"
#include "glthread.h"
#include "math/m_matrix.h"
#if defined(MESA_TRACE)
#include "Trace/tr_context.h"
#endif
#if CHAN_BITS == 8
typedef GLubyte GLchan;
#define CHAN_MAX 255
#define CHAN_MAXF 255.0F
#define CHAN_TYPE GL_UNSIGNED_BYTE
#elif CHAN_BITS == 16
typedef GLushort GLchan;
#define CHAN_MAX 65535
#define CHAN_MAXF 65535.0F
#define CHAN_TYPE GL_UNSIGNED_SHORT
#elif CHAN_BITS == 32
typedef GLfloat GLchan;
#define CHAN_MAX 1.0
#define CHAN_MAXF 1.0F
#define CHAN_TYPE GL_FLOAT
#else
#error "illegal number of color channel bits"
#endif
#if ACCUM_BITS==8
typedef GLbyte GLaccum;
#elif ACCUM_BITS==16
typedef GLshort GLaccum;
#elif ACCUM_BITS==32
typedef GLfloat GLaccum;
#else
# error "illegal number of accumulation bits"
#endif
#if STENCIL_BITS==8
typedef GLubyte GLstencil;
# define STENCIL_MAX 0xff
#elif STENCIL_BITS==16
typedef GLushort GLstencil;
# define STENCIL_MAX 0xffff
#else
# error "illegal number of stencil bits"
#endif
typedef GLuint GLdepth;
typedef int GLfixed;
struct _mesa_HashTable;
struct gl_texture_image;
struct gl_texture_object;
typedef struct __GLcontextRec GLcontext;
typedef struct __GLcontextModesRec GLvisual;
typedef struct gl_frame_buffer GLframebuffer;
#define VERT_ATTRIB_POS 0
#define VERT_ATTRIB_WEIGHT 1
#define VERT_ATTRIB_NORMAL 2
#define VERT_ATTRIB_COLOR0 3
#define VERT_ATTRIB_COLOR1 4
#define VERT_ATTRIB_FOG 5
#define VERT_ATTRIB_SIX 6
#define VERT_ATTRIB_SEVEN 7
#define VERT_ATTRIB_TEX0 8
#define VERT_ATTRIB_TEX1 9
#define VERT_ATTRIB_TEX2 10
#define VERT_ATTRIB_TEX3 11
#define VERT_ATTRIB_TEX4 12
#define VERT_ATTRIB_TEX5 13
#define VERT_ATTRIB_TEX6 14
#define VERT_ATTRIB_TEX7 15
#define VERT_ATTRIB_MAX 16
#define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX)
#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
struct gl_color_table {
GLenum Format;
GLenum IntFormat;
GLuint Size;
GLvoid *Table;
GLboolean FloatTable;
GLubyte RedSize;
GLubyte GreenSize;
GLubyte BlueSize;
GLubyte AlphaSize;
GLubyte LuminanceSize;
GLubyte IntensitySize;
};
#define FRONT_AMBIENT_BIT 0x1
#define BACK_AMBIENT_BIT 0x2
#define FRONT_DIFFUSE_BIT 0x4
#define BACK_DIFFUSE_BIT 0x8
#define FRONT_SPECULAR_BIT 0x10
#define BACK_SPECULAR_BIT 0x20
#define FRONT_EMISSION_BIT 0x40
#define BACK_EMISSION_BIT 0x80
#define FRONT_SHININESS_BIT 0x100
#define BACK_SHININESS_BIT 0x200
#define FRONT_INDEXES_BIT 0x400
#define BACK_INDEXES_BIT 0x800
#define FRONT_MATERIAL_BITS (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT | \
FRONT_DIFFUSE_BIT | FRONT_SPECULAR_BIT | \
FRONT_SHININESS_BIT | FRONT_INDEXES_BIT)
#define BACK_MATERIAL_BITS (BACK_EMISSION_BIT | BACK_AMBIENT_BIT | \
BACK_DIFFUSE_BIT | BACK_SPECULAR_BIT | \
BACK_SHININESS_BIT | BACK_INDEXES_BIT)
#define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
#define EXP_TABLE_SIZE 512
#define SHINE_TABLE_SIZE 256
struct gl_shine_tab {
struct gl_shine_tab *next, *prev;
GLfloat tab[SHINE_TABLE_SIZE+1];
GLfloat shininess;
GLuint refcount;
};
struct gl_light {
struct gl_light *next;
struct gl_light *prev;
GLfloat Ambient[4];
GLfloat Diffuse[4];
GLfloat Specular[4];
GLfloat EyePosition[4];
GLfloat EyeDirection[4];
GLfloat SpotExponent;
GLfloat SpotCutoff;
GLfloat _CosCutoff;
GLfloat ConstantAttenuation;
GLfloat LinearAttenuation;
GLfloat QuadraticAttenuation;
GLboolean Enabled;
GLuint _Flags;
GLfloat _Position[4];
GLfloat _VP_inf_norm[3];
GLfloat _h_inf_norm[3];
GLfloat _NormDirection[4];
GLfloat _VP_inf_spot_attenuation;
GLfloat _SpotExpTable[EXP_TABLE_SIZE][2];
GLfloat _MatAmbient[2][3];
GLfloat _MatDiffuse[2][3];
GLfloat _MatSpecular[2][3];
GLfloat _dli;
GLfloat _sli;
};
struct gl_lightmodel {
GLfloat Ambient[4];
GLboolean LocalViewer;
GLboolean TwoSide;
GLenum ColorControl;
};
struct gl_material
{
GLfloat Ambient[4];
GLfloat Diffuse[4];
GLfloat Specular[4];
GLfloat Emission[4];
GLfloat Shininess;
GLfloat AmbientIndex;
GLfloat DiffuseIndex;
GLfloat SpecularIndex;
};
struct gl_accum_attrib {
GLfloat ClearColor[4];
};
#define FRONT_LEFT_BIT 0x1
#define FRONT_RIGHT_BIT 0x2
#define BACK_LEFT_BIT 0x4
#define BACK_RIGHT_BIT 0x8
#define AUX0_BIT 0x10
#define AUX1_BIT 0x20
#define AUX2_BIT 0x40
#define AUX3_BIT 0x80
struct gl_colorbuffer_attrib {
GLuint ClearIndex;
GLclampf ClearColor[4];
GLuint IndexMask;
GLubyte ColorMask[4];
GLenum DrawBuffer;
GLubyte _DrawDestMask;
GLboolean AlphaEnabled;
GLenum AlphaFunc;
GLclampf AlphaRef;
GLboolean BlendEnabled;
GLenum BlendSrcRGB;
GLenum BlendDstRGB;
GLenum BlendSrcA;
GLenum BlendDstA;
GLenum BlendEquation;
GLfloat BlendColor[4];
GLenum LogicOp;
GLboolean IndexLogicOpEnabled;
GLboolean ColorLogicOpEnabled;
GLboolean _LogicOpEnabled;
GLboolean DitherFlag;
};
struct gl_current_attrib {
GLfloat Attrib[VERT_ATTRIB_MAX][4];
GLuint Index;
GLboolean EdgeFlag;
GLfloat RasterPos[4];
GLfloat RasterDistance;
GLfloat RasterColor[4];
GLfloat RasterSecondaryColor[4];
GLuint RasterIndex;
GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];
GLboolean RasterPosValid;
};
struct gl_depthbuffer_attrib {
GLenum Func;
GLfloat Clear;
GLboolean Test;
GLboolean Mask;
GLboolean OcclusionTest;
};
struct gl_enable_attrib {
GLboolean AlphaTest;
GLboolean AutoNormal;
GLboolean Blend;
GLuint ClipPlanes;
GLboolean ColorMaterial;
GLboolean Convolution1D;
GLboolean Convolution2D;
GLboolean Separable2D;
GLboolean CullFace;
GLboolean DepthTest;
GLboolean Dither;
GLboolean Fog;
GLboolean Histogram;
GLboolean Light[MAX_LIGHTS];
GLboolean Lighting;
GLboolean LineSmooth;
GLboolean LineStipple;
GLboolean IndexLogicOp;
GLboolean ColorLogicOp;
GLboolean Map1Color4;
GLboolean Map1Index;
GLboolean Map1Normal;
GLboolean Map1TextureCoord1;
GLboolean Map1TextureCoord2;
GLboolean Map1TextureCoord3;
GLboolean Map1TextureCoord4;
GLboolean Map1Vertex3;
GLboolean Map1Vertex4;
GLboolean Map1Attrib[16];
GLboolean Map2Color4;
GLboolean Map2Index;
GLboolean Map2Normal;
GLboolean Map2TextureCoord1;
GLboolean Map2TextureCoord2;
GLboolean Map2TextureCoord3;
GLboolean Map2TextureCoord4;
GLboolean Map2Vertex3;
GLboolean Map2Vertex4;
GLboolean Map2Attrib[16];
GLboolean MinMax;
GLboolean Normalize;
GLboolean PixelTexture;
GLboolean PointSmooth;
GLboolean PolygonOffsetPoint;
GLboolean PolygonOffsetLine;
GLboolean PolygonOffsetFill;
GLboolean PolygonSmooth;
GLboolean PolygonStipple;
GLboolean RescaleNormals;
GLboolean Scissor;
GLboolean Stencil;
GLboolean MultisampleEnabled;
GLboolean SampleAlphaToCoverage;
GLboolean SampleAlphaToOne;
GLboolean SampleCoverage;
GLboolean SampleCoverageInvert;
GLboolean RasterPositionUnclipped;
GLuint Texture[MAX_TEXTURE_UNITS];
GLuint TexGen[MAX_TEXTURE_UNITS];
GLboolean VertexProgram;
GLboolean VertexProgramPointSize;
GLboolean VertexProgramTwoSide;
GLboolean PointSprite;
};
struct gl_eval_attrib {
GLboolean Map1Color4;
GLboolean Map1Index;
GLboolean Map1Normal;
GLboolean Map1TextureCoord1;
GLboolean Map1TextureCoord2;
GLboolean Map1TextureCoord3;
GLboolean Map1TextureCoord4;
GLboolean Map1Vertex3;
GLboolean Map1Vertex4;
GLboolean Map1Attrib[16];
GLboolean Map2Color4;
GLboolean Map2Index;
GLboolean Map2Normal;
GLboolean Map2TextureCoord1;
GLboolean Map2TextureCoord2;
GLboolean Map2TextureCoord3;
GLboolean Map2TextureCoord4;
GLboolean Map2Vertex3;
GLboolean Map2Vertex4;
GLboolean Map2Attrib[16];
GLboolean AutoNormal;
GLint MapGrid1un;
GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du;
GLint MapGrid2un, MapGrid2vn;
GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du;
GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv;
};
struct gl_fog_attrib {
GLboolean Enabled;
GLfloat Color[4];
GLfloat Density;
GLfloat Start;
GLfloat End;
GLfloat Index;
GLenum Mode;
GLboolean ColorSumEnabled;
GLenum FogCoordinateSource;
};
struct gl_hint_attrib {
GLenum PerspectiveCorrection;
GLenum PointSmooth;
GLenum LineSmooth;
GLenum PolygonSmooth;
GLenum Fog;
GLenum ClipVolumeClipping;
GLenum TextureCompression;
GLenum GenerateMipmap;
};
struct gl_histogram_attrib {
GLuint Width;
GLint Format;
GLuint Count[HISTOGRAM_TABLE_SIZE][4];
GLboolean Sink;
GLubyte RedSize;
GLubyte GreenSize;
GLubyte BlueSize;
GLubyte AlphaSize;
GLubyte LuminanceSize;
};
struct gl_minmax_attrib {
GLenum Format;
GLboolean Sink;
GLfloat Min[4], Max[4];
};
struct gl_convolution_attrib {
GLenum Format;
GLenum InternalFormat;
GLuint Width;
GLuint Height;
GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4];
};
#define LIGHT_SPOT 0x1
#define LIGHT_LOCAL_VIEWER 0x2
#define LIGHT_POSITIONAL 0x4
#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
struct gl_light_attrib {
struct gl_light Light[MAX_LIGHTS];
struct gl_lightmodel Model;
struct gl_material Material[2];
GLboolean Enabled;
GLenum ShadeModel;
GLenum ColorMaterialFace;
GLenum ColorMaterialMode;
GLuint ColorMaterialBitmask;
GLboolean ColorMaterialEnabled;
struct gl_light EnabledList;
GLboolean _NeedVertices;
GLuint _Flags;
GLfloat _BaseColor[2][3];
};
struct gl_line_attrib {
GLboolean SmoothFlag;
GLboolean StippleFlag;
GLushort StipplePattern;
GLint StippleFactor;
GLfloat Width;
GLfloat _Width;
};
struct gl_list_attrib {
GLuint ListBase;
};
struct gl_list_opcode {
GLuint size;
void (*execute)( GLcontext *ctx, void *data );
void (*destroy)( GLcontext *ctx, void *data );
void (*print)( GLcontext *ctx, void *data );
};
#define GL_MAX_EXT_OPCODES 16
struct gl_list_extensions {
struct gl_list_opcode opcode[GL_MAX_EXT_OPCODES];
GLuint nr_opcodes;
};
struct gl_multisample_attrib {
GLboolean Enabled;
GLboolean SampleAlphaToCoverage;
GLboolean SampleAlphaToOne;
GLboolean SampleCoverage;
GLfloat SampleCoverageValue;
GLboolean SampleCoverageInvert;
};
struct gl_pixel_attrib {
GLenum ReadBuffer;
GLubyte _ReadSrcMask;
GLfloat RedBias, RedScale;
GLfloat GreenBias, GreenScale;
GLfloat BlueBias, BlueScale;
GLfloat AlphaBias, AlphaScale;
GLfloat DepthBias, DepthScale;
GLint IndexShift, IndexOffset;
GLboolean MapColorFlag;
GLboolean MapStencilFlag;
GLfloat ZoomX, ZoomY;
GLint MapStoSsize;
GLint MapItoIsize;
GLint MapItoRsize;
GLint MapItoGsize;
GLint MapItoBsize;
GLint MapItoAsize;
GLint MapRtoRsize;
GLint MapGtoGsize;
GLint MapBtoBsize;
GLint MapAtoAsize;
GLint MapStoS[MAX_PIXEL_MAP_TABLE];
GLint MapItoI[MAX_PIXEL_MAP_TABLE];
GLfloat MapItoR[MAX_PIXEL_MAP_TABLE];
GLfloat MapItoG[MAX_PIXEL_MAP_TABLE];
GLfloat MapItoB[MAX_PIXEL_MAP_TABLE];
GLfloat MapItoA[MAX_PIXEL_MAP_TABLE];
GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE];
GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE];
GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE];
GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE];
GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE];
GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE];
GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE];
GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE];
GLboolean HistogramEnabled;
GLboolean MinMaxEnabled;
GLboolean PixelTextureEnabled;
GLenum FragmentRgbSource;
GLenum FragmentAlphaSource;
GLfloat PostColorMatrixScale[4];
GLfloat PostColorMatrixBias[4];
GLfloat ColorTableScale[4];
GLfloat ColorTableBias[4];
GLboolean ColorTableEnabled;
GLfloat PCCTscale[4];
GLfloat PCCTbias[4];
GLboolean PostConvolutionColorTableEnabled;
GLfloat PCMCTscale[4];
GLfloat PCMCTbias[4];
GLboolean PostColorMatrixColorTableEnabled;
GLboolean Convolution1DEnabled;
GLboolean Convolution2DEnabled;
GLboolean Separable2DEnabled;
GLfloat ConvolutionBorderColor[3][4];
GLenum ConvolutionBorderMode[3];
GLfloat ConvolutionFilterScale[3][4];
GLfloat ConvolutionFilterBias[3][4];
GLfloat PostConvolutionScale[4];
GLfloat PostConvolutionBias[4];
};
struct gl_point_attrib {
GLboolean SmoothFlag;
GLfloat Size;
GLfloat _Size;
GLfloat Params[3];
GLfloat MinSize, MaxSize;
GLfloat Threshold;
GLboolean _Attenuated;
GLboolean PointSprite;
GLboolean CoordReplace[MAX_TEXTURE_UNITS];
GLenum SpriteRMode;
};
struct gl_polygon_attrib {
GLenum FrontFace;
GLenum FrontMode;
GLenum BackMode;
GLboolean _FrontBit;
GLboolean CullFlag;
GLboolean SmoothFlag;
GLboolean StippleFlag;
GLenum CullFaceMode;
GLfloat OffsetFactor;
GLfloat OffsetUnits;
GLboolean OffsetPoint;
GLboolean OffsetLine;
GLboolean OffsetFill;
};
struct gl_scissor_attrib {
GLboolean Enabled;
GLint X, Y;
GLsizei Width, Height;
};
struct gl_stencil_attrib {
GLboolean Enabled;
GLboolean TestTwoSide;
GLubyte ActiveFace;
GLenum Function[2];
GLenum FailFunc[2];
GLenum ZPassFunc[2];
GLenum ZFailFunc[2];
GLstencil Ref[2];
GLstencil ValueMask[2];
GLstencil WriteMask[2];
GLstencil Clear;
};
#define S_BIT 1
#define T_BIT 2
#define R_BIT 4
#define Q_BIT 8
#define TEXTURE_1D_BIT 0x01
#define TEXTURE_2D_BIT 0x02
#define TEXTURE_3D_BIT 0x04
#define TEXTURE_CUBE_BIT 0x08
#define TEXTURE_RECT_BIT 0x10
#define NUM_TEXTURE_TARGETS 5
#define TEXGEN_SPHERE_MAP 0x1
#define TEXGEN_OBJ_LINEAR 0x2
#define TEXGEN_EYE_LINEAR 0x4
#define TEXGEN_REFLECTION_MAP_NV 0x8
#define TEXGEN_NORMAL_MAP_NV 0x10
#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
TEXGEN_REFLECTION_MAP_NV | \
TEXGEN_NORMAL_MAP_NV)
#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
TEXGEN_REFLECTION_MAP_NV | \
TEXGEN_NORMAL_MAP_NV | \
TEXGEN_EYE_LINEAR)
#define ENABLE_TEXGEN0 0x1
#define ENABLE_TEXGEN1 0x2
#define ENABLE_TEXGEN2 0x4
#define ENABLE_TEXGEN3 0x8
#define ENABLE_TEXGEN4 0x10
#define ENABLE_TEXGEN5 0x20
#define ENABLE_TEXGEN6 0x40
#define ENABLE_TEXGEN7 0x80
#define ENABLE_TEXMAT0 0x1
#define ENABLE_TEXMAT1 0x2
#define ENABLE_TEXMAT2 0x4
#define ENABLE_TEXMAT3 0x8
#define ENABLE_TEXMAT4 0x10
#define ENABLE_TEXMAT5 0x20
#define ENABLE_TEXMAT6 0x40
#define ENABLE_TEXMAT7 0x80
#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
typedef void (*FetchTexelFunc)( const struct gl_texture_image *texImage,
GLint col, GLint row, GLint img,
GLvoid *texelOut );
struct gl_texture_format {
GLint MesaFormat;
GLenum BaseFormat;
GLubyte RedBits;
GLubyte GreenBits;
GLubyte BlueBits;
GLubyte AlphaBits;
GLubyte LuminanceBits;
GLubyte IntensityBits;
GLubyte IndexBits;
GLubyte DepthBits;
GLint TexelBytes;
FetchTexelFunc FetchTexel1D;
FetchTexelFunc FetchTexel2D;
FetchTexelFunc FetchTexel3D;
};
struct gl_texture_image {
GLenum Format;
GLint IntFormat;
GLuint Border;
GLuint Width;
GLuint Height;
GLuint Depth;
GLuint RowStride;
GLuint Width2;
GLuint Height2;
GLuint Depth2;
GLuint WidthLog2;
GLuint HeightLog2;
GLuint DepthLog2;
GLuint MaxLog2;
GLfloat WidthScale;
GLfloat HeightScale;
GLfloat DepthScale;
GLvoid *Data;
GLboolean IsClientData;
const struct gl_texture_format *TexFormat;
FetchTexelFunc FetchTexel;
GLboolean IsCompressed;
GLuint CompressedSize;
void *DriverData;
};
struct gl_texture_object {
_glthread_Mutex Mutex;
GLint RefCount;
GLuint Name;
GLenum Target;
GLfloat Priority;
GLfloat BorderColor[4];
GLchan _BorderChan[4];
GLenum WrapS;
GLenum WrapT;
GLenum WrapR;
GLenum MinFilter;
GLenum MagFilter;
GLfloat MinLod;
GLfloat MaxLod;
GLfloat LodBias;
GLint BaseLevel;
GLint MaxLevel;
GLfloat MaxAnisotropy;
GLboolean CompareFlag;
GLenum CompareOperator;
GLfloat ShadowAmbient;
GLenum CompareMode;
GLenum CompareFunc;
GLenum DepthMode;
GLint _MaxLevel;
GLfloat _MaxLambda;
GLboolean GenerateMipmap;
struct gl_texture_image *Image[MAX_TEXTURE_LEVELS];
struct gl_texture_image *NegX[MAX_TEXTURE_LEVELS];
struct gl_texture_image *PosY[MAX_TEXTURE_LEVELS];
struct gl_texture_image *NegY[MAX_TEXTURE_LEVELS];
struct gl_texture_image *PosZ[MAX_TEXTURE_LEVELS];
struct gl_texture_image *NegZ[MAX_TEXTURE_LEVELS];
struct gl_color_table Palette;
GLboolean Complete;
struct gl_texture_object *Next;
void *DriverData;
};
struct gl_texture_unit {
GLuint Enabled;
GLuint _ReallyEnabled;
GLenum EnvMode;
GLfloat EnvColor[4];
GLuint TexGenEnabled;
GLenum GenModeS;
GLenum GenModeT;
GLenum GenModeR;
GLenum GenModeQ;
GLuint _GenBitS;
GLuint _GenBitT;
GLuint _GenBitR;
GLuint _GenBitQ;
GLuint _GenFlags;
GLfloat ObjectPlaneS[4];
GLfloat ObjectPlaneT[4];
GLfloat ObjectPlaneR[4];
GLfloat ObjectPlaneQ[4];
GLfloat EyePlaneS[4];
GLfloat EyePlaneT[4];
GLfloat EyePlaneR[4];
GLfloat EyePlaneQ[4];
GLfloat LodBias;
GLenum CombineModeRGB;
GLenum CombineModeA;
GLenum CombineSourceRGB[3];
GLenum CombineSourceA[3];
GLenum CombineOperandRGB[3];
GLenum CombineOperandA[3];
GLuint CombineScaleShiftRGB;
GLuint CombineScaleShiftA;
struct gl_texture_object *Current1D;
struct gl_texture_object *Current2D;
struct gl_texture_object *Current3D;
struct gl_texture_object *CurrentCubeMap;
struct gl_texture_object *CurrentRect;
struct gl_texture_object *_Current;
struct gl_texture_object Saved1D;
struct gl_texture_object Saved2D;
struct gl_texture_object Saved3D;
struct gl_texture_object SavedCubeMap;
struct gl_texture_object SavedRect;
};
struct gl_texture_attrib {
GLuint CurrentUnit;
GLuint _EnabledUnits;
GLuint _GenFlags;
GLuint _TexGenEnabled;
GLuint _TexMatEnabled;
struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
struct gl_texture_object *Proxy1D;
struct gl_texture_object *Proxy2D;
struct gl_texture_object *Proxy3D;
struct gl_texture_object *ProxyCubeMap;
struct gl_texture_object *ProxyRect;
GLboolean SharedPalette;
struct gl_color_table Palette;
};
struct gl_transform_attrib {
GLenum MatrixMode;
GLfloat EyeUserPlane[MAX_CLIP_PLANES][4];
GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4];
GLuint ClipPlanesEnabled;
GLboolean Normalize;
GLboolean RescaleNormals;
GLboolean RasterPositionUnclipped;
};
struct gl_viewport_attrib {
GLint X, Y;
GLsizei Width, Height;
GLfloat Near, Far;
GLmatrix _WindowMap;
};
struct gl_attrib_node {
GLbitfield kind;
void *data;
struct gl_attrib_node *next;
};
struct gl_pixelstore_attrib {
GLint Alignment;
GLint RowLength;
GLint SkipPixels;
GLint SkipRows;
GLint ImageHeight;
GLint SkipImages;
GLboolean SwapBytes;
GLboolean LsbFirst;
GLboolean ClientStorage;
GLboolean Invert;
};
#define CA_CLIENT_DATA 0x1
struct gl_client_array {
GLint Size;
GLenum Type;
GLsizei Stride;
GLsizei StrideB;
void *Ptr;
GLuint Flags;
GLuint Enabled;
};
struct gl_array_attrib {
struct gl_client_array Vertex;
struct gl_client_array Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
struct gl_client_array TexCoord[MAX_TEXTURE_UNITS];
struct gl_client_array EdgeFlag;
struct gl_client_array VertexAttrib[16];
GLint TexCoordInterleaveFactor;
GLint ActiveTexture;
GLuint LockFirst;
GLuint LockCount;
GLuint _Enabled;
GLuint NewState;
};
struct gl_feedback {
GLenum Type;
GLuint _Mask;
GLfloat *Buffer;
GLuint BufferSize;
GLuint Count;
};
struct gl_selection {
GLuint *Buffer;
GLuint BufferSize;
GLuint BufferCount;
GLuint Hits;
GLuint NameStackDepth;
GLuint NameStack[MAX_NAME_STACK_DEPTH];
GLboolean HitFlag;
GLfloat HitMinZ, HitMaxZ;
};
struct gl_1d_map {
GLuint Order;
GLfloat u1, u2, du;
GLfloat *Points;
};
struct gl_2d_map {
GLuint Uorder;
GLuint Vorder;
GLfloat u1, u2, du;
GLfloat v1, v2, dv;
GLfloat *Points;
};
struct gl_evaluators {
struct gl_1d_map Map1Vertex3;
struct gl_1d_map Map1Vertex4;
struct gl_1d_map Map1Index;
struct gl_1d_map Map1Color4;
struct gl_1d_map Map1Normal;
struct gl_1d_map Map1Texture1;
struct gl_1d_map Map1Texture2;
struct gl_1d_map Map1Texture3;
struct gl_1d_map Map1Texture4;
struct gl_1d_map Map1Attrib[16];
struct gl_2d_map Map2Vertex3;
struct gl_2d_map Map2Vertex4;
struct gl_2d_map Map2Index;
struct gl_2d_map Map2Color4;
struct gl_2d_map Map2Normal;
struct gl_2d_map Map2Texture1;
struct gl_2d_map Map2Texture2;
struct gl_2d_map Map2Texture3;
struct gl_2d_map Map2Texture4;
struct gl_2d_map Map2Attrib[16];
};
#define VP_MAX_INSTRUCTIONS 128
#define VP_NUM_INPUT_REGS VERT_ATTRIB_MAX
#define VP_NUM_OUTPUT_REGS 15
#define VP_NUM_TEMP_REGS 12
#define VP_NUM_PROG_REGS 96
#define VP_NUM_TOTAL_REGISTERS (VP_NUM_INPUT_REGS + VP_NUM_OUTPUT_REGS + VP_NUM_TEMP_REGS + VP_NUM_PROG_REGS)
#define VP_INPUT_REG_START 0
#define VP_INPUT_REG_END (VP_INPUT_REG_START + VP_NUM_INPUT_REGS - 1)
#define VP_OUTPUT_REG_START (VP_INPUT_REG_END + 1)
#define VP_OUTPUT_REG_END (VP_OUTPUT_REG_START + VP_NUM_OUTPUT_REGS - 1)
#define VP_TEMP_REG_START (VP_OUTPUT_REG_END + 1)
#define VP_TEMP_REG_END (VP_TEMP_REG_START + VP_NUM_TEMP_REGS - 1)
#define VP_PROG_REG_START (VP_TEMP_REG_END + 1)
#define VP_PROG_REG_END (VP_PROG_REG_START + VP_NUM_PROG_REGS - 1)
struct vp_machine
{
GLfloat Registers[VP_NUM_TOTAL_REGISTERS][4];
GLint AddressReg;
};
enum vp_opcode
{
MOV,
LIT,
RCP,
RSQ,
EXP,
LOG,
MUL,
ADD,
DP3,
DP4,
DST,
MIN,
MAX,
SLT,
SGE,
MAD,
ARL,
DPH,
RCC,
SUB,
ABS,
END
};
struct vp_src_register
{
GLint Register;
GLuint Swizzle[4];
GLboolean Negate;
GLboolean RelAddr;
};
struct vp_dst_register
{
GLint Register;
GLboolean WriteMask[4];
};
struct vp_instruction
{
enum vp_opcode Opcode;
struct vp_src_register SrcReg[3];
struct vp_dst_register DstReg;
};
struct vp_program
{
GLubyte *String;
struct vp_instruction *Instructions;
GLenum Target;
GLint RefCount;
GLboolean IsPositionInvariant;
GLboolean Resident;
GLuint InputsRead;
GLuint OutputsWritten;
};
struct vertex_program_state
{
GLboolean Enabled;
GLboolean PointSizeEnabled;
GLboolean TwoSideEnabled;
GLuint CurrentID;
GLint ErrorPos;
struct vp_program *Current;
struct vp_machine Machine;
GLenum TrackMatrix[VP_NUM_PROG_REGS / 4];
GLenum TrackMatrixTransform[VP_NUM_PROG_REGS / 4];
};
struct gl_shared_state {
_glthread_Mutex Mutex;
GLint RefCount;
struct _mesa_HashTable *DisplayList;
struct _mesa_HashTable *TexObjects;
struct gl_texture_object *TexObjectList;
struct gl_texture_object *Default1D;
struct gl_texture_object *Default2D;
struct gl_texture_object *Default3D;
struct gl_texture_object *DefaultCubeMap;
struct gl_texture_object *DefaultRect;
struct _mesa_HashTable *VertexPrograms;
void *DriverData;
};
struct gl_frame_buffer {
GLvisual Visual;
GLuint Width, Height;
GLboolean UseSoftwareDepthBuffer;
GLboolean UseSoftwareAccumBuffer;
GLboolean UseSoftwareStencilBuffer;
GLboolean UseSoftwareAlphaBuffers;
GLvoid *DepthBuffer;
GLstencil *Stencil;
GLaccum *Accum;
GLvoid *FrontLeftAlpha;
GLvoid *BackLeftAlpha;
GLvoid *FrontRightAlpha;
GLvoid *BackRightAlpha;
GLint _Xmin, _Ymin;
GLint _Xmax, _Ymax;
};
struct gl_constants {
GLint MaxTextureLevels;
GLint Max3DTextureLevels;
GLint MaxCubeTextureLevels;
GLint MaxTextureRectSize;
GLuint MaxTextureUnits;
GLfloat MaxTextureMaxAnisotropy;
GLfloat MaxTextureLodBias;
GLuint MaxArrayLockSize;
GLint SubPixelBits;
GLfloat MinPointSize, MaxPointSize;
GLfloat MinPointSizeAA, MaxPointSizeAA;
GLfloat PointSizeGranularity;
GLfloat MinLineWidth, MaxLineWidth;
GLfloat MinLineWidthAA, MaxLineWidthAA;
GLfloat LineWidthGranularity;
GLuint NumAuxBuffers;
GLuint MaxColorTableSize;
GLuint MaxConvolutionWidth;
GLuint MaxConvolutionHeight;
GLuint MaxClipPlanes;
GLuint MaxLights;
};
struct extension;
struct gl_extensions {
char *ext_string;
struct extension *ext_list;
GLboolean ARB_depth_texture;
GLboolean ARB_imaging;
GLboolean ARB_multisample;
GLboolean ARB_multitexture;
GLboolean ARB_shadow;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_compression;
GLboolean ARB_texture_cube_map;
GLboolean ARB_texture_env_combine;
GLboolean ARB_texture_env_crossbar;
GLboolean ARB_texture_env_dot3;
GLboolean ARB_texture_mirrored_repeat;
GLboolean ARB_window_pos;
GLboolean ATI_texture_env_combine3;
GLboolean ATI_texture_mirror_once;
GLboolean EXT_blend_color;
GLboolean EXT_blend_func_separate;
GLboolean EXT_blend_logic_op;
GLboolean EXT_blend_minmax;
GLboolean EXT_blend_subtract;
GLboolean EXT_convolution;
GLboolean EXT_compiled_vertex_array;
GLboolean EXT_fog_coord;
GLboolean EXT_histogram;
GLboolean EXT_multi_draw_arrays;
GLboolean EXT_paletted_texture;
GLboolean EXT_point_parameters;
GLboolean EXT_shadow_funcs;
GLboolean EXT_secondary_color;
GLboolean EXT_shared_texture_palette;
GLboolean EXT_stencil_wrap;
GLboolean EXT_stencil_two_side;
GLboolean EXT_texture3D;
GLboolean EXT_texture_compression_s3tc;
GLboolean EXT_texture_env_add;
GLboolean EXT_texture_env_combine;
GLboolean EXT_texture_env_dot3;
GLboolean EXT_texture_filter_anisotropic;
GLboolean EXT_texture_lod_bias;
GLboolean EXT_vertex_array_set;
GLboolean HP_occlusion_test;
GLboolean IBM_rasterpos_clip;
GLboolean MESA_pack_invert;
GLboolean MESA_resize_buffers;
GLboolean MESA_ycbcr_texture;
GLboolean NV_blend_square;
GLboolean NV_point_sprite;
GLboolean NV_texture_rectangle;
GLboolean NV_vertex_program;
GLboolean NV_vertex_program1_1;
GLboolean SGI_color_matrix;
GLboolean SGI_color_table;
GLboolean SGIS_generate_mipmap;
GLboolean SGIS_pixel_texture;
GLboolean SGIS_texture_edge_clamp;
GLboolean SGIX_depth_texture;
GLboolean SGIX_pixel_texture;
GLboolean SGIX_shadow;
GLboolean SGIX_shadow_ambient;
GLboolean TDFX_texture_compression_FXT1;
GLboolean APPLE_client_storage;
};
struct matrix_stack
{
GLmatrix *Top;
GLmatrix *Stack;
GLuint Depth;
GLuint MaxDepth;
GLuint DirtyFlag;
};
#define IMAGE_SCALE_BIAS_BIT 0x1
#define IMAGE_SHIFT_OFFSET_BIT 0x2
#define IMAGE_MAP_COLOR_BIT 0x4
#define IMAGE_COLOR_TABLE_BIT 0x8
#define IMAGE_CONVOLUTION_BIT 0x10
#define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
#define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40
#define IMAGE_COLOR_MATRIX_BIT 0x80
#define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100
#define IMAGE_HISTOGRAM_BIT 0x200
#define IMAGE_MIN_MAX_BIT 0x400
#define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \
IMAGE_SHIFT_OFFSET_BIT | \
IMAGE_MAP_COLOR_BIT | \
IMAGE_COLOR_TABLE_BIT)
#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \
IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \
IMAGE_COLOR_MATRIX_BIT | \
IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\
IMAGE_HISTOGRAM_BIT | \
IMAGE_MIN_MAX_BIT)
#define _NEW_MODELVIEW 0x1
#define _NEW_PROJECTION 0x2
#define _NEW_TEXTURE_MATRIX 0x4
#define _NEW_COLOR_MATRIX 0x8
#define _NEW_ACCUM 0x10
#define _NEW_COLOR 0x20
#define _NEW_DEPTH 0x40
#define _NEW_EVAL 0x80
#define _NEW_FOG 0x100
#define _NEW_HINT 0x200
#define _NEW_LIGHT 0x400
#define _NEW_LINE 0x800
#define _NEW_PIXEL 0x1000
#define _NEW_POINT 0x2000
#define _NEW_POLYGON 0x4000
#define _NEW_POLYGONSTIPPLE 0x8000
#define _NEW_SCISSOR 0x10000
#define _NEW_STENCIL 0x20000
#define _NEW_TEXTURE 0x40000
#define _NEW_TRANSFORM 0x80000
#define _NEW_VIEWPORT 0x100000
#define _NEW_PACKUNPACK 0x200000
#define _NEW_ARRAY 0x400000
#define _NEW_RENDERMODE 0x800000
#define _NEW_BUFFERS 0x1000000
#define _NEW_MULTISAMPLE 0x2000000
#define _NEW_TRACK_MATRIX 0x4000000
#define _NEW_PROGRAM 0x8000000
#define _NEW_ALL ~0
#define _NEW_ARRAY_VERTEX VERT_BIT_POS
#define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT
#define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL
#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
#define _NEW_ARRAY_INDEX VERT_BIT_SIX
#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
#define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3
#define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4
#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
#define _NEW_ARRAY_ATTRIB_0 0x10000
#define _NEW_ARRAY_ALL 0xffffffff
#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i))
#define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i))
#define DD_FLATSHADE 0x1
#define DD_SEPARATE_SPECULAR 0x2
#define DD_TRI_CULL_FRONT_BACK 0x4
#define DD_TRI_LIGHT_TWOSIDE 0x8
#define DD_TRI_UNFILLED 0x10
#define DD_TRI_SMOOTH 0x20
#define DD_TRI_STIPPLE 0x40
#define DD_TRI_OFFSET 0x80
#define DD_LINE_SMOOTH 0x100
#define DD_LINE_STIPPLE 0x200
#define DD_LINE_WIDTH 0x400
#define DD_POINT_SMOOTH 0x800
#define DD_POINT_SIZE 0x1000
#define DD_POINT_ATTEN 0x2000
#define _DD_NEW_FLATSHADE _NEW_LIGHT
#define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG)
#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
#define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT
#define _DD_NEW_TRI_UNFILLED _NEW_POLYGON
#define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
#define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
#define _DD_NEW_TRI_OFFSET _NEW_POLYGON
#define _DD_NEW_LINE_SMOOTH _NEW_LINE
#define _DD_NEW_LINE_STIPPLE _NEW_LINE
#define _DD_NEW_LINE_WIDTH _NEW_LINE
#define _DD_NEW_POINT_SMOOTH _NEW_POINT
#define _DD_NEW_POINT_SIZE _NEW_POINT
#define _DD_NEW_POINT_ATTEN _NEW_POINT
#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
_NEW_TEXTURE | \
_NEW_POINT | \
_NEW_MODELVIEW)
#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
_NEW_TEXTURE)
#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX)
#define NEED_NORMALS_TEXGEN 0x1
#define NEED_NORMALS_LIGHT 0x2
#define NEED_EYE_TEXGEN 0x1
#define NEED_EYE_LIGHT 0x2
#define NEED_EYE_LIGHT_MODELVIEW 0x4
#define NEED_EYE_POINT_ATTEN 0x8
#define NEED_EYE_DRIVER 0x10
union node;
typedef union node Node;
#include "dd.h"
#define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *))
struct gl_tnl_module {
GLvertexformat *Current;
void *Swapped[NUM_VERTEX_FORMAT_ENTRIES][2];
GLuint SwapCount;
};
struct __GLcontextRec {
__GLimports imports;
__GLexports exports;
struct gl_shared_state *Shared;
struct _glapi_table *Save;
struct _glapi_table *Exec;
struct _glapi_table *CurrentDispatch;
GLboolean ExecPrefersFloat;
GLboolean SavePrefersFloat;
GLvisual Visual;
GLframebuffer *DrawBuffer;
GLframebuffer *ReadBuffer;
struct dd_function_table Driver;
void *DriverCtx;
void *DriverMgrCtx;
struct gl_constants Const;
struct matrix_stack ModelviewMatrixStack;
struct matrix_stack ProjectionMatrixStack;
struct matrix_stack ColorMatrixStack;
struct matrix_stack TextureMatrixStack[MAX_TEXTURE_UNITS];
struct matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES];
struct matrix_stack *CurrentStack;
GLmatrix _ModelProjectMatrix;
GLuint CallDepth;
GLboolean ExecuteFlag;
GLboolean CompileFlag;
Node *CurrentListPtr;
GLuint CurrentListNum;
Node *CurrentBlock;
GLuint CurrentPos;
struct gl_extensions Extensions;
GLuint AttribStackDepth;
struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH];
struct gl_accum_attrib Accum;
struct gl_colorbuffer_attrib Color;
struct gl_current_attrib Current;
struct gl_depthbuffer_attrib Depth;
struct gl_eval_attrib Eval;
struct gl_fog_attrib Fog;
struct gl_hint_attrib Hint;
struct gl_light_attrib Light;
struct gl_line_attrib Line;
struct gl_list_attrib List;
struct gl_multisample_attrib Multisample;
struct gl_pixel_attrib Pixel;
struct gl_point_attrib Point;
struct gl_polygon_attrib Polygon;
GLuint PolygonStipple[32];
struct gl_scissor_attrib Scissor;
struct gl_stencil_attrib Stencil;
struct gl_texture_attrib Texture;
struct gl_transform_attrib Transform;
struct gl_viewport_attrib Viewport;
struct gl_histogram_attrib Histogram;
struct gl_minmax_attrib MinMax;
struct gl_convolution_attrib Convolution1D;
struct gl_convolution_attrib Convolution2D;
struct gl_convolution_attrib Separable2D;
GLuint ClientAttribStackDepth;
struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH];
struct gl_array_attrib Array;
struct gl_pixelstore_attrib Pack;
struct gl_pixelstore_attrib Unpack;
struct gl_evaluators EvalMap;
struct gl_feedback Feedback;
struct gl_selection Select;
struct gl_color_table ColorTable;
struct gl_color_table ProxyColorTable;
struct gl_color_table PostConvolutionColorTable;
struct gl_color_table ProxyPostConvolutionColorTable;
struct gl_color_table PostColorMatrixColorTable;
struct gl_color_table ProxyPostColorMatrixColorTable;
struct vertex_program_state VertexProgram;
GLenum ErrorValue;
GLenum RenderMode;
GLuint NewState;
GLuint _TriangleCaps;
GLuint _ImageTransferState;
GLfloat _EyeZDir[3];
GLfloat _ModelViewInvScale;
GLuint _NeedEyeCoords;
GLuint _NeedNormals;
struct gl_shine_tab *_ShineTable[2];
struct gl_shine_tab *_ShineTabList;
struct gl_list_extensions listext;
GLboolean OcclusionResult;
GLboolean OcclusionResultSaved;
GLuint _Facing;
GLuint DepthMax;
GLfloat DepthMaxF;
GLfloat MRD;
GLboolean CatchSignals;
GLboolean NoRaster;
GLboolean FirstTimeCurrent;
GLboolean NoDither;
GLboolean Rendering;
#if defined(MESA_TRACE)
struct _glapi_table *TraceDispatch;
trace_context_t *TraceCtx;
#else
void *TraceDispatch;
void *TraceCtx;
#endif
struct gl_tnl_module TnlModule;
void *swrast_context;
void *swsetup_context;
void *swtnl_context;
void *swtnl_im;
void *acache_context;
void *aelt_context;
};
extern const char *_mesa_prim_name[GL_POLYGON+4];
#ifdef MESA_DEBUG
extern int MESA_VERBOSE;
extern int MESA_DEBUG_FLAGS;
#else
# define MESA_VERBOSE 0
# define MESA_DEBUG_FLAGS 0
# ifndef NDEBUG
# define NDEBUG
# endif
#endif
enum _verbose {
VERBOSE_VARRAY = 0x0001,
VERBOSE_TEXTURE = 0x0002,
VERBOSE_IMMEDIATE = 0x0004,
VERBOSE_PIPELINE = 0x0008,
VERBOSE_DRIVER = 0x0010,
VERBOSE_STATE = 0x0020,
VERBOSE_API = 0x0040,
VERBOSE_DISPLAY_LIST = 0x0100,
VERBOSE_LIGHTING = 0x0200,
VERBOSE_PRIMS = 0x0400,
VERBOSE_VERTS = 0x0800
};
enum _debug {
DEBUG_ALWAYS_FLUSH = 0x1
};
#define Elements(x) sizeof(x)/sizeof(*(x))
#define FLUSH_VERTICES(ctx, newstate) \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __FUNCTION__); \
if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
ctx->NewState |= newstate; \
} while (0)
#define FLUSH_CURRENT(ctx, newstate) \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
ctx->NewState |= newstate; \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
do { \
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
_mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
return retval; \
} \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END(ctx) \
do { \
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
_mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
return; \
} \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
do { \
ASSERT_OUTSIDE_BEGIN_END(ctx); \
FLUSH_VERTICES(ctx, 0); \
} while (0)
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
do { \
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
FLUSH_VERTICES(ctx, 0); \
} while (0)
#endif