summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_arrayelt.c3
-rw-r--r--src/mesa/main/api_eval.c324
-rw-r--r--src/mesa/main/api_loopback.c686
-rw-r--r--src/mesa/main/api_loopback.h6
-rw-r--r--src/mesa/main/api_noop.c569
-rw-r--r--src/mesa/main/api_noop.h30
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/main/context.h4
-rw-r--r--src/mesa/main/dd.h35
-rw-r--r--src/mesa/main/dlist.c866
-rw-r--r--src/mesa/main/dlist.h5
-rw-r--r--src/mesa/main/get.c10
-rw-r--r--src/mesa/main/macros.h2
-rw-r--r--src/mesa/main/mtypes.h35
-rw-r--r--src/mesa/main/state.c2
-rw-r--r--src/mesa/main/vtxfmt.c21
-rw-r--r--src/mesa/main/vtxfmt_tmp.h107
17 files changed, 1541 insertions, 1168 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index e4533713cd..68e263ea1b 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -250,6 +250,9 @@ static void (*fogcoordfuncs[8])( const void * ) = {
GLboolean _ae_create_context( GLcontext *ctx )
{
+ if (ctx->aelt_context)
+ return GL_TRUE;
+
ctx->aelt_context = MALLOC( sizeof(AEcontext) );
if (!ctx->aelt_context)
return GL_FALSE;
diff --git a/src/mesa/main/api_eval.c b/src/mesa/main/api_eval.c
deleted file mode 100644
index 3302ec3f7d..0000000000
--- a/src/mesa/main/api_eval.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "api_eval.h"
-#include "context.h"
-#include "macros.h"
-#include "math/m_eval.h"
-
-static void do_EvalCoord1f(GLcontext* ctx, GLfloat u)
-{
-
- /** Color Index **/
- if (ctx->Eval.Map1Index)
- {
- GLfloat findex;
- struct gl_1d_map *map = &ctx->EvalMap.Map1Index;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, &findex, uu, 1, map->Order);
- glIndexi( (GLint) findex );
- }
-
- /** Color **/
- if (ctx->Eval.Map1Color4) {
- GLfloat fcolor[4];
- struct gl_1d_map *map = &ctx->EvalMap.Map1Color4;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, fcolor, uu, 4, map->Order);
- glColor4fv( fcolor );
- }
-
- /** Normal Vector **/
- if (ctx->Eval.Map1Normal) {
- GLfloat normal[3];
- struct gl_1d_map *map = &ctx->EvalMap.Map1Normal;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, normal, uu, 3, map->Order);
- glNormal3fv( normal );
- }
-
- /** Texture Coordinates **/
- if (ctx->Eval.Map1TextureCoord4) {
- GLfloat texcoord[4];
- struct gl_1d_map *map = &ctx->EvalMap.Map1Texture4;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, texcoord, uu, 4, map->Order);
- glTexCoord4fv( texcoord );
- }
- else if (ctx->Eval.Map1TextureCoord3) {
- GLfloat texcoord[4];
- struct gl_1d_map *map = &ctx->EvalMap.Map1Texture3;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, texcoord, uu, 3, map->Order);
- glTexCoord3fv( texcoord );
- }
- else if (ctx->Eval.Map1TextureCoord2) {
- GLfloat texcoord[4];
- struct gl_1d_map *map = &ctx->EvalMap.Map1Texture2;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, texcoord, uu, 2, map->Order);
- glTexCoord2fv( texcoord );
- }
- else if (ctx->Eval.Map1TextureCoord1) {
- GLfloat texcoord[4];
- struct gl_1d_map *map = &ctx->EvalMap.Map1Texture1;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, texcoord, uu, 1, map->Order);
- glTexCoord1fv( texcoord );
- }
-
- /** Vertex **/
- if (ctx->Eval.Map1Vertex4)
- {
- GLfloat vertex[4];
- struct gl_1d_map *map = &ctx->EvalMap.Map1Vertex4;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, vertex, uu, 4, map->Order);
- glVertex4fv( vertex );
- }
- else if (ctx->Eval.Map1Vertex3)
- {
- GLfloat vertex[4];
- struct gl_1d_map *map = &ctx->EvalMap.Map1Vertex3;
- GLfloat uu = (u - map->u1) * map->du;
- _math_horner_bezier_curve(map->Points, vertex, uu, 3, map->Order);
- glVertex3fv( vertex );
- }
-}
-
-#define CROSS_PROD(n, u, v) \
- (n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \
- (n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \
- (n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0]
-
-
-static void do_EvalCoord2f( GLcontext* ctx, GLfloat u, GLfloat v )
-{
- /** Color Index **/
- if (ctx->Eval.Map2Index) {
- GLfloat findex;
- struct gl_2d_map *map = &ctx->EvalMap.Map2Index;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
- _math_horner_bezier_surf(map->Points, &findex, uu, vv, 1,
- map->Uorder, map->Vorder);
- glIndexi( (GLuint) (GLint) findex );
- }
-
- /** Color **/
- if (ctx->Eval.Map2Color4) {
- GLfloat fcolor[4];
- struct gl_2d_map *map = &ctx->EvalMap.Map2Color4;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
- _math_horner_bezier_surf(map->Points, fcolor, uu, vv, 4,
- map->Uorder, map->Vorder);
- glColor4fv( fcolor );
- }
-
- /** Normal **/
- if (ctx->Eval.Map2Normal &&
- (!ctx->Eval.AutoNormal || (!ctx->Eval.Map2Vertex3 &&
- !ctx->Eval.Map2Vertex4))) {
- GLfloat normal[3];
- struct gl_2d_map *map = &ctx->EvalMap.Map2Normal;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
- _math_horner_bezier_surf(map->Points, normal, uu, vv, 3,
- map->Uorder, map->Vorder);
- glNormal3fv( normal );
- }
-
- /** Texture Coordinates **/
- if (ctx->Eval.Map2TextureCoord4) {
- GLfloat texcoord[4];
- struct gl_2d_map *map = &ctx->EvalMap.Map2Texture4;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
- _math_horner_bezier_surf(map->Points, texcoord, uu, vv, 4,
- map->Uorder, map->Vorder);
- glTexCoord4fv( texcoord );
- }
- else if (ctx->Eval.Map2TextureCoord3) {
- GLfloat texcoord[4];
- struct gl_2d_map *map = &ctx->EvalMap.Map2Texture3;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
- _math_horner_bezier_surf(map->Points, texcoord, uu, vv, 3,
- map->Uorder, map->Vorder);
- glTexCoord3fv( texcoord );
- }
- else if (ctx->Eval.Map2TextureCoord2) {
- GLfloat texcoord[4];
- struct gl_2d_map *map = &ctx->EvalMap.Map2Texture2;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
- _math_horner_bezier_surf(map->Points, texcoord, uu, vv, 2,
- map->Uorder, map->Vorder);
- glTexCoord2fv( texcoord );
- }
- else if (ctx->Eval.Map2TextureCoord1) {
- GLfloat texcoord[4];
- struct gl_2d_map *map = &ctx->EvalMap.Map2Texture1;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
- _math_horner_bezier_surf(map->Points, texcoord, uu, vv, 1,
- map->Uorder, map->Vorder);
- glTexCoord1fv( texcoord );
- }
-
- /** Vertex **/
- if(ctx->Eval.Map2Vertex4) {
- GLfloat vertex[4];
- GLfloat normal[3];
- struct gl_2d_map *map = &ctx->EvalMap.Map2Vertex4;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
-
- if (ctx->Eval.AutoNormal) {
- GLfloat du[4], dv[4];
-
- _math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv, 4,
- map->Uorder, map->Vorder);
-
- CROSS_PROD(normal, du, dv);
- NORMALIZE_3FV(normal);
- glNormal3fv( normal );
- glVertex4fv( vertex );
- }
- else {
- _math_horner_bezier_surf(map->Points, vertex, uu, vv, 4,
- map->Uorder, map->Vorder);
- glVertex4fv( vertex );
- }
- }
- else if (ctx->Eval.Map2Vertex3) {
- GLfloat vertex[4];
- struct gl_2d_map *map = &ctx->EvalMap.Map2Vertex3;
- GLfloat uu = (u - map->u1) * map->du;
- GLfloat vv = (v - map->v1) * map->dv;
- if (ctx->Eval.AutoNormal) {
- GLfloat du[3], dv[3];
- GLfloat normal[3];
- _math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv, 3,
- map->Uorder, map->Vorder);
- CROSS_PROD(normal, du, dv);
- NORMALIZE_3FV(normal);
- glNormal3fv( normal );
- glVertex3fv( vertex );
- }
- else {
- _math_horner_bezier_surf(map->Points, vertex, uu, vv, 3,
- map->Uorder, map->Vorder);
- glVertex3fv( vertex );
- }
- }
-}
-
-
-void _mesa_EvalPoint1( GLint i )
-{
- GET_CURRENT_CONTEXT( ctx );
- GLfloat du = ((ctx->Eval.MapGrid1u2 - ctx->Eval.MapGrid1u1) /
- (GLfloat) ctx->Eval.MapGrid1un);
- GLfloat u = i * du + ctx->Eval.MapGrid1u1;
-
- glEvalCoord1f( u );
-}
-
-
-void _mesa_EvalPoint2( GLint i, GLint j )
-{
- GET_CURRENT_CONTEXT( ctx );
- GLfloat du = ((ctx->Eval.MapGrid2u2 - ctx->Eval.MapGrid2u1) /
- (GLfloat) ctx->Eval.MapGrid2un);
- GLfloat dv = ((ctx->Eval.MapGrid2v2 - ctx->Eval.MapGrid2v1) /
- (GLfloat) ctx->Eval.MapGrid2vn);
- GLfloat u = i * du + ctx->Eval.MapGrid2u1;
- GLfloat v = j * dv + ctx->Eval.MapGrid2v1;
-
- glEvalCoord2f( u, v );
-}
-
-/* Wierd thing about eval is that it doesn't affect 'current' values.
- * This technique of saving and resetting current values requires
- * that:
- *
- * 1) Current values are updated immediately in the glColor,
- * etc. functions.
- *
- * 2) Hardware color values are stored seperately from ctx->Current,
- * for example in dma buffers, or direct emit to registers.
- */
-void _mesa_EvalCoord1f( GLfloat u )
-{
- GET_CURRENT_CONTEXT( ctx );
- GLfloat normal[3], texcoord[4], color[4];
- GLuint index;
-
- 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.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;
-}
-
-void _mesa_EvalCoord2f( GLfloat u, GLfloat v )
-{
- GET_CURRENT_CONTEXT( ctx );
- GLfloat normal[3], texcoord[4], color[4];
- GLuint index;
-
- 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.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;
-}
-
-void _mesa_EvalCoord1fv( const GLfloat *u )
-{
- glEvalCoord1f( u[0] );
-}
-
-void _mesa_EvalCoord2fv( const GLfloat *u )
-{
- glEvalCoord2f( u[0], u[1] );
-}
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index a2dc3c6c6b..c163d668fd 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -45,7 +45,6 @@
* listed in dd.h. The easiest way for a driver to do this is to
* install the supplied software t&l module.
*/
-#define COLORUBV(v) glColor4ubv(v)
#define COLORF(r,g,b,a) glColor4f(r,g,b,a)
#define VERTEX2(x,y) glVertex2f(x,y)
#define VERTEX3(x,y,z) glVertex3f(x,y,z)
@@ -55,7 +54,7 @@
#define TEXCOORD2(s,t) glTexCoord2f(s,t)
#define TEXCOORD3(s,t,u) glTexCoord3f(s,t,u)
#define TEXCOORD4(s,t,u,v) glTexCoord4f(s,t,u,v)
-#define INDEX(c) glIndexi(c)
+#define INDEX(c) glIndexf(c)
#define MULTI_TEXCOORD1(z,s) glMultiTexCoord1fARB(z,s)
#define MULTI_TEXCOORD2(z,s,t) glMultiTexCoord2fARB(z,s,t)
#define MULTI_TEXCOORD3(z,s,t,u) glMultiTexCoord3fARB(z,s,t,u)
@@ -65,294 +64,15 @@
#define MATERIALFV(a,b,c) glMaterialfv(a,b,c)
#define RECTF(a,b,c,d) glRectf(a,b,c,d)
-#define ATTRIB(index, x, y, z, w) _glapi_Dispatch->VertexAttrib4fNV(index, x, y, z, w)
-
-
-#define FOGCOORDF(x) _glapi_Dispatch->FogCoordfEXT(x)
-#define SECONDARYCOLORUB(a,b,c) _glapi_Dispatch->SecondaryColor3ubEXT(a,b,c)
-#define SECONDARYCOLORF(a,b,c) _glapi_Dispatch->SecondaryColor3fEXT(a,b,c)
-
-
-static void GLAPIENTRY
-loopback_Color3b( GLbyte red, GLbyte green, GLbyte blue )
-{
- GLubyte col[4];
- col[0] = BYTE_TO_UBYTE(red);
- col[1] = BYTE_TO_UBYTE(green);
- col[2] = BYTE_TO_UBYTE(blue);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3d( GLdouble red, GLdouble green, GLdouble blue )
-{
- GLubyte col[4];
- GLfloat r = (GLfloat) red;
- GLfloat g = (GLfloat) green;
- GLfloat b = (GLfloat) blue;
- UNCLAMPED_FLOAT_TO_UBYTE(col[0], r);
- UNCLAMPED_FLOAT_TO_UBYTE(col[1], g);
- UNCLAMPED_FLOAT_TO_UBYTE(col[2], b);
- col[3] = 255;
- COLORUBV( col );
-}
-
-static void GLAPIENTRY
-loopback_Color3i( GLint red, GLint green, GLint blue )
-{
- GLubyte col[4];
- col[0] = INT_TO_UBYTE(red);
- col[1] = INT_TO_UBYTE(green);
- col[2] = INT_TO_UBYTE(blue);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3s( GLshort red, GLshort green, GLshort blue )
-{
- GLubyte col[4];
- col[0] = SHORT_TO_UBYTE(red);
- col[1] = SHORT_TO_UBYTE(green);
- col[2] = SHORT_TO_UBYTE(blue);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3ui( GLuint red, GLuint green, GLuint blue )
-{
- GLubyte col[4];
- col[0] = UINT_TO_UBYTE(red);
- col[1] = UINT_TO_UBYTE(green);
- col[2] = UINT_TO_UBYTE(blue);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3us( GLushort red, GLushort green, GLushort blue )
-{
- GLubyte col[4];
- col[0] = USHORT_TO_UBYTE(red);
- col[1] = USHORT_TO_UBYTE(green);
- col[2] = USHORT_TO_UBYTE(blue);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha )
-{
- GLubyte col[4];
- col[0] = BYTE_TO_UBYTE(red);
- col[1] = BYTE_TO_UBYTE(green);
- col[2] = BYTE_TO_UBYTE(blue);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha )
-{
- GLubyte col[4];
- GLfloat r = (GLfloat) red;
- GLfloat g = (GLfloat) green;
- GLfloat b = (GLfloat) blue;
- GLfloat a = (GLfloat) alpha;
- UNCLAMPED_FLOAT_TO_UBYTE(col[0], r);
- UNCLAMPED_FLOAT_TO_UBYTE(col[1], g);
- UNCLAMPED_FLOAT_TO_UBYTE(col[2], b);
- UNCLAMPED_FLOAT_TO_UBYTE(col[3], a);
- COLORUBV( col );
-}
-
-static void GLAPIENTRY
-loopback_Color4i( GLint red, GLint green, GLint blue, GLint alpha )
-{
- GLubyte col[4];
- col[0] = INT_TO_UBYTE(red);
- col[1] = INT_TO_UBYTE(green);
- col[2] = INT_TO_UBYTE(blue);
- col[3] = INT_TO_UBYTE(alpha);
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4s( GLshort red, GLshort green, GLshort blue,
- GLshort alpha )
-{
- GLubyte col[4];
- col[0] = SHORT_TO_UBYTE(red);
- col[1] = SHORT_TO_UBYTE(green);
- col[2] = SHORT_TO_UBYTE(blue);
- col[3] = SHORT_TO_UBYTE(alpha);
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha )
-{
- GLubyte col[4];
- col[0] = UINT_TO_UBYTE(red);
- col[1] = UINT_TO_UBYTE(green);
- col[2] = UINT_TO_UBYTE(blue);
- col[3] = UINT_TO_UBYTE(alpha);
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4us( GLushort red, GLushort green, GLushort blue,
- GLushort alpha )
-{
- GLubyte col[4];
- col[0] = USHORT_TO_UBYTE(red);
- col[1] = USHORT_TO_UBYTE(green);
- col[2] = USHORT_TO_UBYTE(blue);
- col[3] = USHORT_TO_UBYTE(alpha);
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3bv( const GLbyte *v )
-{
- GLubyte col[4];
- col[0] = BYTE_TO_UBYTE(v[0]);
- col[1] = BYTE_TO_UBYTE(v[1]);
- col[2] = BYTE_TO_UBYTE(v[2]);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3dv( const GLdouble *v )
-{
- GLubyte col[4];
- GLfloat r = (GLfloat) v[0];
- GLfloat g = (GLfloat) v[1];
- GLfloat b = (GLfloat) v[2];
- UNCLAMPED_FLOAT_TO_UBYTE(col[0], r);
- UNCLAMPED_FLOAT_TO_UBYTE(col[1], g);
- UNCLAMPED_FLOAT_TO_UBYTE(col[2], b);
- col[3] = 255;
- COLORUBV( col );
-}
-
-static void GLAPIENTRY
-loopback_Color3iv( const GLint *v )
-{
- GLubyte col[4];
- col[0] = INT_TO_UBYTE(v[0]);
- col[1] = INT_TO_UBYTE(v[1]);
- col[2] = INT_TO_UBYTE(v[2]);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3sv( const GLshort *v )
-{
- GLubyte col[4];
- col[0] = SHORT_TO_UBYTE(v[0]);
- col[1] = SHORT_TO_UBYTE(v[1]);
- col[2] = SHORT_TO_UBYTE(v[2]);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3uiv( const GLuint *v )
-{
- GLubyte col[4];
- col[0] = UINT_TO_UBYTE(v[0]);
- col[1] = UINT_TO_UBYTE(v[1]);
- col[2] = UINT_TO_UBYTE(v[2]);
- col[3] = 255;
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color3usv( const GLushort *v )
-{
- GLubyte col[4];
- col[0] = USHORT_TO_UBYTE(v[0]);
- col[1] = USHORT_TO_UBYTE(v[1]);
- col[2] = USHORT_TO_UBYTE(v[2]);
- col[3] = 255;
- COLORUBV(col);
-
-}
-
-static void GLAPIENTRY
-loopback_Color4bv( const GLbyte *v )
-{
- GLubyte col[4];
- col[0] = BYTE_TO_UBYTE(v[0]);
- col[1] = BYTE_TO_UBYTE(v[1]);
- col[2] = BYTE_TO_UBYTE(v[2]);
- col[3] = BYTE_TO_UBYTE(v[3]);
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4dv( const GLdouble *v )
-{
- GLubyte col[4];
- GLfloat r = (GLfloat) v[0];
- GLfloat g = (GLfloat) v[1];
- GLfloat b = (GLfloat) v[2];
- GLfloat a = (GLfloat) v[3];
- UNCLAMPED_FLOAT_TO_UBYTE(col[0], r);
- UNCLAMPED_FLOAT_TO_UBYTE(col[1], g);
- UNCLAMPED_FLOAT_TO_UBYTE(col[2], b);
- UNCLAMPED_FLOAT_TO_UBYTE(col[3], a);
- COLORUBV( col );
-}
-
-static void GLAPIENTRY
-loopback_Color4iv( const GLint *v )
-{
- GLubyte col[4];
- col[0] = INT_TO_UBYTE(v[0]);
- col[1] = INT_TO_UBYTE(v[1]);
- col[2] = INT_TO_UBYTE(v[2]);
- col[3] = INT_TO_UBYTE(v[3]);
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4sv( const GLshort *v)
-{
- GLubyte col[4];
- col[0] = SHORT_TO_UBYTE(v[0]);
- col[1] = SHORT_TO_UBYTE(v[1]);
- col[2] = SHORT_TO_UBYTE(v[2]);
- col[3] = SHORT_TO_UBYTE(v[3]);
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4uiv( const GLuint *v)
-{
- GLubyte col[4];
- col[0] = UINT_TO_UBYTE(v[0]);
- col[1] = UINT_TO_UBYTE(v[1]);
- col[2] = UINT_TO_UBYTE(v[2]);
- col[3] = UINT_TO_UBYTE(v[3]);
- COLORUBV(col);
-}
-
-static void GLAPIENTRY
-loopback_Color4usv( const GLushort *v)
-{
- GLubyte col[4];
- col[0] = USHORT_TO_UBYTE(v[0]);
- col[1] = USHORT_TO_UBYTE(v[1]);
- col[2] = USHORT_TO_UBYTE(v[2]);
- col[3] = USHORT_TO_UBYTE(v[3]);
- COLORUBV(col);
-}
+/* Extension functions must be dereferenced through _glapi_Dispatch as
+ * not all libGL.so's will have all the uptodate entrypoints.
+ */
+#define ATTRIB1(index,x) _glapi_Dispatch->VertexAttrib1fNV(index,x)
+#define ATTRIB2(index,x,y) _glapi_Dispatch->VertexAttrib2fNV(index,x,y)
+#define ATTRIB3(index,x,y,z) _glapi_Dispatch->VertexAttrib3fNV(index,x,y,z)
+#define ATTRIB4(index,x,y,z,w) _glapi_Dispatch->VertexAttrib4fNV(index,x,y,z,w)
+#define FOGCOORDF(x) _glapi_Dispatch->FogCoordfEXT(x)
+#define SECONDARYCOLORF(a,b,c) _glapi_Dispatch->SecondaryColor3fEXT(a,b,c)
static void GLAPIENTRY
loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue )
@@ -397,6 +117,13 @@ loopback_Color3us_f( GLushort red, GLushort green, GLushort blue )
USHORT_TO_FLOAT(blue), 1.0 );
}
+static void GLAPIENTRY
+loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue )
+{
+ COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green),
+ UBYTE_TO_FLOAT(blue), 1.0 );
+}
+
static void GLAPIENTRY
loopback_Color3bv_f( const GLbyte *v )
@@ -439,6 +166,13 @@ loopback_Color3usv_f( const GLushort *v )
USHORT_TO_FLOAT(v[2]), 1.0 );
}
+static void GLAPIENTRY
+loopback_Color3ubv_f( const GLubyte *v )
+{
+ COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]), 1.0 );
+}
+
static void GLAPIENTRY
loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue,
@@ -484,6 +218,13 @@ loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha
USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) );
}
+static void
+loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
+{
+ COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green),
+ UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha) );
+}
+
static void GLAPIENTRY
loopback_Color4iv_f( const GLint *v )
@@ -530,6 +271,13 @@ loopback_Color4usv_f( const GLushort *v)
}
static void GLAPIENTRY
+loopback_Color4ubv_f( const GLubyte *v)
+{
+ COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) );
+}
+
+static void GLAPIENTRY
loopback_FogCoorddEXT( GLdouble d )
{
FOGCOORDF( (GLfloat) d );
@@ -545,55 +293,49 @@ loopback_FogCoorddvEXT( const GLdouble *v )
static void GLAPIENTRY
loopback_Indexd( GLdouble c )
{
- INDEX( (GLint) c );
+ INDEX( (GLfloat) c );
}
static void GLAPIENTRY
-loopback_Indexf( GLfloat c )
+loopback_Indexi( GLint c )
{
- INDEX( (GLuint) (GLint) c );
+ INDEX( (GLfloat) c );
}
static void GLAPIENTRY
loopback_Indexs( GLshort c )
{
- INDEX( (GLint) c );
+ INDEX( (GLfloat) c );
}
static void GLAPIENTRY
loopback_Indexub( GLubyte c )
{
- INDEX( (GLint) c );
+ INDEX( (GLfloat) c );
}
static void GLAPIENTRY
loopback_Indexdv( const GLdouble *c )
{
- INDEX( (GLint) (GLint) *c );
-}
-
-static void GLAPIENTRY
-loopback_Indexfv( const GLfloat *c )
-{
- INDEX( (GLint) (GLint) *c );
+ INDEX( (GLfloat) *c );
}
static void GLAPIENTRY
loopback_Indexiv( const GLint *c )
{
- INDEX( *c );
+ INDEX( (GLfloat) *c );
}
static void GLAPIENTRY
loopback_Indexsv( const GLshort *c )
{
- INDEX( (GLint) *c );
+ INDEX( (GLfloat) *c );
}
static void GLAPIENTRY
loopback_Indexubv( const GLubyte *c )
{
- INDEX( (GLint) *c );
+ INDEX( (GLfloat) *c );
}
static void GLAPIENTRY
@@ -1173,114 +915,6 @@ loopback_Rectsv(const GLshort *v1, const GLshort *v2)
}
static void GLAPIENTRY
-loopback_SecondaryColor3bEXT( GLbyte red, GLbyte green, GLbyte blue )
-{
- SECONDARYCOLORUB( BYTE_TO_UBYTE(red),
- BYTE_TO_UBYTE(green),
- BYTE_TO_UBYTE(blue) );
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3dEXT( GLdouble red, GLdouble green, GLdouble blue )
-{
- GLubyte col[3];
- GLfloat r = (GLfloat) red;
- GLfloat g = (GLfloat) green;
- GLfloat b = (GLfloat) blue;
- UNCLAMPED_FLOAT_TO_UBYTE(col[0], r);
- UNCLAMPED_FLOAT_TO_UBYTE(col[1], g);
- UNCLAMPED_FLOAT_TO_UBYTE(col[2], b);
- SECONDARYCOLORUB( col[0], col[1], col[2] );
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3iEXT( GLint red, GLint green, GLint blue )
-{
- SECONDARYCOLORUB( INT_TO_UBYTE(red),
- INT_TO_UBYTE(green),
- INT_TO_UBYTE(blue));
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3sEXT( GLshort red, GLshort green, GLshort blue )
-{
- SECONDARYCOLORUB(SHORT_TO_UBYTE(red),
- SHORT_TO_UBYTE(green),
- SHORT_TO_UBYTE(blue));
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3uiEXT( GLuint red, GLuint green, GLuint blue )
-{
- SECONDARYCOLORUB(UINT_TO_UBYTE(red),
- UINT_TO_UBYTE(green),
- UINT_TO_UBYTE(blue));
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3usEXT( GLushort red, GLushort green, GLushort blue )
-{
- SECONDARYCOLORUB(USHORT_TO_UBYTE(red),
- USHORT_TO_UBYTE(green),
- USHORT_TO_UBYTE(blue));
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3bvEXT( const GLbyte *v )
-{
- const GLfloat a = BYTE_TO_FLOAT(v[0]);
- const GLfloat b = BYTE_TO_FLOAT(v[1]);
- const GLfloat c = BYTE_TO_FLOAT(v[2]);
- SECONDARYCOLORF(a,b,c);
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3dvEXT( const GLdouble *v )
-{
- GLubyte col[3];
- GLfloat r = (GLfloat) v[0];
- GLfloat g = (GLfloat) v[1];
- GLfloat b = (GLfloat) v[2];
- UNCLAMPED_FLOAT_TO_UBYTE(col[0], r);
- UNCLAMPED_FLOAT_TO_UBYTE(col[1], g);
- UNCLAMPED_FLOAT_TO_UBYTE(col[2], b);
- SECONDARYCOLORUB( col[0], col[1], col[2] );
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3ivEXT( const GLint *v )
-{
- SECONDARYCOLORUB(INT_TO_UBYTE(v[0]),
- INT_TO_UBYTE(v[1]),
- INT_TO_UBYTE(v[2]));
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3svEXT( const GLshort *v )
-{
- SECONDARYCOLORUB(SHORT_TO_UBYTE(v[0]),
- SHORT_TO_UBYTE(v[1]),
- SHORT_TO_UBYTE(v[2]));
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3uivEXT( const GLuint *v )
-{
- SECONDARYCOLORUB(UINT_TO_UBYTE(v[0]),
- UINT_TO_UBYTE(v[1]),
- UINT_TO_UBYTE(v[2]));
-}
-
-static void GLAPIENTRY
-loopback_SecondaryColor3usvEXT( const GLushort *v )
-{
- SECONDARYCOLORUB(USHORT_TO_UBYTE(v[0]),
- USHORT_TO_UBYTE(v[1]),
- USHORT_TO_UBYTE(v[2]));
-}
-
-
-static void GLAPIENTRY
loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue )
{
SECONDARYCOLORF( BYTE_TO_FLOAT(red),
@@ -1327,6 +961,14 @@ loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue )
}
static void GLAPIENTRY
+loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue )
+{
+ SECONDARYCOLORF(UBYTE_TO_FLOAT(red),
+ UBYTE_TO_FLOAT(green),
+ UBYTE_TO_FLOAT(blue));
+}
+
+static void GLAPIENTRY
loopback_SecondaryColor3bvEXT_f( const GLbyte *v )
{
SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]),
@@ -1371,6 +1013,14 @@ loopback_SecondaryColor3usvEXT_f( const GLushort *v )
USHORT_TO_FLOAT(v[2]));
}
+static void GLAPIENTRY
+loopback_SecondaryColor3ubvEXT_f( const GLubyte *v )
+{
+ SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]));
+}
+
/*
* GL_NV_vertex_program
@@ -1379,153 +1029,153 @@ loopback_SecondaryColor3usvEXT_f( const GLushort *v )
static void GLAPIENTRY
loopback_VertexAttrib1sNV(GLuint index, GLshort x)
{
- ATTRIB(index, (GLfloat) x, 0.0F, 0.0F, 1.0F);
+ ATTRIB1(index, (GLfloat) x);
}
static void GLAPIENTRY
loopback_VertexAttrib1fNV(GLuint index, GLfloat x)
{
- ATTRIB(index, x, 0.0F, 0.0F, 1.0F);
+ ATTRIB1(index, x);
}
static void GLAPIENTRY
loopback_VertexAttrib1dNV(GLuint index, GLdouble x)
{
- ATTRIB(index, (GLfloat) x, 0.0F, 0.0F, 1.0F);
+ ATTRIB1(index, (GLfloat) x);
}
static void GLAPIENTRY
loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y)
{
- ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F);
+ ATTRIB2(index, (GLfloat) x, y);
}
static void GLAPIENTRY
loopback_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
{
- ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F);
+ ATTRIB2(index, (GLfloat) x, y);
}
static void GLAPIENTRY
loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y)
{
- ATTRIB(index, (GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
+ ATTRIB2(index, (GLfloat) x, (GLfloat) y);
}
static void GLAPIENTRY
loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z)
{
- ATTRIB(index, (GLfloat) x, y, z, 1.0F);
+ ATTRIB3(index, (GLfloat) x, y, z);
}
static void GLAPIENTRY
loopback_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
{
- ATTRIB(index, x, y, z, 1.0F);
+ ATTRIB3(index, x, y, z);
}
static void GLAPIENTRY
loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z)
{
- ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
+ ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
}
static void GLAPIENTRY
loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
{
- ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+ ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
}
static void GLAPIENTRY
loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
- ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
+ ATTRIB4(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
}
static void GLAPIENTRY
loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
{
- ATTRIB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y),
+ ATTRIB4(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y),
UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w));
}
static void GLAPIENTRY
loopback_VertexAttrib1svNV(GLuint index, const GLshort *v)
{
- ATTRIB(index, (GLfloat) v[0], 0.0F, 0.0F, 1.0F);
+ ATTRIB1(index, (GLfloat) v[0]);
}
static void GLAPIENTRY
loopback_VertexAttrib1fvNV(GLuint index, const GLfloat *v)
{
- ATTRIB(index, v[0], 0.0F, 0.0F, 1.0F);
+ ATTRIB1(index, v[0]);
}
static void GLAPIENTRY
loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+ ATTRIB1(index, (GLfloat) v[0]);
}
static void GLAPIENTRY
loopback_VertexAttrib2svNV(GLuint index, const GLshort *v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+ ATTRIB2(index, (GLfloat) v[0], (GLfloat) v[1]);
}
static void GLAPIENTRY
loopback_VertexAttrib2fvNV(GLuint index, const GLfloat *v)
{
- ATTRIB(index, v[0], v[1], 0.0F, 1.0F);
+ ATTRIB2(index, v[0], v[1]);
}
static void GLAPIENTRY
loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
+ ATTRIB2(index, (GLfloat) v[0], (GLfloat) v[1]);
}
static void GLAPIENTRY
loopback_VertexAttrib3svNV(GLuint index, const GLshort *v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+ ATTRIB2(index, (GLfloat) v[0], (GLfloat) v[1]);
}
static void GLAPIENTRY
loopback_VertexAttrib3fvNV(GLuint index, const GLfloat *v)
{
- ATTRIB(index, v[0], v[1], v[2], 1.0F);
+ ATTRIB3(index, v[0], v[1], v[2]);
}
static void GLAPIENTRY
loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
+ ATTRIB3(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]);
}
static void GLAPIENTRY
loopback_VertexAttrib4svNV(GLuint index, const GLshort *v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2],
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2],
(GLfloat)v[3]);
}
static void GLAPIENTRY
loopback_VertexAttrib4fvNV(GLuint index, const GLfloat *v)
{
- ATTRIB(index, v[0], v[1], v[2], v[3]);
+ ATTRIB4(index, v[0], v[1], v[2], v[3]);
}
static void GLAPIENTRY
loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void GLAPIENTRY
loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
{
- ATTRIB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]),
+ ATTRIB4(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]),
UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]));
}
@@ -1642,171 +1292,127 @@ loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
static void GLAPIENTRY
loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void GLAPIENTRY
loopback_VertexAttrib4ivARB(GLuint index, const GLint * v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void GLAPIENTRY
loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void GLAPIENTRY
loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void GLAPIENTRY
loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v)
{
- ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIB4(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);
}
static void GLAPIENTRY
loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v)
{
- ATTRIB(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]),
+ ATTRIB4(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]),
BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]));
}
static void GLAPIENTRY
loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v)
{
- ATTRIB(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
+ ATTRIB4(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]));
}
static void GLAPIENTRY
loopback_VertexAttrib4NivARB(GLuint index, const GLint * v)
{
- ATTRIB(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]),
+ ATTRIB4(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]),
INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]));
}
static void GLAPIENTRY
loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v)
{
- ATTRIB(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
+ ATTRIB4(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]));
}
static void GLAPIENTRY
loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v)
{
- ATTRIB(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]),
+ ATTRIB4(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]),
UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]));
}
-void
-_mesa_loopback_prefer_float( struct _glapi_table *dest,
- GLboolean prefer_float_colors )
-{
- if (!prefer_float_colors) {
- dest->Color3b = loopback_Color3b;
- dest->Color3d = loopback_Color3d;
- dest->Color3i = loopback_Color3i;
- dest->Color3s = loopback_Color3s;
- dest->Color3ui = loopback_Color3ui;
- dest->Color3us = loopback_Color3us;
- dest->Color4b = loopback_Color4b;
- dest->Color4d = loopback_Color4d;
- dest->Color4i = loopback_Color4i;
- dest->Color4s = loopback_Color4s;
- dest->Color4ui = loopback_Color4ui;
- dest->Color4us = loopback_Color4us;
- dest->Color3bv = loopback_Color3bv;
- dest->Color3dv = loopback_Color3dv;
- dest->Color3iv = loopback_Color3iv;
- dest->Color3sv = loopback_Color3sv;
- dest->Color3uiv = loopback_Color3uiv;
- dest->Color3usv = loopback_Color3usv;
- dest->Color4bv = loopback_Color4bv;
- dest->Color4dv = loopback_Color4dv;
- dest->Color4iv = loopback_Color4iv;
- dest->Color4sv = loopback_Color4sv;
- dest->Color4uiv = loopback_Color4uiv;
- dest->Color4usv = loopback_Color4usv;
- dest->SecondaryColor3bEXT = loopback_SecondaryColor3bEXT;
- dest->SecondaryColor3dEXT = loopback_SecondaryColor3dEXT;
- dest->SecondaryColor3iEXT = loopback_SecondaryColor3iEXT;
- dest->SecondaryColor3sEXT = loopback_SecondaryColor3sEXT;
- dest->SecondaryColor3uiEXT = loopback_SecondaryColor3uiEXT;
- dest->SecondaryColor3usEXT = loopback_SecondaryColor3usEXT;
- dest->SecondaryColor3bvEXT = loopback_SecondaryColor3bvEXT;
- dest->SecondaryColor3dvEXT = loopback_SecondaryColor3dvEXT;
- dest->SecondaryColor3ivEXT = loopback_SecondaryColor3ivEXT;
- dest->SecondaryColor3svEXT = loopback_SecondaryColor3svEXT;
- dest->SecondaryColor3uivEXT = loopback_SecondaryColor3uivEXT;
- dest->SecondaryColor3usvEXT = loopback_SecondaryColor3usvEXT;
- }
- else {
- dest->Color3b = loopback_Color3b_f;
- dest->Color3d = loopback_Color3d_f;
- dest->Color3i = loopback_Color3i_f;
- dest->Color3s = loopback_Color3s_f;
- dest->Color3ui = loopback_Color3ui_f;
- dest->Color3us = loopback_Color3us_f;
- dest->Color4b = loopback_Color4b_f;
- dest->Color4d = loopback_Color4d_f;
- dest->Color4i = loopback_Color4i_f;
- dest->Color4s = loopback_Color4s_f;
- dest->Color4ui = loopback_Color4ui_f;
- dest->Color4us = loopback_Color4us_f;
- dest->Color3bv = loopback_Color3bv_f;
- dest->Color3dv = loopback_Color3dv_f;
- dest->Color3iv = loopback_Color3iv_f;
- dest->Color3sv = loopback_Color3sv_f;
- dest->Color3uiv = loopback_Color3uiv_f;
- dest->Color3usv = loopback_Color3usv_f;
- dest->Color4bv = loopback_Color4bv_f;
- dest->Color4dv = loopback_Color4dv_f;
- dest->Color4iv = loopback_Color4iv_f;
- dest->Color4sv = loopback_Color4sv_f;
- dest->Color4uiv = loopback_Color4uiv_f;
- dest->Color4usv = loopback_Color4usv_f;
- dest->SecondaryColor3bEXT = loopback_SecondaryColor3bEXT_f;
- dest->SecondaryColor3dEXT = loopback_SecondaryColor3dEXT_f;
- dest->SecondaryColor3iEXT = loopback_SecondaryColor3iEXT_f;
- dest->SecondaryColor3sEXT = loopback_SecondaryColor3sEXT_f;
- dest->SecondaryColor3uiEXT = loopback_SecondaryColor3uiEXT_f;
- dest->SecondaryColor3usEXT = loopback_SecondaryColor3usEXT_f;
- dest->SecondaryColor3bvEXT = loopback_SecondaryColor3bvEXT_f;
- dest->SecondaryColor3dvEXT = loopback_SecondaryColor3dvEXT_f;
- dest->SecondaryColor3ivEXT = loopback_SecondaryColor3ivEXT_f;
- dest->SecondaryColor3svEXT = loopback_SecondaryColor3svEXT_f;
- dest->SecondaryColor3uivEXT = loopback_SecondaryColor3uivEXT_f;
- dest->SecondaryColor3usvEXT = loopback_SecondaryColor3usvEXT_f;
- }
-}
-/* Passing prefer_float_colors as true will mean that all colors
- * *except* Color{34}ub{v} are passed as floats. Setting it false will
- * mean all colors *except* Color{34}f{v} are passed as ubytes.
- *
+/*
* This code never registers handlers for any of the entry points
* listed in vtxfmt.h.
*/
void
-_mesa_loopback_init_api_table( struct _glapi_table *dest,
- GLboolean prefer_float_colors )
-{
- _mesa_loopback_prefer_float( dest, prefer_float_colors );
-
+_mesa_loopback_init_api_table( struct _glapi_table *dest )
+{
+ dest->Color3b = loopback_Color3b_f;
+ dest->Color3d = loopback_Color3d_f;
+ dest->Color3i = loopback_Color3i_f;
+ dest->Color3s = loopback_Color3s_f;
+ dest->Color3ui = loopback_Color3ui_f;
+ dest->Color3us = loopback_Color3us_f;
+ dest->Color3ub = loopback_Color3ub_f;
+ dest->Color4b = loopback_Color4b_f;
+ dest->Color4d = loopback_Color4d_f;
+ dest->Color4i = loopback_Color4i_f;
+ dest->Color4s = loopback_Color4s_f;
+ dest->Color4ui = loopback_Color4ui_f;
+ dest->Color4us = loopback_Color4us_f;
+ dest->Color4ub = loopback_Color4ub_f;
+ dest->Color3bv = loopback_Color3bv_f;
+ dest->Color3dv = loopback_Color3dv_f;
+ dest->Color3iv = loopback_Color3iv_f;
+ dest->Color3sv = loopback_Color3sv_f;
+ dest->Color3uiv = loopback_Color3uiv_f;
+ dest->Color3usv = loopback_Color3usv_f;
+ dest->Color3ubv = loopback_Color3ubv_f;
+ dest->Color4bv = loopback_Color4bv_f;
+ dest->Color4dv = loopback_Color4dv_f;
+ dest->Color4iv = loopback_Color4iv_f;
+ dest->Color4sv = loopback_Color4sv_f;
+ dest->Color4uiv = loopback_Color4uiv_f;
+ dest->Color4usv = loopback_Color4usv_f;
+ dest->Color4ubv = loopback_Color4ubv_f;
+
+ dest->SecondaryColor3bEXT = loopback_SecondaryColor3bEXT_f;
+ dest->SecondaryColor3dEXT = loopback_SecondaryColor3dEXT_f;
+ dest->SecondaryColor3iEXT = loopback_SecondaryColor3iEXT_f;
+ dest->SecondaryColor3sEXT = loopback_SecondaryColor3sEXT_f;
+ dest->SecondaryColor3uiEXT = loopback_SecondaryColor3uiEXT_f;
+ dest->SecondaryColor3usEXT = loopback_SecondaryColor3usEXT_f;
+ dest->SecondaryColor3ubEXT = loopback_SecondaryColor3ubEXT_f;
+ dest->SecondaryColor3bvEXT = loopback_SecondaryColor3bvEXT_f;
+ dest->SecondaryColor3dvEXT = loopback_SecondaryColor3dvEXT_f;
+ dest->SecondaryColor3ivEXT = loopback_SecondaryColor3ivEXT_f;
+ dest->SecondaryColor3svEXT = loopback_SecondaryColor3svEXT_f;
+ dest->SecondaryColor3uivEXT = loopback_SecondaryColor3uivEXT_f;
+ dest->SecondaryColor3usvEXT = loopback_SecondaryColor3usvEXT_f;
+ dest->SecondaryColor3ubvEXT = loopback_SecondaryColor3ubvEXT_f;
+
dest->Indexd = loopback_Indexd;
- dest->Indexf = loopback_Indexf;
+ dest->Indexi = loopback_Indexi;
dest->Indexs = loopback_Indexs;
dest->Indexub = loopback_Indexub;
dest->Indexdv = loopback_Indexdv;
- dest->Indexfv = loopback_Indexfv;
dest->Indexiv = loopback_Indexiv;
dest->Indexsv = loopback_Indexsv;
dest->Indexubv = loopback_Indexubv;
diff --git a/src/mesa/main/api_loopback.h b/src/mesa/main/api_loopback.h
index 202261aa9c..6f85bbc1d9 100644
--- a/src/mesa/main/api_loopback.h
+++ b/src/mesa/main/api_loopback.h
@@ -32,10 +32,6 @@
struct _glapi_table;
-extern void _mesa_loopback_prefer_float( struct _glapi_table *dest,
- GLboolean prefer_float_colors );
-
-extern void _mesa_loopback_init_api_table( struct _glapi_table *dest,
- GLboolean prefer_float_colors );
+extern void _mesa_loopback_init_api_table( struct _glapi_table *dest );
#endif
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index bab333dca8..f6228739dd 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -27,11 +27,13 @@
#include "glheader.h"
#include "api_noop.h"
#include "api_validate.h"
+#include "api_arrayelt.h"
#include "context.h"
#include "colormac.h"
#include "light.h"
#include "macros.h"
#include "mtypes.h"
+#include "dlist.h"
/* In states where certain vertex components are required for t&l or
@@ -53,93 +55,56 @@ void _mesa_noop_EdgeFlagv( const GLboolean *b )
ctx->Current.EdgeFlag = *b;
}
-void _mesa_noop_FogCoordfEXT( GLfloat a )
+void _mesa_noop_Indexf( GLfloat f )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = a;
+ ctx->Current.Index = f;
}
-void _mesa_noop_FogCoordfvEXT( const GLfloat *v )
+void _mesa_noop_Indexfv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = *v;
+ ctx->Current.Index = *v;
}
-void _mesa_noop_Indexi( GLint i )
+void _mesa_noop_FogCoordfEXT( GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.Index = i;
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG];
+ dest[0] = a;
+ dest[1] = 0.0;
+ dest[2] = 0.0;
+ dest[3] = 1.0;
}
-void _mesa_noop_Indexiv( const GLint *v )
+void _mesa_noop_FogCoordfvEXT( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.Index = *v;
+ GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
+ dest[0] = v[0];
+ dest[1] = 0.0;
+ dest[2] = 0.0;
+ dest[3] = 1.0;
}
void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
- COPY_FLOAT(dest[0], a);
- COPY_FLOAT(dest[1], b);
- COPY_FLOAT(dest[2], c);
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
+ dest[3] = 1.0;
}
void _mesa_noop_Normal3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
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]);
-}
-
-void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint i, nr;
- struct gl_material *mat = &ctx->Light.Material;
- GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0,
- "_mesa_noop_Materialfv" );
-
- if (ctx->Light.ColorMaterialEnabled)
- bitmask &= ~ctx->Light.ColorMaterialBitmask;
-
- if (bitmask == 0)
- return;
-
- switch (face) {
- case GL_SHININESS: nr = 1; break;
- case GL_COLOR_INDEXES: nr = 3; break;
- default: nr = 4 ; break;
- }
-
- for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
- if (bitmask & (1<<i))
- COPY_SZ_4V( mat->Attrib[i], nr, params );
-
- _mesa_update_material( ctx, bitmask );
-}
-
-void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d )
-{
- GET_CURRENT_CONTEXT(ctx);
- 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);
- color[3] = UBYTE_TO_FLOAT(d);
-}
-
-void _mesa_noop_Color4ubv( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- 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]);
- color[3] = UBYTE_TO_FLOAT(v[3]);
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
+ dest[3] = 1.0;
}
void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
@@ -162,26 +127,6 @@ void _mesa_noop_Color4fv( const GLfloat *v )
color[3] = v[3];
}
-void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c )
-{
- GET_CURRENT_CONTEXT(ctx);
- 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);
- color[3] = 1.0;
-}
-
-void _mesa_noop_Color3ubv( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- 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]);
- color[3] = 1.0;
-}
-
void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
@@ -212,7 +157,7 @@ void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
if (unit < MAX_TEXTURE_COORD_UNITS)
{
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
- COPY_FLOAT(dest[0], a);
+ dest[0] = a;
dest[1] = 0;
dest[2] = 0;
dest[3] = 1;
@@ -229,7 +174,7 @@ void _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
if (unit < MAX_TEXTURE_COORD_UNITS)
{
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
- COPY_FLOAT(dest[0], v[0]);
+ dest[0] = v[0];
dest[1] = 0;
dest[2] = 0;
dest[3] = 1;
@@ -246,8 +191,8 @@ void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b )
if (unit < MAX_TEXTURE_COORD_UNITS)
{
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
- COPY_FLOAT(dest[0], a);
- COPY_FLOAT(dest[1], b);
+ dest[0] = a;
+ dest[1] = b;
dest[2] = 0;
dest[3] = 1;
}
@@ -263,8 +208,8 @@ void _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
if (unit < MAX_TEXTURE_COORD_UNITS)
{
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
- COPY_FLOAT(dest[0], v[0]);
- COPY_FLOAT(dest[1], v[1]);
+ dest[0] = v[0];
+ dest[1] = v[1];
dest[2] = 0;
dest[3] = 1;
}
@@ -280,9 +225,9 @@ void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat
if (unit < MAX_TEXTURE_COORD_UNITS)
{
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
- COPY_FLOAT(dest[0], a);
- COPY_FLOAT(dest[1], b);
- COPY_FLOAT(dest[2], c);
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
dest[3] = 1;
}
}
@@ -297,9 +242,9 @@ void _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v )
if (unit < MAX_TEXTURE_COORD_UNITS)
{
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]);
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
dest[3] = 1;
}
}
@@ -315,9 +260,9 @@ void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b,
if (unit < MAX_TEXTURE_COORD_UNITS)
{
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
- COPY_FLOAT(dest[0], a);
- COPY_FLOAT(dest[1], b);
- COPY_FLOAT(dest[2], c);
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
dest[3] = d;
}
}
@@ -332,33 +277,13 @@ void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v )
if (unit < MAX_TEXTURE_COORD_UNITS)
{
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]);
- COPY_FLOAT(dest[3], v[3]);
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
+ dest[3] = v[3];
}
}
-void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c )
-{
- GET_CURRENT_CONTEXT(ctx);
- 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);
- color[3] = 1.0;
-}
-
-void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- 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]);
- color[3] = 1.0;
-}
-
void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
@@ -383,7 +308,7 @@ void _mesa_noop_TexCoord1f( GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- COPY_FLOAT(dest[0], a);
+ dest[0] = a;
dest[1] = 0;
dest[2] = 0;
dest[3] = 1;
@@ -393,7 +318,7 @@ void _mesa_noop_TexCoord1fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- COPY_FLOAT(dest[0], v[0]);
+ dest[0] = v[0];
dest[1] = 0;
dest[2] = 0;
dest[3] = 1;
@@ -403,8 +328,8 @@ void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- COPY_FLOAT(dest[0], a);
- COPY_FLOAT(dest[1], b);
+ dest[0] = a;
+ dest[1] = b;
dest[2] = 0;
dest[3] = 1;
}
@@ -413,8 +338,8 @@ void _mesa_noop_TexCoord2fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- COPY_FLOAT(dest[0], v[0]);
- COPY_FLOAT(dest[1], v[1]);
+ dest[0] = v[0];
+ dest[1] = v[1];
dest[2] = 0;
dest[3] = 1;
}
@@ -423,9 +348,9 @@ void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- COPY_FLOAT(dest[0], a);
- COPY_FLOAT(dest[1], b);
- COPY_FLOAT(dest[2], c);
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
dest[3] = 1;
}
@@ -433,9 +358,9 @@ void _mesa_noop_TexCoord3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
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]);
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
dest[3] = 1;
}
@@ -443,23 +368,136 @@ void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- COPY_FLOAT(dest[0], a);
- COPY_FLOAT(dest[1], b);
- COPY_FLOAT(dest[2], c);
- COPY_FLOAT(dest[3], d);
+ dest[0] = a;
+ dest[1] = b;
+ dest[2] = c;
+ dest[3] = d;
}
void _mesa_noop_TexCoord4fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
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]);
+ dest[0] = v[0];
+ dest[1] = v[1];
+ dest[2] = v[2];
+ dest[3] = v[3];
+}
+
+
+
+void _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < 16) {
+ ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
+}
+
+void _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < 16) {
+ ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
+}
+
+void _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < 16) {
+ ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
+}
+
+void _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < 16) {
+ ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
+}
+
+void _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < 16) {
+ ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
+}
+
+void _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (index < 16) {
+ ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
+}
+
+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);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
+}
+
+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]);
+ }
+ else
+ _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
}
-/* Useful outside begin/end?
+/* Material
+ */
+void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i, nr;
+ struct gl_material *mat = &ctx->Light.Material;
+ GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0,
+ "_mesa_noop_Materialfv" );
+
+ if (ctx->Light.ColorMaterialEnabled)
+ bitmask &= ~ctx->Light.ColorMaterialBitmask;
+
+ if (bitmask == 0)
+ return;
+
+ switch (face) {
+ case GL_SHININESS: nr = 1; break;
+ case GL_COLOR_INDEXES: nr = 3; break;
+ default: nr = 4 ; break;
+ }
+
+ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
+ if (bitmask & (1<<i))
+ COPY_SZ_4V( mat->Attrib[i], nr, params );
+
+ _mesa_update_material( ctx, bitmask );
+}
+
+/* These really are noops outside begin/end:
*/
void _mesa_noop_Vertex2fv( const GLfloat *v )
{
@@ -491,26 +529,55 @@ void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
(void) a; (void) b; (void) c; (void) d;
}
+/* Similarly, these have no effect outside begin/end:
+ */
+void _mesa_noop_EvalCoord1f( GLfloat a )
+{
+ (void) a;
+}
+void _mesa_noop_EvalCoord1fv( const GLfloat *v )
+{
+ (void) v;
+}
-void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
- GLfloat y, GLfloat z, GLfloat w )
+void _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b )
{
- GET_CURRENT_CONTEXT(ctx);
- if (index < 16) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
- }
+ (void) a; (void) b;
}
-void _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
+void _mesa_noop_EvalCoord2fv( const GLfloat *v )
{
- GET_CURRENT_CONTEXT(ctx);
- if (index < 16) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
- }
+ (void) v;
+}
+
+void _mesa_noop_EvalPoint1( GLint a )
+{
+ (void) a;
+}
+
+void _mesa_noop_EvalPoint2( GLint a, GLint b )
+{
+ (void) a; (void) b;
}
+/* Begin -- call into driver, should result in the vtxfmt being
+ * swapped out:
+ */
+void _mesa_noop_Begin( GLenum mode )
+{
+}
+
+
+/* End -- just raise an error
+ */
+void _mesa_noop_End( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error( ctx, GL_INVALID_OPERATION, __FUNCTION__ );
+}
+
/* Execute a glRectf() function. This is not suitable for GL_COMPILE
* modes (as the test for outside begin/end is not compiled),
@@ -549,7 +616,7 @@ void _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
return;
glBegin(mode);
- for (i = start ; i <= count ; i++)
+ for (i = start ; i < count ; i++)
glArrayElement( i );
glEnd();
}
@@ -599,3 +666,199 @@ void _mesa_noop_DrawRangeElements(GLenum mode,
count, type, indices ))
glDrawElements( mode, count, type, indices );
}
+
+/*
+ * Eval Mesh
+ */
+
+/* KW: If are compiling, we don't know whether eval will produce a
+ * vertex when it is run in the future. If this is pure immediate
+ * mode, eval is a noop if neither vertex map is enabled.
+ *
+ * Thus we need to have a check in the display list code or
+ * elsewhere for eval(1,2) vertices in the case where
+ * map(1,2)_vertex is disabled, and to purge those vertices from
+ * the vb.
+ */
+void _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+ GLfloat u, du;
+ GLenum prim;
+
+ switch (mode) {
+ case GL_POINT:
+ prim = GL_POINTS;
+ break;
+ case GL_LINE:
+ prim = GL_LINE_STRIP;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" );
+ return;
+ }
+
+ /* No effect if vertex maps disabled.
+ */
+ if (!ctx->Eval.Map1Vertex4 &&
+ !ctx->Eval.Map1Vertex3 &&
+ !(ctx->VertexProgram.Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
+ return;
+
+ du = ctx->Eval.MapGrid1du;
+ u = ctx->Eval.MapGrid1u1 + i1 * du;
+
+ glBegin( prim );
+ for (i=i1;i<=i2;i++,u+=du) {
+ glEvalCoord1f( u );
+ }
+ glEnd();
+}
+
+
+
+void _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat u, du, v, dv, v1, u1;
+ GLint i, j;
+
+ switch (mode) {
+ case GL_POINT:
+ case GL_LINE:
+ case GL_FILL:
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
+ return;
+ }
+
+ /* No effect if vertex maps disabled.
+ */
+ if (!ctx->Eval.Map2Vertex4 &&
+ !ctx->Eval.Map2Vertex3 &&
+ !(ctx->VertexProgram.Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
+ return;
+
+ du = ctx->Eval.MapGrid2du;
+ dv = ctx->Eval.MapGrid2dv;
+ v1 = ctx->Eval.MapGrid2v1 + j1 * dv;
+ u1 = ctx->Eval.MapGrid2u1 + i1 * du;
+
+ switch (mode) {
+ case GL_POINT:
+ glBegin( GL_POINTS );
+ for (v=v1,j=j1;j<=j2;j++,v+=dv) {
+ for (u=u1,i=i1;i<=i2;i++,u+=du) {
+ glEvalCoord2f(u, v );
+ }
+ }
+ glEnd();
+ break;
+ case GL_LINE:
+ for (v=v1,j=j1;j<=j2;j++,v+=dv) {
+ glBegin( GL_LINE_STRIP );
+ for (u=u1,i=i1;i<=i2;i++,u+=du) {
+ glEvalCoord2f(u, v );
+ }
+ glEnd();
+ }
+ for (u=u1,i=i1;i<=i2;i++,u+=du) {
+ glBegin( GL_LINE_STRIP );
+ for (v=v1,j=j1;j<=j2;j++,v+=dv) {
+ glEvalCoord2f(u, v );
+ }
+ glEnd();
+ }
+ break;
+ case GL_FILL:
+ for (v=v1,j=j1;j<j2;j++,v+=dv) {
+ glBegin( GL_TRIANGLE_STRIP );
+ for (u=u1,i=i1;i<=i2;i++,u+=du) {
+ glEvalCoord2f(u, v );
+ glEvalCoord2f(u, v+dv );
+ }
+ glEnd();
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
+ return;
+ }
+}
+
+
+
+/* Build a vertexformat full of things to use outside begin/end pairs.
+ *
+ * TODO -- build a whole dispatch table for this purpose, and likewise
+ * for inside begin/end.
+ */
+void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
+{
+ vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
+ vfmt->Begin = _mesa_noop_Begin;
+ vfmt->CallList = _mesa_CallList;
+ vfmt->CallLists = _mesa_CallLists;
+ vfmt->Color3f = _mesa_noop_Color3f;
+ vfmt->Color3fv = _mesa_noop_Color3fv;
+ vfmt->Color4f = _mesa_noop_Color4f;
+ vfmt->Color4fv = _mesa_noop_Color4fv;
+ vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
+ vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
+ vfmt->End = _mesa_noop_End;
+ vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f;
+ vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv;
+ vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f;
+ vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv;
+ vfmt->EvalPoint1 = _mesa_noop_EvalPoint1;
+ vfmt->EvalPoint2 = _mesa_noop_EvalPoint2;
+ vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
+ vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
+ vfmt->Indexf = _mesa_noop_Indexf;
+ vfmt->Indexfv = _mesa_noop_Indexfv;
+ vfmt->Materialfv = _mesa_noop_Materialfv;
+ vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB;
+ vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB;
+ vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB;
+ vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB;
+ vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB;
+ vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB;
+ vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB;
+ vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB;
+ vfmt->Normal3f = _mesa_noop_Normal3f;
+ vfmt->Normal3fv = _mesa_noop_Normal3fv;
+ vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT;
+ vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT;
+ vfmt->TexCoord1f = _mesa_noop_TexCoord1f;
+ vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv;
+ vfmt->TexCoord2f = _mesa_noop_TexCoord2f;
+ vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv;
+ vfmt->TexCoord3f = _mesa_noop_TexCoord3f;
+ vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv;
+ vfmt->TexCoord4f = _mesa_noop_TexCoord4f;
+ vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv;
+ vfmt->Vertex2f = _mesa_noop_Vertex2f;
+ vfmt->Vertex2fv = _mesa_noop_Vertex2fv;
+ vfmt->Vertex3f = _mesa_noop_Vertex3f;
+ vfmt->Vertex3fv = _mesa_noop_Vertex3fv;
+ vfmt->Vertex4f = _mesa_noop_Vertex4f;
+ vfmt->Vertex4fv = _mesa_noop_Vertex4fv;
+ vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV;
+ vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV;
+ vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV;
+ vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV;
+ vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV;
+ vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV;
+ vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV;
+ vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV;
+
+ vfmt->Rectf = _mesa_noop_Rectf;
+
+ vfmt->DrawArrays = _mesa_noop_DrawArrays;
+ vfmt->DrawElements = _mesa_noop_DrawElements;
+ vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements;
+ vfmt->EvalMesh1 = _mesa_noop_EvalMesh1;
+ vfmt->EvalMesh2 = _mesa_noop_EvalMesh2;
+}
diff --git a/src/mesa/main/api_noop.h b/src/mesa/main/api_noop.h
index da133ace78..ecc889b67e 100644
--- a/src/mesa/main/api_noop.h
+++ b/src/mesa/main/api_noop.h
@@ -46,9 +46,9 @@ extern void _mesa_noop_FogCoordfEXT( GLfloat a );
extern void _mesa_noop_FogCoordfvEXT( const GLfloat *v );
-extern void _mesa_noop_Indexi( GLint i );
+extern void _mesa_noop_Indexf( GLfloat i );
-extern void _mesa_noop_Indexiv( const GLint *v );
+extern void _mesa_noop_Indexfv( const GLfloat *v );
extern void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c );
@@ -127,11 +127,37 @@ extern void _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c );
extern void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
+extern void _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x );
+
+extern void _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v );
+
+extern void _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y );
+extern void _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v );
+
+extern void _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z );
+extern void _mesa_noop_VertexAttrib3fvNV( GLuint index, const 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 );
+extern void _mesa_noop_End( void );
+extern void _mesa_noop_Begin( GLenum mode );
+extern void _mesa_noop_EvalPoint2( GLint a, GLint b );
+extern void _mesa_noop_EvalPoint1( GLint a );
+extern void _mesa_noop_EvalCoord2fv( const GLfloat *v );
+extern void _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b );
+extern void _mesa_noop_EvalCoord1fv( const GLfloat *v );
+extern void _mesa_noop_EvalCoord1f( GLfloat a );
+
+extern void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt );
+
+extern void _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2,
+ GLint j1, GLint j2 );
+
+extern void _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 );
/* Not strictly a noop -- translate Rectf down to Begin/End and
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index f524045532..e554f7508e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1431,15 +1431,13 @@ _mesa_initialize_context( GLcontext *ctx,
#if _HAVE_FULL_GL
_mesa_init_dlist_table(ctx->Save, dispatchSize);
+ _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
- ctx->ExecPrefersFloat = GL_FALSE;
- ctx->SavePrefersFloat = GL_FALSE;
/* Neutral tnl module stuff */
_mesa_init_exec_vtxfmt( ctx );
ctx->TnlModule.Current = NULL;
ctx->TnlModule.SwapCount = 0;
-
#endif
return GL_TRUE;
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 838b7bbcdd..663cfc8450 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -49,6 +49,7 @@
#include "glapi.h"
+#include "imports.h"
#include "mtypes.h"
@@ -263,6 +264,7 @@ _mesa_Flush( void );
/** \name Macros for contexts/flushing. */
/*@{*/
+
/**
* Flush vertices.
*
@@ -272,8 +274,6 @@ _mesa_Flush( void );
* Checks if dd_function_table::NeedFlush is marked to flush stored vertices,
* and calls dd_function_table::FlushVertices if so. Marks
* __GLcontextRec::NewState with \p newstate.
- *
- * \todo Eventually let the driver specify what state changes require a flush:
*/
#define FLUSH_VERTICES(ctx, newstate) \
do { \
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 9942227354..e9826abd6d 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -819,6 +819,7 @@ struct dd_function_table {
* these conditions.
*/
GLuint NeedFlush;
+ GLuint SaveNeedFlush;
/**
* If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
@@ -830,6 +831,14 @@ struct dd_function_table {
* FLUSH_UPDATE_CURRENT bit, even after performing the update.
*/
void (*FlushVertices)( GLcontext *ctx, GLuint flags );
+ void (*SaveFlushVertices)( GLcontext *ctx );
+
+ /**
+ * Give the driver the opportunity to hook in its own vtxfmt for
+ * compiling optimized display lists. This is called on each valid
+ * glBegin() during list compilation.
+ */
+ GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode );
/**
* Notify driver that the special derived value _NeedEyeCoords has
@@ -910,12 +919,8 @@ typedef struct {
void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */
void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
void (GLAPIENTRYP Color3fv)( const GLfloat * );
- void (GLAPIENTRYP Color3ub)( GLubyte, GLubyte, GLubyte );
- void (GLAPIENTRYP Color3ubv)( const GLubyte * );
void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
void (GLAPIENTRYP Color4fv)( const GLfloat * );
- void (GLAPIENTRYP Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
- void (GLAPIENTRYP Color4ubv)( const GLubyte * );
void (GLAPIENTRYP EdgeFlag)( GLboolean );
void (GLAPIENTRYP EdgeFlagv)( const GLboolean * );
void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */
@@ -926,8 +931,8 @@ typedef struct {
void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); /* NOTE */
void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
- void (GLAPIENTRYP Indexi)( GLint );
- void (GLAPIENTRYP Indexiv)( const GLint * );
+ void (GLAPIENTRYP Indexf)( GLfloat );
+ void (GLAPIENTRYP Indexfv)( const GLfloat * );
void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
@@ -941,8 +946,6 @@ typedef struct {
void (GLAPIENTRYP Normal3fv)( const GLfloat * );
void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
- void (GLAPIENTRYP SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte );
- void (GLAPIENTRYP SecondaryColor3ubvEXT)( const GLubyte * );
void (GLAPIENTRYP TexCoord1f)( GLfloat );
void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
@@ -958,8 +961,15 @@ typedef struct {
void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
void (GLAPIENTRYP CallList)( GLuint ); /* NOTE */
+ void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */
void (GLAPIENTRYP Begin)( GLenum );
void (GLAPIENTRYP End)( void );
+ void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
+ void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
+ void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
+ void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
+ void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
+ void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
/*@}*/
@@ -970,10 +980,6 @@ typedef struct {
/**
* \name Array
- *
- * These may or may not belong here. Heuristic: if an array is
- * enabled, the installed vertex format should support that array and
- * its current size natively.
*/
/*@{*/
void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count );
@@ -999,11 +1005,6 @@ typedef struct {
void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
/*@}*/
- /**
- * Should core try to send colors to glColor4f or glColor4chan,
- * where it has a choice?
- */
- GLboolean prefer_float_colors;
} GLvertexformat;
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index c654cb6219..c547a2c74d 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -30,6 +30,7 @@
#include "glheader.h"
#include "imports.h"
+#include "api_arrayelt.h"
#include "api_loopback.h"
#include "config.h"
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
@@ -82,6 +83,21 @@
#include "math/m_xform.h"
+/**
+ * Flush vertices.
+ *
+ * \param ctx GL context.
+ *
+ * Checks if dd_function_table::SaveNeedFlush is marked to flush
+ * stored (save) vertices, and calls
+ * dd_function_table::SaveFlushVertices if so.
+ */
+#define SAVE_FLUSH_VERTICES(ctx) \
+do { \
+ if (ctx->Driver.SaveNeedFlush) \
+ ctx->Driver.SaveFlushVertices(ctx); \
+} while (0)
+
/**
* Macro to assert that the API call was made outside the
@@ -123,7 +139,7 @@ do { \
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
do { \
ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
- FLUSH_VERTICES(ctx, 0); \
+ SAVE_FLUSH_VERTICES(ctx); \
} while (0)
/**
@@ -136,7 +152,7 @@ do { \
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
do { \
ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
- FLUSH_VERTICES(ctx, 0); \
+ SAVE_FLUSH_VERTICES(ctx); \
} while (0)
@@ -294,6 +310,26 @@ typedef enum {
OPCODE_PROGRAM_STRING_ARB,
OPCODE_PROGRAM_ENV_PARAMETER_ARB,
+
+ /* Vertex attributes -- fallback for when optimized display
+ * list build isn't active.
+ */
+ OPCODE_ATTR_1F,
+ OPCODE_ATTR_2F,
+ OPCODE_ATTR_3F,
+ OPCODE_ATTR_4F,
+ OPCODE_MATERIAL,
+ OPCODE_INDEX,
+ OPCODE_EDGEFLAG,
+ OPCODE_BEGIN,
+ OPCODE_END,
+ OPCODE_RECTF,
+ OPCODE_EVAL_C1,
+ OPCODE_EVAL_C2,
+ OPCODE_EVAL_P1,
+ OPCODE_EVAL_P2,
+
+
/* The following three are meta instructions */
OPCODE_ERROR, /* raise compiled-in error */
OPCODE_CONTINUE,
@@ -734,6 +770,20 @@ void _mesa_init_lists( void )
InstSize[OPCODE_PROGRAM_STRING_ARB] = 5;
InstSize[OPCODE_PROGRAM_ENV_PARAMETER_ARB] = 7;
#endif
+ InstSize[OPCODE_ATTR_1F] = 3;
+ InstSize[OPCODE_ATTR_2F] = 4;
+ InstSize[OPCODE_ATTR_3F] = 5;
+ InstSize[OPCODE_ATTR_4F] = 6;
+ InstSize[OPCODE_MATERIAL] = 7;
+ InstSize[OPCODE_INDEX] = 2;
+ InstSize[OPCODE_EDGEFLAG] = 2;
+ InstSize[OPCODE_BEGIN] = 2;
+ InstSize[OPCODE_END] = 1;
+ InstSize[OPCODE_RECTF] = 5;
+ InstSize[OPCODE_EVAL_C1] = 2;
+ InstSize[OPCODE_EVAL_C2] = 3;
+ InstSize[OPCODE_EVAL_P1] = 2;
+ InstSize[OPCODE_EVAL_P2] = 3;
}
init_flag = 1;
}
@@ -758,9 +808,9 @@ _mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz )
}
#endif
- if (ctx->CurrentPos + count + 2 > BLOCK_SIZE) {
+ if (ctx->ListState.CurrentPos + count + 2 > BLOCK_SIZE) {
/* This block is full. Allocate a new block and chain to it */
- n = ctx->CurrentBlock + ctx->CurrentPos;
+ n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
n[0].opcode = OPCODE_CONTINUE;
newblock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE );
if (!newblock) {
@@ -768,12 +818,12 @@ _mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz )
return NULL;
}
n[1].next = (Node *) newblock;
- ctx->CurrentBlock = newblock;
- ctx->CurrentPos = 0;
+ ctx->ListState.CurrentBlock = newblock;
+ ctx->ListState.CurrentPos = 0;
}
- n = ctx->CurrentBlock + ctx->CurrentPos;
- ctx->CurrentPos += count;
+ n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
+ ctx->ListState.CurrentPos += count;
n[0].opcode = (OpCode) opcode;
@@ -967,13 +1017,17 @@ void GLAPIENTRY _mesa_save_CallList( GLuint list )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
+ SAVE_FLUSH_VERTICES(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST, 1 );
if (n) {
n[1].ui = list;
}
+
+ /* After this, we don't know what begin/end state we're in:
+ */
+ ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+
if (ctx->ExecuteFlag) {
(*ctx->Exec->CallList)( list );
}
@@ -986,8 +1040,7 @@ void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *list
GLint i;
GLboolean typeErrorFlag;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
+ SAVE_FLUSH_VERTICES(ctx);
switch (type) {
case GL_BYTE:
@@ -1014,6 +1067,11 @@ void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *list
n[2].b = typeErrorFlag;
}
}
+
+ /* After this, we don't know what begin/end state we're in:
+ */
+ ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+
if (ctx->ExecuteFlag) {
(*ctx->Exec->CallLists)( n, type, lists );
}
@@ -1162,7 +1220,6 @@ static void GLAPIENTRY save_ColorMaterial( GLenum face, GLenum mode )
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MATERIAL, 2 );
if (n) {
@@ -2728,7 +2785,6 @@ static void GLAPIENTRY save_PopMatrix( void )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
(void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_MATRIX, 0 );
if (ctx->ExecuteFlag) {
(*ctx->Exec->PopMatrix)();
@@ -2773,7 +2829,6 @@ static void GLAPIENTRY save_PushAttrib( GLbitfield mask )
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_ATTRIB, 1 );
if (n) {
n[1].bf = mask;
@@ -2815,7 +2870,6 @@ static void GLAPIENTRY save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloa
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
n = ALLOC_INSTRUCTION( ctx, OPCODE_RASTER_POS, 4 );
if (n) {
n[1].f = x;
@@ -3555,7 +3609,6 @@ static void GLAPIENTRY save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GL
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- FLUSH_CURRENT(ctx, 0);
n = ALLOC_INSTRUCTION( ctx, OPCODE_WINDOW_POS, 4 );
if (n) {
n[1].f = x;
@@ -4533,6 +4586,593 @@ save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
+
+static void save_Attr1f( GLenum attr, GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F, 2 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ }
+
+ ctx->ListState.ActiveAttribSize[attr] = 1;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib1fNV)( attr, x );
+ }
+}
+
+static void save_Attr2f( GLenum attr, GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F, 3 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ }
+
+ ctx->ListState.ActiveAttribSize[attr] = 2;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib2fNV)( attr, x, y );
+ }
+}
+
+static void save_Attr3f( GLenum attr, GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F, 4 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ n[4].f = z;
+ }
+
+ ctx->ListState.ActiveAttribSize[attr] = 3;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib3fNV)( attr, x, y, z );
+ }
+}
+
+static void save_Attr4f( GLenum attr, GLfloat x, GLfloat y, GLfloat z,
+ GLfloat w )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F, 5 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ n[4].f = z;
+ n[5].f = w;
+ }
+
+ ctx->ListState.ActiveAttribSize[attr] = 4;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, w);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib4fNV)( attr, x, y, z, w );
+ }
+}
+
+static void save_EvalCoord1f( GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_C1, 1 );
+ if (n) {
+ n[1].f = x;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalCoord1f)( x );
+ }
+}
+
+static void save_EvalCoord1fv( const GLfloat *v )
+{
+ save_EvalCoord1f( v[0] );
+}
+
+static void save_EvalCoord2f( GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_C2, 2 );
+ if (n) {
+ n[1].f = x;
+ n[2].f = y;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalCoord2f)( x, y );
+ }
+}
+
+static void save_EvalCoord2fv( const GLfloat *v )
+{
+ save_EvalCoord2f( v[0], v[1] );
+}
+
+
+static void save_EvalPoint1( GLint x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_P1, 1 );
+ if (n) {
+ n[1].i = x;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalPoint1)( x );
+ }
+}
+
+static void save_EvalPoint2( GLint x, GLint y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_P2, 2 );
+ if (n) {
+ n[1].i = x;
+ n[2].i = y;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EvalPoint2)( x, y );
+ }
+}
+
+static void save_Indexf( GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX, 1 );
+ if (n) {
+ n[1].f = x;
+ }
+
+ ctx->ListState.ActiveIndex = 1;
+ ctx->ListState.CurrentIndex = x;
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Indexi)( x );
+ }
+}
+
+static void save_Indexfv( const GLfloat *v )
+{
+ save_Indexf( v[0] );
+}
+
+static void save_EdgeFlag( GLboolean x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_EDGEFLAG, 1 );
+ if (n) {
+ n[1].b = x;
+ }
+
+ ctx->ListState.ActiveEdgeFlag = 1;
+ ctx->ListState.CurrentEdgeFlag = x;
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EdgeFlag)( x );
+ }
+}
+
+static void save_EdgeFlagv( const GLboolean *v )
+{
+ save_EdgeFlag( v[0] );
+}
+
+static void save_Materialfv( GLenum face, GLenum pname, const GLfloat *param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ int args, i;
+
+ SAVE_FLUSH_VERTICES( ctx );
+
+ switch (face) {
+ case GL_BACK:
+ case GL_FRONT:
+ case GL_FRONT_AND_BACK:
+ break;
+ default:
+ _mesa_compile_error( ctx, GL_INVALID_ENUM, "material(face)" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_EMISSION:
+ case GL_AMBIENT:
+ case GL_DIFFUSE:
+ case GL_SPECULAR:
+ case GL_AMBIENT_AND_DIFFUSE:
+ args = 4;
+ break;
+ case GL_SHININESS:
+ args = 1;
+ break;
+ case GL_COLOR_INDEXES:
+ args = 3;
+ break;
+ default:
+ _mesa_compile_error( ctx, GL_INVALID_ENUM, "material(pname)" );
+ return;
+ }
+
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_MATERIAL, 6 );
+ if (n) {
+ n[1].e = face;
+ n[2].e = pname;
+ for (i = 0 ; i < args ; i++)
+ n[3+i].f = param[i];
+ }
+
+ {
+ GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, 0 );
+ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
+ if (bitmask & (1<<i)) {
+ ctx->ListState.ActiveMaterialSize[i] = args;
+ COPY_SZ_4V( ctx->ListState.CurrentMaterial[i], args, param );
+ }
+ }
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Materialfv)( face, pname, param );
+ }
+}
+
+static void save_Begin( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLboolean error = GL_FALSE;
+
+ if (mode < GL_POINTS || mode > GL_POLYGON) {
+ _mesa_compile_error( ctx, GL_INVALID_ENUM, "Begin (mode)");
+ error = GL_TRUE;
+ }
+ else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
+ /* Typically the first begin. This may raise an error on
+ * playback, depending on whether CallList is issued from inside
+ * a begin/end or not.
+ */
+ ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
+ }
+ else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) {
+ ctx->Driver.CurrentSavePrimitive = mode;
+ }
+ else {
+ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "recursive begin" );
+ error = GL_TRUE;
+ }
+
+ if (!error) {
+ /* Give the driver an opportunity to hook in an optimized
+ * display list compiler.
+ */
+ if (ctx->Driver.NotifySaveBegin( ctx, mode ))
+ return;
+
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN, 1 );
+ if (n) {
+ n[1].e = mode;
+ }
+ }
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Begin)( mode );
+ }
+}
+
+static void save_End( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ SAVE_FLUSH_VERTICES( ctx );
+ (void) ALLOC_INSTRUCTION( ctx, OPCODE_END, 0 );
+ ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->End)( );
+ }
+}
+
+static void save_Rectf( GLfloat a, GLfloat b,
+ GLfloat c, GLfloat d )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_RECTF, 4 );
+ if (n) {
+ n[1].f = a;
+ n[2].f = b;
+ n[3].f = c;
+ n[4].f = d;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->Rectf)( a, b, c, d );
+ }
+}
+
+/*
+ */
+static void save_Vertex2f( GLfloat x, GLfloat y )
+{
+ save_Attr2f( VERT_ATTRIB_POS, x, y );
+}
+
+static void save_Vertex2fv( const GLfloat *v )
+{
+ save_Attr2f( VERT_ATTRIB_POS, v[0], v[1] );
+}
+
+static void save_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_POS, x, y, z );
+}
+
+static void save_Vertex3fv( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_POS, v[0], v[1], v[2] );
+}
+
+static void save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ save_Attr4f( VERT_ATTRIB_POS, x, y, z, w );
+}
+
+static void save_Vertex4fv( const GLfloat *v )
+{
+ save_Attr4f( VERT_ATTRIB_POS, v[0], v[1], v[2], v[3] );
+}
+
+static void save_TexCoord1f( GLfloat x )
+{
+ save_Attr1f( VERT_ATTRIB_TEX0, x );
+}
+
+static void save_TexCoord1fv( const GLfloat *v )
+{
+ save_Attr1f( VERT_ATTRIB_TEX0, v[0] );
+}
+
+static void save_TexCoord2f( GLfloat x, GLfloat y )
+{
+ save_Attr2f( VERT_ATTRIB_TEX0, x, y );
+}
+
+static void save_TexCoord2fv( const GLfloat *v )
+{
+ save_Attr2f( VERT_ATTRIB_TEX0, v[0], v[1] );
+}
+
+static void save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_TEX0, x, y, z );
+}
+
+static void save_TexCoord3fv( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_TEX0, v[0], v[1], v[2] );
+}
+
+static void save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ save_Attr4f( VERT_ATTRIB_TEX0, x, y, z, w );
+}
+
+static void save_TexCoord4fv( const GLfloat *v )
+{
+ save_Attr4f( VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3] );
+}
+
+static void save_Normal3f( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_NORMAL, x, y, z );
+}
+
+static void save_Normal3fv( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_NORMAL, v[0], v[1], v[2] );
+}
+
+static void save_FogCoordfEXT( GLfloat x )
+{
+ save_Attr1f( VERT_ATTRIB_FOG, x );
+}
+
+static void save_FogCoordfvEXT( const GLfloat *v )
+{
+ save_Attr1f( VERT_ATTRIB_FOG, v[0] );
+}
+
+static void save_Color3f( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_COLOR0, x, y, z );
+}
+
+static void save_Color3fv( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] );
+}
+
+static void save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ save_Attr4f( VERT_ATTRIB_COLOR0, x, y, z, w );
+}
+
+static void save_Color4fv( const GLfloat *v )
+{
+ save_Attr4f( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] );
+}
+
+static void save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z )
+{
+ save_Attr3f( VERT_ATTRIB_COLOR1, x, y, z );
+}
+
+static void save_SecondaryColor3fvEXT( const GLfloat *v )
+{
+ save_Attr3f( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] );
+}
+
+
+/* Just call the respective ATTR for texcoord
+ */
+static void save_MultiTexCoord1f( GLenum target, GLfloat x )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr1f( attr, x );
+}
+
+static void save_MultiTexCoord1fv( GLenum target, const GLfloat *v )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr1f( attr, v[0] );
+}
+
+static void save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr2f( attr, x, y );
+}
+
+static void save_MultiTexCoord2fv( GLenum target, const GLfloat *v )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr2f( attr, v[0], v[1] );
+}
+
+static void save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y,
+ GLfloat z)
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr3f( attr, x, y, z );
+}
+
+static void save_MultiTexCoord3fv( GLenum target, const GLfloat *v )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr3f( attr, v[0], v[1], v[2] );
+}
+
+static void save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y,
+ GLfloat z, GLfloat w )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr4f( attr, x, y, z, w );
+}
+
+static void save_MultiTexCoord4fv( GLenum target, const GLfloat *v )
+{
+ GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+ save_Attr4f( attr, v[0], v[1], v[2], v[3] );
+}
+
+
+static void enum_error()
+{
+ GET_CURRENT_CONTEXT( ctx );
+ _mesa_error( ctx, GL_INVALID_ENUM, "VertexAttribfNV" );
+}
+
+/* First level for NV_vertex_program:
+ *
+ * Check for errors at compile time?.
+ */
+static void save_VertexAttrib1fNV( GLuint index, GLfloat x )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr1f( index, x );
+ else
+ enum_error();
+}
+
+static void save_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr1f( index, v[0] );
+ else
+ enum_error();
+}
+
+static void save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr2f( index, x, y );
+ else
+ enum_error();
+}
+
+static void save_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr2f( index, v[0], v[1] );
+ else
+ enum_error();
+}
+
+static void save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y,
+ GLfloat z )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr3f( index, x, y, z );
+ else
+ enum_error();
+}
+
+static void save_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr3f( index, v[0], v[1], v[2] );
+ else
+ enum_error();
+}
+
+static void save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y,
+ GLfloat z, GLfloat w )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr4f( index, x, y, z, w );
+ else
+ enum_error();
+}
+
+static void save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr4f( index, v[0], v[1], v[2], v[3] );
+ else
+ enum_error();
+}
+
+
+
+
+
/* KW: Compile commands
*
* Will appear in the list before the vertex buffer containing the
@@ -4602,7 +5242,7 @@ execute_list( GLcontext *ctx, GLuint list )
if (ctx->Driver.BeginCallList)
ctx->Driver.BeginCallList( ctx, list );
- ctx->CallDepth++;
+ ctx->ListState.CallDepth++;
n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
@@ -4652,7 +5292,7 @@ execute_list( GLcontext *ctx, GLuint list )
break;
case OPCODE_CALL_LIST:
/* Generated by glCallList(), don't add ListBase */
- if (ctx->CallDepth<MAX_LIST_NESTING) {
+ if (ctx->ListState.CallDepth<MAX_LIST_NESTING) {
execute_list( ctx, n[1].ui );
}
break;
@@ -4662,7 +5302,7 @@ execute_list( GLcontext *ctx, GLuint list )
/* user specified a bad data type at compile time */
_mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
}
- else if (ctx->CallDepth < MAX_LIST_NESTING) {
+ else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
execute_list( ctx, ctx->List.ListBase + n[1].ui );
}
break;
@@ -5291,6 +5931,53 @@ execute_list( GLcontext *ctx, GLuint list )
n[4].f, n[5].f, n[6].f);
break;
#endif
+
+ case OPCODE_ATTR_1F:
+ (*ctx->Exec->VertexAttrib1fNV)(n[1].e, n[2].f);
+ break;
+ case OPCODE_ATTR_2F:
+ (*ctx->Exec->VertexAttrib2fvNV)(n[1].e, &n[2].f);
+ break;
+ case OPCODE_ATTR_3F:
+ (*ctx->Exec->VertexAttrib3fvNV)(n[1].e, &n[2].f);
+ break;
+ case OPCODE_ATTR_4F:
+ (*ctx->Exec->VertexAttrib4fvNV)(n[1].e, &n[2].f);
+ break;
+ case OPCODE_MATERIAL:
+ (*ctx->Exec->Materialfv)(n[1].e, n[2].e, &n[3].f);
+ break;
+ case OPCODE_INDEX:
+ (*ctx->Exec->Indexi)(n[1].i);
+ break;
+ case OPCODE_EDGEFLAG:
+ (*ctx->Exec->EdgeFlag)(n[1].b);
+ break;
+ case OPCODE_BEGIN:
+ (*ctx->Exec->Begin)(n[1].e);
+ break;
+ case OPCODE_END:
+ (*ctx->Exec->End)();
+ break;
+ case OPCODE_RECTF:
+ (*ctx->Exec->Rectf)(n[1].f, n[2].f, n[3].f, n[4].f);
+ break;
+ case OPCODE_EVAL_C1:
+ (*ctx->Exec->EvalCoord1f)(n[1].f);
+ break;
+ case OPCODE_EVAL_C2:
+ (*ctx->Exec->EvalCoord2fv)(&n[1].f);
+ break;
+ case OPCODE_EVAL_P1:
+ (*ctx->Exec->EvalPoint1)(n[1].i);
+ break;
+ case OPCODE_EVAL_P2:
+ (*ctx->Exec->EvalPoint2)(n[1].i, n[2].i);
+ break;
+
+
+
+
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
break;
@@ -5312,7 +5999,7 @@ execute_list( GLcontext *ctx, GLuint list )
}
}
}
- ctx->CallDepth--;
+ ctx->ListState.CallDepth--;
if (ctx->Driver.EndCallList)
ctx->Driver.EndCallList( ctx );
@@ -5412,6 +6099,8 @@ void GLAPIENTRY
_mesa_NewList( GLuint list, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
FLUSH_CURRENT(ctx, 0); /* must be called before assert */
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -5429,20 +6118,33 @@ _mesa_NewList( GLuint list, GLenum mode )
return;
}
- if (ctx->CurrentListPtr) {
+ if (ctx->ListState.CurrentListPtr) {
/* already compiling a display list */
_mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" );
return;
}
- /* Allocate new display list */
- ctx->CurrentListNum = list;
- ctx->CurrentBlock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE );
- ctx->CurrentListPtr = ctx->CurrentBlock;
- ctx->CurrentPos = 0;
ctx->CompileFlag = GL_TRUE;
ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
+ /* Allocate new display list */
+ ctx->ListState.CurrentListNum = list;
+ ctx->ListState.CurrentBlock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE );
+ ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock;
+ ctx->ListState.CurrentPos = 0;
+
+ /* Reset acumulated list state:
+ */
+ for (i = 0; i < VERT_ATTRIB_MAX; i++)
+ ctx->ListState.ActiveAttribSize[i] = 0;
+
+ for (i = 0; i < MAT_ATTRIB_MAX; i++)
+ ctx->ListState.ActiveMaterialSize[i] = 0;
+
+ ctx->ListState.ActiveIndex = 0;
+ ctx->ListState.ActiveEdgeFlag = 0;
+
+ ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
ctx->Driver.NewList( ctx, list, mode );
ctx->CurrentDispatch = ctx->Save;
@@ -5452,22 +6154,20 @@ _mesa_NewList( GLuint list, GLenum mode )
/*
- * End definition of current display list. Is the current
- * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
- * we are outside begin/end calls?
+ * End definition of current display list.
*/
void GLAPIENTRY
_mesa_EndList( void )
{
GET_CURRENT_CONTEXT(ctx);
- FLUSH_CURRENT(ctx, 0); /* must be called before assert */
+ SAVE_FLUSH_VERTICES(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glEndList\n");
/* Check that a list is under construction */
- if (!ctx->CurrentListPtr) {
+ if (!ctx->ListState.CurrentListPtr) {
_mesa_error( ctx, GL_INVALID_OPERATION, "glEndList" );
return;
}
@@ -5475,16 +6175,16 @@ _mesa_EndList( void )
(void) ALLOC_INSTRUCTION( ctx, OPCODE_END_OF_LIST, 0 );
/* Destroy old list, if any */
- _mesa_destroy_list(ctx, ctx->CurrentListNum);
+ _mesa_destroy_list(ctx, ctx->ListState.CurrentListNum);
/* Install the list */
- _mesa_HashInsert(ctx->Shared->DisplayList, ctx->CurrentListNum, ctx->CurrentListPtr);
+ _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentListPtr);
if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
- mesa_print_display_list(ctx->CurrentListNum);
+ mesa_print_display_list(ctx->ListState.CurrentListNum);
- ctx->CurrentListNum = 0;
- ctx->CurrentListPtr = NULL;
+ ctx->ListState.CurrentListNum = 0;
+ ctx->ListState.CurrentListPtr = NULL;
ctx->ExecuteFlag = GL_TRUE;
ctx->CompileFlag = GL_FALSE;
@@ -6288,7 +6988,7 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
{
_mesa_init_no_op_table(table, tableSize);
- _mesa_loopback_init_api_table( table, GL_TRUE );
+ _mesa_loopback_init_api_table( table );
/* GL 1.0 */
table->Accum = save_Accum;
@@ -7014,18 +7714,98 @@ void mesa_print_display_list( GLuint list )
/***** Initialization *****/
/**********************************************************************/
+
+void _mesa_save_vtxfmt_init( GLvertexformat *vfmt )
+{
+ vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
+ vfmt->Begin = save_Begin;
+ vfmt->CallList = _mesa_save_CallList;
+ vfmt->CallLists = _mesa_save_CallLists;
+ vfmt->Color3f = save_Color3f;
+ vfmt->Color3fv = save_Color3fv;
+ vfmt->Color4f = save_Color4f;
+ vfmt->Color4fv = save_Color4fv;
+ vfmt->EdgeFlag = save_EdgeFlag;
+ vfmt->EdgeFlagv = save_EdgeFlagv;
+ vfmt->End = save_End;
+ vfmt->EvalCoord1f = save_EvalCoord1f;
+ vfmt->EvalCoord1fv = save_EvalCoord1fv;
+ vfmt->EvalCoord2f = save_EvalCoord2f;
+ vfmt->EvalCoord2fv = save_EvalCoord2fv;
+ vfmt->EvalPoint1 = save_EvalPoint1;
+ vfmt->EvalPoint2 = save_EvalPoint2;
+ vfmt->FogCoordfEXT = save_FogCoordfEXT;
+ vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
+ vfmt->Indexf = save_Indexf;
+ vfmt->Indexfv = save_Indexfv;
+ vfmt->Materialfv = save_Materialfv;
+ vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
+ vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
+ vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
+ vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
+ vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
+ vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
+ vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
+ vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
+ vfmt->Normal3f = save_Normal3f;
+ vfmt->Normal3fv = save_Normal3fv;
+ vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
+ vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
+ vfmt->TexCoord1f = save_TexCoord1f;
+ vfmt->TexCoord1fv = save_TexCoord1fv;
+ vfmt->TexCoord2f = save_TexCoord2f;
+ vfmt->TexCoord2fv = save_TexCoord2fv;
+ vfmt->TexCoord3f = save_TexCoord3f;
+ vfmt->TexCoord3fv = save_TexCoord3fv;
+ vfmt->TexCoord4f = save_TexCoord4f;
+ vfmt->TexCoord4fv = save_TexCoord4fv;
+ vfmt->Vertex2f = save_Vertex2f;
+ vfmt->Vertex2fv = save_Vertex2fv;
+ vfmt->Vertex3f = save_Vertex3f;
+ vfmt->Vertex3fv = save_Vertex3fv;
+ vfmt->Vertex4f = save_Vertex4f;
+ vfmt->Vertex4fv = save_Vertex4fv;
+ vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
+ vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
+ vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
+ vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
+ vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
+ vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
+ vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
+ vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
+
+ vfmt->EvalMesh1 = _mesa_save_EvalMesh1;
+ vfmt->EvalMesh2 = _mesa_save_EvalMesh2;
+ vfmt->Rectf = save_Rectf;
+
+ /* The driver is required to implement these as
+ * 1) They can probably do a better job.
+ * 2) A lot of new mechanisms would have to be added to this module
+ * to support it. That code would probably never get used,
+ * because of (1).
+ */
+#if 0
+ vfmt->DrawArrays = 0;
+ vfmt->DrawElements = 0;
+ vfmt->DrawRangeElements = 0;
+#endif
+}
+
+
+
void _mesa_init_display_list( GLcontext * ctx )
{
/* Display list */
- ctx->CallDepth = 0;
+ ctx->ListState.CallDepth = 0;
ctx->ExecuteFlag = GL_TRUE;
ctx->CompileFlag = GL_FALSE;
- ctx->CurrentListPtr = NULL;
- ctx->CurrentBlock = NULL;
- ctx->CurrentListNum = 0;
- ctx->CurrentPos = 0;
+ ctx->ListState.CurrentListPtr = NULL;
+ ctx->ListState.CurrentBlock = NULL;
+ ctx->ListState.CurrentListNum = 0;
+ ctx->ListState.CurrentPos = 0;
/* Display List group */
ctx->List.ListBase = 0;
+ _mesa_save_vtxfmt_init( &ctx->ListState.ListVtxfmt );
}
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h
index ec2430eed6..a6b9c363a1 100644
--- a/src/mesa/main/dlist.h
+++ b/src/mesa/main/dlist.h
@@ -79,6 +79,8 @@ extern void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 );
extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists );
extern void GLAPIENTRY _mesa_save_CallList( GLuint list );
extern void _mesa_init_display_list( GLcontext * ctx );
+extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
+
#else
@@ -94,6 +96,9 @@ extern void _mesa_init_display_list( GLcontext * ctx );
/** No-op */
#define _mesa_init_display_list(c) ((void)0)
+/** No-op */
+#define _mesa_save_vtxfmt_init(v) ((void)0)
+
#endif
#endif
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 6aa29c37ed..e2412186ea 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -295,7 +295,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_CURRENT_INDEX:
FLUSH_CURRENT(ctx, 0);
- *params = INT_TO_BOOL(ctx->Current.Index);
+ *params = FLOAT_TO_BOOL(ctx->Current.Index);
break;
case GL_CURRENT_NORMAL:
FLUSH_CURRENT(ctx, 0);
@@ -499,7 +499,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = INT_TO_BOOL(ctx->List.ListBase);
break;
case GL_LIST_INDEX:
- *params = INT_TO_BOOL( ctx->CurrentListNum );
+ *params = INT_TO_BOOL( ctx->ListState.CurrentListNum );
break;
case GL_LIST_MODE:
if (!ctx->CompileFlag)
@@ -2041,7 +2041,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->List.ListBase;
break;
case GL_LIST_INDEX:
- *params = (GLdouble) ctx->CurrentListNum;
+ *params = (GLdouble) ctx->ListState.CurrentListNum;
break;
case GL_LIST_MODE:
if (!ctx->CompileFlag)
@@ -3578,7 +3578,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->List.ListBase;
break;
case GL_LIST_INDEX:
- *params = (GLfloat) ctx->CurrentListNum;
+ *params = (GLfloat) ctx->ListState.CurrentListNum;
break;
case GL_LIST_MODE:
if (!ctx->CompileFlag)
@@ -5092,7 +5092,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->List.ListBase;
break;
case GL_LIST_INDEX:
- *params = (GLint) ctx->CurrentListNum;
+ *params = (GLint) ctx->ListState.CurrentListNum;
break;
case GL_LIST_MODE:
if (!ctx->CompileFlag)
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index e449ee3462..4370a58075 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -109,6 +109,8 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
#define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i))
/** Stepping a GLubyte[4] pointer by a byte stride */
#define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i))
+/** Stepping a GLfloat[4] pointer by a byte stride */
+#define STRIDE_4F(p, i) (p = (GLfloat (*)[4])((GLubyte *)p + i))
/** Stepping a GLchan[4] pointer by a byte stride */
#define STRIDE_4CHAN(p, i) (p = (GLchan (*)[4])((GLubyte *)p + i))
/** Stepping a GLchan pointer by a byte stride */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 23ff3548c2..012667a2ab 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -447,7 +447,7 @@ struct gl_current_attrib {
/*@{*/
GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Current vertex attributes
* indexed by VERT_ATTRIB_* */
- GLuint Index; /**< Current color index */
+ GLfloat Index; /**< Current color index */
GLboolean EdgeFlag; /**< Current edge flag */
/*@}*/
@@ -2027,6 +2027,27 @@ struct gl_tnl_module {
/*@}*/
};
+struct mesa_list_state {
+ GLuint CallDepth; /**< Current recursion calling depth */
+ Node *CurrentListPtr; /**< Head of list being compiled */
+ GLuint CurrentListNum; /**< Number of the list being compiled */
+ Node *CurrentBlock; /**< Pointer to current block of nodes */
+ GLuint CurrentPos; /**< Index into current block of nodes */
+ GLvertexformat ListVtxfmt;
+
+ GLubyte ActiveAttribSize[VERT_ATTRIB_MAX];
+ GLfloat CurrentAttrib[VERT_ATTRIB_MAX][4];
+
+ GLubyte ActiveMaterialSize[MAT_ATTRIB_MAX];
+ GLfloat CurrentMaterial[MAT_ATTRIB_MAX][4];
+
+ GLubyte ActiveIndex;
+ GLfloat CurrentIndex;
+
+ GLubyte ActiveEdgeFlag;
+ GLboolean CurrentEdgeFlag;
+};
+
/**
* Mesa context
@@ -2058,9 +2079,6 @@ struct __GLcontextRec {
struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */
/*@}*/
- GLboolean ExecPrefersFloat; /**< What preference for color conversion? */
- GLboolean SavePrefersFloat;
-
GLvisual Visual;
GLframebuffer *DrawBuffer; /**< buffer for writing */
GLframebuffer *ReadBuffer; /**< buffer for reading */
@@ -2090,15 +2108,10 @@ struct __GLcontextRec {
GLmatrix _ModelProjectMatrix;
/** \name Display lists */
- /*@{*/
- GLuint CallDepth; /**< Current recursion calling depth */
+ struct mesa_list_state ListState;
+
GLboolean ExecuteFlag; /**< Execute GL commands? */
GLboolean CompileFlag; /**< Compile GL commands into display list? */
- Node *CurrentListPtr; /**< Head of list being compiled */
- GLuint CurrentListNum; /**< Number of the list being compiled */
- Node *CurrentBlock; /**< Pointer to current block of nodes */
- GLuint CurrentPos; /**< Index into current block of nodes */
- /*@}*/
/** Extensions */
struct gl_extensions Extensions;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 24e7847a28..4c6f75a881 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -144,7 +144,7 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
_mesa_init_no_op_table(exec, tableSize);
#if _HAVE_FULL_GL
- _mesa_loopback_init_api_table( exec, GL_TRUE );
+ _mesa_loopback_init_api_table( exec );
#endif
/* load the dispatch slots we understand */
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index 4d3ca510b0..b9e3f2ef60 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -77,12 +77,8 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt )
tab->ArrayElement = vfmt->ArrayElement;
tab->Color3f = vfmt->Color3f;
tab->Color3fv = vfmt->Color3fv;
- tab->Color3ub = vfmt->Color3ub;
- tab->Color3ubv = vfmt->Color3ubv;
tab->Color4f = vfmt->Color4f;
tab->Color4fv = vfmt->Color4fv;
- tab->Color4ub = vfmt->Color4ub;
- tab->Color4ubv = vfmt->Color4ubv;
tab->EdgeFlag = vfmt->EdgeFlag;
tab->EdgeFlagv = vfmt->EdgeFlagv;
tab->EvalCoord1f = vfmt->EvalCoord1f;
@@ -93,8 +89,8 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt )
tab->EvalPoint2 = vfmt->EvalPoint2;
tab->FogCoordfEXT = vfmt->FogCoordfEXT;
tab->FogCoordfvEXT = vfmt->FogCoordfvEXT;
- tab->Indexi = vfmt->Indexi;
- tab->Indexiv = vfmt->Indexiv;
+ tab->Indexf = vfmt->Indexf;
+ tab->Indexfv = vfmt->Indexfv;
tab->Materialfv = vfmt->Materialfv;
tab->MultiTexCoord1fARB = vfmt->MultiTexCoord1fARB;
tab->MultiTexCoord1fvARB = vfmt->MultiTexCoord1fvARB;
@@ -108,8 +104,6 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt )
tab->Normal3fv = vfmt->Normal3fv;
tab->SecondaryColor3fEXT = vfmt->SecondaryColor3fEXT;
tab->SecondaryColor3fvEXT = vfmt->SecondaryColor3fvEXT;
- tab->SecondaryColor3ubEXT = vfmt->SecondaryColor3ubEXT;
- tab->SecondaryColor3ubvEXT = vfmt->SecondaryColor3ubvEXT;
tab->TexCoord1f = vfmt->TexCoord1f;
tab->TexCoord1fv = vfmt->TexCoord1fv;
tab->TexCoord2f = vfmt->TexCoord2f;
@@ -125,8 +119,15 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt )
tab->Vertex4f = vfmt->Vertex4f;
tab->Vertex4fv = vfmt->Vertex4fv;
tab->CallList = vfmt->CallList;
+ tab->CallLists = vfmt->CallLists;
tab->Begin = vfmt->Begin;
tab->End = vfmt->End;
+ tab->VertexAttrib1fNV = vfmt->VertexAttrib1fNV;
+ tab->VertexAttrib1fvNV = vfmt->VertexAttrib1fvNV;
+ tab->VertexAttrib2fNV = vfmt->VertexAttrib2fNV;
+ tab->VertexAttrib2fvNV = vfmt->VertexAttrib2fvNV;
+ tab->VertexAttrib3fNV = vfmt->VertexAttrib3fNV;
+ tab->VertexAttrib3fvNV = vfmt->VertexAttrib3fvNV;
tab->VertexAttrib4fNV = vfmt->VertexAttrib4fNV;
tab->VertexAttrib4fvNV = vfmt->VertexAttrib4fvNV;
tab->Rectf = vfmt->Rectf;
@@ -150,15 +151,11 @@ void _mesa_install_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt )
{
ctx->TnlModule.Current = vfmt;
_mesa_restore_exec_vtxfmt( ctx );
- if ( ctx->ExecPrefersFloat != vfmt->prefer_float_colors )
- _mesa_loopback_prefer_float( ctx->Exec, vfmt->prefer_float_colors );
}
void _mesa_install_save_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt )
{
install_vtxfmt( ctx->Save, vfmt );
- if ( ctx->SavePrefersFloat != vfmt->prefer_float_colors )
- _mesa_loopback_prefer_float( ctx->Save, vfmt->prefer_float_colors );
}
diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h
index 204b2991de..044ec1bbaf 100644
--- a/src/mesa/main/vtxfmt_tmp.h
+++ b/src/mesa/main/vtxfmt_tmp.h
@@ -48,18 +48,6 @@ static void GLAPIENTRY TAG(Color3fv)( const GLfloat *v )
_glapi_Dispatch->Color3fv( v );
}
-static void GLAPIENTRY TAG(Color3ub)( GLubyte r, GLubyte g, GLubyte b )
-{
- PRE_LOOPBACK( Color3ub );
- _glapi_Dispatch->Color3ub( r, g, b );
-}
-
-static void GLAPIENTRY TAG(Color3ubv)( const GLubyte *v )
-{
- PRE_LOOPBACK( Color3ubv );
- _glapi_Dispatch->Color3ubv( v );
-}
-
static void GLAPIENTRY TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
{
PRE_LOOPBACK( Color4f );
@@ -72,18 +60,6 @@ static void GLAPIENTRY TAG(Color4fv)( const GLfloat *v )
_glapi_Dispatch->Color4fv( v );
}
-static void GLAPIENTRY TAG(Color4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- PRE_LOOPBACK( Color4ub );
- _glapi_Dispatch->Color4ub( r, g, b, a );
-}
-
-static void GLAPIENTRY TAG(Color4ubv)( const GLubyte *v )
-{
- PRE_LOOPBACK( Color4ubv );
- _glapi_Dispatch->Color4ubv( v );
-}
-
static void GLAPIENTRY TAG(EdgeFlag)( GLboolean e )
{
PRE_LOOPBACK( EdgeFlag );
@@ -144,16 +120,16 @@ static void GLAPIENTRY TAG(FogCoordfvEXT)( const GLfloat *v )
_glapi_Dispatch->FogCoordfvEXT( v );
}
-static void GLAPIENTRY TAG(Indexi)( GLint i )
+static void GLAPIENTRY TAG(Indexf)( GLfloat f )
{
- PRE_LOOPBACK( Indexi );
- _glapi_Dispatch->Indexi( i );
+ PRE_LOOPBACK( Indexf );
+ _glapi_Dispatch->Indexf( f );
}
-static void GLAPIENTRY TAG(Indexiv)( const GLint *v )
+static void GLAPIENTRY TAG(Indexfv)( const GLfloat *v )
{
- PRE_LOOPBACK( Indexiv );
- _glapi_Dispatch->Indexiv( v );
+ PRE_LOOPBACK( Indexfv );
+ _glapi_Dispatch->Indexfv( v );
}
static void GLAPIENTRY TAG(Materialfv)( GLenum face, GLenum pname, const GLfloat *v )
@@ -236,18 +212,6 @@ static void GLAPIENTRY TAG(SecondaryColor3fvEXT)( const GLfloat *v )
_glapi_Dispatch->SecondaryColor3fvEXT( v );
}
-static void GLAPIENTRY TAG(SecondaryColor3ubEXT)( GLubyte r, GLubyte g, GLubyte b )
-{
- PRE_LOOPBACK( SecondaryColor3ubEXT );
- _glapi_Dispatch->SecondaryColor3ubEXT( r, g, b );
-}
-
-static void GLAPIENTRY TAG(SecondaryColor3ubvEXT)( const GLubyte *v )
-{
- PRE_LOOPBACK( SecondaryColor3ubvEXT );
- _glapi_Dispatch->SecondaryColor3ubvEXT( v );
-}
-
static void GLAPIENTRY TAG(TexCoord1f)( GLfloat s )
{
PRE_LOOPBACK( TexCoord1f );
@@ -338,6 +302,12 @@ static void GLAPIENTRY TAG(CallList)( GLuint i )
_glapi_Dispatch->CallList( i );
}
+static void GLAPIENTRY TAG(CallLists)( GLsizei sz, GLenum type, const GLvoid *v )
+{
+ PRE_LOOPBACK( CallLists );
+ _glapi_Dispatch->CallLists( sz, type, v );
+}
+
static void GLAPIENTRY TAG(Begin)( GLenum mode )
{
PRE_LOOPBACK( Begin );
@@ -390,6 +360,42 @@ static void GLAPIENTRY TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2,
_glapi_Dispatch->EvalMesh2( mode, i1, i2, j1, j2 );
}
+static void GLAPIENTRY TAG(VertexAttrib1fNV)( GLuint index, GLfloat x )
+{
+ PRE_LOOPBACK( VertexAttrib1fNV );
+ _glapi_Dispatch->VertexAttrib1fNV( index, x );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib1fvNV)( GLuint index, const GLfloat *v )
+{
+ PRE_LOOPBACK( VertexAttrib1fvNV );
+ _glapi_Dispatch->VertexAttrib1fvNV( index, v );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y )
+{
+ PRE_LOOPBACK( VertexAttrib2fNV );
+ _glapi_Dispatch->VertexAttrib2fNV( index, x, y );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib2fvNV)( GLuint index, const GLfloat *v )
+{
+ PRE_LOOPBACK( VertexAttrib2fvNV );
+ _glapi_Dispatch->VertexAttrib2fvNV( index, v );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z )
+{
+ PRE_LOOPBACK( VertexAttrib3fNV );
+ _glapi_Dispatch->VertexAttrib3fNV( index, x, y, z );
+}
+
+static void GLAPIENTRY TAG(VertexAttrib3fvNV)( GLuint index, const GLfloat *v )
+{
+ PRE_LOOPBACK( VertexAttrib3fvNV );
+ _glapi_Dispatch->VertexAttrib3fvNV( index, v );
+}
+
static void GLAPIENTRY TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
PRE_LOOPBACK( VertexAttrib4fNV );
@@ -407,12 +413,8 @@ static GLvertexformat TAG(vtxfmt) = {
TAG(ArrayElement),
TAG(Color3f),
TAG(Color3fv),
- TAG(Color3ub),
- TAG(Color3ubv),
TAG(Color4f),
TAG(Color4fv),
- TAG(Color4ub),
- TAG(Color4ubv),
TAG(EdgeFlag),
TAG(EdgeFlagv),
TAG(EvalCoord1f),
@@ -423,8 +425,8 @@ static GLvertexformat TAG(vtxfmt) = {
TAG(EvalPoint2),
TAG(FogCoordfEXT),
TAG(FogCoordfvEXT),
- TAG(Indexi),
- TAG(Indexiv),
+ TAG(Indexf),
+ TAG(Indexfv),
TAG(Materialfv),
TAG(MultiTexCoord1fARB),
TAG(MultiTexCoord1fvARB),
@@ -438,8 +440,6 @@ static GLvertexformat TAG(vtxfmt) = {
TAG(Normal3fv),
TAG(SecondaryColor3fEXT),
TAG(SecondaryColor3fvEXT),
- TAG(SecondaryColor3ubEXT),
- TAG(SecondaryColor3ubvEXT),
TAG(TexCoord1f),
TAG(TexCoord1fv),
TAG(TexCoord2f),
@@ -455,8 +455,15 @@ static GLvertexformat TAG(vtxfmt) = {
TAG(Vertex4f),
TAG(Vertex4fv),
TAG(CallList),
+ TAG(CallLists),
TAG(Begin),
TAG(End),
+ TAG(VertexAttrib1fNV),
+ TAG(VertexAttrib1fvNV),
+ TAG(VertexAttrib2fNV),
+ TAG(VertexAttrib2fvNV),
+ TAG(VertexAttrib3fNV),
+ TAG(VertexAttrib3fvNV),
TAG(VertexAttrib4fNV),
TAG(VertexAttrib4fvNV),
TAG(Rectf),