Support ARB_texture_env_crossbar. Changes the way programs are
[mesa.git] / src / mesa / main / api_noop.c
index e7f185a272c39afffb26bb8bee220c9c97c47ca7..d3496ff59f5bf4817807f2dc96446e2fc7470487 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.1
+ * Version:  6.5
  *
- * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2005  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"),
@@ -81,7 +81,7 @@ void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a )
 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;
@@ -394,7 +394,7 @@ void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x )
       ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
    }
    else
-      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1f" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fNV" );
 }
 
 void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
@@ -404,7 +404,7 @@ void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
       ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
    }
    else
-      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fv" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvNV" );
 }
 
 void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
@@ -414,7 +414,7 @@ void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y
       ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
    }
    else
-      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2f" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fNV" );
 }
 
 void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
@@ -424,7 +424,7 @@ void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
       ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
    }
    else
-      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fv" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvNV" );
 }
 
 void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
@@ -435,7 +435,7 @@ void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
       ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
    }
    else
-      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3f" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fNV" );
 }
 
 void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
@@ -445,7 +445,7 @@ void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
       ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
    }
    else
-      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fv" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvNV" );
 }
 
 void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
@@ -456,7 +456,7 @@ void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
       ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
    }
    else
-      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4f" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fNV" );
 }
 
 void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
@@ -466,9 +466,98 @@ void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
       ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
    }
    else
-      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fv" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvNV" );
+}
+
+
+/*
+ * XXX Un-alias attribs here
+ */
+
+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);
+   }
+   else
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fARB" );
+}
+
+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);
+   }
+   else
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvARB" );
+}
+
+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);
+   }
+   else
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fARB" );
+}
+
+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);
+   }
+   else
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvARB" );
+}
+
+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);
+   }
+   else
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fARB" );
+}
+
+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);
+   }
+   else
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvARB" );
+}
+
+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);
+   }
+   else
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fARB" );
+}
+
+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]);
+   }
+   else
+      _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvARB" );
 }
 
+
+
 /* Material
  */
 void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
@@ -568,6 +657,7 @@ void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
  */
 void GLAPIENTRY _mesa_noop_Begin( GLenum mode )
 {
+   (void) mode;
 }
 
 
@@ -595,12 +685,12 @@ void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2
       ASSERT_OUTSIDE_BEGIN_END(ctx);
    }
 
-   _glapi_Dispatch->Begin( GL_QUADS );
-   _glapi_Dispatch->Vertex2f( x1, y1 );
-   _glapi_Dispatch->Vertex2f( x2, y1 );
-   _glapi_Dispatch->Vertex2f( x2, y2 );
-   _glapi_Dispatch->Vertex2f( x1, y2 );
-   _glapi_Dispatch->End();
+   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)();
 }
 
 
@@ -616,10 +706,10 @@ void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
    if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
       return;
 
-   _glapi_Dispatch->Begin(mode);
+   GL_CALL(Begin)(mode);
    for (i = 0; i < count; i++)
-      _glapi_Dispatch->ArrayElement(start + i);
-   _glapi_Dispatch->End();
+       GL_CALL(ArrayElement)(start + i);
+   GL_CALL(End)();
 }
 
 
@@ -632,27 +722,27 @@ void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
    if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
       return;
 
-   _glapi_Dispatch->Begin(mode);
+   GL_CALL(Begin)(mode);
 
    switch (type) {
    case GL_UNSIGNED_BYTE:
       for (i = 0 ; i < count ; i++)
-        _glapi_Dispatch->ArrayElement( ((GLubyte *)indices)[i] );
+         GL_CALL(ArrayElement)( ((GLubyte *)indices)[i] );
       break;
    case GL_UNSIGNED_SHORT:
       for (i = 0 ; i < count ; i++)
-        _glapi_Dispatch->ArrayElement( ((GLushort *)indices)[i] );
+         GL_CALL(ArrayElement)( ((GLushort *)indices)[i] );
       break;
    case GL_UNSIGNED_INT:
       for (i = 0 ; i < count ; i++)
-        _glapi_Dispatch->ArrayElement( ((GLuint *)indices)[i] );
+         GL_CALL(ArrayElement)( ((GLuint *)indices)[i] );
       break;
    default:
       _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
       break;
    }
 
-   _glapi_Dispatch->End();
+   GL_CALL(End)();
 }
 
 void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
@@ -665,7 +755,7 @@ void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
    if (_mesa_validate_DrawRangeElements( ctx, mode,
                                         start, end,
                                         count, type, indices ))
-      _glapi_Dispatch->DrawElements( mode, count, type, indices );
+       GL_CALL(DrawElements)( mode, count, type, indices );
 }
 
 /*
@@ -704,17 +794,17 @@ void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
     */
    if (!ctx->Eval.Map1Vertex4 && 
        !ctx->Eval.Map1Vertex3 &&
-       !(ctx->VertexProgram.Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
+       !(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
       return;
 
    du = ctx->Eval.MapGrid1du;
    u = ctx->Eval.MapGrid1u1 + i1 * du;
 
-   _glapi_Dispatch->Begin( prim );
+   GL_CALL(Begin)( prim );
    for (i=i1;i<=i2;i++,u+=du) {
-      _glapi_Dispatch->EvalCoord1f( u );
+      GL_CALL(EvalCoord1f)( u );
    }
-   _glapi_Dispatch->End();
+   GL_CALL(End)();
 }
 
 
@@ -739,7 +829,7 @@ void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1,
     */
    if (!ctx->Eval.Map2Vertex4 && 
        !ctx->Eval.Map2Vertex3 &&
-       !(ctx->VertexProgram.Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
+       !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
       return;
 
    du = ctx->Eval.MapGrid2du;
@@ -749,38 +839,38 @@ void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1,
 
    switch (mode) {
    case GL_POINT:
-      _glapi_Dispatch->Begin( GL_POINTS );
+      GL_CALL(Begin)( GL_POINTS );
       for (v=v1,j=j1;j<=j2;j++,v+=dv) {
         for (u=u1,i=i1;i<=i2;i++,u+=du) {
-           _glapi_Dispatch->EvalCoord2f(u, v );
+           GL_CALL(EvalCoord2f)(u, v );
         }
       }
-      _glapi_Dispatch->End();
+      GL_CALL(End)();
       break;
    case GL_LINE:
       for (v=v1,j=j1;j<=j2;j++,v+=dv) {
-        _glapi_Dispatch->Begin( GL_LINE_STRIP );
+        GL_CALL(Begin)( GL_LINE_STRIP );
         for (u=u1,i=i1;i<=i2;i++,u+=du) {
-           _glapi_Dispatch->EvalCoord2f(u, v );
+           GL_CALL(EvalCoord2f)(u, v );
         }
-        _glapi_Dispatch->End();
+        GL_CALL(End)();
       }
       for (u=u1,i=i1;i<=i2;i++,u+=du) {
-        _glapi_Dispatch->Begin( GL_LINE_STRIP );
+        GL_CALL(Begin)( GL_LINE_STRIP );
         for (v=v1,j=j1;j<=j2;j++,v+=dv) {
-           _glapi_Dispatch->EvalCoord2f(u, v );
+           GL_CALL(EvalCoord2f)(u, v );
         }
-        _glapi_Dispatch->End();
+        GL_CALL(End)();
       }
       break;
    case GL_FILL:
       for (v=v1,j=j1;j<j2;j++,v+=dv) {
-        _glapi_Dispatch->Begin( GL_TRIANGLE_STRIP );
+        GL_CALL(Begin)( GL_TRIANGLE_STRIP );
         for (u=u1,i=i1;i<=i2;i++,u+=du) {
-           _glapi_Dispatch->EvalCoord2f(u, v );
-           _glapi_Dispatch->EvalCoord2f(u, v+dv );
+           GL_CALL(EvalCoord2f)(u, v );
+           GL_CALL(EvalCoord2f)(u, v+dv );
         }
-        _glapi_Dispatch->End();
+        GL_CALL(End)();
       }
       break;
    default:
@@ -854,6 +944,14 @@ void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
    vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV;
    vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV;
    vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV;
+   vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB;
+   vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB;
+   vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB;
+   vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB;
+   vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB;
+   vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB;
+   vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB;
+   vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB;
 
    vfmt->Rectf = _mesa_noop_Rectf;