mesa: Remove ARB_draw_buffers extension enable flag
[mesa.git] / src / mesa / main / eval.c
index f3b97283928489f034cf8f82b831f69c25245840..e651715f7885398df15852b0bed195fd49336f4d 100644 (file)
@@ -1,10 +1,9 @@
-/* $Id: eval.c,v 1.22 2002/01/05 21:53:20 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  4.1
+ * Version:  5.1
  *
- * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
+ * 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"),
  */
 
 
-#ifdef PC_HEADER
-#include "all.h"
-#else
 #include "glheader.h"
+#include "imports.h"
 #include "colormac.h"
 #include "context.h"
 #include "eval.h"
 #include "macros.h"
-#include "mem.h"
-#include "mmath.h"
+#include "mfeatures.h"
 #include "mtypes.h"
-#endif
+#include "main/dispatch.h"
+
+
+#if FEATURE_evaluators
 
 
 /*
@@ -102,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:
@@ -152,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:
@@ -206,8 +205,8 @@ get_2d_map( GLcontext *ctx, GLenum target )
 /*
  * Copy 1-parametric evaluator control points from user-specified
  * memory space to a buffer of contiguous control points.
- * Input:  see glMap1f for details
- * Return:  pointer to buffer of contiguous control points or NULL if out
+ * \param see glMap1f for details
+ * \return pointer to buffer of contiguous control points or NULL if out
  *          of memory.
  */
 GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
@@ -261,14 +260,14 @@ GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
  * Additional memory is allocated to be used by the horner and
  * de Casteljau evaluation schemes.
  *
- * Input:  see glMap2f for details
- * Return:  pointer to buffer of contiguous control points or NULL if out
+ * \param see glMap2f for details
+ * \return pointer to buffer of contiguous control points or NULL if out
  *          of memory.
  */
 GLfloat *_mesa_copy_map_points2f( GLenum target,
-                               GLint ustride, GLint uorder,
-                               GLint vstride, GLint vorder,
-                               const GLfloat *points )
+                                  GLint ustride, GLint uorder,
+                                  GLint vstride, GLint vorder,
+                                  const GLfloat *points )
 {
    GLfloat *buffer, *p;
    GLint i, j, k, size, dsize, hsize;
@@ -309,9 +308,9 @@ GLfloat *_mesa_copy_map_points2f( GLenum target,
  * Same as above but convert doubles to floats.
  */
 GLfloat *_mesa_copy_map_points2d(GLenum target,
-                              GLint ustride, GLint uorder,
-                              GLint vstride, GLint vorder,
-                              const GLdouble *points )
+                                 GLint ustride, GLint uorder,
+                                 GLint vstride, GLint vorder,
+                                 const GLdouble *points )
 {
    GLfloat *buffer, *p;
    GLint i, j, k, size, hsize, dsize;
@@ -364,10 +363,10 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
    GET_CURRENT_CONTEXT(ctx);
    GLint k;
    GLfloat *pnts;
-   struct gl_1d_map *map = 0;
+   struct gl_1d_map *map = NULL;
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
-   assert(type == GL_FLOAT || type == GL_DOUBLE);
+   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
 
    if (u1 == u2) {
       _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" );
@@ -423,7 +422,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
 
 
 
-void
+static void GLAPIENTRY
 _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
              GLint order, const GLfloat *points )
 {
@@ -431,7 +430,7 @@ _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
 }
 
 
-void
+static void GLAPIENTRY
 _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
              GLint order, const GLdouble *points )
 {
@@ -447,8 +446,10 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
    GET_CURRENT_CONTEXT(ctx);
    GLint k;
    GLfloat *pnts;
-   struct gl_2d_map *map = 0;
+   struct gl_2d_map *map = NULL;
+
    ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
 
    if (u1==u2) {
       _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
@@ -520,7 +521,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
 }
 
 
-void
+static void GLAPIENTRY
 _mesa_Map2f( GLenum target,
              GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
              GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
@@ -531,7 +532,7 @@ _mesa_Map2f( GLenum target,
 }
 
 
-void
+static void GLAPIENTRY
 _mesa_Map2d( GLenum target,
              GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
              GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
@@ -543,8 +544,8 @@ _mesa_Map2d( GLenum target,
 
 
 
-void
-_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
+static void GLAPIENTRY
+_mesa_GetnMapdvARB( GLenum target, GLenum query, GLsizei bufSize, GLdouble *v )
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_1d_map *map1d;
@@ -552,6 +553,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
    GLint i, n;
    GLfloat *data;
    GLuint comps;
+   GLsizei numBytes;
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -576,6 +578,9 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
             n = map2d->Uorder * map2d->Vorder * comps;
          }
         if (data) {
+            numBytes = n * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
            for (i=0;i<n;i++) {
               v[i] = data[i];
            }
@@ -583,19 +588,31 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
          break;
       case GL_ORDER:
          if (map1d) {
+            numBytes = 1 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = (GLdouble) map1d->Order;
          }
          else {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = (GLdouble) map2d->Uorder;
             v[1] = (GLdouble) map2d->Vorder;
          }
          break;
       case GL_DOMAIN:
          if (map1d) {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+              goto overflow;
             v[0] = (GLdouble) map1d->u1;
             v[1] = (GLdouble) map1d->u2;
          }
          else {
+            numBytes = 4 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = (GLdouble) map2d->u1;
             v[1] = (GLdouble) map2d->u2;
             v[2] = (GLdouble) map2d->v1;
@@ -605,11 +622,22 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
       default:
          _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" );
    }
+   return;
+
+overflow:
+   _mesa_error( ctx, GL_INVALID_OPERATION,
+               "glGetnMapdvARB(out of bounds: bufSize is %d,"
+               " but %d bytes are required)", bufSize, numBytes );
 }
 
+static void GLAPIENTRY
+_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
+{
+   _mesa_GetnMapdvARB(target, query, INT_MAX, v);
+}
 
-void
-_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
+static void GLAPIENTRY
+_mesa_GetnMapfvARB( GLenum target, GLenum query, GLsizei bufSize, GLfloat *v )
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_1d_map *map1d;
@@ -617,12 +645,13 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
    GLint i, n;
    GLfloat *data;
    GLuint comps;
+   GLsizei numBytes;
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    comps = _mesa_evaluator_components(target);
    if (!comps) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
       return;
    }
 
@@ -641,6 +670,9 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
             n = map2d->Uorder * map2d->Vorder * comps;
          }
         if (data) {
+            numBytes = n * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
            for (i=0;i<n;i++) {
               v[i] = data[i];
            }
@@ -648,19 +680,31 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
          break;
       case GL_ORDER:
          if (map1d) {
+            numBytes = 1 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = (GLfloat) map1d->Order;
          }
          else {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = (GLfloat) map2d->Uorder;
             v[1] = (GLfloat) map2d->Vorder;
          }
          break;
       case GL_DOMAIN:
          if (map1d) {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = map1d->u1;
             v[1] = map1d->u2;
          }
          else {
+            numBytes = 4 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = map2d->u1;
             v[1] = map2d->u2;
             v[2] = map2d->v1;
@@ -670,11 +714,24 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
       default:
          _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" );
    }
+   return;
+
+overflow:
+   _mesa_error( ctx, GL_INVALID_OPERATION,
+               "glGetnMapfvARB(out of bounds: bufSize is %d,"
+               " but %d bytes are required)", bufSize, numBytes );
 }
 
 
-void
-_mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
+static void GLAPIENTRY
+_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
+{
+   _mesa_GetnMapfvARB(target, query, INT_MAX, v);
+}
+
+
+static void GLAPIENTRY
+_mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v )
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_1d_map *map1d;
@@ -682,12 +739,13 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
    GLuint i, n;
    GLfloat *data;
    GLuint comps;
+   GLsizei numBytes;
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    comps = _mesa_evaluator_components(target);
    if (!comps) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
       return;
    }
 
@@ -706,40 +764,67 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
             n = map2d->Uorder * map2d->Vorder * comps;
          }
         if (data) {
+            numBytes = n * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
            for (i=0;i<n;i++) {
-              v[i] = ROUNDF(data[i]);
+              v[i] = IROUND(data[i]);
            }
         }
          break;
       case GL_ORDER:
          if (map1d) {
+            numBytes = 1 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = map1d->Order;
          }
          else {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
             v[0] = map2d->Uorder;
             v[1] = map2d->Vorder;
          }
          break;
       case GL_DOMAIN:
          if (map1d) {
-            v[0] = ROUNDF(map1d->u1);
-            v[1] = ROUNDF(map1d->u2);
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = IROUND(map1d->u1);
+            v[1] = IROUND(map1d->u2);
          }
          else {
-            v[0] = ROUNDF(map2d->u1);
-            v[1] = ROUNDF(map2d->u2);
-            v[2] = ROUNDF(map2d->v1);
-            v[3] = ROUNDF(map2d->v2);
+            numBytes = 4 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = IROUND(map2d->u1);
+            v[1] = IROUND(map2d->u2);
+            v[2] = IROUND(map2d->v1);
+            v[3] = IROUND(map2d->v2);
          }
          break;
       default:
          _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" );
    }
+   return;
+
+overflow:
+   _mesa_error( ctx, GL_INVALID_OPERATION,
+               "glGetnMapivARB(out of bounds: bufSize is %d,"
+               " but %d bytes are required)", bufSize, numBytes );
 }
 
 
+static void GLAPIENTRY
+_mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
+{
+   _mesa_GetnMapivARB(target, query, INT_MAX, v);
+}
+
 
-void
+static void GLAPIENTRY
 _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -757,14 +842,14 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
 }
 
 
-void
+static void GLAPIENTRY
 _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
 {
    _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 );
 }
 
 
-void
+static void GLAPIENTRY
 _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
                  GLint vn, GLfloat v1, GLfloat v2 )
 {
@@ -792,10 +877,215 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
 }
 
 
-void
+static void GLAPIENTRY
 _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
                  GLint vn, GLdouble v1, GLdouble v2 )
 {
    _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2, 
                    vn, (GLfloat) v1, (GLfloat) v2 );
 }
+
+
+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);
+
+   /* GL_ARB_robustness */
+   SET_GetnMapdvARB(disp, _mesa_GetnMapdvARB);
+   SET_GetnMapfvARB(disp, _mesa_GetnMapfvARB);
+   SET_GetnMapivARB(disp, _mesa_GetnMapivARB);
+}
+
+
+#endif /* FEATURE_evaluators */
+
+
+/**********************************************************************/
+/*****                      Initialization                        *****/
+/**********************************************************************/
+
+/**
+ * Initialize a 1-D evaluator map.
+ */
+static void
+init_1d_map( struct gl_1d_map *map, int n, const float *initial )
+{
+   map->Order = 1;
+   map->u1 = 0.0;
+   map->u2 = 1.0;
+   map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
+   if (map->Points) {
+      GLint i;
+      for (i=0;i<n;i++)
+         map->Points[i] = initial[i];
+   }
+}
+
+
+/**
+ * Initialize a 2-D evaluator map 
+ */
+static void
+init_2d_map( struct gl_2d_map *map, int n, const float *initial )
+{
+   map->Uorder = 1;
+   map->Vorder = 1;
+   map->u1 = 0.0;
+   map->u2 = 1.0;
+   map->v1 = 0.0;
+   map->v2 = 1.0;
+   map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
+   if (map->Points) {
+      GLint i;
+      for (i=0;i<n;i++)
+         map->Points[i] = initial[i];
+   }
+}
+
+
+void _mesa_init_eval( struct gl_context *ctx )
+{
+   int i;
+
+   /* Evaluators group */
+   ctx->Eval.Map1Color4 = GL_FALSE;
+   ctx->Eval.Map1Index = GL_FALSE;
+   ctx->Eval.Map1Normal = GL_FALSE;
+   ctx->Eval.Map1TextureCoord1 = GL_FALSE;
+   ctx->Eval.Map1TextureCoord2 = GL_FALSE;
+   ctx->Eval.Map1TextureCoord3 = GL_FALSE;
+   ctx->Eval.Map1TextureCoord4 = GL_FALSE;
+   ctx->Eval.Map1Vertex3 = GL_FALSE;
+   ctx->Eval.Map1Vertex4 = GL_FALSE;
+   memset(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib));
+   ctx->Eval.Map2Color4 = GL_FALSE;
+   ctx->Eval.Map2Index = GL_FALSE;
+   ctx->Eval.Map2Normal = GL_FALSE;
+   ctx->Eval.Map2TextureCoord1 = GL_FALSE;
+   ctx->Eval.Map2TextureCoord2 = GL_FALSE;
+   ctx->Eval.Map2TextureCoord3 = GL_FALSE;
+   ctx->Eval.Map2TextureCoord4 = GL_FALSE;
+   ctx->Eval.Map2Vertex3 = GL_FALSE;
+   ctx->Eval.Map2Vertex4 = GL_FALSE;
+   memset(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib));
+   ctx->Eval.AutoNormal = GL_FALSE;
+   ctx->Eval.MapGrid1un = 1;
+   ctx->Eval.MapGrid1u1 = 0.0;
+   ctx->Eval.MapGrid1u2 = 1.0;
+   ctx->Eval.MapGrid2un = 1;
+   ctx->Eval.MapGrid2vn = 1;
+   ctx->Eval.MapGrid2u1 = 0.0;
+   ctx->Eval.MapGrid2u2 = 1.0;
+   ctx->Eval.MapGrid2v1 = 0.0;
+   ctx->Eval.MapGrid2v2 = 1.0;
+
+   /* Evaluator data */
+   {
+      static GLfloat vertex[4] = { 0.0, 0.0, 0.0, 1.0 };
+      static GLfloat normal[3] = { 0.0, 0.0, 1.0 };
+      static GLfloat index[1] = { 1.0 };
+      static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 };
+      static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 };
+      static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 };
+
+      init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex );
+      init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex );
+      init_1d_map( &ctx->EvalMap.Map1Index, 1, index );
+      init_1d_map( &ctx->EvalMap.Map1Color4, 4, color );
+      init_1d_map( &ctx->EvalMap.Map1Normal, 3, normal );
+      init_1d_map( &ctx->EvalMap.Map1Texture1, 1, texcoord );
+      init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord );
+      init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord );
+      init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord );
+      for (i = 0; i < 16; i++)
+         init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib );
+
+      init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex );
+      init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex );
+      init_2d_map( &ctx->EvalMap.Map2Index, 1, index );
+      init_2d_map( &ctx->EvalMap.Map2Color4, 4, color );
+      init_2d_map( &ctx->EvalMap.Map2Normal, 3, normal );
+      init_2d_map( &ctx->EvalMap.Map2Texture1, 1, texcoord );
+      init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord );
+      init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord );
+      init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord );
+      for (i = 0; i < 16; i++)
+         init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib );
+   }
+}
+
+
+void _mesa_free_eval_data( struct gl_context *ctx )
+{
+   int i;
+
+   /* Free evaluator data */
+   if (ctx->EvalMap.Map1Vertex3.Points)
+      FREE( ctx->EvalMap.Map1Vertex3.Points );
+   if (ctx->EvalMap.Map1Vertex4.Points)
+      FREE( ctx->EvalMap.Map1Vertex4.Points );
+   if (ctx->EvalMap.Map1Index.Points)
+      FREE( ctx->EvalMap.Map1Index.Points );
+   if (ctx->EvalMap.Map1Color4.Points)
+      FREE( ctx->EvalMap.Map1Color4.Points );
+   if (ctx->EvalMap.Map1Normal.Points)
+      FREE( ctx->EvalMap.Map1Normal.Points );
+   if (ctx->EvalMap.Map1Texture1.Points)
+      FREE( ctx->EvalMap.Map1Texture1.Points );
+   if (ctx->EvalMap.Map1Texture2.Points)
+      FREE( ctx->EvalMap.Map1Texture2.Points );
+   if (ctx->EvalMap.Map1Texture3.Points)
+      FREE( ctx->EvalMap.Map1Texture3.Points );
+   if (ctx->EvalMap.Map1Texture4.Points)
+      FREE( ctx->EvalMap.Map1Texture4.Points );
+   for (i = 0; i < 16; i++)
+      FREE((ctx->EvalMap.Map1Attrib[i].Points));
+
+   if (ctx->EvalMap.Map2Vertex3.Points)
+      FREE( ctx->EvalMap.Map2Vertex3.Points );
+   if (ctx->EvalMap.Map2Vertex4.Points)
+      FREE( ctx->EvalMap.Map2Vertex4.Points );
+   if (ctx->EvalMap.Map2Index.Points)
+      FREE( ctx->EvalMap.Map2Index.Points );
+   if (ctx->EvalMap.Map2Color4.Points)
+      FREE( ctx->EvalMap.Map2Color4.Points );
+   if (ctx->EvalMap.Map2Normal.Points)
+      FREE( ctx->EvalMap.Map2Normal.Points );
+   if (ctx->EvalMap.Map2Texture1.Points)
+      FREE( ctx->EvalMap.Map2Texture1.Points );
+   if (ctx->EvalMap.Map2Texture2.Points)
+      FREE( ctx->EvalMap.Map2Texture2.Points );
+   if (ctx->EvalMap.Map2Texture3.Points)
+      FREE( ctx->EvalMap.Map2Texture3.Points );
+   if (ctx->EvalMap.Map2Texture4.Points)
+      FREE( ctx->EvalMap.Map2Texture4.Points );
+   for (i = 0; i < 16; i++)
+      FREE((ctx->EvalMap.Map2Attrib[i].Points));
+}