diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/Makefile.X11 | 37 | ||||
-rw-r--r-- | src/mesa/main/api_eval.c | 26 | ||||
-rw-r--r-- | src/mesa/main/api_loopback.c | 305 | ||||
-rw-r--r-- | src/mesa/main/api_noop.c | 87 | ||||
-rw-r--r-- | src/mesa/main/api_noop.h | 10 | ||||
-rw-r--r-- | src/mesa/main/attrib.c | 17 | ||||
-rw-r--r-- | src/mesa/main/context.c | 88 | ||||
-rw-r--r-- | src/mesa/main/context.h | 7 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 5 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 17 | ||||
-rw-r--r-- | src/mesa/main/dlist.h | 21 | ||||
-rw-r--r-- | src/mesa/main/drawpix.c | 19 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 1606 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 4 | ||||
-rw-r--r-- | src/mesa/main/get.c | 1310 | ||||
-rw-r--r-- | src/mesa/main/glprocs.h | 64 | ||||
-rw-r--r-- | src/mesa/main/light.c | 4 | ||||
-rw-r--r-- | src/mesa/main/matrix.c | 54 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 264 | ||||
-rw-r--r-- | src/mesa/main/rastpos.c | 47 | ||||
-rw-r--r-- | src/mesa/main/state.c | 30 | ||||
-rw-r--r-- | src/mesa/main/vtxfmt.c | 10 | ||||
-rw-r--r-- | src/mesa/main/vtxfmt_tmp.h | 18 |
23 files changed, 2369 insertions, 1681 deletions
diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index dc7b2c99f25..6a2e5d7ae42 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.59 2001/11/23 20:44:12 brianp Exp $ +# $Id: Makefile.X11,v 1.60 2001/12/14 02:55:08 brianp Exp $ # Mesa 3-D graphics library # Version: 4.1 @@ -21,9 +21,9 @@ LIBDIR = ../lib CORE_SOURCES = \ - swrast_setup/ss_context.c \ - swrast_setup/ss_triangle.c \ - swrast_setup/ss_vb.c \ + vpexec.c \ + vpparse.c \ + vpstate.c \ api_arrayelt.c \ api_loopback.c \ api_noop.c \ @@ -121,6 +121,9 @@ CORE_SOURCES = \ swrast/s_texstore.c \ swrast/s_triangle.c \ swrast/s_zoom.c \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c \ + swrast_setup/ss_vb.c \ tnl/t_array_api.c \ tnl/t_array_import.c \ tnl/t_context.c \ @@ -138,6 +141,7 @@ CORE_SOURCES = \ tnl/t_vb_light.c \ tnl/t_vb_normals.c \ tnl/t_vb_points.c \ + tnl/t_vb_program.c \ tnl/t_vb_render.c \ tnl/t_vb_texgen.c \ tnl/t_vb_texmat.c \ @@ -337,3 +341,28 @@ dep: $(CORE_SOURCES) $(DRIVER_SOURCES) $(OSMESA_SOURCES) tags: etags `find . -name \*.[ch]` `find ../include` + + + +# XXX temporary for NV_vertex_program +VPFILES = \ + include/GL/glext.h \ + src/Makefile.X11 \ + src/vpparse.[ch] \ + src/vpexec.[ch] \ + src/vpstate.[ch] \ + src/attrib.c \ + src/context.c \ + src/enable.c \ + src/extensions.c \ + src/get.c \ + src/matrix.c \ + src/mtypes.h \ + src/varray.c \ + src/tnl/t_vb_program.c \ + tests/vptest1.c \ + tests/vptest2.c + +vptar: + cd .. ; tar cvf vpfiles.tar $(VPFILES) ; gzip vpfiles.tar + diff --git a/src/mesa/main/api_eval.c b/src/mesa/main/api_eval.c index f25ede9bdaf..f644a98371e 100644 --- a/src/mesa/main/api_eval.c +++ b/src/mesa/main/api_eval.c @@ -1,4 +1,4 @@ -/* $Id: api_eval.c,v 1.1 2001/06/04 13:57:35 keithw Exp $ */ +/* $Id: api_eval.c,v 1.2 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -281,16 +281,16 @@ void _mesa_EvalCoord1f( GLfloat u ) GLfloat normal[3], texcoord[4], color[4]; GLuint index; - COPY_3FV( normal, ctx->Current.Normal ); - COPY_4FV( texcoord, ctx->Current.Texcoord[0] ); - COPY_4FV( color, ctx->Current.Color ); + COPY_3FV( normal, ctx->Current.Attrib[VERT_ATTRIB_NORMAL] ); + COPY_4FV( texcoord, ctx->Current.Attrib[VERT_ATTRIB_TEX0] ); + COPY_4FV( color, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); index = ctx->Current.Index; do_EvalCoord1f( ctx, u ); - COPY_3FV( ctx->Current.Normal, normal ); - COPY_4FV( ctx->Current.Texcoord[0], texcoord ); - COPY_4FV( ctx->Current.Color, color ); + COPY_3FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], normal ); + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0], texcoord ); + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color ); ctx->Current.Index = index; } @@ -300,16 +300,16 @@ void _mesa_EvalCoord2f( GLfloat u, GLfloat v ) GLfloat normal[3], texcoord[4], color[4]; GLuint index; - COPY_3FV( normal, ctx->Current.Normal ); - COPY_4FV( texcoord, ctx->Current.Texcoord[0] ); - COPY_4FV( color, ctx->Current.Color ); + COPY_3FV( normal, ctx->Current.Attrib[VERT_ATTRIB_NORMAL] ); + COPY_4FV( texcoord, ctx->Current.Attrib[VERT_ATTRIB_TEX0] ); + COPY_4FV( color, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); index = ctx->Current.Index; do_EvalCoord2f( ctx, u, v ); - COPY_3FV( ctx->Current.Normal, normal ); - COPY_4FV( ctx->Current.Texcoord[0], texcoord ); - COPY_4FV( ctx->Current.Color, color ); + COPY_3FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], normal ); + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0], texcoord ); + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color ); ctx->Current.Index = index; } diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index 3ec4f30f362..cf38a549013 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -1,4 +1,4 @@ -/* $Id: api_loopback.c,v 1.11 2001/12/04 23:43:31 brianp Exp $ */ +/* $Id: api_loopback.c,v 1.12 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -66,6 +66,7 @@ #define RECTF(a,b,c,d) DRIVER(Rectf)(a,b,c,d) #define SECONDARYCOLORUB(a,b,c) DRIVER(SecondaryColor3ubEXT)(a,b,c) #define SECONDARYCOLORF(a,b,c) DRIVER(SecondaryColor3fEXT)(a,b,c) +#define ATTRIB(index, x, y, z, w) DRIVER(VertexAttrib4fNV)(index, x, y, z, w) static void @@ -1367,6 +1368,267 @@ loopback_SecondaryColor3usvEXT_f( const GLushort *v ) } +/* + * GL_NV_vertex_program + */ + +static void +loopback_VertexAttrib1sNV(GLuint index, GLshort x) +{ + ATTRIB(index, (GLfloat) x, 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib1fNV(GLuint index, GLfloat x) +{ + ATTRIB(index, x, 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib1dNV(GLuint index, GLdouble x) +{ + ATTRIB(index, (GLfloat) x, 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) +{ + ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) +{ + ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) +{ + ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) +{ + ATTRIB(index, (GLfloat) x, y, z, 1.0F); +} + +static void +loopback_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + ATTRIB(index, x, y, z, 1.0F); +} + +static void +loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void +loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void +loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void +loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + ATTRIB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), + UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); +} + +static void +loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) +{ + ATTRIB(index, (GLfloat) v[0], 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib1fvNV(GLuint index, const GLfloat *v) +{ + ATTRIB(index, v[0], 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2fvNV(GLuint index, const GLfloat *v) +{ + ATTRIB(index, v[0], v[1], 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLdouble) v[1], 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void +loopback_VertexAttrib3fvNV(GLuint index, const GLfloat *v) +{ + ATTRIB(index, v[0], v[1], v[2], 1.0F); +} + +static void +loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void +loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void +loopback_VertexAttrib4fvNV(GLuint index, const GLfloat *v) +{ + ATTRIB(index, v[0], v[1], v[2], v[3]); +} + +static void +loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void +loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) +{ + ATTRIB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); +} + + +static void +loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1svNV(index + i, v + i); +} + +static void +loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1fvNV(index + i, v + i); +} + +static void +loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1dvNV(index + i, v + i); +} + +static void +loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2svNV(index + i, v + 2 * i); +} + +static void +loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2fvNV(index + i, v + 2 * i); +} + +static void +loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2dvNV(index + i, v + 2 * i); +} + +static void +loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3svNV(index + i, v + 3 * i); +} + +static void +loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3fvNV(index + i, v + 3 * i); +} + +static void +loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3dvNV(index + i, v + 3 * i); +} + +static void +loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4svNV(index + i, v + 4 * i); +} + +static void +loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4fvNV(index + i, v + 4 * i); +} + +static void +loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4dvNV(index + i, v + 4 * i); +} + +static void +loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); +} + void _mesa_loopback_prefer_float( struct _glapi_table *dest, @@ -1564,4 +1826,45 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest, dest->Rectsv = loopback_Rectsv; dest->FogCoorddEXT = loopback_FogCoorddEXT; dest->FogCoorddvEXT = loopback_FogCoorddvEXT; + + dest->VertexAttrib1sNV = loopback_VertexAttrib1sNV; + dest->VertexAttrib1fNV = loopback_VertexAttrib1fNV; + dest->VertexAttrib1dNV = loopback_VertexAttrib1dNV; + dest->VertexAttrib2sNV = loopback_VertexAttrib2sNV; + dest->VertexAttrib2fNV = loopback_VertexAttrib2fNV; + dest->VertexAttrib2dNV = loopback_VertexAttrib2dNV; + dest->VertexAttrib3sNV = loopback_VertexAttrib3sNV; + dest->VertexAttrib3fNV = loopback_VertexAttrib3fNV; + dest->VertexAttrib3dNV = loopback_VertexAttrib3dNV; + dest->VertexAttrib4sNV = loopback_VertexAttrib4sNV; + dest->VertexAttrib4dNV = loopback_VertexAttrib4dNV; + dest->VertexAttrib4ubNV = loopback_VertexAttrib4ubNV; + + dest->VertexAttrib1svNV = loopback_VertexAttrib1svNV; + dest->VertexAttrib1fvNV = loopback_VertexAttrib1fvNV; + dest->VertexAttrib1dvNV = loopback_VertexAttrib1dvNV; + dest->VertexAttrib2svNV = loopback_VertexAttrib2svNV; + dest->VertexAttrib2fvNV = loopback_VertexAttrib2fvNV; + dest->VertexAttrib2dvNV = loopback_VertexAttrib2dvNV; + dest->VertexAttrib3svNV = loopback_VertexAttrib3svNV; + dest->VertexAttrib3fvNV = loopback_VertexAttrib3fvNV; + dest->VertexAttrib3dvNV = loopback_VertexAttrib3dvNV; + dest->VertexAttrib4svNV = loopback_VertexAttrib4svNV; + dest->VertexAttrib4fvNV = loopback_VertexAttrib4fvNV; + dest->VertexAttrib4dvNV = loopback_VertexAttrib4dvNV; + dest->VertexAttrib4ubvNV = loopback_VertexAttrib4ubvNV; + + dest->VertexAttribs1svNV = loopback_VertexAttribs1svNV; + dest->VertexAttribs1fvNV = loopback_VertexAttribs1fvNV; + dest->VertexAttribs1dvNV = loopback_VertexAttribs1dvNV; + dest->VertexAttribs2svNV = loopback_VertexAttribs2svNV; + dest->VertexAttribs2fvNV = loopback_VertexAttribs2fvNV; + dest->VertexAttribs2dvNV = loopback_VertexAttribs2dvNV; + dest->VertexAttribs3svNV = loopback_VertexAttribs3svNV; + dest->VertexAttribs3fvNV = loopback_VertexAttribs3fvNV; + dest->VertexAttribs3dvNV = loopback_VertexAttribs3dvNV; + dest->VertexAttribs4svNV = loopback_VertexAttribs4svNV; + dest->VertexAttribs4fvNV = loopback_VertexAttribs4fvNV; + dest->VertexAttribs4dvNV = loopback_VertexAttribs4dvNV; + dest->VertexAttribs4ubvNV = loopback_VertexAttribs4ubvNV; } diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 58a6e7d7712..b603b74f5e2 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -1,8 +1,8 @@ -/* $Id: api_noop.c,v 1.8 2001/04/28 08:39:17 keithw Exp $ */ +/* $Id: api_noop.c,v 1.9 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -58,13 +58,13 @@ void _mesa_noop_EdgeFlagv( const GLboolean *b ) void _mesa_noop_FogCoordfEXT( GLfloat a ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.FogCoord = a; + ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = a; } void _mesa_noop_FogCoordfvEXT( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.FogCoord = *v; + ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = *v; } void _mesa_noop_Indexi( GLint i ) @@ -82,7 +82,7 @@ void _mesa_noop_Indexiv( const GLint *v ) void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Normal; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -91,7 +91,7 @@ void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) void _mesa_noop_Normal3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Normal; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -155,7 +155,7 @@ void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = UBYTE_TO_FLOAT(a); color[1] = UBYTE_TO_FLOAT(b); color[2] = UBYTE_TO_FLOAT(c); @@ -165,7 +165,7 @@ void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d ) void _mesa_noop_Color4ubv( const GLubyte *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = UBYTE_TO_FLOAT(v[0]); color[1] = UBYTE_TO_FLOAT(v[1]); color[2] = UBYTE_TO_FLOAT(v[2]); @@ -175,7 +175,7 @@ void _mesa_noop_Color4ubv( const GLubyte *v ) void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = a; color[1] = b; color[2] = c; @@ -185,7 +185,7 @@ void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) void _mesa_noop_Color4fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; @@ -195,7 +195,7 @@ void _mesa_noop_Color4fv( const GLfloat *v ) void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = UBYTE_TO_FLOAT(a); color[1] = UBYTE_TO_FLOAT(b); color[2] = UBYTE_TO_FLOAT(c); @@ -205,7 +205,7 @@ void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c ) void _mesa_noop_Color3ubv( const GLubyte *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = UBYTE_TO_FLOAT(v[0]); color[1] = UBYTE_TO_FLOAT(v[1]); color[2] = UBYTE_TO_FLOAT(v[2]); @@ -215,7 +215,7 @@ void _mesa_noop_Color3ubv( const GLubyte *v ) void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = a; color[1] = b; color[2] = c; @@ -225,7 +225,7 @@ void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) void _mesa_noop_Color3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; @@ -241,7 +241,7 @@ void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], a); dest[1] = 0; dest[2] = 0; @@ -258,7 +258,7 @@ void _mesa_noop_MultiTexCoord1fvARB( GLenum target, GLfloat *v ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], v[0]); dest[1] = 0; dest[2] = 0; @@ -275,7 +275,7 @@ void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); dest[2] = 0; @@ -292,7 +292,7 @@ void _mesa_noop_MultiTexCoord2fvARB( GLenum target, GLfloat *v ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); dest[2] = 0; @@ -309,7 +309,7 @@ void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -326,7 +326,7 @@ void _mesa_noop_MultiTexCoord3fvARB( GLenum target, GLfloat *v ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -344,7 +344,7 @@ void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -361,7 +361,7 @@ void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -372,7 +372,7 @@ void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v ) void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.SecondaryColor; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = UBYTE_TO_FLOAT(a); color[1] = UBYTE_TO_FLOAT(b); color[2] = UBYTE_TO_FLOAT(c); @@ -382,7 +382,7 @@ void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ) void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.SecondaryColor; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = UBYTE_TO_FLOAT(v[0]); color[1] = UBYTE_TO_FLOAT(v[1]); color[2] = UBYTE_TO_FLOAT(v[2]); @@ -392,7 +392,7 @@ void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v ) void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.SecondaryColor; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = a; color[1] = b; color[2] = c; @@ -402,7 +402,7 @@ void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.SecondaryColor; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; @@ -412,7 +412,7 @@ void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) void _mesa_noop_TexCoord1f( GLfloat a ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], a); dest[1] = 0; dest[2] = 0; @@ -422,7 +422,7 @@ void _mesa_noop_TexCoord1f( GLfloat a ) void _mesa_noop_TexCoord1fv( GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], v[0]); dest[1] = 0; dest[2] = 0; @@ -432,7 +432,7 @@ void _mesa_noop_TexCoord1fv( GLfloat *v ) void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); dest[2] = 0; @@ -442,7 +442,7 @@ void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) void _mesa_noop_TexCoord2fv( GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); dest[2] = 0; @@ -452,7 +452,7 @@ void _mesa_noop_TexCoord2fv( GLfloat *v ) void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -462,7 +462,7 @@ void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) void _mesa_noop_TexCoord3fv( GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -472,7 +472,7 @@ void _mesa_noop_TexCoord3fv( GLfloat *v ) void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -482,13 +482,32 @@ void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) void _mesa_noop_TexCoord4fv( GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); COPY_FLOAT(dest[3], v[3]); } +void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z, GLfloat w ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < 16) { + ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); + } +} + +void _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < 16) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); + } +} + + + /* Execute a glRectf() function. This is not suitable for GL_COMPILE * modes (as the test for outside begin/end is not compiled), * but may be useful for drivers in circumstances which exclude diff --git a/src/mesa/main/api_noop.h b/src/mesa/main/api_noop.h index c80179d2930..14fb9fcc2b7 100644 --- a/src/mesa/main/api_noop.h +++ b/src/mesa/main/api_noop.h @@ -1,8 +1,8 @@ -/* $Id: api_noop.h,v 1.3 2001/03/12 00:48:37 gareth Exp $ */ +/* $Id: api_noop.h,v 1.4 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -116,6 +116,12 @@ extern void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); extern void _mesa_noop_TexCoord4fv( GLfloat *v ); +extern void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z, GLfloat w ); + +extern void _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ); + + /* Not strictly a noop -- translate Rectf down to Begin/End and * vertices. Closer to the loopback operations, but doesn't meet the diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 01a913955a9..8b49cd4e96f 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.57 2001/09/18 15:27:18 kschultz Exp $ */ +/* $Id: attrib.c,v 1.58 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -240,6 +240,10 @@ _mesa_PushAttrib(GLbitfield mask) attr->Texture[i] = ctx->Texture.Unit[i].Enabled; attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled; } + /* GL_NV_vertex_program */ + attr->VertexProgram = ctx->VertexProgram.Enabled; + attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled; + attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled; newnode = new_attrib_node( GL_ENABLE_BIT ); newnode->data = attr; newnode->next = head; @@ -537,6 +541,17 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert, enable->SampleCoverageInvert, GL_SAMPLE_COVERAGE_INVERT_ARB); + /* GL_NV_vertex_program */ + TEST_AND_UPDATE(ctx->VertexProgram.Enabled, + enable->VertexProgram, + GL_VERTEX_PROGRAM_NV); + TEST_AND_UPDATE(ctx->VertexProgram.PointSizeEnabled, + enable->VertexProgramPointSize, + GL_VERTEX_PROGRAM_POINT_SIZE_NV); + TEST_AND_UPDATE(ctx->VertexProgram.TwoSideEnabled, + enable->VertexProgramTwoSide, + GL_VERTEX_PROGRAM_TWO_SIDE_NV); + #undef TEST_AND_UPDATE /* texture unit enables */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 230af9c564f..1f87a13fe63 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,8 +1,8 @@ -/* $Id: context.c,v 1.149 2001/11/06 15:53:00 brianp Exp $ */ +/* $Id: context.c,v 1.150 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -53,7 +53,6 @@ #include "mtypes.h" #include "varray.h" #include "vtxfmt.h" - #include "math/m_translate.h" #include "math/m_vertices.h" #include "math/m_matrix.h" @@ -89,6 +88,8 @@ int MESA_DEBUG_FLAGS = 0 ; #endif + + /**********************************************************************/ /***** OpenGL SI-style interface (new in Mesa 3.5) *****/ /**********************************************************************/ @@ -477,6 +478,37 @@ one_time_init( void ) } +static void +init_matrix_stack( struct matrix_stack *stack, + GLuint maxDepth, GLuint dirtyFlag ) +{ + GLuint i; + + stack->Depth = 0; + stack->MaxDepth = maxDepth; + stack->DirtyFlag = dirtyFlag; + /* Top matrix */ + _math_matrix_ctr( &stack->Top ); + _math_matrix_alloc_inv( &stack->Top ); + /* The stack */ + stack->Stack = MALLOC(maxDepth * sizeof(GLmatrix)); + for (i = 0; i < maxDepth; i++) { + _math_matrix_ctr(&stack->Stack[i]); + _math_matrix_alloc_inv(&stack->Stack[i]); + } +} + + +static void +free_matrix_stack( struct matrix_stack *stack ) +{ + GLuint i; + _math_matrix_dtr( &stack->Top ); + for (i = 0; i < stack->MaxDepth; i++) { + _math_matrix_dtr(&stack->Stack[i]); + } +} + /* * Allocate and initialize a shared context state structure. @@ -768,6 +800,9 @@ init_attrib_groups( GLcontext *ctx ) _math_matrix_ctr( &ctx->ModelViewStack[i] ); _math_matrix_alloc_inv( &ctx->ModelViewStack[i] ); } +#if 1 + init_matrix_stack(&ctx->ModelviewStack, 32, _NEW_MODELVIEW); +#endif /* Projection matrix - need inv for user clipping in clip space*/ _math_matrix_ctr( &ctx->ProjectionMatrix ); @@ -828,10 +863,16 @@ init_attrib_groups( GLcontext *ctx ) ctx->Color.MultiDrawBuffer = GL_FALSE; /* Current group */ - ASSIGN_4V( ctx->Current.Color, 1.0, 1.0, 1.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 0.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 0.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 ); + for (i = 0; i < MAX_TEXTURE_UNITS; i++) + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i], 0.0, 0.0, 0.0, 1.0 ); ctx->Current.Index = 1; - for (i=0; i<MAX_TEXTURE_UNITS; i++) - ASSIGN_4V( ctx->Current.Texcoord[i], 0.0, 0.0, 0.0, 1.0 ); + ctx->Current.EdgeFlag = GL_TRUE; + ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterDistance = 0.0; ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); @@ -840,8 +881,6 @@ init_attrib_groups( GLcontext *ctx ) ASSIGN_4V( ctx->Current.RasterMultiTexCoord[i], 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterTexCoord = ctx->Current.RasterMultiTexCoord[0]; ctx->Current.RasterPosValid = GL_TRUE; - ctx->Current.EdgeFlag = GL_TRUE; - ASSIGN_3V( ctx->Current.Normal, 0.0, 0.0, 1.0 ); /* Depth buffer group */ @@ -1279,6 +1318,17 @@ init_attrib_groups( GLcontext *ctx ) _mesa_init_colortable(&ctx->PostColorMatrixColorTable); _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); + /* GL_NV_vertex_program */ + ctx->VertexProgram.Binding = 0; + ctx->VertexProgram.HashTable = _mesa_NewHashTable(); + ctx->VertexProgram.Enabled = GL_FALSE; + ctx->VertexProgram.PointSizeEnabled = GL_FALSE; + ctx->VertexProgram.TwoSideEnabled = GL_FALSE; + for (i = 0; i < VP_NUM_PROG_REGS / 4; i++) { + ctx->VertexProgram.TrackMatrix[i] = GL_NONE; + ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; + } + /* Miscellaneous */ ctx->NewState = _NEW_ALL; ctx->RenderMode = GL_RENDER; @@ -1600,6 +1650,10 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_make_current(NULL, NULL); } +#if 1 + free_matrix_stack(&ctx->ModelviewStack); +#endif + _math_matrix_dtr( &ctx->ModelView ); for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) { _math_matrix_dtr( &ctx->ModelViewStack[i] ); @@ -1690,6 +1744,9 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_extensions_dtr(ctx); + /* GL_NV_vertex_program */ + _mesa_DeleteHashTable(ctx->VertexProgram.HashTable); + FREE(ctx->Exec); FREE(ctx->Save); } @@ -1971,21 +2028,6 @@ _mesa_warning( const GLcontext *ctx, const char *s ) /* - * Compile an error into current display list. - */ -void -_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ) -{ - if (ctx->CompileFlag) - _mesa_save_error( ctx, error, s ); - - if (ctx->ExecuteFlag) - _mesa_error( ctx, error, s ); -} - - - -/* * This is Mesa's error handler. Normally, all that's done is the updating * of the current error value. If Mesa is compiled with -DDEBUG or if the * environment variable "MESA_DEBUG" is defined then a real error message diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 3d56ada0533..e0bb2ad09f6 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -1,8 +1,8 @@ -/* $Id: context.h,v 1.27 2001/05/03 14:11:18 brianp Exp $ */ +/* $Id: context.h,v 1.28 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -204,9 +204,6 @@ _mesa_warning( const GLcontext *ctx, const char *s ); extern void _mesa_error( GLcontext *ctx, GLenum error, const char *s ); -extern void -_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); - extern void diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 52707e14f43..f22aa943195 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.64 2001/12/04 23:43:31 brianp Exp $ */ +/* $Id: dd.h,v 1.65 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -696,6 +696,9 @@ typedef struct { void (*CallList)( GLuint ); /* NOTE */ void (*Begin)( GLenum ); void (*End)( void ); + void (*VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); + void (*VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); + /* Drivers present a reduced set of the functions possible in * begin/end objects. Core mesa provides translation stubs for the * remaining functions to map down to these entrypoints. diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 050373aee74..bb2c68d0d08 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.80 2001/12/13 19:58:20 kschultz Exp $ */ +/* $Id: dlist.c,v 1.81 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -4049,6 +4049,21 @@ _mesa_save_error( GLcontext *ctx, GLenum error, const char *s ) } +/* + * Compile an error into current display list. + */ +void +_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ) +{ + if (ctx->CompileFlag) + _mesa_save_error( ctx, error, s ); + + if (ctx->ExecuteFlag) + _mesa_error( ctx, error, s ); +} + + + static GLboolean islist(GLcontext *ctx, GLuint list) { diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index 2994cf73d0c..6671620d470 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -1,8 +1,8 @@ -/* $Id: dlist.h,v 1.16 2001/03/24 06:01:27 gareth Exp $ */ +/* $Id: dlist.h,v 1.17 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -83,19 +83,20 @@ extern void _mesa_ListBase( GLuint base ); extern void _mesa_NewList( GLuint list, GLenum mode ); -extern void _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ); +extern void _mesa_init_dlist_table( struct _glapi_table *table, + GLuint tableSize ); extern void _mesa_save_error( GLcontext *ctx, GLenum error, const char *s ); +extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); -void * -_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ); -int -_mesa_alloc_opcode( GLcontext *ctx, GLuint sz, - void (*execute)( GLcontext *, void * ), - void (*destroy)( GLcontext *, void * ), - void (*print)( GLcontext *, void * ) ); +extern void *_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ); + +extern int _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, + void (*execute)( GLcontext *, void * ), + void (*destroy)( GLcontext *, void * ), + void (*print)( GLcontext *, void * ) ); extern void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index f605ae1624e..ac1c68af5ed 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.57 2001/12/13 19:12:42 brianp Exp $ */ +/* $Id: drawpix.c,v 1.58 2001/12/14 02:55:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -71,13 +71,14 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, &ctx->Unpack, pixels); } else if (ctx->RenderMode==GL_FEEDBACK) { + /* Feedback the current raster pos info */ if (ctx->Current.RasterPosValid) { - FLUSH_CURRENT(ctx, 0); + FLUSH_CURRENT( ctx, 0 ); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, - ctx->Current.RasterIndex, + ctx->Current.RasterIndex, ctx->Current.RasterTexCoord ); } } @@ -146,13 +147,13 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, } else if (ctx->RenderMode == GL_FEEDBACK) { if (ctx->Current.RasterPosValid) { - FLUSH_CURRENT(ctx, 0); + FLUSH_CURRENT( ctx, 0 ); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); - _mesa_feedback_vertex( ctx, - ctx->Current.RasterPos, - ctx->Current.RasterColor, - ctx->Current.RasterIndex, - ctx->Current.RasterTexCoord ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoord ); } } else if (ctx->RenderMode == GL_SELECT) { diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index a1adf1de821..758426d0e4b 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.50 2001/06/26 01:32:48 brianp Exp $ */ +/* $Id: enable.c,v 1.51 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -37,13 +37,20 @@ #include "simple_list.h" #include "mtypes.h" #include "enums.h" - #include "math/m_matrix.h" #include "math/m_xform.h" - #endif +#define CHECK_EXTENSION(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_ENUM, \ + state ? "glEnableClientState": "glDisableClientState"); \ + return; \ + } + + + static void client_state( GLcontext *ctx, GLenum cap, GLboolean state ) { @@ -51,41 +58,66 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state ) GLboolean *var; switch (cap) { - case GL_VERTEX_ARRAY: - var = &ctx->Array.Vertex.Enabled; - flag = _NEW_ARRAY_VERTEX; - break; - case GL_NORMAL_ARRAY: - var = &ctx->Array.Normal.Enabled; - flag = _NEW_ARRAY_NORMAL; - break; - case GL_COLOR_ARRAY: - var = &ctx->Array.Color.Enabled; - flag = _NEW_ARRAY_COLOR; - break; - case GL_INDEX_ARRAY: - var = &ctx->Array.Index.Enabled; - flag = _NEW_ARRAY_INDEX; - break; - case GL_TEXTURE_COORD_ARRAY: - var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; - flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); - break; - case GL_EDGE_FLAG_ARRAY: - var = &ctx->Array.EdgeFlag.Enabled; - flag = _NEW_ARRAY_EDGEFLAG; - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - var = &ctx->Array.FogCoord.Enabled; - flag = _NEW_ARRAY_FOGCOORD; - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - var = &ctx->Array.SecondaryColor.Enabled; - flag = _NEW_ARRAY_SECONDARYCOLOR; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); - return; + case GL_VERTEX_ARRAY: + var = &ctx->Array.Vertex.Enabled; + flag = _NEW_ARRAY_VERTEX; + break; + case GL_NORMAL_ARRAY: + var = &ctx->Array.Normal.Enabled; + flag = _NEW_ARRAY_NORMAL; + break; + case GL_COLOR_ARRAY: + var = &ctx->Array.Color.Enabled; + flag = _NEW_ARRAY_COLOR0; + break; + case GL_INDEX_ARRAY: + var = &ctx->Array.Index.Enabled; + flag = _NEW_ARRAY_INDEX; + break; + case GL_TEXTURE_COORD_ARRAY: + var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; + flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); + break; + case GL_EDGE_FLAG_ARRAY: + var = &ctx->Array.EdgeFlag.Enabled; + flag = _NEW_ARRAY_EDGEFLAG; + break; + case GL_FOG_COORDINATE_ARRAY_EXT: + var = &ctx->Array.FogCoord.Enabled; + flag = _NEW_ARRAY_FOGCOORD; + break; + case GL_SECONDARY_COLOR_ARRAY_EXT: + var = &ctx->Array.SecondaryColor.Enabled; + flag = _NEW_ARRAY_COLOR1; + break; + + /* GL_NV_vertex_program */ + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION(NV_vertex_program); + { + GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; + var = &ctx->Array.VertexAttrib[n].Enabled; + flag = _NEW_ARRAY_VERT_ATTRIB0; /* XXX flag OK? */ + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); + return; } if (*var == flag) @@ -126,6 +158,15 @@ _mesa_DisableClientState( GLenum cap ) } +#undef CHECK_EXTENSION +#define CHECK_EXTENSION(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_ENUM, \ + state ? "glEnable": "glDisable"); \ + return; \ + } + + /* * Perform glEnable and glDisable calls. */ @@ -138,680 +179,686 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->NewState); switch (cap) { - case GL_ALPHA_TEST: - if (ctx->Color.AlphaEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.AlphaEnabled = state; - break; - case GL_AUTO_NORMAL: - if (ctx->Eval.AutoNormal == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.AutoNormal = state; - break; - case GL_BLEND: - if (ctx->Color.BlendEnabled == state) - return; - - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.BlendEnabled = state; - /* The following needed to accomodate 1.0 RGB logic op blending */ - ctx->Color.ColorLogicOpEnabled = - (ctx->Color.BlendEquation == GL_LOGIC_OP && state); - break; - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: { - GLuint p = cap-GL_CLIP_PLANE0; - - if (ctx->Transform.ClipEnabled[p] == state) - return; - - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.ClipEnabled[p] = state; - - if (state) { - ctx->Transform._AnyClip++; - - if (ctx->ProjectionMatrix.flags & MAT_DIRTY) { - _math_matrix_analyse( &ctx->ProjectionMatrix ); - } - - /* This derived state also calculated in clip.c and - * from _mesa_update_state() on changes to EyeUserPlane - * and ctx->ProjectionMatrix respectively. - */ - _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], - ctx->Transform.EyeUserPlane[p], - ctx->ProjectionMatrix.inv ); + case GL_ALPHA_TEST: + if (ctx->Color.AlphaEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.AlphaEnabled = state; + break; + case GL_AUTO_NORMAL: + if (ctx->Eval.AutoNormal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.AutoNormal = state; + break; + case GL_BLEND: + if (ctx->Color.BlendEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.BlendEnabled = state; + /* The following needed to accomodate 1.0 RGB logic op blending */ + ctx->Color.ColorLogicOpEnabled = + (ctx->Color.BlendEquation == GL_LOGIC_OP && state); + break; + case GL_CLIP_PLANE0: + case GL_CLIP_PLANE1: + case GL_CLIP_PLANE2: + case GL_CLIP_PLANE3: + case GL_CLIP_PLANE4: + case GL_CLIP_PLANE5: + { + GLuint p = cap-GL_CLIP_PLANE0; + + if (ctx->Transform.ClipEnabled[p] == state) + return; + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.ClipEnabled[p] = state; + + if (state) { + ctx->Transform._AnyClip++; + + if (ctx->ProjectionMatrix.flags & MAT_DIRTY) { + _math_matrix_analyse( &ctx->ProjectionMatrix ); + } + + /* This derived state also calculated in clip.c and + * from _mesa_update_state() on changes to EyeUserPlane + * and ctx->ProjectionMatrix respectively. + */ + _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], + ctx->Transform.EyeUserPlane[p], + ctx->ProjectionMatrix.inv ); + } + } + break; + case GL_COLOR_MATERIAL: + if (ctx->Light.ColorMaterialEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ColorMaterialEnabled = state; + if (state) { + FLUSH_CURRENT(ctx, 0); + _mesa_update_color_material( ctx, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); + } + break; + case GL_CULL_FACE: + if (ctx->Polygon.CullFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.CullFlag = state; + break; + case GL_DEPTH_TEST: + if (state && ctx->Visual.depthBits==0) { + _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); + return; + } + if (ctx->Depth.Test==state) + return; + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Test = state; + break; + case GL_DITHER: + if (ctx->NoDither) { + state = GL_FALSE; /* MESA_NO_DITHER env var */ + } + if (ctx->Color.DitherFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.DitherFlag = state; + break; + case GL_FOG: + if (ctx->Fog.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Enabled = state; + break; + case GL_HISTOGRAM: + CHECK_EXTENSION(EXT_histogram); + if (ctx->Pixel.HistogramEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.HistogramEnabled = state; + break; + case GL_LIGHT0: + case GL_LIGHT1: + case GL_LIGHT2: + case GL_LIGHT3: + case GL_LIGHT4: + case GL_LIGHT5: + case GL_LIGHT6: + case GL_LIGHT7: + if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; + if (state) { + insert_at_tail(&ctx->Light.EnabledList, + &ctx->Light.Light[cap-GL_LIGHT0]); + } + else { + remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); + } + break; + case GL_LIGHTING: + if (ctx->Light.Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Enabled = state; + + if ((ctx->Light.Enabled && + ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) + || ctx->Fog.ColorSumEnabled) + ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; + else + ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; + + break; + case GL_LINE_SMOOTH: + if (ctx->Line.SmoothFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_LINE_SMOOTH; + break; + case GL_LINE_STIPPLE: + if (ctx->Line.StippleFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.StippleFlag = state; + ctx->_TriangleCaps ^= DD_LINE_STIPPLE; + break; + case GL_INDEX_LOGIC_OP: + if (ctx->Color.IndexLogicOpEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.IndexLogicOpEnabled = state; + break; + case GL_COLOR_LOGIC_OP: + if (ctx->Color.ColorLogicOpEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.ColorLogicOpEnabled = state; + break; + case GL_MAP1_COLOR_4: + if (ctx->Eval.Map1Color4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Color4 = state; + break; + case GL_MAP1_INDEX: + if (ctx->Eval.Map1Index == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Index = state; + break; + case GL_MAP1_NORMAL: + if (ctx->Eval.Map1Normal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Normal = state; + break; + case GL_MAP1_TEXTURE_COORD_1: + if (ctx->Eval.Map1TextureCoord1 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord1 = state; + break; + case GL_MAP1_TEXTURE_COORD_2: + if (ctx->Eval.Map1TextureCoord2 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord2 = state; + break; + case GL_MAP1_TEXTURE_COORD_3: + if (ctx->Eval.Map1TextureCoord3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord3 = state; + break; + case GL_MAP1_TEXTURE_COORD_4: + if (ctx->Eval.Map1TextureCoord4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord4 = state; + break; + case GL_MAP1_VERTEX_3: + if (ctx->Eval.Map1Vertex3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Vertex3 = state; + break; + case GL_MAP1_VERTEX_4: + if (ctx->Eval.Map1Vertex4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Vertex4 = state; + break; + case GL_MAP2_COLOR_4: + if (ctx->Eval.Map2Color4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Color4 = state; + break; + case GL_MAP2_INDEX: + if (ctx->Eval.Map2Index == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Index = state; + break; + case GL_MAP2_NORMAL: + if (ctx->Eval.Map2Normal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Normal = state; + break; + case GL_MAP2_TEXTURE_COORD_1: + if (ctx->Eval.Map2TextureCoord1 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord1 = state; + break; + case GL_MAP2_TEXTURE_COORD_2: + if (ctx->Eval.Map2TextureCoord2 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord2 = state; + break; + case GL_MAP2_TEXTURE_COORD_3: + if (ctx->Eval.Map2TextureCoord3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord3 = state; + break; + case GL_MAP2_TEXTURE_COORD_4: + if (ctx->Eval.Map2TextureCoord4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord4 = state; + break; + case GL_MAP2_VERTEX_3: + if (ctx->Eval.Map2Vertex3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Vertex3 = state; + break; + case GL_MAP2_VERTEX_4: + if (ctx->Eval.Map2Vertex4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Vertex4 = state; + break; + case GL_MINMAX: + if (ctx->Pixel.MinMaxEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.MinMaxEnabled = state; + break; + case GL_NORMALIZE: + if (ctx->Transform.Normalize == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.Normalize = state; + break; + case GL_POINT_SMOOTH: + if (ctx->Point.SmoothFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_POINT_SMOOTH; + break; + case GL_POLYGON_SMOOTH: + if (ctx->Polygon.SmoothFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_TRI_SMOOTH; + break; + case GL_POLYGON_STIPPLE: + if (ctx->Polygon.StippleFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.StippleFlag = state; + ctx->_TriangleCaps ^= DD_TRI_STIPPLE; + break; + case GL_POLYGON_OFFSET_POINT: + if (ctx->Polygon.OffsetPoint==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetPoint = state; + break; + case GL_POLYGON_OFFSET_LINE: + if (ctx->Polygon.OffsetLine==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetLine = state; + break; + case GL_POLYGON_OFFSET_FILL: + /*case GL_POLYGON_OFFSET_EXT:*/ + if (ctx->Polygon.OffsetFill==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetFill = state; + break; + case GL_RESCALE_NORMAL_EXT: + if (ctx->Transform.RescaleNormals == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.RescaleNormals = state; + break; + case GL_SCISSOR_TEST: + if (ctx->Scissor.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.Enabled = state; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + if (ctx->Texture.SharedPalette == state) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + ctx->Texture.SharedPalette = state; + break; + case GL_STENCIL_TEST: + if (state && ctx->Visual.stencilBits==0) { + _mesa_warning(ctx, + "glEnable(GL_STENCIL_TEST) but no stencil buffer"); + return; + } + if (ctx->Stencil.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Enabled = state; + break; + case GL_TEXTURE_1D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_1D; + if (state) + newenabled |= TEXTURE0_1D; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; } - } - break; - case GL_COLOR_MATERIAL: - if (ctx->Light.ColorMaterialEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); - ctx->Light.ColorMaterialEnabled = state; - if (state) { - FLUSH_CURRENT(ctx, 0); - _mesa_update_color_material( ctx, ctx->Current.Color ); + case GL_TEXTURE_2D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D; + if (state) + newenabled |= TEXTURE0_2D; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; } - break; - case GL_CULL_FACE: - if (ctx->Polygon.CullFlag == state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.CullFlag = state; - break; - case GL_DEPTH_TEST: - if (state && ctx->Visual.depthBits==0) { - _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); - return; + case GL_TEXTURE_3D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D; + if (state) + newenabled |= TEXTURE0_3D; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; } - if (ctx->Depth.Test==state) - return; - FLUSH_VERTICES(ctx, _NEW_DEPTH); - ctx->Depth.Test = state; - break; - case GL_DITHER: - if (ctx->NoDither) { - state = GL_FALSE; /* MESA_NO_DITHER env var */ + case GL_TEXTURE_GEN_Q: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; + if (state) + newenabled |= Q_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; } - if (ctx->Color.DitherFlag==state) - return; - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.DitherFlag = state; - break; - case GL_FOG: - if (ctx->Fog.Enabled==state) - return; - FLUSH_VERTICES(ctx, _NEW_FOG); - ctx->Fog.Enabled = state; - break; - case GL_HISTOGRAM: - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { - _mesa_error(ctx, GL_INVALID_ENUM, "glEnable(GL_HISTOGRAM)"); - return; + case GL_TEXTURE_GEN_R: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; + if (state) + newenabled |= R_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; } - if (ctx->Pixel.HistogramEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.HistogramEnabled = state; break; - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); - ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; - if (state) { - insert_at_tail(&ctx->Light.EnabledList, - &ctx->Light.Light[cap-GL_LIGHT0]); - } - else { - remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); + case GL_TEXTURE_GEN_S: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; + if (state) + newenabled |= S_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; } break; - case GL_LIGHTING: - if (ctx->Light.Enabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); - ctx->Light.Enabled = state; - - if ((ctx->Light.Enabled && - ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) - || ctx->Fog.ColorSumEnabled) - ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; - else - ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; - - break; - case GL_LINE_SMOOTH: - if (ctx->Line.SmoothFlag == state) - return; - FLUSH_VERTICES(ctx, _NEW_LINE); - ctx->Line.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_LINE_SMOOTH; - break; - case GL_LINE_STIPPLE: - if (ctx->Line.StippleFlag == state) - return; - FLUSH_VERTICES(ctx, _NEW_LINE); - ctx->Line.StippleFlag = state; - ctx->_TriangleCaps ^= DD_LINE_STIPPLE; - break; - case GL_INDEX_LOGIC_OP: - if (ctx->Color.IndexLogicOpEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.IndexLogicOpEnabled = state; - break; - case GL_COLOR_LOGIC_OP: - if (ctx->Color.ColorLogicOpEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.ColorLogicOpEnabled = state; - break; - case GL_MAP1_COLOR_4: - if (ctx->Eval.Map1Color4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Color4 = state; - break; - case GL_MAP1_INDEX: - if (ctx->Eval.Map1Index == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Index = state; - break; - case GL_MAP1_NORMAL: - if (ctx->Eval.Map1Normal == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Normal = state; - break; - case GL_MAP1_TEXTURE_COORD_1: - if (ctx->Eval.Map1TextureCoord1 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1TextureCoord1 = state; - break; - case GL_MAP1_TEXTURE_COORD_2: - if (ctx->Eval.Map1TextureCoord2 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1TextureCoord2 = state; - break; - case GL_MAP1_TEXTURE_COORD_3: - if (ctx->Eval.Map1TextureCoord3 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1TextureCoord3 = state; - break; - case GL_MAP1_TEXTURE_COORD_4: - if (ctx->Eval.Map1TextureCoord4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1TextureCoord4 = state; - break; - case GL_MAP1_VERTEX_3: - if (ctx->Eval.Map1Vertex3 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Vertex3 = state; - break; - case GL_MAP1_VERTEX_4: - if (ctx->Eval.Map1Vertex4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Vertex4 = state; - break; - case GL_MAP2_COLOR_4: - if (ctx->Eval.Map2Color4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Color4 = state; - break; - case GL_MAP2_INDEX: - if (ctx->Eval.Map2Index == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Index = state; - break; - case GL_MAP2_NORMAL: - if (ctx->Eval.Map2Normal == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Normal = state; - break; - case GL_MAP2_TEXTURE_COORD_1: - if (ctx->Eval.Map2TextureCoord1 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2TextureCoord1 = state; - break; - case GL_MAP2_TEXTURE_COORD_2: - if (ctx->Eval.Map2TextureCoord2 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2TextureCoord2 = state; - break; - case GL_MAP2_TEXTURE_COORD_3: - if (ctx->Eval.Map2TextureCoord3 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2TextureCoord3 = state; - break; - case GL_MAP2_TEXTURE_COORD_4: - if (ctx->Eval.Map2TextureCoord4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2TextureCoord4 = state; - break; - case GL_MAP2_VERTEX_3: - if (ctx->Eval.Map2Vertex3 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Vertex3 = state; - break; - case GL_MAP2_VERTEX_4: - if (ctx->Eval.Map2Vertex4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Vertex4 = state; - break; - case GL_MINMAX: - if (ctx->Pixel.MinMaxEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.MinMaxEnabled = state; - break; - case GL_NORMALIZE: - if (ctx->Transform.Normalize == state) - return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.Normalize = state; - break; - case GL_POINT_SMOOTH: - if (ctx->Point.SmoothFlag==state) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_POINT_SMOOTH; - break; - case GL_POLYGON_SMOOTH: - if (ctx->Polygon.SmoothFlag==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_TRI_SMOOTH; - break; - case GL_POLYGON_STIPPLE: - if (ctx->Polygon.StippleFlag==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.StippleFlag = state; - ctx->_TriangleCaps ^= DD_TRI_STIPPLE; - break; - case GL_POLYGON_OFFSET_POINT: - if (ctx->Polygon.OffsetPoint==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.OffsetPoint = state; - break; - case GL_POLYGON_OFFSET_LINE: - if (ctx->Polygon.OffsetLine==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.OffsetLine = state; - break; - case GL_POLYGON_OFFSET_FILL: - /*case GL_POLYGON_OFFSET_EXT:*/ - if (ctx->Polygon.OffsetFill==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.OffsetFill = state; - break; - case GL_RESCALE_NORMAL_EXT: - if (ctx->Transform.RescaleNormals == state) - return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.RescaleNormals = state; - break; - case GL_SCISSOR_TEST: - if (ctx->Scissor.Enabled==state) - return; - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.Enabled = state; - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - if (ctx->Texture.SharedPalette == state) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - ctx->Texture.SharedPalette = state; - break; - case GL_STENCIL_TEST: - if (state && ctx->Visual.stencilBits==0) { - _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); - return; + case GL_TEXTURE_GEN_T: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; + if (state) + newenabled |= T_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; } - if (ctx->Stencil.Enabled==state) - return; - FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.Enabled = state; break; - case GL_TEXTURE_1D: { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_1D; - if (state) - newenabled |= TEXTURE0_1D; - if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Enabled = newenabled; - break; - } - case GL_TEXTURE_2D: { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D; - if (state) - newenabled |= TEXTURE0_2D; - if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Enabled = newenabled; - break; - } - case GL_TEXTURE_3D: { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D; - if (state) - newenabled |= TEXTURE0_3D; - if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Enabled = newenabled; - break; - } - case GL_TEXTURE_GEN_Q: { - GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; - if (state) - newenabled |= Q_BIT; - if (texUnit->TexGenEnabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->TexGenEnabled = newenabled; - break; - } - case GL_TEXTURE_GEN_R: { - GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; - if (state) - newenabled |= R_BIT; - if (texUnit->TexGenEnabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->TexGenEnabled = newenabled; - break; - } - break; - case GL_TEXTURE_GEN_S: { - GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; - if (state) - newenabled |= S_BIT; - if (texUnit->TexGenEnabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->TexGenEnabled = newenabled; - break; - } - break; - case GL_TEXTURE_GEN_T: { - GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; - if (state) - newenabled |= T_BIT; - if (texUnit->TexGenEnabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->TexGenEnabled = newenabled; - break; - } - break; - - /* - * CLIENT STATE!!! - */ - case GL_VERTEX_ARRAY: - case GL_NORMAL_ARRAY: - case GL_COLOR_ARRAY: - case GL_INDEX_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - case GL_EDGE_FLAG_ARRAY: - case GL_FOG_COORDINATE_ARRAY_EXT: - case GL_SECONDARY_COLOR_ARRAY_EXT: - client_state( ctx, cap, state ); - return; + + /* + * CLIENT STATE!!! + */ + case GL_VERTEX_ARRAY: + case GL_NORMAL_ARRAY: + case GL_COLOR_ARRAY: + case GL_INDEX_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + case GL_EDGE_FLAG_ARRAY: + case GL_FOG_COORDINATE_ARRAY_EXT: + case GL_SECONDARY_COLOR_ARRAY_EXT: + client_state( ctx, cap, state ); + return; /* GL_HP_occlusion_test */ - case GL_OCCLUSION_TEST_HP: - if (!ctx->Extensions.HP_occlusion_test) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Depth.OcclusionTest == state) - return; - FLUSH_VERTICES(ctx, _NEW_DEPTH); - ctx->Depth.OcclusionTest = state; - if (state) - ctx->OcclusionResult = ctx->OcclusionResultSaved; - else - ctx->OcclusionResultSaved = ctx->OcclusionResult; - break; + case GL_OCCLUSION_TEST_HP: + CHECK_EXTENSION(HP_occlusion_test); + if (ctx->Depth.OcclusionTest == state) + return; + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.OcclusionTest = state; + if (state) + ctx->OcclusionResult = ctx->OcclusionResultSaved; + else + ctx->OcclusionResultSaved = ctx->OcclusionResult; + break; /* GL_SGIS_pixel_texture */ - case GL_PIXEL_TEXTURE_SGIS: - if (!ctx->Extensions.SGIS_pixel_texture) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.PixelTextureEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PixelTextureEnabled = state; - break; + case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION(SGIS_pixel_texture); + if (ctx->Pixel.PixelTextureEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PixelTextureEnabled = state; + break; /* GL_SGIX_pixel_texture */ - case GL_PIXEL_TEX_GEN_SGIX: - if (!ctx->Extensions.SGIX_pixel_texture) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.PixelTextureEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PixelTextureEnabled = state; - break; + case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION(SGIX_pixel_texture); + if (ctx->Pixel.PixelTextureEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PixelTextureEnabled = state; + break; /* GL_SGI_color_table */ - case GL_COLOR_TABLE_SGI: - if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.ColorTableEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.ColorTableEnabled = state; - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.PostConvolutionColorTableEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionColorTableEnabled = state; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixColorTableEnabled = state; - break; + case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); + if (ctx->Pixel.ColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.ColorTableEnabled = state; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); + if (ctx->Pixel.PostConvolutionColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionColorTableEnabled = state; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); + if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixColorTableEnabled = state; + break; /* GL_EXT_convolution */ - case GL_CONVOLUTION_1D: - if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Pixel.Convolution1DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Convolution1DEnabled = state; - break; - case GL_CONVOLUTION_2D: - if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Pixel.Convolution2DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Convolution2DEnabled = state; - break; - case GL_SEPARABLE_2D: - if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Pixel.Separable2DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Separable2DEnabled = state; - break; + case GL_CONVOLUTION_1D: + CHECK_EXTENSION(EXT_convolution); + if (ctx->Pixel.Convolution1DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Convolution1DEnabled = state; + break; + case GL_CONVOLUTION_2D: + CHECK_EXTENSION(EXT_convolution); + if (ctx->Pixel.Convolution2DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Convolution2DEnabled = state; + break; + case GL_SEPARABLE_2D: + CHECK_EXTENSION(EXT_convolution); + if (ctx->Pixel.Separable2DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Separable2DEnabled = state; + break; /* GL_ARB_texture_cube_map */ - case GL_TEXTURE_CUBE_MAP_ARB: { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE; - if (state) - newenabled |= TEXTURE0_CUBE; - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Enabled = newenabled; - break; - } - /* GL_EXT_secondary_color */ - case GL_COLOR_SUM_EXT: - if (!ctx->Extensions.EXT_secondary_color) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Fog.ColorSumEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_FOG); - ctx->Fog.ColorSumEnabled = state; - - if ((ctx->Light.Enabled && - ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) - || ctx->Fog.ColorSumEnabled) - ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; - else - ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; + case GL_TEXTURE_CUBE_MAP_ARB: + { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE; + CHECK_EXTENSION(ARB_texture_cube_map); + if (state) + newenabled |= TEXTURE0_CUBE; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + } + break; - break; + /* GL_EXT_secondary_color */ + case GL_COLOR_SUM_EXT: + CHECK_EXTENSION(EXT_secondary_color); + if (ctx->Fog.ColorSumEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.ColorSumEnabled = state; + + if ((ctx->Light.Enabled && + ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) + || ctx->Fog.ColorSumEnabled) + ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; + else + ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; + + break; /* GL_ARB_multisample */ - case GL_MULTISAMPLE_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.Enabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.Enabled = state; - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.SampleAlphaToCoverage == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.SampleAlphaToCoverage = state; - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.SampleAlphaToOne == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.SampleAlphaToOne = state; - break; - case GL_SAMPLE_COVERAGE_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.SampleCoverage == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.SampleCoverage = state; - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.SampleCoverageInvert == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.SampleCoverageInvert = state; - break; + case GL_MULTISAMPLE_ARB: + CHECK_EXTENSION(ARB_multisample); + if (ctx->Multisample.Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.Enabled = state; + break; + case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: + CHECK_EXTENSION(ARB_multisample); + if (ctx->Multisample.SampleAlphaToCoverage == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleAlphaToCoverage = state; + break; + case GL_SAMPLE_ALPHA_TO_ONE_ARB: + CHECK_EXTENSION(ARB_multisample); + if (ctx->Multisample.SampleAlphaToOne == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleAlphaToOne = state; + break; + case GL_SAMPLE_COVERAGE_ARB: + CHECK_EXTENSION(ARB_multisample); + if (ctx->Multisample.SampleCoverage == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleCoverage = state; + break; + case GL_SAMPLE_COVERAGE_INVERT_ARB: + CHECK_EXTENSION(ARB_multisample); + if (ctx->Multisample.SampleCoverageInvert == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleCoverageInvert = state; + break; /* GL_IBM_rasterpos_clip */ - case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (!ctx->Extensions.IBM_rasterpos_clip) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Transform.RasterPositionUnclipped == state) - return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.RasterPositionUnclipped = state; - break; + case GL_RASTER_POSITION_UNCLIPPED_IBM: + CHECK_EXTENSION(IBM_rasterpos_clip); + if (ctx->Transform.RasterPositionUnclipped == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.RasterPositionUnclipped = state; + break; /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (!ctx->Extensions.MESA_sprite_point) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Point.SpriteMode == state) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SpriteMode = state; - break; + case GL_SPRITE_POINT_MESA: + CHECK_EXTENSION(MESA_sprite_point); + if (ctx->Point.SpriteMode == state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SpriteMode = state; + break; + + /* GL_NV_vertex_program */ + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION(NV_vertex_program); + if (ctx->VertexProgram.Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); /* XXX OK? */ + ctx->VertexProgram.Enabled = state; + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION(NV_vertex_program); + if (ctx->VertexProgram.PointSizeEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); /* XXX OK? */ + ctx->VertexProgram.PointSizeEnabled = state; + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION(NV_vertex_program); + if (ctx->VertexProgram.TwoSideEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); /* XXX OK? */ + ctx->VertexProgram.TwoSideEnabled = state; + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION(NV_vertex_program); + break; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION(NV_vertex_program); + break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; + default: + _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; } if (ctx->Driver.Enable) { @@ -843,6 +890,13 @@ _mesa_Disable( GLenum cap ) } +#undef CHECK_EXTENSION +#define CHECK_EXTENSION(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ + return GL_FALSE; \ + } + GLboolean _mesa_IsEnabled( GLenum cap ) @@ -872,14 +926,6 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Color.DitherFlag; case GL_FOG: return ctx->Fog.Enabled; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) { - return ctx->Pixel.HistogramEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } case GL_LIGHTING: return ctx->Light.Enabled; case GL_LIGHT0: @@ -935,8 +981,6 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Eval.Map2Vertex3; case GL_MAP2_VERTEX_4: return ctx->Eval.Map2Vertex4; - case GL_MINMAX: - return ctx->Pixel.MinMaxEnabled; case GL_NORMALIZE: return ctx->Transform.Normalize; case GL_POINT_SMOOTH: @@ -962,37 +1006,44 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Stencil.Enabled; case GL_TEXTURE_1D: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE0_1D) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_2D: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE0_2D) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_3D: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE0_3D) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_Q: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_R: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_S: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_T: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; } @@ -1012,107 +1063,154 @@ _mesa_IsEnabled( GLenum cap ) case GL_EDGE_FLAG_ARRAY: return ctx->Array.EdgeFlag.Enabled; + /* GL_EXT_histogram */ + case GL_HISTOGRAM: + CHECK_EXTENSION(EXT_histogram); + return ctx->Pixel.HistogramEnabled; + case GL_MINMAX: + CHECK_EXTENSION(EXT_histogram); + return ctx->Pixel.MinMaxEnabled; + /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - return ctx->Depth.OcclusionTest; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); - return GL_FALSE; - } + CHECK_EXTENSION(HP_occlusion_test); + return ctx->Depth.OcclusionTest; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION(SGIS_pixel_texture); return ctx->Pixel.PixelTextureEnabled; /* GL_SGIX_pixel_texture */ case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION(SGIX_pixel_texture); return ctx->Pixel.PixelTextureEnabled; /* GL_SGI_color_table */ case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.ColorTableEnabled; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.PostConvolutionColorTableEnabled; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.PostColorMatrixColorTableEnabled; /* GL_EXT_convolution */ case GL_CONVOLUTION_1D: + CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Convolution1DEnabled; case GL_CONVOLUTION_2D: + CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Convolution2DEnabled; case GL_SEPARABLE_2D: + CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Separable2DEnabled; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + CHECK_EXTENSION(ARB_texture_cube_map); + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE; } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.Enabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.Enabled; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.SampleAlphaToCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleAlphaToCoverage; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.SampleAlphaToOne; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleAlphaToOne; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.SampleCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleCoverage; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.SampleCoverageInvert; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleCoverageInvert; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - return ctx->Transform.RasterPositionUnclipped; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(IBM_rasterpos_clip); + return ctx->Transform.RasterPositionUnclipped; /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: return ctx->Point.SpriteMode; + /* GL_NV_vertex_program */ + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.Enabled; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.PointSizeEnabled; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.TwoSideEnabled; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION(NV_vertex_program); + { + GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; + return ctx->Array.VertexAttrib[n].Enabled; + } + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION(NV_vertex_program); + return GL_FALSE; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION(NV_vertex_program); + return GL_FALSE; + default: _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); return GL_FALSE; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 75bbb05281a..ee8eb4f5383 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.67 2001/12/04 23:44:55 brianp Exp $ */ +/* $Id: extensions.c,v 1.68 2001/12/14 02:50:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -112,6 +112,7 @@ static struct { { ON, "GL_MESA_window_pos", F(MESA_window_pos) }, { OFF, "GL_NV_blend_square", F(NV_blend_square) }, { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, + { OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, { OFF, "GL_SGI_color_table", F(SGI_color_table) }, { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, @@ -170,6 +171,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) "GL_MESA_resize_buffers", "GL_NV_blend_square", "GL_NV_texgen_reflection", + "GL_NV_vertex_program", "GL_SGI_color_matrix", "GL_SGI_color_table", "GL_SGIS_generate_mipmap", diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 2e513056019..a6a4d12d4c8 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.73 2001/12/04 23:44:56 brianp Exp $ */ +/* $Id: get.c,v 1.74 2001/12/14 02:55:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -59,6 +59,34 @@ #endif +/* Check if named extension is enabled, if not generate error and return */ + +#define CHECK_EXTENSION_B(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanv"); \ + return; \ + } + +#define CHECK_EXTENSION_I(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerv"); \ + return; \ + } + +#define CHECK_EXTENSION_F(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_VALUE, "glGetFloatv"); \ + return; \ + } + +#define CHECK_EXTENSION_D(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_VALUE, "glGetDoublev"); \ + return; \ + } + + + static GLenum pixel_texgen_mode(const GLcontext *ctx) @@ -231,10 +259,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_CURRENT_COLOR: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOL(ctx->Current.Color[0]); - params[1] = FLOAT_TO_BOOL(ctx->Current.Color[1]); - params[2] = FLOAT_TO_BOOL(ctx->Current.Color[2]); - params[3] = FLOAT_TO_BOOL(ctx->Current.Color[3]); + params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); + params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); + params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); + params[3] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); break; case GL_CURRENT_INDEX: FLUSH_CURRENT(ctx, 0); @@ -242,9 +270,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_CURRENT_NORMAL: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOL(ctx->Current.Normal[0]); - params[1] = FLOAT_TO_BOOL(ctx->Current.Normal[1]); - params[2] = FLOAT_TO_BOOL(ctx->Current.Normal[2]); + params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); + params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); + params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_BOOL(ctx->Current.RasterColor[0]); @@ -275,10 +303,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_CURRENT_TEXTURE_COORDS: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texUnit][0]); - params[1] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texUnit][1]); - params[2] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texUnit][2]); - params[3] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texUnit][3]); + params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]); + params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]); + params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]); + params[3] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]); break; case GL_DEPTH_BIAS: *params = FLOAT_TO_BOOL(ctx->Pixel.DepthBias); @@ -363,15 +391,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_GREEN_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram) { - *params = ctx->Pixel.HistogramEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } - break; case GL_INDEX_BITS: *params = INT_TO_BOOL( ctx->Visual.indexBits ); break; @@ -595,9 +614,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = INT_TO_BOOL(MAX_WIDTH); params[1] = INT_TO_BOOL(MAX_HEIGHT); break; - case GL_MINMAX: - *params = ctx->Pixel.MinMaxEnabled; - break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(ctx->ModelView.m[i]); @@ -983,47 +999,34 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; + CHECK_EXTENSION_B(ARB_texture_cube_map); + *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; + CHECK_EXTENSION_B(ARB_texture_cube_map); + *params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name); + break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = INT_TO_BOOL(1 << (ctx->Const.MaxCubeTextureLevels - 1)); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + CHECK_EXTENSION_B(ARB_texture_cube_map); + *params = INT_TO_BOOL(1 << (ctx->Const.MaxCubeTextureLevels - 1)); break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = INT_TO_BOOL(ctx->Hint.TextureCompression); - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + CHECK_EXTENSION_B(ARB_texture_compression); + *params = INT_TO_BOOL(ctx->Hint.TextureCompression); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = INT_TO_BOOL(ctx->Const.NumCompressedTextureFormats); - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + CHECK_EXTENSION_B(ARB_texture_compression); + *params = INT_TO_BOOL(ctx->Const.NumCompressedTextureFormats); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { + CHECK_EXTENSION_B(ARB_texture_compression); + { GLuint i; for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) params[i] = INT_TO_BOOL(ctx->Const.CompressedTextureFormats[i]); } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); break; /* GL_EXT_compiled_vertex_array */ @@ -1078,26 +1081,18 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - *params = ctx->Depth.OcclusionTest; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - } + CHECK_EXTENSION_B(HP_occlusion_test); + *params = ctx->Depth.OcclusionTest; return; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HP_occlusion_test) { - if (ctx->Depth.OcclusionTest) - *params = ctx->OcclusionResult; - else - *params = ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - } + CHECK_EXTENSION_B(HP_occlusion_test); + if (ctx->Depth.OcclusionTest) + *params = ctx->OcclusionResult; + else + *params = ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; return; /* GL_SGIS_pixel_texture */ @@ -1152,63 +1147,68 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_convolution (also in 1.2 imaging) */ case GL_CONVOLUTION_1D_EXT: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = ctx->Pixel.Convolution1DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(EXT_convolution); + *params = ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = ctx->Pixel.Convolution2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(EXT_convolution); + *params = ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = ctx->Pixel.Separable2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(EXT_convolution); + *params = ctx->Pixel.Separable2DEnabled; break; case GL_MAX_CONVOLUTION_WIDTH: + CHECK_EXTENSION_B(EXT_convolution); *params = INT_TO_BOOL(ctx->Const.MaxConvolutionWidth); break; case GL_MAX_CONVOLUTION_HEIGHT: + CHECK_EXTENSION_B(EXT_convolution); *params = INT_TO_BOOL(ctx->Const.MaxConvolutionHeight); break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[0]); break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[1]); break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[2]); break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[3]); break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[0]); break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[1]); break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); break; + /* GL_EXT_histogram (also in 1.2 imaging) */ + case GL_HISTOGRAM: + CHECK_EXTENSION_B(EXT_histogram); + *params = ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_B(EXT_histogram); + *params = ctx->Pixel.MinMaxEnabled; + break; + /* GL_SGI_color_table (also in 1.2 imaging */ case GL_COLOR_TABLE_SGI: *params = ctx->Pixel.ColorTableEnabled; @@ -1222,39 +1222,49 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_B(EXT_secondary_color); *params = ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_B(EXT_secondary_color); FLUSH_CURRENT(ctx, 0); - params[0] = INT_TO_BOOL(ctx->Current.SecondaryColor[0]); - params[1] = INT_TO_BOOL(ctx->Current.SecondaryColor[1]); - params[2] = INT_TO_BOOL(ctx->Current.SecondaryColor[2]); + params[0] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); + params[1] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); + params[2] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); break; case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_B(EXT_secondary_color); *params = ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color); *params = ENUM_TO_BOOL(ctx->Array.SecondaryColor.Type); break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color); *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride); break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color); *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride); break; /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord); FLUSH_CURRENT(ctx, 0); - *params = FLOAT_TO_BOOL(ctx->Current.FogCoord); + *params = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); break; case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_B(EXT_fog_coord); *params = ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord); *params = ENUM_TO_BOOL(ctx->Array.FogCoord.Type); break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord); *params = INT_TO_BOOL(ctx->Array.FogCoord.Stride); break; @@ -1265,120 +1275,160 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_texture_filter_anisotropic */ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = FLOAT_TO_BOOL(ctx->Const.MaxTextureMaxAnisotropy); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - return; - } + CHECK_EXTENSION_B(EXT_texture_filter_anisotropic); + *params = FLOAT_TO_BOOL(ctx->Const.MaxTextureMaxAnisotropy); break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.Enabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample); + *params = ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleAlphaToCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample); + *params = ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleAlphaToOne; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample); + *params = ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample); + *params = ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = FLOAT_TO_BOOL(ctx->Multisample.SampleCoverageValue); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample); + *params = FLOAT_TO_BOOL(ctx->Multisample.SampleCoverageValue); break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleCoverageInvert; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample); + *params = ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample); + *params = 0; /* XXX fix someday */ break; case GL_SAMPLES_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample); + *params = 0; /* XXX fix someday */ break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - *params = ctx->Transform.RasterPositionUnclipped; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBoolean"); - return; - } + CHECK_EXTENSION_B(IBM_rasterpos_clip); + *params = ctx->Transform.RasterPositionUnclipped; break; /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - return; - } + CHECK_EXTENSION_B(MESA_sprite_point); + *params = ctx->Point.SpriteMode; break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = ENUM_TO_BOOL(ctx->Hint.GenerateMipmap); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(SGIS_generate_mipmap); + *params = ENUM_TO_BOOL(ctx->Hint.GenerateMipmap); + break; + + /* GL_NV_vertex_program */ + case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = VP_MAX_MATRIX_DEPTH; + break; + case GL_MAX_TRACK_MATRICES_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = VP_MAX_MATRICES; + break; + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = ctx->VertexProgram.Enabled; + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = ctx->VertexProgram.PointSizeEnabled; + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = ctx->VertexProgram.TwoSideEnabled; + break; + case GL_CURRENT_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = 0; + break; + case GL_CURRENT_MATRIX_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = 0; + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = 0; + break; + case GL_PROGRAM_ERROR_POSITION_NV: + CHECK_EXTENSION_B(NV_vertex_program); + *params = 0; + break; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION_B(NV_vertex_program); + { + GLuint n = (GLint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; + *params = ctx->Array.VertexAttrib[n].Enabled; + } + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program); + _mesa_problem(ctx, "glGetBoolean NV token not implemented"); + *params = 0; + break; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program); + _mesa_problem(ctx, "glGetBoolean NV token not implemented"); + *params = 0; break; default: @@ -1535,10 +1585,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_CURRENT_COLOR: FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.Color[0]); - params[1] = (ctx->Current.Color[1]); - params[2] = (ctx->Current.Color[2]); - params[3] = (ctx->Current.Color[3]); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; + params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; break; case GL_CURRENT_INDEX: FLUSH_CURRENT(ctx, 0); @@ -1546,9 +1596,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_CURRENT_NORMAL: FLUSH_CURRENT(ctx, 0); - params[0] = (GLdouble) ctx->Current.Normal[0]; - params[1] = (GLdouble) ctx->Current.Normal[1]; - params[2] = (GLdouble) ctx->Current.Normal[2]; + params[0] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; + params[1] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; + params[2] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; break; case GL_CURRENT_RASTER_COLOR: params[0] = (GLdouble) ctx->Current.RasterColor[0]; @@ -1579,10 +1629,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_CURRENT_TEXTURE_COORDS: FLUSH_CURRENT(ctx, 0); - params[0] = (GLdouble) ctx->Current.Texcoord[texUnit][0]; - params[1] = (GLdouble) ctx->Current.Texcoord[texUnit][1]; - params[2] = (GLdouble) ctx->Current.Texcoord[texUnit][2]; - params[3] = (GLdouble) ctx->Current.Texcoord[texUnit][3]; + params[0] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; + params[1] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; + params[2] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; + params[3] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; break; case GL_DEPTH_BIAS: *params = (GLdouble) ctx->Pixel.DepthBias; @@ -1667,15 +1717,6 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_GREEN_SCALE: *params = (GLdouble) ctx->Pixel.GreenScale; break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) { - *params = (GLdouble) ctx->Pixel.HistogramEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } - break; case GL_INDEX_BITS: *params = (GLdouble) ctx->Visual.indexBits; break; @@ -1899,9 +1940,6 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) params[0] = (GLdouble) MAX_WIDTH; params[1] = (GLdouble) MAX_HEIGHT; break; - case GL_MINMAX: - *params = (GLdouble) ctx->Pixel.MinMaxEnabled; - break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = (GLdouble) ctx->ModelView.m[i]; @@ -2287,47 +2325,34 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; + CHECK_EXTENSION_D(ARB_texture_cube_map); + *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLdouble) textureUnit->CurrentCubeMap->Name; - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; + CHECK_EXTENSION_D(ARB_texture_cube_map); + *params = (GLdouble) textureUnit->CurrentCubeMap->Name; + break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLdouble) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; + CHECK_EXTENSION_D(ARB_texture_cube_map); + *params = (GLdouble) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLdouble) ctx->Hint.TextureCompression; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + CHECK_EXTENSION_D(ARB_texture_compression); + *params = (GLdouble) ctx->Hint.TextureCompression; break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLdouble) ctx->Const.NumCompressedTextureFormats; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + CHECK_EXTENSION_D(ARB_texture_compression); + *params = (GLdouble) ctx->Const.NumCompressedTextureFormats; break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { + CHECK_EXTENSION_D(ARB_texture_compression); + { GLuint i; for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) params[i] = (GLdouble) ctx->Const.CompressedTextureFormats[i]; } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); break; /* GL_EXT_compiled_vertex_array */ @@ -2382,27 +2407,19 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - *params = (GLdouble) ctx->Depth.OcclusionTest; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - } - return; + CHECK_EXTENSION_D(HP_occlusion_test); + *params = (GLdouble) ctx->Depth.OcclusionTest; + break; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HP_occlusion_test) { - if (ctx->Depth.OcclusionTest) - *params = (GLdouble) ctx->OcclusionResult; - else - *params = (GLdouble) ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - } - return; + CHECK_EXTENSION_D(HP_occlusion_test); + if (ctx->Depth.OcclusionTest) + *params = (GLdouble) ctx->OcclusionResult; + else + *params = (GLdouble) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + break; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: @@ -2456,63 +2473,68 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_convolution (also in 1.2 imaging) */ case GL_CONVOLUTION_1D_EXT: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLdouble) ctx->Pixel.Convolution1DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(EXT_convolution); + *params = (GLdouble) ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLdouble) ctx->Pixel.Convolution2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(EXT_convolution); + *params = (GLdouble) ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLdouble) ctx->Pixel.Separable2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(EXT_convolution); + *params = (GLdouble) ctx->Pixel.Separable2DEnabled; break; case GL_MAX_CONVOLUTION_WIDTH: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Const.MaxConvolutionWidth; break; case GL_MAX_CONVOLUTION_HEIGHT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Const.MaxConvolutionHeight; break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Pixel.PostConvolutionScale[0]; break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Pixel.PostConvolutionScale[1]; break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Pixel.PostConvolutionScale[2]; break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Pixel.PostConvolutionScale[3]; break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Pixel.PostConvolutionBias[0]; break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Pixel.PostConvolutionBias[1]; break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_D(EXT_convolution); *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; break; + /* GL_EXT_histogram (also in 1.2 imaging) */ + case GL_HISTOGRAM: + CHECK_EXTENSION_D(EXT_histogram); + *params = (GLdouble) ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_D(EXT_histogram); + *params = (GLdouble) ctx->Pixel.MinMaxEnabled; + break; + /* GL_SGI_color_table (also in 1.2 imaging */ case GL_COLOR_TABLE_SGI: *params = (GLdouble) ctx->Pixel.ColorTableEnabled; @@ -2526,39 +2548,49 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_D(EXT_secondary_color); *params = (GLdouble) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_D(EXT_secondary_color); FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.SecondaryColor[0]); - params[1] = (ctx->Current.SecondaryColor[1]); - params[2] = (ctx->Current.SecondaryColor[2]); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; break; case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_D(EXT_secondary_color); *params = (GLdouble) ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_D(EXT_secondary_color); *params = (GLdouble) ctx->Array.SecondaryColor.Type; break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_D(EXT_secondary_color); *params = (GLdouble) ctx->Array.SecondaryColor.Stride; break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_D(EXT_secondary_color); *params = (GLdouble) ctx->Array.SecondaryColor.Stride; break; /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_D(EXT_fog_coord); FLUSH_CURRENT(ctx, 0); - *params = (GLdouble) ctx->Current.FogCoord; + *params = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; break; case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_D(EXT_fog_coord); *params = (GLdouble) ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_D(EXT_fog_coord); *params = (GLdouble) ctx->Array.FogCoord.Type; break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_D(EXT_fog_coord); *params = (GLdouble) ctx->Array.FogCoord.Stride; break; @@ -2569,122 +2601,65 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_texture_filter_anisotropic */ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = (GLdouble) ctx->Const.MaxTextureMaxAnisotropy; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - return; - } + CHECK_EXTENSION_D(EXT_texture_filter_anisotropic); + *params = (GLdouble) ctx->Const.MaxTextureMaxAnisotropy; break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.Enabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample); + *params = (GLdouble) ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.SampleAlphaToCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample); + *params = (GLdouble) ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.SampleAlphaToOne; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample); + *params = (GLdouble) ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.SampleCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample); + *params = (GLdouble) ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleCoverageValue; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample); + *params = ctx->Multisample.SampleCoverageValue; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.SampleCoverageInvert; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample); + *params = (GLdouble) ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0.0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample); + *params = 0.0; /* XXX fix someday */ break; case GL_SAMPLES_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0.0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample); + *params = 0.0; /* XXX fix someday */ break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - *params = (GLdouble) ctx->Transform.RasterPositionUnclipped; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(IBM_rasterpos_clip); + *params = (GLdouble) ctx->Transform.RasterPositionUnclipped; break; /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLdouble) ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - return; - } + CHECK_EXTENSION_D(MESA_sprite_point); + *params = (GLdouble) ctx->Point.SpriteMode; break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLdouble) ctx->Hint.GenerateMipmap; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(SGIS_generate_mipmap); + *params = (GLdouble) ctx->Hint.GenerateMipmap; break; + /* GL_NV_vertex_program */ + /* to do */ + default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); } @@ -2846,10 +2821,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_CURRENT_COLOR: FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.Color[0]); - params[1] = (ctx->Current.Color[1]); - params[2] = (ctx->Current.Color[2]); - params[3] = (ctx->Current.Color[3]); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; + params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; break; case GL_CURRENT_INDEX: FLUSH_CURRENT(ctx, 0); @@ -2857,9 +2832,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_CURRENT_NORMAL: FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Normal[0]; - params[1] = ctx->Current.Normal[1]; - params[2] = ctx->Current.Normal[2]; + params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; break; case GL_CURRENT_RASTER_COLOR: params[0] = ctx->Current.RasterColor[0]; @@ -2890,10 +2865,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_CURRENT_TEXTURE_COORDS: FLUSH_CURRENT(ctx, 0); - params[0] = (GLfloat) ctx->Current.Texcoord[texUnit][0]; - params[1] = (GLfloat) ctx->Current.Texcoord[texUnit][1]; - params[2] = (GLfloat) ctx->Current.Texcoord[texUnit][2]; - params[3] = (GLfloat) ctx->Current.Texcoord[texUnit][3]; + params[0] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; + params[1] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; + params[2] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; + params[3] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; break; case GL_DEPTH_BIAS: *params = (GLfloat) ctx->Pixel.DepthBias; @@ -2978,15 +2953,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_GREEN_SCALE: *params = (GLfloat) ctx->Pixel.GreenScale; break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) { - *params = (GLfloat) ctx->Pixel.HistogramEnabled; - } - else { - GET_FLOAT_ERROR; - return; - } - break; case GL_INDEX_BITS: *params = (GLfloat) ctx->Visual.indexBits; break; @@ -3210,9 +3176,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat) MAX_WIDTH; params[1] = (GLfloat) MAX_HEIGHT; break; - case GL_MINMAX: - *params = (GLfloat) ctx->Pixel.MinMaxEnabled; - break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = ctx->ModelView.m[i]; @@ -3600,54 +3563,43 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - else - GET_FLOAT_ERROR; - return; + CHECK_EXTENSION_F(ARB_texture_cube_map); + *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLfloat) textureUnit->CurrentCubeMap->Name; - else - GET_FLOAT_ERROR; - return; + CHECK_EXTENSION_F(ARB_texture_cube_map); + *params = (GLfloat) textureUnit->CurrentCubeMap->Name; + break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLfloat) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); - else - GET_FLOAT_ERROR; - return; + CHECK_EXTENSION_F(ARB_texture_cube_map); + *params = (GLfloat) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLfloat) ctx->Hint.TextureCompression; - } - else - GET_FLOAT_ERROR; + CHECK_EXTENSION_F(ARB_texture_compression); + *params = (GLfloat) ctx->Hint.TextureCompression; break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLfloat) ctx->Const.NumCompressedTextureFormats; - } - else - GET_FLOAT_ERROR; + CHECK_EXTENSION_F(ARB_texture_compression); + *params = (GLfloat) ctx->Const.NumCompressedTextureFormats; break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { + CHECK_EXTENSION_F(ARB_texture_compression); + { GLuint i; for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) params[i] = (GLfloat) ctx->Const.CompressedTextureFormats[i]; } - else - GET_FLOAT_ERROR; break; /* GL_EXT_compiled_vertex_array */ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: + CHECK_EXTENSION_F(EXT_compiled_vertex_array); *params = (GLfloat) ctx->Array.LockFirst; break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: + CHECK_EXTENSION_F(EXT_compiled_vertex_array); *params = (GLfloat) ctx->Array.LockCount; break; @@ -3667,27 +3619,19 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - *params = (GLfloat) ctx->Depth.OcclusionTest; - } - else { - GET_FLOAT_ERROR; - } - return; + CHECK_EXTENSION_F(HP_occlusion_test); + *params = (GLfloat) ctx->Depth.OcclusionTest; + break; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HP_occlusion_test) { - if (ctx->Depth.OcclusionTest) - *params = (GLfloat) ctx->OcclusionResult; - else - *params = (GLfloat) ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - } - else { - GET_FLOAT_ERROR; - } - return; + CHECK_EXTENSION_F(HP_occlusion_test); + if (ctx->Depth.OcclusionTest) + *params = (GLfloat) ctx->OcclusionResult; + else + *params = (GLfloat) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + break; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: @@ -3741,63 +3685,68 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_convolution (also in 1.2 imaging) */ case GL_CONVOLUTION_1D_EXT: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLfloat) ctx->Pixel.Convolution1DEnabled; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(EXT_convolution); + *params = (GLfloat) ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLfloat) ctx->Pixel.Convolution2DEnabled; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(EXT_convolution); + *params = (GLfloat) ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLfloat) ctx->Pixel.Separable2DEnabled; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(EXT_convolution); + *params = (GLfloat) ctx->Pixel.Separable2DEnabled; break; case GL_MAX_CONVOLUTION_WIDTH: + CHECK_EXTENSION_F(EXT_convolution); *params = (GLfloat) ctx->Const.MaxConvolutionWidth; break; case GL_MAX_CONVOLUTION_HEIGHT: + CHECK_EXTENSION_F(EXT_convolution); *params = (GLfloat) ctx->Const.MaxConvolutionHeight; break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution); *params = ctx->Pixel.PostConvolutionScale[0]; break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution); *params = ctx->Pixel.PostConvolutionScale[1]; break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution); *params = ctx->Pixel.PostConvolutionScale[2]; break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution); *params = ctx->Pixel.PostConvolutionScale[3]; break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution); *params = ctx->Pixel.PostConvolutionBias[0]; break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution); *params = ctx->Pixel.PostConvolutionBias[1]; break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution); *params = ctx->Pixel.PostConvolutionBias[2]; break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution); *params = ctx->Pixel.PostConvolutionBias[2]; break; + /* GL_EXT_histogram (also in 1.2 imaging) */ + case GL_HISTOGRAM: + CHECK_EXTENSION_F(EXT_histogram); + *params = (GLfloat) ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_F(EXT_histogram); + *params = (GLfloat) ctx->Pixel.MinMaxEnabled; + break; + /* GL_SGI_color_table (also in 1.2 imaging */ case GL_COLOR_TABLE_SGI: *params = (GLfloat) ctx->Pixel.ColorTableEnabled; @@ -3811,39 +3760,49 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_F(EXT_secondary_color); *params = (GLfloat) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_F(EXT_secondary_color); FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.SecondaryColor[0]); - params[1] = (ctx->Current.SecondaryColor[1]); - params[2] = (ctx->Current.SecondaryColor[2]); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; break; case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_F(EXT_secondary_color); *params = (GLfloat) ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color); *params = (GLfloat) ctx->Array.SecondaryColor.Type; break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color); *params = (GLfloat) ctx->Array.SecondaryColor.Stride; break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color); *params = (GLfloat) ctx->Array.SecondaryColor.Stride; break; /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord); FLUSH_CURRENT(ctx, 0); - *params = (GLfloat) ctx->Current.FogCoord; + *params = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; break; case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_F(EXT_fog_coord); *params = (GLfloat) ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord); *params = (GLfloat) ctx->Array.FogCoord.Type; break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord); *params = (GLfloat) ctx->Array.FogCoord.Stride; break; @@ -3854,122 +3813,65 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_texture_filter_anisotropic */ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = ctx->Const.MaxTextureMaxAnisotropy; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(EXT_texture_filter_anisotropic); + *params = ctx->Const.MaxTextureMaxAnisotropy; break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.Enabled; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample); + *params = (GLfloat) ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.SampleAlphaToCoverage; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample); + *params = (GLfloat) ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.SampleAlphaToOne; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample); + *params = (GLfloat) ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.SampleCoverage; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample); + *params = (GLfloat) ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleCoverageValue; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample); + *params = ctx->Multisample.SampleCoverageValue; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.SampleCoverageInvert; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample); + *params = (GLfloat) ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0.0; /* XXX fix someday */ - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample); + *params = 0.0; /* XXX fix someday */ break; case GL_SAMPLES_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0.0; /* XXX fix someday */ - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample); + *params = 0.0; /* XXX fix someday */ break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - *params = (GLfloat) ctx->Transform.RasterPositionUnclipped; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(IBM_rasterpos_clip); + *params = (GLfloat) ctx->Transform.RasterPositionUnclipped; break; /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLfloat) ctx->Point.SpriteMode; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(MESA_sprite_point); + *params = (GLfloat) ctx->Point.SpriteMode; break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLfloat) ctx->Hint.GenerateMipmap; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(SGIS_generate_mipmap); + *params = (GLfloat) ctx->Hint.GenerateMipmap; break; + /* GL_NV_vertex_program */ + /* to do */ + default: GET_FLOAT_ERROR; } @@ -4126,10 +4028,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_CURRENT_COLOR: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT( ( ctx->Current.Color[0] ) ); - params[1] = FLOAT_TO_INT( ( ctx->Current.Color[1] ) ); - params[2] = FLOAT_TO_INT( ( ctx->Current.Color[2] ) ); - params[3] = FLOAT_TO_INT( ( ctx->Current.Color[3] ) ); + params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); + params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); + params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); + params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); break; case GL_CURRENT_INDEX: FLUSH_CURRENT(ctx, 0); @@ -4137,9 +4039,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_CURRENT_NORMAL: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT( ctx->Current.Normal[0] ); - params[1] = FLOAT_TO_INT( ctx->Current.Normal[1] ); - params[2] = FLOAT_TO_INT( ctx->Current.Normal[2] ); + params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); + params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); + params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_INT( ctx->Current.RasterColor[0] ); @@ -4170,10 +4072,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_CURRENT_TEXTURE_COORDS: FLUSH_CURRENT(ctx, 0); - params[0] = (GLint) ctx->Current.Texcoord[texUnit][0]; - params[1] = (GLint) ctx->Current.Texcoord[texUnit][1]; - params[2] = (GLint) ctx->Current.Texcoord[texUnit][2]; - params[3] = (GLint) ctx->Current.Texcoord[texUnit][3]; + params[0] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; + params[1] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; + params[2] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; + params[3] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; break; case GL_DEPTH_BIAS: *params = (GLint) ctx->Pixel.DepthBias; @@ -4258,15 +4160,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_GREEN_SCALE: *params = (GLint) ctx->Pixel.GreenScale; break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) { - *params = (GLint) ctx->Pixel.HistogramEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); - return; - } - break; case GL_INDEX_BITS: *params = (GLint) ctx->Visual.indexBits; break; @@ -4490,9 +4383,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = (GLint) MAX_WIDTH; params[1] = (GLint) MAX_HEIGHT; break; - case GL_MINMAX: - *params = (GLint) ctx->Pixel.MinMaxEnabled; - break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = (GLint) ctx->ModelView.m[i]; @@ -4878,54 +4768,43 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; + CHECK_EXTENSION_I(ARB_texture_cube_map); + *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = textureUnit->CurrentCubeMap->Name; - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; + CHECK_EXTENSION_I(ARB_texture_cube_map); + *params = textureUnit->CurrentCubeMap->Name; + break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; + CHECK_EXTENSION_I(ARB_texture_cube_map); + *params = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLint) ctx->Hint.TextureCompression; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + CHECK_EXTENSION_I(ARB_texture_compression); + *params = (GLint) ctx->Hint.TextureCompression; break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLint) ctx->Const.NumCompressedTextureFormats; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + CHECK_EXTENSION_I(ARB_texture_compression); + *params = (GLint) ctx->Const.NumCompressedTextureFormats; break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { + CHECK_EXTENSION_I(ARB_texture_compression); + { GLuint i; for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) params[i] = (GLint) ctx->Const.CompressedTextureFormats[i]; } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); break; /* GL_EXT_compiled_vertex_array */ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: + CHECK_EXTENSION_I(EXT_compiled_vertex_array); *params = ctx->Array.LockFirst; break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: + CHECK_EXTENSION_I(EXT_compiled_vertex_array); *params = ctx->Array.LockCount; break; @@ -4973,205 +4852,209 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - *params = (GLint) ctx->Depth.OcclusionTest; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } - return; + CHECK_EXTENSION_I(HP_occlusion_test); + *params = (GLint) ctx->Depth.OcclusionTest; + break; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HP_occlusion_test) { - if (ctx->Depth.OcclusionTest) - *params = (GLint) ctx->OcclusionResult; - else - *params = (GLint) ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } - return; + CHECK_EXTENSION_I(HP_occlusion_test); + if (ctx->Depth.OcclusionTest) + *params = (GLint) ctx->OcclusionResult; + else + *params = (GLint) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + break; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION_I(SGIS_pixel_texture); *params = (GLint) ctx->Pixel.PixelTextureEnabled; break; /* GL_SGIX_pixel_texture */ case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION_I(SGIX_pixel_texture); *params = (GLint) ctx->Pixel.PixelTextureEnabled; break; case GL_PIXEL_TEX_GEN_MODE_SGIX: + CHECK_EXTENSION_I(SGIX_pixel_texture); *params = (GLint) pixel_texgen_mode(ctx); break; /* GL_SGI_color_matrix (also in 1.2 imaging) */ case GL_COLOR_MATRIX_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); for (i=0;i<16;i++) { params[i] = (GLint) ctx->ColorMatrix.m[i]; } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = ctx->ColorStackDepth + 1; break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = MAX_COLOR_STACK_DEPTH; break; case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = (GLint) ctx->Pixel.PostColorMatrixScale[0]; break; case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = (GLint) ctx->Pixel.PostColorMatrixScale[1]; break; case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = (GLint) ctx->Pixel.PostColorMatrixScale[2]; break; case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = (GLint) ctx->Pixel.PostColorMatrixScale[3]; break; case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = (GLint) ctx->Pixel.PostColorMatrixBias[0]; break; case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = (GLint) ctx->Pixel.PostColorMatrixBias[1]; break; case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = (GLint) ctx->Pixel.PostColorMatrixBias[2]; break; case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + CHECK_EXTENSION_I(SGI_color_matrix); *params = (GLint) ctx->Pixel.PostColorMatrixBias[3]; break; /* GL_EXT_convolution (also in 1.2 imaging) */ case GL_CONVOLUTION_1D_EXT: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLint) ctx->Pixel.Convolution1DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(EXT_convolution); + *params = (GLint) ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLint) ctx->Pixel.Convolution2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(EXT_convolution); + *params = (GLint) ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLint) ctx->Pixel.Separable2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(EXT_convolution); + *params = (GLint) ctx->Pixel.Separable2DEnabled; break; case GL_MAX_CONVOLUTION_WIDTH: + CHECK_EXTENSION_I(EXT_convolution); *params = ctx->Const.MaxConvolutionWidth; break; case GL_MAX_CONVOLUTION_HEIGHT: + CHECK_EXTENSION_I(EXT_convolution); *params = ctx->Const.MaxConvolutionHeight; break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution); *params = (GLint) ctx->Pixel.PostConvolutionScale[0]; break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution); *params = (GLint) ctx->Pixel.PostConvolutionScale[1]; break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution); *params = (GLint) ctx->Pixel.PostConvolutionScale[2]; break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution); *params = (GLint) ctx->Pixel.PostConvolutionScale[3]; break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution); *params = (GLint) ctx->Pixel.PostConvolutionBias[0]; break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution); *params = (GLint) ctx->Pixel.PostConvolutionBias[1]; break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution); *params = (GLint) ctx->Pixel.PostConvolutionBias[2]; break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution); *params = (GLint) ctx->Pixel.PostConvolutionBias[2]; break; + /* GL_EXT_histogram (also in 1.2 imaging) */ + case GL_HISTOGRAM: + CHECK_EXTENSION_I(EXT_histogram); + *params = (GLint) ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_I(EXT_histogram); + *params = (GLint) ctx->Pixel.MinMaxEnabled; + break; + /* GL_SGI_color_table (also in 1.2 imaging */ case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table); *params = (GLint) ctx->Pixel.ColorTableEnabled; break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table); *params = (GLint) ctx->Pixel.PostConvolutionColorTableEnabled; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table); *params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled; break; /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_I(EXT_secondary_color); *params = (GLint) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_I(EXT_secondary_color); FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[0]) ); - params[1] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[1]) ); - params[2] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[2]) ); + params[0] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]) ); + params[1] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]) ); + params[2] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]) ); break; case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_I(EXT_secondary_color); *params = (GLint) ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color); *params = (GLint) ctx->Array.SecondaryColor.Type; break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color); *params = (GLint) ctx->Array.SecondaryColor.Stride; break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color); *params = (GLint) ctx->Array.SecondaryColor.Stride; break; /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: - if (ctx->Extensions.EXT_fog_coord) { - FLUSH_CURRENT(ctx, 0); - *params = (GLint) ctx->Current.FogCoord; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } + CHECK_EXTENSION_I(EXT_fog_coord); + FLUSH_CURRENT(ctx, 0); + *params = (GLint) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; break; case GL_FOG_COORDINATE_ARRAY_EXT: - if (ctx->Extensions.EXT_fog_coord) { - *params = (GLint) ctx->Array.FogCoord.Enabled; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } + CHECK_EXTENSION_I(EXT_fog_coord); + *params = (GLint) ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - if (ctx->Extensions.EXT_fog_coord) { - *params = (GLint) ctx->Array.FogCoord.Type; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } + CHECK_EXTENSION_I(EXT_fog_coord); + *params = (GLint) ctx->Array.FogCoord.Type; break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - if (ctx->Extensions.EXT_fog_coord) { - *params = (GLint) ctx->Array.FogCoord.Stride; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } + CHECK_EXTENSION_I(EXT_fog_coord); + *params = (GLint) ctx->Array.FogCoord.Stride; break; /* GL_EXT_texture_lod_bias */ @@ -5181,122 +5064,65 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_EXT_texture_filter_anisotropic */ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = (GLint) ctx->Const.MaxTextureMaxAnisotropy; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - return; - } + CHECK_EXTENSION_I(EXT_texture_filter_anisotropic); + *params = (GLint) ctx->Const.MaxTextureMaxAnisotropy; break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.Enabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample); + *params = (GLint) ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleAlphaToCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample); + *params = (GLint) ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleAlphaToOne; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample); + *params = (GLint) ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample); + *params = (GLint) ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleCoverageValue; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample); + *params = (GLint) ctx->Multisample.SampleCoverageValue; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleCoverageInvert; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample); + *params = (GLint) ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample); + *params = 0; /* XXX fix someday */ break; case GL_SAMPLES_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample); + *params = 0; /* XXX fix someday */ break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - *params = (GLint) ctx->Transform.RasterPositionUnclipped; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(IBM_rasterpos_clip); + *params = (GLint) ctx->Transform.RasterPositionUnclipped; break; /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLint) ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - return; - } + CHECK_EXTENSION_I(MESA_sprite_point); + *params = (GLint) ctx->Point.SpriteMode; break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLint) ctx->Hint.GenerateMipmap; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(SGIS_generate_mipmap); + *params = (GLint) ctx->Hint.GenerateMipmap; break; + /* GL_NV_vertex_program */ + /* to do */ + default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); } diff --git a/src/mesa/main/glprocs.h b/src/mesa/main/glprocs.h index c91be5a030e..bf573adfa0a 100644 --- a/src/mesa/main/glprocs.h +++ b/src/mesa/main/glprocs.h @@ -688,5 +688,69 @@ static struct name_address_offset static_functions[] = { { "glWindowPos3fvARB", (GLvoid *) glWindowPos3fvARB, _gloffset_WindowPos3fvARB }, { "glWindowPos3ivARB", (GLvoid *) glWindowPos3ivARB, _gloffset_WindowPos3ivARB }, { "glWindowPos3svARB", (GLvoid *) glWindowPos3svARB, _gloffset_WindowPos3svARB }, + { "glBindProgramNV", (GLvoid *) glBindProgramNV, _gloffset_BindProgramNV }, + { "glDeleteProgramsNV", (GLvoid *) glDeleteProgramsNV, _gloffset_DeleteProgramsNV }, + { "glExecuteProgramNV", (GLvoid *) glExecuteProgramNV, _gloffset_ExecuteProgramNV }, + { "glGenProgramsNV", (GLvoid *) glGenProgramsNV, _gloffset_GenProgramsNV }, + { "glAreProgramsResidentNV", (GLvoid *) glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV }, + { "glRequestResidentProgramsNV", (GLvoid *) glRequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV }, + { "glGetProgramParameterfvNV", (GLvoid *) glGetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV }, + { "glGetProgramParameterdvNV", (GLvoid *) glGetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV }, + { "glGetProgramivNV", (GLvoid *) glGetProgramivNV, _gloffset_GetProgramivNV }, + { "glGetProgramStringNV", (GLvoid *) glGetProgramStringNV, _gloffset_GetProgramStringNV }, + { "glGetTrackMatrixivNV", (GLvoid *) glGetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV }, + { "glGetVertexAttribdvNV", (GLvoid *) glGetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV }, + { "glGetVertexAttribfvNV", (GLvoid *) glGetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV }, + { "glGetVertexAttribivNV", (GLvoid *) glGetVertexAttribivNV, _gloffset_GetVertexAttribivNV }, + { "glGetVertexAttribPointervNV", (GLvoid *) glGetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV }, + { "glIsProgramNV", (GLvoid *) glIsProgramNV, _gloffset_IsProgramNV }, + { "glLoadProgramNV", (GLvoid *) glLoadProgramNV, _gloffset_LoadProgramNV }, + { "glProgramParameter4fNV", (GLvoid *) glProgramParameter4fNV, _gloffset_ProgramParameter4fNV }, + { "glProgramParameter4dNV", (GLvoid *) glProgramParameter4dNV, _gloffset_ProgramParameter4dNV }, + { "glProgramParameter4dvNV", (GLvoid *) glProgramParameter4dvNV, _gloffset_ProgramParameter4dvNV }, + { "glProgramParameter4fvNV", (GLvoid *) glProgramParameter4fvNV, _gloffset_ProgramParameter4fvNV }, + { "glProgramParameters4dvNV", (GLvoid *) glProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV }, + { "glProgramParameters4fvNV", (GLvoid *) glProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV }, + { "glTrackMatrixNV", (GLvoid *) glTrackMatrixNV, _gloffset_TrackMatrixNV }, + { "glVertexAttribPointerNV", (GLvoid *) glVertexAttribPointerNV, _gloffset_VertexAttribPointerNV }, + { "glVertexAttrib1sNV", (GLvoid *) glVertexAttrib1sNV, _gloffset_VertexAttrib1sNV }, + { "glVertexAttrib1fNV", (GLvoid *) glVertexAttrib1fNV, _gloffset_VertexAttrib1fNV }, + { "glVertexAttrib1dNV", (GLvoid *) glVertexAttrib1dNV, _gloffset_VertexAttrib1dNV }, + { "glVertexAttrib2sNV", (GLvoid *) glVertexAttrib2sNV, _gloffset_VertexAttrib2sNV }, + { "glVertexAttrib2fNV", (GLvoid *) glVertexAttrib2fNV, _gloffset_VertexAttrib2fNV }, + { "glVertexAttrib2dNV", (GLvoid *) glVertexAttrib2dNV, _gloffset_VertexAttrib2dNV }, + { "glVertexAttrib3sNV", (GLvoid *) glVertexAttrib3sNV, _gloffset_VertexAttrib3sNV }, + { "glVertexAttrib3fNV", (GLvoid *) glVertexAttrib3fNV, _gloffset_VertexAttrib3fNV }, + { "glVertexAttrib3dNV", (GLvoid *) glVertexAttrib3dNV, _gloffset_VertexAttrib3dNV }, + { "glVertexAttrib4sNV", (GLvoid *) glVertexAttrib4sNV, _gloffset_VertexAttrib4sNV }, + { "glVertexAttrib4fNV", (GLvoid *) glVertexAttrib4fNV, _gloffset_VertexAttrib4fNV }, + { "glVertexAttrib4dNV", (GLvoid *) glVertexAttrib4dNV, _gloffset_VertexAttrib4dNV }, + { "glVertexAttrib4ubNV", (GLvoid *) glVertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV }, + { "glVertexAttrib1svNV", (GLvoid *) glVertexAttrib1svNV, _gloffset_VertexAttrib1svNV }, + { "glVertexAttrib1fvNV", (GLvoid *) glVertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV }, + { "glVertexAttrib1dvNV", (GLvoid *) glVertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV }, + { "glVertexAttrib2svNV", (GLvoid *) glVertexAttrib2svNV, _gloffset_VertexAttrib2svNV }, + { "glVertexAttrib2fvNV", (GLvoid *) glVertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV }, + { "glVertexAttrib2dvNV", (GLvoid *) glVertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV }, + { "glVertexAttrib3svNV", (GLvoid *) glVertexAttrib3svNV, _gloffset_VertexAttrib3svNV }, + { "glVertexAttrib3fvNV", (GLvoid *) glVertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV }, + { "glVertexAttrib3dvNV", (GLvoid *) glVertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV }, + { "glVertexAttrib4svNV", (GLvoid *) glVertexAttrib4svNV, _gloffset_VertexAttrib4svNV }, + { "glVertexAttrib4fvNV", (GLvoid *) glVertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV }, + { "glVertexAttrib4dvNV", (GLvoid *) glVertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV }, + { "glVertexAttrib4ubvNV", (GLvoid *) glVertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV }, + { "glVertexAttribs1svNV", (GLvoid *) glVertexAttribs1svNV, _gloffset_VertexAttribs1svNV }, + { "glVertexAttribs1fvNV", (GLvoid *) glVertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV }, + { "glVertexAttribs1dvNV", (GLvoid *) glVertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV }, + { "glVertexAttribs2svNV", (GLvoid *) glVertexAttribs2svNV, _gloffset_VertexAttribs2svNV }, + { "glVertexAttribs2fvNV", (GLvoid *) glVertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV }, + { "glVertexAttribs2dvNV", (GLvoid *) glVertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV }, + { "glVertexAttribs3svNV", (GLvoid *) glVertexAttribs3svNV, _gloffset_VertexAttribs3svNV }, + { "glVertexAttribs3fvNV", (GLvoid *) glVertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV }, + { "glVertexAttribs3dvNV", (GLvoid *) glVertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV }, + { "glVertexAttribs4svNV", (GLvoid *) glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV }, + { "glVertexAttribs4fvNV", (GLvoid *) glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV }, + { "glVertexAttribs4dvNV", (GLvoid *) glVertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV }, + { "glVertexAttribs4ubvNV", (GLvoid *) glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV }, { NULL, NULL } /* end of list marker */ }; diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 8bd545035c3..c5f741567da 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,4 +1,4 @@ -/* $Id: light.c,v 1.46 2001/09/18 16:16:21 kschultz Exp $ */ +/* $Id: light.c,v 1.47 2001/12/14 02:50:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -881,7 +881,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) if (ctx->Light.ColorMaterialEnabled) { FLUSH_CURRENT( ctx, 0 ); - _mesa_update_color_material( ctx, ctx->Current.Color ); + _mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } } diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 4b510fefcd1..763669e0c66 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.36 2001/09/18 16:16:21 kschultz Exp $ */ +/* $Id: matrix.c,v 1.37 2001/12/14 02:50:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -57,25 +57,38 @@ /**********************************************************************/ -#define GET_ACTIVE_MATRIX(ctx, mat, flags, where) \ +#define GET_ACTIVE_MATRIX(mat, where) \ do { \ + GLint n; \ if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "%s\n", where); \ switch (ctx->Transform.MatrixMode) { \ case GL_MODELVIEW: \ mat = &ctx->ModelView; \ - flags |= _NEW_MODELVIEW; \ + ctx->NewState |= _NEW_MODELVIEW; \ break; \ case GL_PROJECTION: \ mat = &ctx->ProjectionMatrix; \ - flags |= _NEW_PROJECTION; \ + ctx->NewState |= _NEW_PROJECTION; \ break; \ case GL_TEXTURE: \ mat = &ctx->TextureMatrix[ctx->Texture.CurrentUnit]; \ - flags |= _NEW_TEXTURE_MATRIX; \ + ctx->NewState |= _NEW_TEXTURE_MATRIX; \ break; \ case GL_COLOR: \ mat = &ctx->ColorMatrix; \ - flags |= _NEW_COLOR_MATRIX; \ + ctx->NewState |= _NEW_COLOR_MATRIX; \ + break; \ + case GL_MATRIX0_NV: \ + case GL_MATRIX1_NV: \ + case GL_MATRIX2_NV: \ + case GL_MATRIX3_NV: \ + case GL_MATRIX4_NV: \ + case GL_MATRIX5_NV: \ + case GL_MATRIX6_NV: \ + case GL_MATRIX7_NV: \ + n = ctx->Transform.MatrixMode - GL_MATRIX0_NV; \ + mat = &ctx->VertexProgram.Matrix[n]; \ + ctx->NewState |= _NEW_TRACK_MATRIX; \ break; \ default: \ _mesa_problem(ctx, where); \ @@ -92,7 +105,7 @@ _mesa_Frustum( GLdouble left, GLdouble right, GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glFrustrum" ); + GET_ACTIVE_MATRIX(mat, "glFrustrum"); if (nearval <= 0.0 || farval <= 0.0 || @@ -119,7 +132,7 @@ _mesa_Ortho( GLdouble left, GLdouble right, GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glOrtho" ); + GET_ACTIVE_MATRIX(mat, "glOrtho"); if (left == right || bottom == top || @@ -142,6 +155,19 @@ _mesa_MatrixMode( GLenum mode ) ASSERT_OUTSIDE_BEGIN_END(ctx); switch (mode) { + case GL_MATRIX0_NV: + case GL_MATRIX1_NV: + case GL_MATRIX2_NV: + case GL_MATRIX3_NV: + case GL_MATRIX4_NV: + case GL_MATRIX5_NV: + case GL_MATRIX6_NV: + case GL_MATRIX7_NV: + if (!ctx->Extensions.NV_vertex_program) { + _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode" ); + return; + } + /* FALL-THROUGH */ case GL_MODELVIEW: case GL_PROJECTION: case GL_TEXTURE: @@ -275,7 +301,7 @@ _mesa_LoadIdentity( void ) GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadIdentity"); + GET_ACTIVE_MATRIX(mat, "glLoadIdentity"); _math_matrix_set_identity( mat ); } @@ -286,7 +312,7 @@ _mesa_LoadMatrixf( const GLfloat *m ) GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadMatrix"); + GET_ACTIVE_MATRIX(mat, "glLoadMatrix"); _math_matrix_loadf( mat, m ); } @@ -312,7 +338,7 @@ _mesa_MultMatrixf( const GLfloat *m ) GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" ); + GET_ACTIVE_MATRIX(mat, "glMultMatrix"); _math_matrix_mul_floats( mat, m ); } @@ -343,7 +369,7 @@ _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (angle != 0.0F) { GLmatrix *mat = 0; - GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glRotate" ); + GET_ACTIVE_MATRIX(mat, "glRotate"); _math_matrix_rotate( mat, angle, x, y, z ); } } @@ -364,7 +390,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glScale"); + GET_ACTIVE_MATRIX(mat, "glScale"); _math_matrix_scale( mat, x, y, z ); } @@ -385,7 +411,7 @@ _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glTranslate"); + GET_ACTIVE_MATRIX(mat, "glTranslate"); _math_matrix_translate( mat, x, y, z ); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 865978214d1..32820178d41 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.54 2001/12/04 23:44:56 brianp Exp $ */ +/* $Id: mtypes.h,v 1.55 2001/12/14 02:50:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -63,7 +63,7 @@ #define CHAN_MAXF 1.0F #define CHAN_TYPE GL_FLOAT #else -#error illegal number of color channel bits +#error "illegal number of color channel bits" #endif @@ -295,28 +295,46 @@ 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 Normal[3]; /* Current vertex normal */ - GLfloat Color[4]; /* Current RGBA color */ - GLfloat SecondaryColor[4]; /* Current secondary color */ - GLfloat FogCoord; /* Current Fog coord */ + GLfloat Attrib[8 + MAX_TEXTURE_UNITS][4]; /* Current vertex attributes */ + /* indexed by VERT_ATTRIB_* */ GLuint Index; /* Current color index */ GLboolean EdgeFlag; /* Current edge flag */ - GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */ - /* These values are always valid. + /* These values are always valid. BTW, note how similar this set of + * attributes is to the SWvertex datatype in the software rasterizer... */ GLfloat RasterPos[4]; /* Current raster position */ GLfloat RasterDistance; /* Current raster distance */ GLfloat RasterColor[4]; /* Current raster color */ GLfloat RasterSecondaryColor[4]; /* Current rast 2ndary color */ - GLuint RasterIndex; /* Current raster index */ - GLfloat *RasterTexCoord; /* Current raster texcoord*/ + GLuint RasterIndex; /* Current raster index */ + GLfloat *RasterTexCoord; /* Current raster texcoord */ GLfloat RasterMultiTexCoord[MAX_TEXTURE_UNITS][4]; GLfloat RasterFogCoord; - GLboolean RasterPosValid; /* Raster po valid flag */ + GLboolean RasterPosValid; /* Raster pos valid flag */ }; @@ -387,6 +405,10 @@ struct gl_enable_attrib { 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; }; @@ -475,6 +497,11 @@ struct gl_convolution_attrib { }; +#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]; /* Array of lights */ struct gl_lightmodel Model; /* Lighting model */ @@ -494,17 +521,11 @@ struct gl_light_attrib { /* Derived for optimizations: */ GLboolean _NeedVertices; /* Use fast shader? */ - GLuint _Flags; /* LIGHT_* flags, see below */ + GLuint _Flags; /* LIGHT_* flags, see above */ GLfloat _BaseColor[2][3]; }; -#define LIGHT_SPOT 0x1 -#define LIGHT_LOCAL_VIEWER 0x2 -#define LIGHT_POSITIONAL 0x4 - -#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER) - struct gl_line_attrib { GLboolean SmoothFlag; /* GL_LINE_SMOOTH enabled? */ GLboolean StippleFlag; /* GL_LINE_STIPPLE enabled? */ @@ -519,6 +540,7 @@ struct gl_list_attrib { GLuint ListBase; }; + struct gl_list_opcode { GLuint size; void (*execute)( GLcontext *ctx, void *data ); @@ -1021,6 +1043,8 @@ struct gl_array_attrib { struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; struct gl_client_array EdgeFlag; + struct gl_client_array VertexAttrib[16]; /* GL_NV_vertex_program */ + GLint TexCoordInterleaveFactor; GLint ActiveTexture; /* Client Active Texture */ GLuint LockFirst; @@ -1103,6 +1127,158 @@ struct gl_evaluators { /* + * Vertex program tokens and datatypes + */ + +#define VP_MAX_INSTRUCTIONS 128 +#define VP_MAX_MATRICES 8 +#define VP_MAX_MATRIX_DEPTH 4 + +#define VP_NUM_INPUT_REGS 16 +#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) + +/* Location of register sets within the whole register file */ +#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) + +/* 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 +{ + GLfloat Registers[VP_NUM_TOTAL_REGISTERS][4]; + GLint AddressReg; /* might someday be a 4-vector */ +}; + + +/* Vertex program opcodes */ +enum vp_opcode +{ + MOV, + LIT, + RCP, + RSQ, + EXP, + LOG, + MUL, + ADD, + DP3, + DP4, + DST, + MIN, + MAX, + SLT, + SGE, + MAD, + ARL, + END +}; + + +/* Instruction source register */ +struct vp_src_register +{ + GLint Register; /* or the offset from the address register */ + GLuint Swizzle[4]; + GLboolean Negate; + GLboolean RelAddr; +}; + + +/* Instruction destination register */ +struct vp_dst_register +{ + GLint Register; + GLboolean WriteMask[4]; +}; + + +/* Vertex program instruction */ +struct vp_instruction +{ + enum vp_opcode Opcode; + struct vp_src_register SrcReg[3]; + struct vp_dst_register DstReg; +}; + + +/* The actual vertex program, stored in the hash table */ +struct vp_program +{ + GLubyte *String; /* Original user code */ + struct vp_instruction *Instructions; /* Compiled instructions */ + GLenum Target; /* GL_VERTEX_PROGRAM_NV or GL_VERTEX_STATE_PROGRAM_NV */ + GLint ErrorPos; + GLboolean Resident; +}; + + +/* + * State vars for GL_NV_vertex_program + */ +struct gl_vertex_program +{ + GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */ + GLboolean PointSizeEnabled; /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + GLboolean TwoSideEnabled; /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + GLuint Binding; /* currently bound program */ + struct _mesa_HashTable *HashTable; /* all programs */ + struct vp_machine Machine; /* machine state */ + GLmatrix Matrix[VP_MAX_MATRICES]; /* Tracking matrices */ + GLmatrix MatrixStack[VP_MAX_MATRICES][VP_MAX_MATRIX_DEPTH-1]; /* stacks */ + GLuint MatrixStackDepth[VP_MAX_MATRICES]; + + GLenum TrackMatrix[VP_NUM_PROG_REGS / 4]; + GLenum TrackMatrixTransform[VP_NUM_PROG_REGS / 4]; + +}; + + + +/* * State which can be shared by multiple contexts: */ struct gl_shared_state { @@ -1246,6 +1422,7 @@ struct gl_extensions { GLboolean MESA_sprite_point; GLboolean NV_blend_square; GLboolean NV_texgen_reflection; + GLboolean NV_vertex_program; GLboolean SGI_color_matrix; GLboolean SGI_color_table; GLboolean SGIS_generate_mipmap; @@ -1259,6 +1436,16 @@ struct gl_extensions { }; +/* XXX just an idea */ +struct matrix_stack +{ + GLmatrix Top; + GLmatrix *Stack; + GLuint Depth; + GLuint MaxDepth; + GLuint DirtyFlag; /* _NEW_MODELVIEW or _NEW_PROJECTION, for example */ +}; + /* * Bits for image transfer operations (ctx->ImageTransferState). @@ -1319,28 +1506,32 @@ struct gl_extensions { #define _NEW_RENDERMODE 0x800000 /* RenderMode, Feedback, Select */ #define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */ #define _NEW_MULTISAMPLE 0x2000000 /* ctx->Multisample */ +#define _NEW_TRACK_MATRIX 0x4000000 /* ctx->VertexProgram */ #define _NEW_ALL ~0 /* 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_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_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i)) @@ -1467,6 +1658,9 @@ struct __GLcontextRec { GLmatrix ModelView; /* current matrix, not stored on stack */ GLuint ModelViewStackDepth; GLmatrix ModelViewStack[MAX_MODELVIEW_STACK_DEPTH - 1]; +#if 1 + struct matrix_stack ModelviewStack; +#endif /* Projection matrix and stack */ GLmatrix ProjectionMatrix; /* current matrix, not stored on stack */ @@ -1551,6 +1745,8 @@ struct __GLcontextRec { struct gl_color_table PostColorMatrixColorTable; struct gl_color_table ProxyPostColorMatrixColorTable; + struct gl_vertex_program VertexProgram; /* GL_NV_vertex_program */ + GLenum ErrorValue; /* Last error code */ GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLuint NewState; /* bitwise-or of _NEW_* flags */ diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index a7b4e16a41a..276c54c6ec7 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,4 +1,4 @@ -/* $Id: rastpos.c,v 1.32 2001/11/18 23:52:38 brianp Exp $ */ +/* $Id: rastpos.c,v 1.33 2001/12/14 02:50:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -291,7 +291,7 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) /* raster color */ if (ctx->Light.Enabled) { GLfloat *norm, eyenorm[3]; - GLfloat *objnorm = ctx->Current.Normal; + GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; if (ctx->_NeedEyeCoords) { GLfloat *inv = ctx->ModelView.inv; @@ -311,9 +311,10 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) else { /* use current color or index */ if (ctx->Visual.rgbMode) { - COPY_4FV(ctx->Current.RasterColor, ctx->Current.Color); + COPY_4FV(ctx->Current.RasterColor, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); COPY_4FV(ctx->Current.RasterSecondaryColor, - ctx->Current.SecondaryColor); + ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); } else { ctx->Current.RasterIndex = ctx->Current.Index; @@ -362,13 +363,13 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) ctx->Current.RasterPos[3] = clip[3]; ctx->Current.RasterPosValid = GL_TRUE; - ctx->Current.RasterFogCoord = ctx->Current.FogCoord; + ctx->Current.RasterFogCoord = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; { GLuint texSet; for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet], - ctx->Current.Texcoord[texSet] ); + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); } } @@ -559,10 +560,8 @@ _mesa_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) /* raster color = current color or index */ if (ctx->Visual.rgbMode) { - ctx->Current.RasterColor[0] = (ctx->Current.Color[0]); - ctx->Current.RasterColor[1] = (ctx->Current.Color[1]); - ctx->Current.RasterColor[2] = (ctx->Current.Color[2]); - ctx->Current.RasterColor[3] = (ctx->Current.Color[3]); + COPY_4FV(ctx->Current.RasterColor, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } else { ctx->Current.RasterIndex = ctx->Current.Index; @@ -573,7 +572,7 @@ _mesa_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) GLuint texSet; for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet], - ctx->Current.Texcoord[texSet] ); + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); } } @@ -834,23 +833,27 @@ void _mesa_WindowPos3fARB(GLfloat x, GLfloat y, GLfloat z) ctx->Current.RasterPosValid = GL_TRUE; /* XXX might have to change this */ - ctx->Current.RasterDistance = ctx->Current.FogCoord; - ctx->Current.RasterFogCoord = ctx->Current.FogCoord; + ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; + ctx->Current.RasterFogCoord = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; /* raster color = current color or index */ if (ctx->Visual.rgbMode) { - ctx->Current.RasterColor[0] = CLAMP(ctx->Current.Color[0], 0.0F, 1.0F); - ctx->Current.RasterColor[1] = CLAMP(ctx->Current.Color[1], 0.0F, 1.0F); - ctx->Current.RasterColor[2] = CLAMP(ctx->Current.Color[2], 0.0F, 1.0F); - ctx->Current.RasterColor[3] = CLAMP(ctx->Current.Color[3], 0.0F, 1.0F); + ctx->Current.RasterColor[0] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F); + ctx->Current.RasterColor[1] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F); + ctx->Current.RasterColor[2] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F); + ctx->Current.RasterColor[3] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F); ctx->Current.RasterSecondaryColor[0] - = CLAMP(ctx->Current.SecondaryColor[0], 0.0F, 1.0F); + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F); ctx->Current.RasterSecondaryColor[1] - = CLAMP(ctx->Current.SecondaryColor[1], 0.0F, 1.0F); + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F); ctx->Current.RasterSecondaryColor[2] - = CLAMP(ctx->Current.SecondaryColor[2], 0.0F, 1.0F); + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F); ctx->Current.RasterSecondaryColor[3] - = CLAMP(ctx->Current.SecondaryColor[3], 0.0F, 1.0F); + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); } else { ctx->Current.RasterIndex = ctx->Current.Index; @@ -861,7 +864,7 @@ void _mesa_WindowPos3fARB(GLfloat x, GLfloat y, GLfloat z) GLuint texSet; for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet], - ctx->Current.Texcoord[texSet] ); + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); } } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 4beaa07d5cc..d331d434c61 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.72 2001/12/04 23:43:31 brianp Exp $ */ +/* $Id: state.c,v 1.73 2001/12/14 02:50:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -69,6 +69,7 @@ #include "texstate.h" #include "mtypes.h" #include "varray.h" +#include "vpstate.h" #include "math/m_matrix.h" #include "math/m_xform.h" @@ -456,6 +457,33 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; + /* ###. GL_NV_vertex_program */ + exec->BindProgramNV = _mesa_BindProgramNV; + exec->DeleteProgramsNV = _mesa_DeleteProgramsNV; + exec->ExecuteProgramNV = _mesa_ExecuteProgramNV; + exec->GenProgramsNV = _mesa_GenProgramsNV; + exec->AreProgramsResidentNV = _mesa_AreProgramsResidentNV; + exec->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV; + exec->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV; + exec->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV; + exec->GetProgramivNV = _mesa_GetProgramivNV; + exec->GetProgramStringNV = _mesa_GetProgramStringNV; + exec->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV; + exec->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV; + exec->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV; + exec->GetVertexAttribivNV = _mesa_GetVertexAttribivNV; + exec->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV; + exec->IsProgramNV = _mesa_IsProgramNV; + exec->LoadProgramNV = _mesa_LoadProgramNV; + exec->ProgramParameter4dNV = _mesa_ProgramParameter4dNV; + exec->ProgramParameter4dvNV = _mesa_ProgramParameter4dvNV; + exec->ProgramParameter4fNV = _mesa_ProgramParameter4fNV; + exec->ProgramParameter4fvNV = _mesa_ProgramParameter4fvNV; + exec->ProgramParameters4dvNV = _mesa_ProgramParameters4dvNV; + exec->ProgramParameters4fvNV = _mesa_ProgramParameters4fvNV; + exec->TrackMatrixNV = _mesa_TrackMatrixNV; + exec->VertexAttribPointerNV = _mesa_VertexAttribPointerNV; + /* ARB 1. GL_ARB_multitexture */ exec->ActiveTextureARB = _mesa_ActiveTextureARB; exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB; diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 73f54a0b409..29e57fc8fde 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -1,4 +1,4 @@ -/* $Id: vtxfmt.c,v 1.8 2001/12/04 23:43:31 brianp Exp $ */ +/* $Id: vtxfmt.c,v 1.9 2001/12/14 02:50:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -82,6 +82,7 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt ) { + printf("%s()\n", __FUNCTION__); tab->ArrayElement = vfmt->ArrayElement; tab->Color3f = vfmt->Color3f; tab->Color3fv = vfmt->Color3fv; @@ -132,18 +133,17 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt ) tab->Vertex3fv = vfmt->Vertex3fv; tab->Vertex4f = vfmt->Vertex4f; tab->Vertex4fv = vfmt->Vertex4fv; + tab->CallList = vfmt->CallList; tab->Begin = vfmt->Begin; tab->End = vfmt->End; - -/* tab->NewList = vfmt->NewList; */ - tab->CallList = vfmt->CallList; - + tab->VertexAttrib4fNV = vfmt->VertexAttrib4fNV; tab->Rectf = vfmt->Rectf; tab->DrawArrays = vfmt->DrawArrays; tab->DrawElements = vfmt->DrawElements; tab->DrawRangeElements = vfmt->DrawRangeElements; tab->EvalMesh1 = vfmt->EvalMesh1; tab->EvalMesh2 = vfmt->EvalMesh2; + assert(tab->EvalMesh2); } diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h index 59a8b441ac4..e946a859873 100644 --- a/src/mesa/main/vtxfmt_tmp.h +++ b/src/mesa/main/vtxfmt_tmp.h @@ -1,4 +1,4 @@ -/* $Id: vtxfmt_tmp.h,v 1.7 2001/12/04 23:43:31 brianp Exp $ */ +/* $Id: vtxfmt_tmp.h,v 1.8 2001/12/14 02:55:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -391,6 +391,18 @@ static void TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2, _glapi_Dispatch->EvalMesh2( mode, i1, i2, j1, j2 ); } +static void TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + PRE_LOOPBACK( VertexAttrib4fNV ); + glVertexAttrib4fNV( index, x, y, z, w ); +} + +static void TAG(VertexAttrib4fvNV)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib4fNV ); + glVertexAttrib4fvNV( index, v ); +} + static GLvertexformat TAG(vtxfmt) = { TAG(ArrayElement), @@ -446,12 +458,14 @@ static GLvertexformat TAG(vtxfmt) = { TAG(CallList), TAG(Begin), TAG(End), + TAG(VertexAttrib4fNV), + TAG(VertexAttrib4fvNV), TAG(Rectf), TAG(DrawArrays), TAG(DrawElements), TAG(DrawRangeElements), TAG(EvalMesh1), - TAG(EvalMesh2), + TAG(EvalMesh2) }; #undef TAG |