-/* $Id: mtypes.h,v 1.4 2000/11/28 00:07:51 brianp Exp $ */
+/* $Id: mtypes.h,v 1.12 2001/01/08 04:09:41 keithw Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
- *
+ *
* Copyright (C) 1999-2000 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
#ifndef TYPES_H
#define TYPES_H
-
+
#include "glheader.h"
#include "config.h" /* Hardwired parameters */
-#include "fixed.h" /* GLfixed */
#include "glapitable.h"
#include "glthread.h"
#include "math/m_matrix.h" /* GLmatrix */
-#include "math/m_translate.h" /* trans_XXX_func */
#if defined(MESA_TRACE)
#include "Trace/tr_context.h"
typedef GLuint GLdepth; /* Must be 32-bits! */
+/*
+ * Fixed point data type:
+ */
+typedef int GLfixed;
+
+
+
/*
* Some forward type declarations
*/
+/* 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)
+
+
/* Data structure for color tables */
struct gl_color_table {
GLvoid *Table;
GLfloat _VP_inf_norm[3]; /* Norm direction to infinite light */
GLfloat _h_inf_norm[3]; /* Norm( _VP_inf_norm + <0,0,1> ) */
GLfloat _NormDirection[4]; /* normalized spotlight direction */
- GLfloat _VP_inf_spot_attenuation;
+ GLfloat _VP_inf_spot_attenuation;
GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */
GLfloat _MatAmbient[2][3]; /* material ambient * light ambient */
};
-/* Move to using pointers to this struct in the immediate structs -
- * this is too big to keep 94 unused copies (7K) lying around in
- * display lists.
- */
-struct gl_material
+struct gl_material
{
GLfloat Ambient[4];
GLfloat Diffuse[4];
};
-
-
-
/*
* Attribute structures:
* We define a struct for each attribute group to make pushing and
* popping attributes easy. Also it's a good organization.
*/
-
struct gl_accum_attrib {
GLfloat ClearColor[4]; /* Accumulation buffer clear color */
};
struct gl_current_attrib {
- /* These values valid only when FLUSH_TNL( FLUSH_UPDATE_CURRENT )
- * has been called.
+ /* These values valid only when FLUSH_VERTICES has been called.
*/
GLfloat Normal[3]; /* Current vertex normal */
GLchan Color[4]; /* Current RGBA color */
GLuint Index; /* Current color index */
GLboolean EdgeFlag; /* Current edge flag */
GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */
-
+
/* These values are always valid.
*/
GLfloat RasterPos[4]; /* Current raster position */
struct gl_light_attrib {
struct gl_light Light[MAX_LIGHTS]; /* Array of lights */
struct gl_lightmodel Model; /* Lighting model */
+
+ /* Must flush FLUSH_VERTICES before referencing:
+ */
struct gl_material Material[2]; /* Material 0=front, 1=back */
+
GLboolean Enabled; /* Lighting enabled flag */
GLenum ShadeModel; /* GL_FLAT or GL_SMOOTH */
GLenum ColorMaterialFace; /* GL_FRONT, BACK or FRONT_AND_BACK */
/* Derived for optimizations: */
GLboolean _NeedVertices; /* Use fast shader? */
- GLuint _Flags; /* State, see below */
+ GLuint _Flags; /* LIGHT_* flags, see below */
GLfloat _BaseColor[2][3];
GLchan _BaseAlpha[2];
};
GLushort StipplePattern; /* Stipple pattern */
GLint StippleFactor; /* Stipple repeat factor */
GLfloat Width; /* Line width */
+ GLfloat _Width; /* Clamped Line width */
};
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 */
GLenum FrontFace; /* Either GL_CW or GL_CCW */
GLenum FrontMode; /* Either GL_POINT, GL_LINE or GL_FILL */
GLenum BackMode; /* Either GL_POINT, GL_LINE or GL_FILL */
- GLboolean FrontBit; /* */
- GLboolean _Unfilled; /* True if back or front mode is not GL_FILL */
+ GLboolean _FrontBit; /* */
GLboolean CullFlag; /* Culling on/off flag */
- GLubyte _CullBits; /* Used for cull testing */
GLboolean SmoothFlag; /* True if GL_POLYGON_SMOOTH is enabled */
GLboolean StippleFlag; /* True if GL_POLYGON_STIPPLE is enabled */
GLenum CullFaceMode; /* Culling mode GL_FRONT or GL_BACK */
#define TEXTURE3_3D (TEXTURE0_3D << 12)
#define TEXTURE3_CUBE (TEXTURE0_CUBE << 12)
#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
+#define TEXTURE4_1D (TEXTURE0_1D << 16) /* Texture unit 3 */
+#define TEXTURE4_2D (TEXTURE0_2D << 16)
+#define TEXTURE4_3D (TEXTURE0_3D << 16)
+#define TEXTURE4_CUBE (TEXTURE0_CUBE << 16)
+#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
+#define TEXTURE5_1D (TEXTURE0_1D << 20) /* Texture unit 3 */
+#define TEXTURE5_2D (TEXTURE0_2D << 20)
+#define TEXTURE5_3D (TEXTURE0_3D << 20)
+#define TEXTURE5_CUBE (TEXTURE0_CUBE << 20)
+#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
+#define TEXTURE6_1D (TEXTURE0_1D << 24) /* Texture unit 3 */
+#define TEXTURE6_2D (TEXTURE0_2D << 24)
+#define TEXTURE6_3D (TEXTURE0_3D << 24)
+#define TEXTURE6_CUBE (TEXTURE0_CUBE << 24)
+#define TEXTURE6_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
+#define TEXTURE7_1D (TEXTURE0_1D << 28) /* Texture unit 3 */
+#define TEXTURE7_2D (TEXTURE0_2D << 28)
+#define TEXTURE7_3D (TEXTURE0_3D << 28)
+#define TEXTURE7_CUBE (TEXTURE0_CUBE << 28)
+#define TEXTURE7_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
/* Bitmap versions of the GL_ constants.
*/
/* A selection of state flags to make driver and module's lives easier.
*/
-#define ENABLE_TEX0 0x000f /* TEXTURE0_ANY */
-#define ENABLE_TEX1 0x00f0 /* TEXTURE1_ANY */
-#define ENABLE_TEX2 0x0f00 /* TEXTURE2_ANY */
-#define ENABLE_TEX3 0xf000 /* TEXTURE3_ANY */
-#define ENABLE_TEXGEN0 0x10000
-#define ENABLE_TEXGEN1 0x20000
-#define ENABLE_TEXGEN2 0x40000
-#define ENABLE_TEXGEN3 0x80000
-#define ENABLE_TEXMAT0 0x100000 /* Ie. not the identity matrix */
-#define ENABLE_TEXMAT1 0x200000
-#define ENABLE_TEXMAT2 0x400000
-#define ENABLE_TEXMAT3 0x800000
-#define ENABLE_LIGHT 0x1000000
-#define ENABLE_FOG 0x2000000
-#define ENABLE_USERCLIP 0x4000000
-#define ENABLE_NORMALIZE 0x10000000
-#define ENABLE_RESCALE 0x20000000
-#define ENABLE_POINT_ATTEN 0x40000000
-
-
-#define ENABLE_TEX_ANY (ENABLE_TEX0 | ENABLE_TEX1 | \
- ENABLE_TEX2 | ENABLE_TEX3)
+#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 0x100 /* Ie. not the identity matrix */
+#define ENABLE_TEXMAT1 0x200
+#define ENABLE_TEXMAT2 0x400
+#define ENABLE_TEXMAT3 0x800
+#define ENABLE_TEXMAT4 0x1000
+#define ENABLE_TEXMAT5 0x2000
+#define ENABLE_TEXMAT6 0x4000
+#define ENABLE_TEXMAT7 0x8000
+#define ENABLE_LIGHT 0x10000
+#define ENABLE_FOG 0x20000
+#define ENABLE_USERCLIP 0x40000
+#define ENABLE_NORMALIZE 0x100000
+#define ENABLE_RESCALE 0x200000
+#define ENABLE_POINT_ATTEN 0x400000
+
+
#define ENABLE_TEXGEN_ANY (ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | \
- ENABLE_TEXGEN2 | ENABLE_TEXGEN3)
+ ENABLE_TEXGEN2 | ENABLE_TEXGEN3 | \
+ ENABLE_TEXGEN4 | ENABLE_TEXGEN5 | \
+ ENABLE_TEXGEN6 | ENABLE_TEXGEN7)
+
#define ENABLE_TEXMAT_ANY (ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | \
- ENABLE_TEXMAT2 | ENABLE_TEXMAT3)
+ ENABLE_TEXMAT2 | ENABLE_TEXMAT3 | \
+ ENABLE_TEXMAT4 | ENABLE_TEXMAT5 | \
+ ENABLE_TEXMAT6 | ENABLE_TEXMAT7)
+#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
+#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
/* Texture image record */
struct gl_texture_image {
GLenum MagFilter; /* magnification filter */
GLfloat MinLod; /* OpenGL 1.2 */
GLfloat MaxLod; /* OpenGL 1.2 */
- GLint BaseLevel; /* OpenGL 1.2 */
- GLint MaxLevel; /* OpenGL 1.2 */
- GLint _P; /* Highest mipmap level */
- GLfloat _M; /* = MIN(MaxLevel, P) - BaseLevel */
+ GLint BaseLevel; /* user-specified, OpenGL 1.2 */
+ GLint MaxLevel; /* user-specified, OpenGL 1.2 */
+ GLint _MaxLevel; /* actual max mipmap level (q in the spec) */
+ GLfloat _MaxLambda; /* = _MaxLevel - BaseLevel (q - b in spec) */
struct gl_texture_image *Image[MAX_TEXTURE_LEVELS];
/* Texture cube faces */
*/
struct gl_texture_unit {
GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE */
- GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
+ GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
GLfloat EnvColor[4];
GLuint _GenFlags; /* for texgen */
struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
-
+
struct gl_texture_object *Proxy1D;
struct gl_texture_object *Proxy2D;
struct gl_texture_object *Proxy3D;
};
-
-/* KW: Renamed ClipEquation to avoid having 'ClipClipEquation'
- */
struct gl_transform_attrib {
GLenum MatrixMode; /* Matrix mode */
GLfloat EyeUserPlane[MAX_CLIP_PLANES][4];
struct gl_client_array TexCoord[MAX_TEXTURE_UNITS];
struct gl_client_array EdgeFlag;
- trans_4f_func _VertexFunc; /* conversion functions */
- trans_3f_func _NormalFunc;
- trans_4ub_func _ColorFunc;
- trans_1ui_func _IndexFunc;
- trans_1f_func _FogCoordFunc;
- trans_4ub_func _SecondaryColorFunc;
- trans_4f_func _TexCoordFunc[MAX_TEXTURE_UNITS];
- trans_1ub_func _EdgeFlagFunc;
-
GLint TexCoordInterleaveFactor;
GLint ActiveTexture; /* Client Active Texture */
-
GLuint LockFirst;
GLuint LockCount;
+
+ GLuint _Enabled; /* _NEW_ARRAY_* - bit set if array enabled */
+ GLuint NewState; /* _NEW_ARRAY_* */
};
struct gl_feedback {
GLenum Type;
- GLuint Mask;
+ GLuint _Mask; /* FB_* bits */
GLfloat *Buffer;
GLuint BufferSize;
GLuint Count;
GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */
GLfloat *Points; /* Points to contiguous control points */
};
-
+
/*
* 2-D Evaluator control points
GLboolean EXT_texture_compression_s3tc;
GLboolean EXT_texture_env_add;
GLboolean EXT_texture_env_combine;
+ GLboolean EXT_texture_env_dot3;
GLboolean EXT_texture_object;
GLboolean EXT_texture_lod_bias;
GLboolean EXT_vertex_array_set;
GLboolean INGR_blend_func_separate;
GLboolean MESA_window_pos;
GLboolean MESA_resize_buffers;
+ GLboolean MESA_sprite_point;
GLboolean NV_blend_square;
GLboolean NV_texgen_reflection;
GLboolean PGI_misc_hints;
/*
- * Bits to indicate what state has changed.
+ * Bits to indicate what state has changed. 6 unused flags.
*/
#define _NEW_MODELVIEW 0x1 /* ctx->ModelView */
#define _NEW_PROJECTION 0x2 /* ctx->Projection */
#define _NEW_EVAL 0x80 /* ctx->Eval, ctx->EvalMap */
#define _NEW_FOG 0x100 /* ctx->Fog */
#define _NEW_HINT 0x200 /* ctx->Hint */
-#define _NEW_400 0x400 /* unused */
+#define _NEW_400 0x400 /* */
#define _NEW_LIGHT 0x800 /* ctx->Light */
-#define _NEW_1000 0x1000 /* unused */
+#define _NEW_1000 0x1000 /* */
#define _NEW_LINE 0x2000 /* ctx->Line */
-#define _NEW_FEEDBACK_SELECT 0x4000 /* ctx->Feedback, ctx->Select */
+#define _NEW_4000 0x4000 /* */
#define _NEW_PIXEL 0x8000 /* ctx->Pixel */
#define _NEW_POINT 0x10000 /* ctx->Point */
#define _NEW_POLYGON 0x20000 /* ctx->Polygon */
#define _NEW_PACKUNPACK 0x1000000 /* ctx->Pack, ctx->Unpack */
#define _NEW_ARRAY 0x2000000 /* ctx->Array */
#define _NEW_COLORTABLE 0x4000000 /* ctx->{*}ColorTable */
-#define _NEW_RENDERMODE 0x8000000 /* ctx->RenderMode */
+#define _NEW_RENDERMODE 0x8000000 /* RenderMode, Feedback, Select */
#define _NEW_BUFFERS 0x10000000 /* ctx->Visual, ctx->DrawBuffer, */
#define _NEW_ALL ~0
-/* What can the driver do, what requires us to call render_triangle or
- * a non-driver rasterize function?
+/* Bits to track array state changes (also used to summarize array enabled)
+ */
+#define _NEW_ARRAY_VERTEX 0x1
+#define _NEW_ARRAY_COLOR 0x2
+#define _NEW_ARRAY_NORMAL 0x4
+#define _NEW_ARRAY_INDEX 0x8
+#define _NEW_ARRAY_EDGEFLAG 0x10
+#define _NEW_ARRAY_SECONDARYCOLOR 0x20
+#define _NEW_ARRAY_FOGCOORD 0x40
+#define _NEW_ARRAY_TEXCOORD_0 0x80
+#define _NEW_ARRAY_TEXCOORD_1 0x100
+#define _NEW_ARRAY_TEXCOORD_2 0x200
+#define _NEW_ARRAY_TEXCOORD_3 0x400
+#define _NEW_ARRAY_TEXCOORD_4 0x800
+#define _NEW_ARRAY_TEXCOORD_5 0x1000
+#define _NEW_ARRAY_TEXCOORD_6 0x2000
+#define _NEW_ARRAY_TEXCOORD_7 0x4000
+#define _NEW_ARRAY_ALL 0x7fff
+
+#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0<<(i))
+
+/* A bunch of flags that we think might be useful to drivers.
*/
#define DD_FEEDBACK 0x1
#define DD_SELECT 0x2
#define DD_FLATSHADE 0x4
-#define DD_MULTIDRAW 0x8
#define DD_SEPERATE_SPECULAR 0x10
#define DD_TRI_LIGHT_TWOSIDE 0x20
#define DD_TRI_UNFILLED 0x40
#define DD_TRI_SMOOTH 0x80
#define DD_TRI_STIPPLE 0x100
#define DD_TRI_OFFSET 0x200
-#define DD_TRI_CULL 0x400
#define DD_LINE_SMOOTH 0x800
#define DD_LINE_STIPPLE 0x1000
#define DD_LINE_WIDTH 0x2000
#define DD_POINT_SMOOTH 0x4000
#define DD_POINT_SIZE 0x8000
#define DD_POINT_ATTEN 0x10000
-#define DD_LIGHTING_CULL 0x20000
-#define DD_TRI_CULL_FRONT_BACK 0x400000 /* not supported by most drivers */
-#define DD_Z_NEVER 0x800000
-#define DD_STENCIL 0x1000000
+#define DD_TRI_CULL_FRONT_BACK 0x400000 /* special case on some hw */
+#define DD_Z_NEVER 0x800000 /* special case on some hw */
+#define DD_STENCIL 0x1000000
/* Define the state changes under which each of these bits might change
*/
#define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
#define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
#define _DD_NEW_TRI_OFFSET _NEW_POLYGON
-#define _DD_NEW_TRI_CULL _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_SIZE _NEW_POINT
#define _DD_NEW_POINT_ATTEN _NEW_POINT
#define _DD_NEW_LIGHTING_CULL _NEW_LIGHT
-#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
+#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
#define _DD_NEW_Z_NEVER _NEW_DEPTH
#define _DD_NEW_STENCIL _NEW_STENCIL
-#define _TNL_NEW_RENDERFLAGS (_NEW_TEXTURE | \
- _DD_NEW_SEPERATE_SPECULAR | \
- _NEW_POLYGON | \
- _NEW_FOG | \
- _NEW_RENDERMODE)
-#define _TNL_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \
- _NEW_TEXTURE| \
- _NEW_POINT| \
- _NEW_MODELVIEW)
-
-#define _TNL_NEW_NEED_NORMALS (_NEW_LIGHT| \
- _NEW_TEXTURE)
+#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \
+ _NEW_TEXTURE| \
+ _NEW_POINT| \
+ _NEW_MODELVIEW)
-#define _TNL_NEW_NORMAL_TRANSFORM (_NEW_MODELVIEW|_NEW_TRANSFORM| \
- _TNL_NEW_NEED_NORMALS)
+#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT| \
+ _NEW_TEXTURE)
+#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL|_NEW_COLOR_MATRIX)
-#define _TNL_NEW_SPACES (_TNL_NEW_NEED_NORMALS | \
- _TNL_NEW_NEED_EYE_COORDS )
#define NEED_NORMALS_TEXGEN 0x1
#define NEED_NORMALS_LIGHT 0x2
-#define DD_ANY_CULL (DD_TRI_CULL_FRONT_BACK| \
- DD_TRI_CULL| \
- DD_LIGHTING_CULL)
-
-
-
-
-
-
/*
* Forward declaration of display list datatypes:
*/
/*
- * The library context:
+ * The library context:
*/
struct __GLcontextRec {
/*
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 SavePrefersFloat;
GLuint _NeedEyeCoords;
GLuint _NeedNormals; /* Are vertex normal vectors needed? */
- struct gl_shine_tab *_ShineTable[4]; /* Active shine tables */
+ struct gl_shine_tab *_ShineTable[2]; /* Active shine tables */
struct gl_shine_tab *_ShineTabList; /* Mru list of inactive shine tables */
struct gl_list_extensions listext; /* driver dlist extensions */
/* Should 3Dfx Glide driver catch signals? */
GLboolean CatchSignals;
-
+
/* For debugging/development only */
GLboolean NoRaster;
GLboolean FirstTimeCurrent;
void *swrast_context;
void *swsetup_context;
void *swtnl_context;
- void *swtnl_vb;
void *swtnl_im;
+ void *acache_context;
+ void *aelt_context;
};
/* The string names for GL_POINT, GL_LINE_LOOP, etc */
-extern const char *_mesa_prim_name[GL_POLYGON+2];
+extern const char *_mesa_prim_name[GL_POLYGON+4];
extern GLenum gl_reduce_prim[];
#ifdef MESA_DEBUG
-extern int MESA_VERBOSE;
+extern int MESA_VERBOSE;
extern int MESA_DEBUG_FLAGS;
#else
# define MESA_VERBOSE 0
VERBOSE_DRIVER = 0x10,
VERBOSE_STATE = 0x20,
VERBOSE_API = 0x40,
- VERBOSE_TRIANGLE_CHECKS = 0x80,
- VERBOSE_CULL = 0x100,
VERBOSE_DISPLAY_LIST = 0x200,
VERBOSE_LIGHTING = 0x400
-};
+};
enum _debug {
DEBUG_ALWAYS_FLUSH = 0x1
-};
+};
#define Elements(x) sizeof(x)/sizeof(*(x))
-#define FLUSH_TNL( ctx, flags ) \
-do { \
- if (ctx->Driver.NeedFlush & flags) \
- ctx->Driver.FlushVertices( ctx, flags ); \
-} while (0)
-#define FLUSH_TNL_RETURN( ctx, flags, where ) \
+/* Eventually let the driver specify what statechanges require a flush:
+ */
+#define FLUSH_VERTICES(ctx, newstate) \
do { \
- if (ctx->Driver.NeedFlush & flags) { \
- if (!ctx->Driver.FlushVertices( ctx, flags )) { \
- gl_error( ctx, GL_INVALID_OPERATION, where ); \
- return; \
- } \
- } \
+ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
+ ctx->NewState |= newstate; \
} while (0)
-#define FLUSH_TNL_RETVAL( ctx, flags, where, what ) \
+#define FLUSH_CURRENT(ctx, newstate) \
do { \
- if (ctx->Driver.NeedFlush & flags) { \
- if (!ctx->Driver.FlushVertices( ctx, flags )) { \
- gl_error( ctx, GL_INVALID_OPERATION, where ); \
- return what; \
- } \
- } \
+ 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 != GL_POLYGON+1) { \
+ gl_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ return retval; \
+ } \
+} while (0)
-#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what ) \
- FLUSH_TNL_RETVAL( ctx, \
- (FLUSH_INSIDE_BEGIN_END| \
- FLUSH_STORED_VERTICES), \
- where, what )
+#define ASSERT_OUTSIDE_BEGIN_END(ctx) \
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx,)
-#define ASSERT_OUTSIDE_BEGIN_END( ctx, where ) \
- FLUSH_TNL_RETURN( ctx, \
- (FLUSH_INSIDE_BEGIN_END| \
- FLUSH_STORED_VERTICES), \
- where )
+#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( ctx, where ) \
- ASSERT_OUTSIDE_BEGIN_END( ctx, where );
-
-#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL( ctx, where, what ) \
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what );
+#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)
#ifdef DEBUG