mesa: Add getters for ARB_ES2_compatibility MAX_*_VECTORS.
[mesa.git] / src / mesa / main / eval.c
index 3f89f9c1eae456173fe9b0846770e0dbb93eb78b..9ab55072f00cdf970539432c4975aada5be84fea 100644 (file)
 #include "context.h"
 #include "eval.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "mtypes.h"
+#include "main/dispatch.h"
+
+
+#if FEATURE_evaluators
 
 
 /*
@@ -96,7 +101,7 @@ GLuint _mesa_evaluator_components( GLenum target )
  * Return pointer to the gl_1d_map struct for the named target.
  */
 static struct gl_1d_map *
-get_1d_map( GLcontext *ctx, GLenum target )
+get_1d_map( struct gl_context *ctx, GLenum target )
 {
    switch (target) {
       case GL_MAP1_VERTEX_3:
@@ -146,7 +151,7 @@ get_1d_map( GLcontext *ctx, GLenum target )
  * Return pointer to the gl_2d_map struct for the named target.
  */
 static struct gl_2d_map *
-get_2d_map( GLcontext *ctx, GLenum target )
+get_2d_map( struct gl_context *ctx, GLenum target )
 {
    switch (target) {
       case GL_MAP2_VERTEX_3:
@@ -417,7 +422,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
              GLint order, const GLfloat *points )
 {
@@ -425,7 +430,7 @@ _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
              GLint order, const GLdouble *points )
 {
@@ -516,7 +521,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Map2f( GLenum target,
              GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
              GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
@@ -527,7 +532,7 @@ _mesa_Map2f( GLenum target,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Map2d( GLenum target,
              GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
              GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
@@ -539,7 +544,7 @@ _mesa_Map2d( GLenum target,
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -604,7 +609,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -669,7 +674,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -735,7 +740,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -753,14 +758,14 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
 {
    _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 );
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
                  GLint vn, GLfloat v1, GLfloat v2 )
 {
@@ -788,7 +793,7 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
                  GLint vn, GLdouble v1, GLdouble v2 )
 {
@@ -797,6 +802,41 @@ _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
 }
 
 
+void
+_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
+                          const GLvertexformat *vfmt)
+{
+   SET_EvalCoord1f(disp, vfmt->EvalCoord1f);
+   SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv);
+   SET_EvalCoord2f(disp, vfmt->EvalCoord2f);
+   SET_EvalCoord2fv(disp, vfmt->EvalCoord2fv);
+   SET_EvalPoint1(disp, vfmt->EvalPoint1);
+   SET_EvalPoint2(disp, vfmt->EvalPoint2);
+
+   SET_EvalMesh1(disp, vfmt->EvalMesh1);
+   SET_EvalMesh2(disp, vfmt->EvalMesh2);
+}
+
+
+void
+_mesa_init_eval_dispatch(struct _glapi_table *disp)
+{
+   SET_GetMapdv(disp, _mesa_GetMapdv);
+   SET_GetMapfv(disp, _mesa_GetMapfv);
+   SET_GetMapiv(disp, _mesa_GetMapiv);
+   SET_Map1d(disp, _mesa_Map1d);
+   SET_Map1f(disp, _mesa_Map1f);
+   SET_Map2d(disp, _mesa_Map2d);
+   SET_Map2f(disp, _mesa_Map2f);
+   SET_MapGrid1d(disp, _mesa_MapGrid1d);
+   SET_MapGrid1f(disp, _mesa_MapGrid1f);
+   SET_MapGrid2d(disp, _mesa_MapGrid2d);
+   SET_MapGrid2f(disp, _mesa_MapGrid2f);
+}
+
+
+#endif /* FEATURE_evaluators */
+
 
 /**********************************************************************/
 /*****                      Initialization                        *****/
@@ -841,7 +881,7 @@ init_2d_map( struct gl_2d_map *map, int n, const float *initial )
 }
 
 
-void _mesa_init_eval( GLcontext *ctx )
+void _mesa_init_eval( struct gl_context *ctx )
 {
    int i;
 
@@ -855,7 +895,7 @@ void _mesa_init_eval( GLcontext *ctx )
    ctx->Eval.Map1TextureCoord4 = GL_FALSE;
    ctx->Eval.Map1Vertex3 = GL_FALSE;
    ctx->Eval.Map1Vertex4 = GL_FALSE;
-   MEMSET(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib));
+   memset(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib));
    ctx->Eval.Map2Color4 = GL_FALSE;
    ctx->Eval.Map2Index = GL_FALSE;
    ctx->Eval.Map2Normal = GL_FALSE;
@@ -865,7 +905,7 @@ void _mesa_init_eval( GLcontext *ctx )
    ctx->Eval.Map2TextureCoord4 = GL_FALSE;
    ctx->Eval.Map2Vertex3 = GL_FALSE;
    ctx->Eval.Map2Vertex4 = GL_FALSE;
-   MEMSET(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib));
+   memset(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib));
    ctx->Eval.AutoNormal = GL_FALSE;
    ctx->Eval.MapGrid1un = 1;
    ctx->Eval.MapGrid1u1 = 0.0;
@@ -913,7 +953,7 @@ void _mesa_init_eval( GLcontext *ctx )
 }
 
 
-void _mesa_free_eval_data( GLcontext *ctx )
+void _mesa_free_eval_data( struct gl_context *ctx )
 {
    int i;