X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fmtypes.h;h=cc6c40f7a232e1b9b9b3f09e182ba6d4d613d4e7;hb=112f7cdeabebb487418ca10e5911920adfb7832b;hp=f597c1d02fefa7cb4cf3c595ff11ea001c76412b;hpb=30f51ae067379c2b3573c06b707d25a9704df7be;p=mesa.git diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f597c1d02fe..cc6c40f7a23 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,10 +1,10 @@ -/* $Id: mtypes.h,v 1.56 2001/12/18 04:06:45 brianp Exp $ */ +/* $Id: mtypes.h,v 1.77 2002/06/06 16:31:24 brianp Exp $ */ /* * Mesa 3-D graphics library * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,6 +24,10 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/** + * \file mtypes.h + * \brief Main Mesa data structures. + */ #ifndef TYPES_H #define TYPES_H @@ -67,7 +71,7 @@ #endif -/* +/** * Accumulation buffer data type: */ #if ACCUM_BITS==8 @@ -81,7 +85,7 @@ #endif -/* +/** * Stencil buffer data type: */ #if STENCIL_BITS==8 @@ -95,20 +99,20 @@ #endif -/* +/** * Depth buffer data type: */ typedef GLuint GLdepth; /* Must be 32-bits! */ -/* +/** * Fixed point data type: */ typedef int GLfixed; -/* +/** * Some forward type declarations */ struct _mesa_HashTable; @@ -120,7 +124,52 @@ typedef struct gl_frame_buffer GLframebuffer; -/* Maximum number of temporary vertices required for clipping. (Used +/* These define the aliases between numbered vertex attributes and + * conventional OpenGL vertex attributes. We use these values in + * quite a few places. New in Mesa 4.1. + */ +#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 + +/* These are used in bitfields in many places */ +#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))) + + + +/** + * Maximum number of temporary vertices required for clipping. (Used * in array_cache and tnl modules). */ #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) @@ -185,7 +234,7 @@ struct gl_shine_tab { struct gl_light { - struct gl_light *next; /* double linked list with sentinel */ + struct gl_light *next; /* double linked list with sentinel */ struct gl_light *prev; GLfloat Ambient[4]; /* ambient color */ @@ -295,30 +344,10 @@ struct gl_colorbuffer_attrib { }; -/* These define the aliases between numbered vertex attributes and - * conventional OpenGL vertex attributes. - */ -#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 - struct gl_current_attrib { /* These values valid only when FLUSH_VERTICES has been called. */ - GLfloat Attrib[8 + MAX_TEXTURE_UNITS][4]; /* Current vertex attributes */ + GLfloat Attrib[VERT_ATTRIB_MAX][4]; /* Current vertex attributes */ /* indexed by VERT_ATTRIB_* */ GLuint Index; /* Current color index */ GLboolean EdgeFlag; /* Current edge flag */ @@ -331,9 +360,7 @@ struct gl_current_attrib { GLfloat RasterColor[4]; /* Current raster color */ GLfloat RasterSecondaryColor[4]; /* Current rast 2ndary color */ GLuint RasterIndex; /* Current raster index */ - GLfloat *RasterTexCoord; /* Current raster texcoord */ - GLfloat RasterMultiTexCoord[MAX_TEXTURE_UNITS][4]; - GLfloat RasterFogCoord; + GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/* Current raster texcoords */ GLboolean RasterPosValid; /* Raster pos valid flag */ }; @@ -351,7 +378,7 @@ struct gl_enable_attrib { GLboolean AlphaTest; GLboolean AutoNormal; GLboolean Blend; - GLboolean ClipPlane[MAX_CLIP_PLANES]; + GLuint ClipPlanes; GLboolean ColorMaterial; GLboolean Convolution1D; GLboolean Convolution2D; @@ -376,6 +403,7 @@ struct gl_enable_attrib { GLboolean Map1TextureCoord4; GLboolean Map1Vertex3; GLboolean Map1Vertex4; + GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ GLboolean Map2Color4; GLboolean Map2Index; GLboolean Map2Normal; @@ -385,6 +413,7 @@ struct gl_enable_attrib { GLboolean Map2TextureCoord4; GLboolean Map2Vertex3; GLboolean Map2Vertex4; + GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ GLboolean MinMax; GLboolean Normalize; GLboolean PixelTexture; @@ -397,18 +426,18 @@ struct gl_enable_attrib { GLboolean RescaleNormals; GLboolean Scissor; GLboolean Stencil; - GLboolean MultisampleEnabled; /* GL_ARB_multisample */ - GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ - GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ - GLboolean SampleCoverage; /* GL_ARB_multisample */ - GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ + GLboolean MultisampleEnabled; /* GL_ARB_multisample */ + GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ + GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ + GLboolean SampleCoverage; /* GL_ARB_multisample */ + GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ GLuint Texture[MAX_TEXTURE_UNITS]; GLuint TexGen[MAX_TEXTURE_UNITS]; - /* GL_NV_vertex_program */ - GLboolean VertexProgram; - GLboolean VertexProgramPointSize; - GLboolean VertexProgramTwoSide; + GLboolean VertexProgram; /* GL_NV_vertex_program */ + GLboolean VertexProgramPointSize; /* GL_NV_vertex_program */ + GLboolean VertexProgramTwoSide; /* GL_NV_vertex_program */ + GLboolean PointSprite; /* GL_NV_point_sprite */ }; @@ -423,6 +452,7 @@ struct gl_eval_attrib { GLboolean Map1TextureCoord4; GLboolean Map1Vertex3; GLboolean Map1Vertex4; + GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ GLboolean Map2Color4; GLboolean Map2Index; GLboolean Map2Normal; @@ -432,6 +462,7 @@ struct gl_eval_attrib { GLboolean Map2TextureCoord4; GLboolean Map2Vertex3; GLboolean Map2Vertex4; + GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ GLboolean AutoNormal; /* Map Grid endpoints and divisions and calculated du values */ GLint MapGrid1un; @@ -638,13 +669,15 @@ struct gl_pixel_attrib { struct gl_point_attrib { GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */ - GLboolean SpriteMode; /* GL_MESA_sprite_point extension */ GLfloat Size; /* User-specified point size */ GLfloat _Size; /* Size clamped to Const.Min/MaxPointSize */ GLfloat Params[3]; /* GL_EXT_point_parameters */ GLfloat MinSize, MaxSize; /* GL_EXT_point_parameters */ GLfloat Threshold; /* GL_EXT_point_parameters */ GLboolean _Attenuated; /* True if Params != [1, 0, 0] */ + GLboolean PointSprite; /* GL_NV_point_sprite */ + GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /* GL_NV_point_sprite */ + GLenum SpriteRMode; /* GL_NV_point_sprite */ }; @@ -693,6 +726,8 @@ struct gl_stencil_attrib { #define R_BIT 4 #define Q_BIT 8 +#define NUM_TEXTURE_TARGETS 4 /* 1D, 2D, 3D and CUBE */ + /* Texture Enabled flags */ #define TEXTURE0_1D 0x1 /* Texture unit 0 (default) */ #define TEXTURE0_2D 0x2 @@ -867,7 +902,7 @@ struct gl_texture_object { GLchan ShadowAmbient; /* GL_SGIX/ARB_shadow_ambient */ GLenum CompareMode; /* GL_ARB_shadow */ GLenum CompareFunc; /* GL_ARB_shadow */ - GLenum CompareResult; /* GL_ARB_shadow */ + GLenum DepthMode; /* GL_ARB_depth_texture */ GLint _MaxLevel; /* actual max mipmap level (q in the spec) */ GLfloat _MaxLambda; /* = _MaxLevel - BaseLevel (q - b in spec) */ GLboolean GenerateMipmap; /* GL_SGIS_generate_mipmap */ @@ -977,8 +1012,7 @@ struct gl_transform_attrib { GLenum MatrixMode; /* Matrix mode */ GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4]; /* derived */ - GLboolean ClipEnabled[MAX_CLIP_PLANES]; - GLubyte _AnyClip; /* How many ClipEnabled? */ + GLuint ClipPlanesEnabled; /* on/off bitmask */ GLboolean Normalize; /* Normalize all normals? */ GLboolean RescaleNormals; /* GL_EXT_rescale_normal */ GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ @@ -1029,7 +1063,7 @@ struct gl_client_array { GLsizei StrideB; /* actual stride in bytes */ void *Ptr; GLuint Flags; - GLboolean Enabled; + GLuint Enabled; /* one of the _NEW_ARRAY_ bits */ }; @@ -1112,6 +1146,7 @@ struct gl_evaluators { struct gl_1d_map Map1Texture2; struct gl_1d_map Map1Texture3; struct gl_1d_map Map1Texture4; + struct gl_1d_map Map1Attrib[16]; /* GL_NV_vertex_program */ /* 2-D maps */ struct gl_2d_map Map2Vertex3; @@ -1123,6 +1158,7 @@ struct gl_evaluators { struct gl_2d_map Map2Texture2; struct gl_2d_map Map2Texture3; struct gl_2d_map Map2Texture4; + struct gl_2d_map Map2Attrib[16]; /* GL_NV_vertex_program */ }; @@ -1132,7 +1168,7 @@ struct gl_evaluators { #define VP_MAX_INSTRUCTIONS 128 -#define VP_NUM_INPUT_REGS 16 +#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 @@ -1149,40 +1185,6 @@ struct gl_evaluators { #define VP_PROG_REG_START (VP_TEMP_REG_END + 1) #define VP_PROG_REG_END (VP_PROG_REG_START + VP_NUM_PROG_REGS - 1) -/* Input register names */ -#define VP_IN_OPOS (VP_INPUT_REG_START + 0) -#define VP_IN_WGHT (VP_INPUT_REG_START + 1) -#define VP_IN_NRML (VP_INPUT_REG_START + 2) -#define VP_IN_COL0 (VP_INPUT_REG_START + 3) -#define VP_IN_COL1 (VP_INPUT_REG_START + 4) -#define VP_IN_FOGC (VP_INPUT_REG_START + 5) -#define VP_IN_TEX0 (VP_INPUT_REG_START + 8) -#define VP_IN_TEX1 (VP_INPUT_REG_START + 9) -#define VP_IN_TEX2 (VP_INPUT_REG_START + 10) -#define VP_IN_TEX3 (VP_INPUT_REG_START + 11) -#define VP_IN_TEX4 (VP_INPUT_REG_START + 12) -#define VP_IN_TEX5 (VP_INPUT_REG_START + 13) -#define VP_IN_TEX6 (VP_INPUT_REG_START + 14) -#define VP_IN_TEX7 (VP_INPUT_REG_START + 15) - -/* Output register names */ -#define VP_OUT_HPOS (VP_OUTPUT_REG_START + 0) -#define VP_OUT_COL0 (VP_OUTPUT_REG_START + 1) -#define VP_OUT_COL1 (VP_OUTPUT_REG_START + 2) -#define VP_OUT_BFC0 (VP_OUTPUT_REG_START + 3) -#define VP_OUT_BFC1 (VP_OUTPUT_REG_START + 4) -#define VP_OUT_FOGC (VP_OUTPUT_REG_START + 5) -#define VP_OUT_PSIZ (VP_OUTPUT_REG_START + 6) -#define VP_OUT_TEX0 (VP_OUTPUT_REG_START + 7) -#define VP_OUT_TEX1 (VP_OUTPUT_REG_START + 8) -#define VP_OUT_TEX2 (VP_OUTPUT_REG_START + 9) -#define VP_OUT_TEX3 (VP_OUTPUT_REG_START + 10) -#define VP_OUT_TEX4 (VP_OUTPUT_REG_START + 11) -#define VP_OUT_TEX5 (VP_OUTPUT_REG_START + 12) -#define VP_OUT_TEX6 (VP_OUTPUT_REG_START + 13) -#define VP_OUT_TEX7 (VP_OUTPUT_REG_START + 14) - - /* Machine state (i.e. the register file) */ struct vp_machine @@ -1212,6 +1214,10 @@ enum vp_opcode SGE, MAD, ARL, + DPH, + RCC, + SUB, + ABS, END }; @@ -1251,7 +1257,10 @@ struct vp_program GLenum Target; /* GL_VERTEX_PROGRAM_NV or GL_VERTEX_STATE_PROGRAM_NV */ GLint ErrorPos; /* Position in string where error was detected */ GLint RefCount; /* Since programs can be shared among contexts */ + GLboolean IsPositionInvariant; /* GL_NV_vertex_program1_1 */ GLboolean Resident; + GLuint InputsRead; /* Bitmask of which input regs are read */ + GLuint OutputsWritten; /* Bitmask of which output regs are written to */ }; @@ -1305,7 +1314,7 @@ struct gl_shared_state { struct gl_frame_buffer { GLvisual Visual; /* The corresponding visual */ - GLint Width, Height; /* size of frame buffer in pixels */ + GLuint Width, Height; /* size of frame buffer in pixels */ GLboolean UseSoftwareDepthBuffer; GLboolean UseSoftwareAccumBuffer; @@ -1374,6 +1383,7 @@ struct gl_extensions { /* Flags to quickly test if certain extensions are available. * Not every extension needs to have such a flag, but it's encouraged. */ + GLboolean ARB_depth_texture; GLboolean ARB_imaging; GLboolean ARB_multisample; GLboolean ARB_multitexture; @@ -1382,6 +1392,7 @@ struct gl_extensions { 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; @@ -1400,6 +1411,7 @@ struct gl_extensions { GLboolean EXT_point_parameters; GLboolean EXT_polygon_offset; GLboolean EXT_rescale_normal; + GLboolean EXT_shadow_funcs; GLboolean EXT_secondary_color; GLboolean EXT_shared_texture_palette; GLboolean EXT_stencil_wrap; @@ -1419,14 +1431,16 @@ struct gl_extensions { GLboolean MESA_resize_buffers; GLboolean MESA_sprite_point; GLboolean NV_blend_square; + GLboolean NV_point_sprite; GLboolean NV_texgen_reflection; 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; /* or GL_ARB_depth_texture */ + GLboolean SGIX_depth_texture; GLboolean SGIX_pixel_texture; GLboolean SGIX_shadow; GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ @@ -1505,33 +1519,35 @@ struct matrix_stack #define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */ #define _NEW_MULTISAMPLE 0x2000000 /* ctx->Multisample */ #define _NEW_TRACK_MATRIX 0x4000000 /* ctx->VertexProgram */ +#define _NEW_PROGRAM 0x8000000 /* ctx->VertexProgram */ #define _NEW_ALL ~0 /* Bits to track array state changes (also used to summarize array enabled) */ -#define _NEW_ARRAY_VERTEX (1 << VERT_ATTRIB_POS) -#define _NEW_ARRAY_WEIGHT (1 << VERT_ATTRIB_WEIGHT) -#define _NEW_ARRAY_NORMAL (1 << VERT_ATTRIB_NORMAL) -#define _NEW_ARRAY_COLOR0 (1 << VERT_ATTRIB_COLOR0) -#define _NEW_ARRAY_COLOR1 (1 << VERT_ATTRIB_COLOR1) -#define _NEW_ARRAY_FOGCOORD (1 << VERT_ATTRIB_FOG) -#define _NEW_ARRAY_INDEX (1 << VERT_ATTRIB_SIX) -#define _NEW_ARRAY_EDGEFLAG (1 << VERT_ATTRIB_SEVEN) -#define _NEW_ARRAY_TEXCOORD_0 (1 << VERT_ATTRIB_TEX0) -#define _NEW_ARRAY_TEXCOORD_1 (1 << VERT_ATTRIB_TEX1) -#define _NEW_ARRAY_TEXCOORD_2 (1 << VERT_ATTRIB_TEX2) -#define _NEW_ARRAY_TEXCOORD_3 (1 << VERT_ATTRIB_TEX3) -#define _NEW_ARRAY_TEXCOORD_4 (1 << VERT_ATTRIB_TEX4) -#define _NEW_ARRAY_TEXCOORD_5 (1 << VERT_ATTRIB_TEX5) -#define _NEW_ARRAY_TEXCOORD_6 (1 << VERT_ATTRIB_TEX6) -#define _NEW_ARRAY_TEXCOORD_7 (1 << VERT_ATTRIB_TEX7) -#define _NEW_ARRAY_ALL 0xffff -#define _NEW_ARRAY_VERT_ATTRIB0 0x10000 +#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 /* start at bit 16 */ +#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)) /* A bunch of flags that we think might be useful to drivers. */ @@ -1578,13 +1594,16 @@ struct matrix_stack #define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX) +/* Bits for ctx->_NeedNormals */ #define NEED_NORMALS_TEXGEN 0x1 #define NEED_NORMALS_LIGHT 0x2 +/* Bits for ctx->_NeedEyeCoords */ #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 /* @@ -1616,15 +1635,16 @@ struct gl_tnl_module { }; -/* - * The library context: +/** + * This is the central context data structure for Mesa. Almost all + * OpenGL state is contained in this structure. */ struct __GLcontextRec { - /* - ** Os related interfaces; these *must* be the first members of this - ** structure, because they are exposed to the outside world (i.e. GLX - ** extension). - */ + /** + * OS related interfaces; these *must* be the first members of this + * structure, because they are exposed to the outside world (i.e. GLX + * extension). + */ __GLimports imports; __GLexports exports; @@ -1632,22 +1652,24 @@ struct __GLcontextRec { struct gl_shared_state *Shared; /* API function pointer tables */ - struct _glapi_table *Save; /* Display list save funcs */ - struct _glapi_table *Exec; /* Execute funcs */ - struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */ + struct _glapi_table *Save; /**< Display list save funcs */ + struct _glapi_table *Exec; /**< Execute funcs */ + struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */ - GLboolean ExecPrefersFloat; /* What preference for color conversion? */ + GLboolean ExecPrefersFloat; /**< What preference for color conversion? */ GLboolean SavePrefersFloat; GLvisual Visual; - GLframebuffer *DrawBuffer; /* buffer for writing */ - GLframebuffer *ReadBuffer; /* buffer for reading */ + GLframebuffer *DrawBuffer; /**< buffer for writing */ + GLframebuffer *ReadBuffer; /**< buffer for reading */ - /* Driver function pointer table */ + /** + * Device driver function pointer table + */ struct dd_function_table Driver; - void *DriverCtx; /* Points to device driver context/state */ - void *DriverMgrCtx; /* Points to device driver manager (optional)*/ + void *DriverCtx; /**< Points to device driver context/state */ + void *DriverMgrCtx; /**< Points to device driver manager (optional)*/ /* Core/Driver constants */ struct gl_constants Const; @@ -1748,22 +1770,22 @@ struct __GLcontextRec { struct gl_list_extensions listext; /* driver dlist extensions */ - GLboolean OcclusionResult; /* GL_HP_occlusion_test */ - GLboolean OcclusionResultSaved; /* GL_HP_occlusion_test */ + GLboolean OcclusionResult; /**< for GL_HP_occlusion_test */ + GLboolean OcclusionResultSaved; /**< for GL_HP_occlusion_test */ /* Z buffer stuff */ - GLuint DepthMax; /* Max depth buffer value */ - GLfloat DepthMaxF; /* Float max depth buffer value */ - GLfloat MRD; /* minimum resolvable difference in Z values */ + GLuint DepthMax; /**< Max depth buffer value */ + GLfloat DepthMaxF; /**< Float max depth buffer value */ + GLfloat MRD; /**< minimum resolvable difference in Z values */ - /* Should 3Dfx Glide driver catch signals? */ + /** Should 3Dfx Glide driver catch signals? */ GLboolean CatchSignals; - /* For debugging/development only */ + /** For debugging/development only */ GLboolean NoRaster; GLboolean FirstTimeCurrent; - /* Dither disable via MESA_NO_DITHER env var */ + /** Dither disable via MESA_NO_DITHER env var */ GLboolean NoDither; GLboolean Rendering; @@ -1794,6 +1816,9 @@ struct __GLcontextRec { /* The string names for GL_POINT, GL_LINE_LOOP, etc */ extern const char *_mesa_prim_name[GL_POLYGON+4]; +#ifndef MESA_DEBUG +#define MESA_DEBUG +#endif #ifdef MESA_DEBUG extern int MESA_VERBOSE; @@ -1815,8 +1840,10 @@ enum _verbose { VERBOSE_DRIVER = 0x0010, VERBOSE_STATE = 0x0020, VERBOSE_API = 0x0040, - VERBOSE_DISPLAY_LIST = 0x0200, - VERBOSE_LIGHTING = 0x0400 + VERBOSE_DISPLAY_LIST = 0x0100, + VERBOSE_LIGHTING = 0x0200, + VERBOSE_PRIMS = 0x0400, + VERBOSE_VERTS = 0x0800 }; @@ -1828,22 +1855,34 @@ enum _debug { #define Elements(x) sizeof(x)/sizeof(*(x)) - +/* + * Provide a reasonable replacement for __FUNCTION__ when using + * non-GNU C compilers. + */ +#if !defined(__GNUC__) +#define STRINGIZE(x) #x +#define STRINGIZE_EVAL(x) STRINGIZE(x) +#define __FUNCTION__ STRINGIZE_EVAL(__FILE__) ", line " STRINGIZE_EVAL(__LINE__) +#endif /* Eventually let the driver specify what statechanges require a flush: */ -#define FLUSH_VERTICES(ctx, newstate) \ -do { \ - if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ - ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ - ctx->NewState |= newstate; \ +#define FLUSH_VERTICES(ctx, newstate) \ +do { \ + if (MESA_VERBOSE & VERBOSE_STATE) \ + fprintf(stderr, "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 (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ - ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ - ctx->NewState |= newstate; \ +#define FLUSH_CURRENT(ctx, newstate) \ +do { \ + if (MESA_VERBOSE & VERBOSE_STATE) \ + fprintf(stderr, "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) \