X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Feval.c;h=86c8f75a1d25df5542d79fcf6378b80998e7cf46;hb=a0d667036d8c8b77fa62f74263583b07909f8637;hp=95d6e2318793c466344775dfad787f23c0901f24;hpb=b605f4ff11c894500f2d0273c5d4653ff413448d;p=mesa.git diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 95d6e231879..86c8f75a1d2 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -1,7 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * @@ -18,9 +17,10 @@ * 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. + * THE AUTHORS OR COPYRIGHT HOLDERS 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. */ @@ -39,15 +39,11 @@ #include "glheader.h" #include "imports.h" -#include "colormac.h" #include "context.h" #include "eval.h" #include "macros.h" #include "mtypes.h" -#include "glapi/dispatch.h" - - -#if FEATURE_evaluators +#include "main/dispatch.h" /* @@ -79,19 +75,6 @@ GLuint _mesa_evaluator_components( GLenum target ) default: break; } - /* XXX need to check for the vertex program extension - if (!ctx->Extensions.NV_vertex_program) - return 0; - */ - - if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV && - target <= GL_MAP1_VERTEX_ATTRIB15_4_NV) - return 4; - - if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV && - target <= GL_MAP2_VERTEX_ATTRIB15_4_NV) - return 4; - return 0; } @@ -100,7 +83,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: @@ -121,25 +104,6 @@ get_1d_map( GLcontext *ctx, GLenum target ) return &ctx->EvalMap.Map1Texture3; case GL_MAP1_TEXTURE_COORD_4: return &ctx->EvalMap.Map1Texture4; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - if (!ctx->Extensions.NV_vertex_program) - return NULL; - return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV]; default: return NULL; } @@ -150,7 +114,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: @@ -171,25 +135,6 @@ get_2d_map( GLcontext *ctx, GLenum target ) return &ctx->EvalMap.Map2Texture3; case GL_MAP2_TEXTURE_COORD_4: return &ctx->EvalMap.Map2Texture4; - case GL_MAP2_VERTEX_ATTRIB0_4_NV: - case GL_MAP2_VERTEX_ATTRIB1_4_NV: - case GL_MAP2_VERTEX_ATTRIB2_4_NV: - case GL_MAP2_VERTEX_ATTRIB3_4_NV: - case GL_MAP2_VERTEX_ATTRIB4_4_NV: - case GL_MAP2_VERTEX_ATTRIB5_4_NV: - case GL_MAP2_VERTEX_ATTRIB6_4_NV: - case GL_MAP2_VERTEX_ATTRIB7_4_NV: - case GL_MAP2_VERTEX_ATTRIB8_4_NV: - case GL_MAP2_VERTEX_ATTRIB9_4_NV: - case GL_MAP2_VERTEX_ATTRIB10_4_NV: - case GL_MAP2_VERTEX_ATTRIB11_4_NV: - case GL_MAP2_VERTEX_ATTRIB12_4_NV: - case GL_MAP2_VERTEX_ATTRIB13_4_NV: - case GL_MAP2_VERTEX_ATTRIB14_4_NV: - case GL_MAP2_VERTEX_ATTRIB15_4_NV: - if (!ctx->Extensions.NV_vertex_program) - return NULL; - return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV]; default: return NULL; } @@ -217,7 +162,7 @@ GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder, if (!points || !size) return NULL; - buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); + buffer = malloc(uorder * size * sizeof(GLfloat)); if (buffer) for (i = 0, p = buffer; i < uorder; i++, points += ustride) @@ -241,7 +186,7 @@ GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder, if (!points || !size) return NULL; - buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); + buffer = malloc(uorder * size * sizeof(GLfloat)); if (buffer) for (i = 0, p = buffer; i < uorder; i++, points += ustride) @@ -285,9 +230,9 @@ GLfloat *_mesa_copy_map_points2f( GLenum target, hsize = (uorder > vorder ? uorder : vorder)*size; if(hsize>dsize) - buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); + buffer = malloc((uorder*vorder*size+hsize)*sizeof(GLfloat)); else - buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); + buffer = malloc((uorder*vorder*size+dsize)*sizeof(GLfloat)); /* compute the increment value for the u-loop */ uinc = ustride - vorder*vstride; @@ -328,9 +273,9 @@ GLfloat *_mesa_copy_map_points2d(GLenum target, hsize = (uorder > vorder ? uorder : vorder)*size; if(hsize>dsize) - buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); + buffer = malloc((uorder*vorder*size+hsize)*sizeof(GLfloat)); else - buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); + buffer = malloc((uorder*vorder*size+dsize)*sizeof(GLfloat)); /* compute the increment value for the u-loop */ uinc = ustride - vorder*vstride; @@ -364,8 +309,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLfloat *pnts; 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)" ); @@ -383,6 +327,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, k = _mesa_evaluator_components( target ); if (k == 0) { _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); + return; } if (ustride < k) { @@ -414,14 +359,13 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, map->u1 = u1; map->u2 = u2; map->du = 1.0F / (u2 - u1); - if (map->Points) - FREE( map->Points ); + free(map->Points); map->Points = pnts; } -static void GLAPIENTRY +void GLAPIENTRY _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ) { @@ -429,7 +373,7 @@ _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, } -static void GLAPIENTRY +void GLAPIENTRY _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ) { @@ -447,8 +391,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat *pnts; struct gl_2d_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, "glMap2(u1,u2)" ); @@ -473,6 +416,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, k = _mesa_evaluator_components( target ); if (k==0) { _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); + return; } if (ustride < k) { @@ -514,13 +458,12 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, map->v1 = v1; map->v2 = v2; map->dv = 1.0F / (v2 - v1); - if (map->Points) - FREE( map->Points ); + free(map->Points); map->Points = pnts; } -static void GLAPIENTRY +void GLAPIENTRY _mesa_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, @@ -531,7 +474,7 @@ _mesa_Map2f( GLenum target, } -static void GLAPIENTRY +void GLAPIENTRY _mesa_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, @@ -543,8 +486,8 @@ _mesa_Map2d( GLenum target, -static void GLAPIENTRY -_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) +void GLAPIENTRY +_mesa_GetnMapdvARB( GLenum target, GLenum query, GLsizei bufSize, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; @@ -552,8 +495,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) GLint i, n; GLfloat *data; GLuint comps; - - ASSERT_OUTSIDE_BEGIN_END(ctx); + GLsizei numBytes; comps = _mesa_evaluator_components(target); if (!comps) { @@ -563,7 +505,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); - ASSERT(map1d || map2d); + assert(map1d || map2d); switch (query) { case GL_COEFF: @@ -576,6 +518,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;iOrder; } 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 +562,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 ); } +void GLAPIENTRY +_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) +{ + _mesa_GetnMapdvARB(target, query, INT_MAX, v); +} -static void GLAPIENTRY -_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) +void GLAPIENTRY +_mesa_GetnMapfvARB( GLenum target, GLenum query, GLsizei bufSize, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; @@ -617,8 +585,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) GLint i, n; GLfloat *data; GLuint comps; - - ASSERT_OUTSIDE_BEGIN_END(ctx); + GLsizei numBytes; comps = _mesa_evaluator_components(target); if (!comps) { @@ -628,7 +595,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); - ASSERT(map1d || map2d); + assert(map1d || map2d); switch (query) { case GL_COEFF: @@ -641,6 +608,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;iOrder; } 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 +652,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 ); } -static void GLAPIENTRY -_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) +void GLAPIENTRY +_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) +{ + _mesa_GetnMapfvARB(target, query, INT_MAX, v); +} + + +void GLAPIENTRY +_mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; @@ -682,8 +677,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) GLuint i, n; GLfloat *data; GLuint comps; - - ASSERT_OUTSIDE_BEGIN_END(ctx); + GLsizei numBytes; comps = _mesa_evaluator_components(target); if (!comps) { @@ -693,7 +687,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); - ASSERT(map1d || map2d); + assert(map1d || map2d); switch (query) { case GL_COEFF: @@ -706,6 +700,9 @@ _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;iOrder; } else { + numBytes = 2 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = map2d->Uorder; v[1] = map2d->Vorder; } break; case GL_DOMAIN: if (map1d) { + numBytes = 2 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = IROUND(map1d->u1); v[1] = IROUND(map1d->u2); } else { + numBytes = 4 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = IROUND(map2d->u1); v[1] = IROUND(map2d->u2); v[2] = IROUND(map2d->v1); @@ -735,15 +744,26 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) 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 ); } +void GLAPIENTRY +_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) +{ + _mesa_GetnMapivARB(target, query, INT_MAX, v); +} -static void GLAPIENTRY + +void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (un<1) { _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" ); @@ -757,19 +777,18 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) } -static void GLAPIENTRY +void GLAPIENTRY _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 ); } -static void GLAPIENTRY +void GLAPIENTRY _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (un<1) { _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" ); @@ -792,7 +811,7 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, } -static void GLAPIENTRY +void GLAPIENTRY _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { @@ -811,32 +830,9 @@ _mesa_install_eval_vtxfmt(struct _glapi_table *disp, 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 *****/ /**********************************************************************/ @@ -850,7 +846,7 @@ 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)); + map->Points = malloc(n * sizeof(GLfloat)); if (map->Points) { GLint i; for (i=0;iu2 = 1.0; map->v1 = 0.0; map->v2 = 1.0; - map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); + map->Points = malloc(n * sizeof(GLfloat)); if (map->Points) { GLint i; for (i=0;iEval.Map1Color4 = GL_FALSE; ctx->Eval.Map1Index = GL_FALSE; @@ -894,7 +888,6 @@ 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)); ctx->Eval.Map2Color4 = GL_FALSE; ctx->Eval.Map2Index = GL_FALSE; ctx->Eval.Map2Normal = GL_FALSE; @@ -904,7 +897,6 @@ 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)); ctx->Eval.AutoNormal = GL_FALSE; ctx->Eval.MapGrid1un = 1; ctx->Eval.MapGrid1u1 = 0.0; @@ -923,7 +915,6 @@ void _mesa_init_eval( GLcontext *ctx ) 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 ); @@ -934,8 +925,6 @@ void _mesa_init_eval( GLcontext *ctx ) 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 ); @@ -946,56 +935,30 @@ void _mesa_init_eval( GLcontext *ctx ) 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( GLcontext *ctx ) +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)); + free(ctx->EvalMap.Map1Vertex3.Points); + free(ctx->EvalMap.Map1Vertex4.Points); + free(ctx->EvalMap.Map1Index.Points); + free(ctx->EvalMap.Map1Color4.Points); + free(ctx->EvalMap.Map1Normal.Points); + free(ctx->EvalMap.Map1Texture1.Points); + free(ctx->EvalMap.Map1Texture2.Points); + free(ctx->EvalMap.Map1Texture3.Points); + free(ctx->EvalMap.Map1Texture4.Points); + + free(ctx->EvalMap.Map2Vertex3.Points); + free(ctx->EvalMap.Map2Vertex4.Points); + free(ctx->EvalMap.Map2Index.Points); + free(ctx->EvalMap.Map2Color4.Points); + free(ctx->EvalMap.Map2Normal.Points); + free(ctx->EvalMap.Map2Texture1.Points); + free(ctx->EvalMap.Map2Texture2.Points); + free(ctx->EvalMap.Map2Texture3.Points); + free(ctx->EvalMap.Map2Texture4.Points); }