X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=inline;f=src%2Fmesa%2Fmain%2Fapi_noop.c;h=09ba7e50622469983e9edabef033b3de922359b8;hb=0e5c2598ec8cd9e20cb02e2b120d5b43103b7b05;hp=661a72008a30d62edb5c9bed2b5f4296f0cbd2c7;hpb=b5b8d22c4ee921dff99b898a5907023b20670a27;p=mesa.git diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 661a72008a3..09ba7e50622 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 6.5.1 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2006 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"), @@ -28,47 +28,41 @@ #include "api_validate.h" #include "api_arrayelt.h" #include "context.h" -#include "colormac.h" #include "light.h" #include "macros.h" -#include "mtypes.h" +#if FEATURE_dlist #include "dlist.h" +#endif +#include "glapi/dispatch.h" -/* In states where certain vertex components are required for t&l or - * rasterization, we still need to keep track of the current values. - * These functions provide this service by keeping uptodate the - * 'ctx->Current' struct for all data elements not included in the - * currently enabled hardware vertex. - * I.e. these functions would typically be used when outside of glBegin/End. +/** + * \file + * Just update the ctx->Current vertex attributes. + * These functions are used when outside glBegin/glEnd or outside display + * lists. */ -void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) +static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.EdgeFlag = b; + ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] = (GLfloat)b; } -void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b ) +static void GLAPIENTRY _mesa_noop_Indexf( GLfloat f ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.EdgeFlag = *b; + ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = f; } -void GLAPIENTRY _mesa_noop_Indexf( GLfloat f ) +static void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.Index = f; + ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = *v; } -void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v ) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Current.Index = *v; -} - -void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a ) +static void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG]; @@ -78,17 +72,17 @@ void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a ) dest[3] = 1.0; } -void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG]; dest[0] = v[0]; dest[1] = 0.0; dest[2] = 0.0; dest[3] = 1.0; } -void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) +static void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; @@ -98,7 +92,7 @@ void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) dest[3] = 1.0; } -void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; @@ -108,7 +102,7 @@ void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v ) dest[3] = 1.0; } -void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +static void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; @@ -118,7 +112,7 @@ void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) color[3] = d; } -void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; @@ -128,7 +122,7 @@ void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v ) color[3] = v[3]; } -void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) +static void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; @@ -138,7 +132,7 @@ void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) color[3] = 1.0; } -void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; @@ -148,7 +142,7 @@ void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v ) color[3] = 1.0; } -void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) +static void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -165,7 +159,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) } } -void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -182,7 +176,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v } } -void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ) +static void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -199,7 +193,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat } } -void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -216,7 +210,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v } } -void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c) +static void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -233,7 +227,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat } } -void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -250,7 +244,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v } } -void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, +static void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); @@ -268,7 +262,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat } } -void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -285,7 +279,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v } } -void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) +static void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; @@ -295,7 +289,7 @@ void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c color[3] = 1.0; } -void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; @@ -305,7 +299,7 @@ void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) color[3] = 1.0; } -void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a ) +static void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -315,7 +309,7 @@ void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a ) dest[3] = 1; } -void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -325,7 +319,7 @@ void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v ) dest[3] = 1; } -void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) +static void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -335,7 +329,7 @@ void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) dest[3] = 1; } -void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -345,7 +339,7 @@ void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v ) dest[3] = 1; } -void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) +static void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -355,7 +349,7 @@ void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) dest[3] = 1; } -void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -365,7 +359,7 @@ void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v ) dest[3] = 1; } -void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +static void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -375,7 +369,7 @@ void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat dest[3] = d; } -void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -386,181 +380,189 @@ void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v ) } +/** + * GL_NV_vertex_program attributes. + * Note that these attributes alias the conventional vertex attributes. + */ -void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x ) +static void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) { ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fNV" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fNV(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvNV" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fvNV(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) +static void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fNV" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fNV(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvNV" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fvNV(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, +static void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fNV" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fNV(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvNV" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fvNV(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, +static void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fNV" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fNV(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvNV" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fvNV(index)" ); } -/* - * XXX Un-alias attribs here + +/** + * GL_ARB_vertex_program attributes. + * Note that these attributes DO NOT alias the conventional vertex attributes. */ -void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ) +static void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { - ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1); + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { + ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, 0, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fARB" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fARB(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { - ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1); + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { + ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], 0, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvARB" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fvARB(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) +static void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { - ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1); + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { + ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fARB" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fARB(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { - ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1); + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { + ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvARB" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fvARB(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, +static void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { - ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1); + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { + ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fARB" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fARB(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { - ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1); + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { + ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvARB" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fvARB(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, +static void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { - ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { + ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, w); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fARB" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fARB(index)" ); } -void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < VERT_ATTRIB_MAX) { - ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { + ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], v[3]); } else - _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvARB" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fvARB(index)" ); } -/* Material +/** + * Called by glMaterial*() */ -void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) +void GLAPIENTRY +_mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLint i, nr; @@ -574,7 +576,7 @@ void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat if (bitmask == 0) return; - switch (face) { + switch (pname) { case GL_SHININESS: nr = 1; break; case GL_COLOR_INDEXES: nr = 3; break; default: nr = 4 ; break; @@ -587,75 +589,80 @@ void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat _mesa_update_material( ctx, bitmask ); } -/* These really are noops outside begin/end: + +/** + * These really are noops outside begin/end: */ -void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v ) { (void) v; } -void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v ) { (void) v; } -void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v ) { (void) v; } -void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b ) +static void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b ) { (void) a; (void) b; } -void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ) +static void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ) { (void) a; (void) b; (void) c; } -void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +static void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { (void) a; (void) b; (void) c; (void) d; } + +#if FEATURE_evaluators /* Similarly, these have no effect outside begin/end: */ -void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ) +static void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ) { (void) a; } -void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v ) { (void) v; } -void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b ) +static void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b ) { (void) a; (void) b; } -void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v ) +static void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v ) { (void) v; } -void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a ) +static void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a ) { (void) a; } -void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ) +static void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ) { (void) a; (void) b; } +#endif /* FEATURE_evaluators */ /* Begin -- call into driver, should result in the vtxfmt being * swapped out: */ -void GLAPIENTRY _mesa_noop_Begin( GLenum mode ) +static void GLAPIENTRY _mesa_noop_Begin( GLenum mode ) { (void) mode; } @@ -663,14 +670,15 @@ void GLAPIENTRY _mesa_noop_Begin( GLenum mode ) /* End -- just raise an error */ -void GLAPIENTRY _mesa_noop_End( void ) +static void GLAPIENTRY _mesa_noop_End( void ) { GET_CURRENT_CONTEXT(ctx); - _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); + _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd(no glBegin)" ); } -/* Execute a glRectf() function. This is not suitable for GL_COMPILE +/** + * Execute a glRectf() function. This is not suitable for GL_COMPILE * modes (as the test for outside begin/end is not compiled), * but may be useful for drivers in circumstances which exclude * display list interactions. @@ -678,27 +686,30 @@ void GLAPIENTRY _mesa_noop_End( void ) * (None of the functions in this file are suitable for GL_COMPILE * modes). */ -void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) +void GLAPIENTRY +_mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); } - GL_CALL(Begin)( GL_QUADS ); - GL_CALL(Vertex2f)( x1, y1 ); - GL_CALL(Vertex2f)( x2, y1 ); - GL_CALL(Vertex2f)( x2, y2 ); - GL_CALL(Vertex2f)( x1, y2 ); - GL_CALL(End)(); + CALL_Begin(GET_DISPATCH(), (GL_QUADS)); + CALL_Vertex2f(GET_DISPATCH(), (x1, y1)); + CALL_Vertex2f(GET_DISPATCH(), (x2, y1)); + CALL_Vertex2f(GET_DISPATCH(), (x2, y2)); + CALL_Vertex2f(GET_DISPATCH(), (x1, y2)); + CALL_End(GET_DISPATCH(), ()); } -/* Some very basic support for arrays. Drivers without explicit array +/** + * Some very basic support for arrays. Drivers without explicit array * support can hook these in, but still need to supply an array-elt * implementation. */ -void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) +static void GLAPIENTRY +_mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); GLint i; @@ -706,15 +717,16 @@ void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) return; - GL_CALL(Begin)(mode); + CALL_Begin(GET_DISPATCH(), (mode)); for (i = 0; i < count; i++) - GL_CALL(ArrayElement)(start + i); - GL_CALL(End)(); + CALL_ArrayElement(GET_DISPATCH(), (start + i)); + CALL_End(GET_DISPATCH(), ()); } -void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices) +static void GLAPIENTRY +_mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); GLint i; @@ -722,56 +734,74 @@ void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) return; - GL_CALL(Begin)(mode); + CALL_Begin(GET_DISPATCH(), (mode)); switch (type) { case GL_UNSIGNED_BYTE: for (i = 0 ; i < count ; i++) - GL_CALL(ArrayElement)( ((GLubyte *)indices)[i] ); + CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] )); break; case GL_UNSIGNED_SHORT: for (i = 0 ; i < count ; i++) - GL_CALL(ArrayElement)( ((GLushort *)indices)[i] ); + CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] )); break; case GL_UNSIGNED_INT: for (i = 0 ; i < count ; i++) - GL_CALL(ArrayElement)( ((GLuint *)indices)[i] ); + CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] )); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); break; } - GL_CALL(End)(); + CALL_End(GET_DISPATCH(), ()); } -void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode, - GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid *indices) + +static void GLAPIENTRY +_mesa_noop_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); if (_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) - GL_CALL(DrawElements)( mode, count, type, indices ); + CALL_DrawElements(GET_DISPATCH(), (mode, count, type, indices)); +} + +/* GL_EXT_multi_draw_arrays */ +void GLAPIENTRY +_mesa_noop_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount) +{ + GLsizei i; + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + CALL_DrawElements(GET_DISPATCH(), (mode, count[i], type, indices[i])); + } + } } /* * 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. +/** + * 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. + * 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 GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) +void GLAPIENTRY +_mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) { GET_CURRENT_CONTEXT(ctx); GLint i; @@ -800,16 +830,17 @@ void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) du = ctx->Eval.MapGrid1du; u = ctx->Eval.MapGrid1u1 + i1 * du; - GL_CALL(Begin)( prim ); + CALL_Begin(GET_DISPATCH(), (prim)); for (i=i1;i<=i2;i++,u+=du) { - GL_CALL(EvalCoord1f)( u ); + CALL_EvalCoord1f(GET_DISPATCH(), (u)); } - GL_CALL(End)(); + CALL_End(GET_DISPATCH(), ()); } -void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) +void GLAPIENTRY +_mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { GET_CURRENT_CONTEXT(ctx); GLfloat u, du, v, dv, v1, u1; @@ -839,38 +870,38 @@ void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, switch (mode) { case GL_POINT: - GL_CALL(Begin)( GL_POINTS ); + CALL_Begin(GET_DISPATCH(), (GL_POINTS)); for (v=v1,j=j1;j<=j2;j++,v+=dv) { for (u=u1,i=i1;i<=i2;i++,u+=du) { - GL_CALL(EvalCoord2f)(u, v ); + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); } } - GL_CALL(End)(); + CALL_End(GET_DISPATCH(), ()); break; case GL_LINE: for (v=v1,j=j1;j<=j2;j++,v+=dv) { - GL_CALL(Begin)( GL_LINE_STRIP ); + CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); for (u=u1,i=i1;i<=i2;i++,u+=du) { - GL_CALL(EvalCoord2f)(u, v ); + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); } - GL_CALL(End)(); + CALL_End(GET_DISPATCH(), ()); } for (u=u1,i=i1;i<=i2;i++,u+=du) { - GL_CALL(Begin)( GL_LINE_STRIP ); + CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); for (v=v1,j=j1;j<=j2;j++,v+=dv) { - GL_CALL(EvalCoord2f)(u, v ); + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); } - GL_CALL(End)(); + CALL_End(GET_DISPATCH(), ()); } break; case GL_FILL: for (v=v1,j=j1;jArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = _mesa_noop_Begin; +#if FEATURE_dlist vfmt->CallList = _mesa_CallList; vfmt->CallLists = _mesa_CallLists; +#endif 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; +#if FEATURE_evaluators 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; +#endif vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; vfmt->Indexf = _mesa_noop_Indexf; @@ -958,6 +994,7 @@ void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->DrawArrays = _mesa_noop_DrawArrays; vfmt->DrawElements = _mesa_noop_DrawElements; vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements; + vfmt->MultiDrawElementsEXT = _mesa_noop_MultiDrawElements; vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; }