-/* $Id: eval.c,v 1.16 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: eval.c,v 1.23 2002/01/05 21:58:42 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
case GL_MAP2_TEXTURE_COORD_2: return 2;
case GL_MAP2_TEXTURE_COORD_3: return 3;
case GL_MAP2_TEXTURE_COORD_4: return 4;
- default: return 0;
+ 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;
+}
+
+
+/*
+ * Return pointer to the gl_1d_map struct for the named target.
+ */
+static struct gl_1d_map *
+get_1d_map( GLcontext *ctx, GLenum target )
+{
+ switch (target) {
+ case GL_MAP1_VERTEX_3:
+ return &ctx->EvalMap.Map1Vertex3;
+ case GL_MAP1_VERTEX_4:
+ return &ctx->EvalMap.Map1Vertex4;
+ case GL_MAP1_INDEX:
+ return &ctx->EvalMap.Map1Index;
+ case GL_MAP1_COLOR_4:
+ return &ctx->EvalMap.Map1Color4;
+ case GL_MAP1_NORMAL:
+ return &ctx->EvalMap.Map1Normal;
+ case GL_MAP1_TEXTURE_COORD_1:
+ return &ctx->EvalMap.Map1Texture1;
+ case GL_MAP1_TEXTURE_COORD_2:
+ return &ctx->EvalMap.Map1Texture2;
+ case GL_MAP1_TEXTURE_COORD_3:
+ 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;
+ }
+}
+
+
+/*
+ * Return pointer to the gl_2d_map struct for the named target.
+ */
+static struct gl_2d_map *
+get_2d_map( GLcontext *ctx, GLenum target )
+{
+ switch (target) {
+ case GL_MAP2_VERTEX_3:
+ return &ctx->EvalMap.Map2Vertex3;
+ case GL_MAP2_VERTEX_4:
+ return &ctx->EvalMap.Map2Vertex4;
+ case GL_MAP2_INDEX:
+ return &ctx->EvalMap.Map2Index;
+ case GL_MAP2_COLOR_4:
+ return &ctx->EvalMap.Map2Color4;
+ case GL_MAP2_NORMAL:
+ return &ctx->EvalMap.Map2Normal;
+ case GL_MAP2_TEXTURE_COORD_1:
+ return &ctx->EvalMap.Map2Texture1;
+ case GL_MAP2_TEXTURE_COORD_2:
+ return &ctx->EvalMap.Map2Texture2;
+ case GL_MAP2_TEXTURE_COORD_3:
+ 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;
}
}
* Return: pointer to buffer of contiguous control points or NULL if out
* of memory.
*/
-GLfloat *gl_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
- const GLfloat *points )
+GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
+ const GLfloat *points )
{
GLfloat *buffer, *p;
GLint i, k, size = _mesa_evaluator_components(target);
- if (!points || size==0) {
+ if (!points || !size)
return NULL;
- }
buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
- if(buffer)
- for(i=0, p=buffer; i<uorder; i++, points+=ustride)
- for(k=0; k<size; k++)
+ if (buffer)
+ for (i = 0, p = buffer; i < uorder; i++, points += ustride)
+ for (k = 0; k < size; k++)
*p++ = points[k];
return buffer;
/*
* Same as above but convert doubles to floats.
*/
-GLfloat *gl_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
- const GLdouble *points )
+GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
+ const GLdouble *points )
{
GLfloat *buffer, *p;
GLint i, k, size = _mesa_evaluator_components(target);
- if (!points || size==0) {
+ if (!points || !size)
return NULL;
- }
buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
- if(buffer)
- for(i=0, p=buffer; i<uorder; i++, points+=ustride)
- for(k=0; k<size; k++)
+ if (buffer)
+ for (i = 0, p = buffer; i < uorder; i++, points += ustride)
+ for (k = 0; k < size; k++)
*p++ = (GLfloat) points[k];
return buffer;
* Return: pointer to buffer of contiguous control points or NULL if out
* of memory.
*/
-GLfloat *gl_copy_map_points2f( GLenum target,
- GLint ustride, GLint uorder,
- GLint vstride, GLint vorder,
- const GLfloat *points )
+GLfloat *_mesa_copy_map_points2f( GLenum target,
+ GLint ustride, GLint uorder,
+ GLint vstride, GLint vorder,
+ const GLfloat *points )
{
GLfloat *buffer, *p;
GLint i, j, k, size, dsize, hsize;
/*
* Same as above but convert doubles to floats.
*/
-GLfloat *gl_copy_map_points2d(GLenum target,
- GLint ustride, GLint uorder,
- GLint vstride, GLint vorder,
- const GLdouble *points )
+GLfloat *_mesa_copy_map_points2d(GLenum target,
+ GLint ustride, GLint uorder,
+ GLint vstride, GLint vorder,
+ const GLdouble *points )
{
GLfloat *buffer, *p;
GLint i, j, k, size, hsize, dsize;
}
-#if 00
-/*
- * This function is called by the display list deallocator function to
- * specify that a given set of control points are no longer needed.
- */
-void gl_free_control_points( GLcontext* ctx, GLenum target, GLfloat *data )
-{
- struct gl_1d_map *map1 = NULL;
- struct gl_2d_map *map2 = NULL;
-
- switch (target) {
- case GL_MAP1_VERTEX_3:
- map1 = &ctx->EvalMap.Map1Vertex3;
- break;
- case GL_MAP1_VERTEX_4:
- map1 = &ctx->EvalMap.Map1Vertex4;
- break;
- case GL_MAP1_INDEX:
- map1 = &ctx->EvalMap.Map1Index;
- break;
- case GL_MAP1_COLOR_4:
- map1 = &ctx->EvalMap.Map1Color4;
- break;
- case GL_MAP1_NORMAL:
- map1 = &ctx->EvalMap.Map1Normal;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- map1 = &ctx->EvalMap.Map1Texture1;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- map1 = &ctx->EvalMap.Map1Texture2;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- map1 = &ctx->EvalMap.Map1Texture3;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- map1 = &ctx->EvalMap.Map1Texture4;
- break;
- case GL_MAP2_VERTEX_3:
- map2 = &ctx->EvalMap.Map2Vertex3;
- break;
- case GL_MAP2_VERTEX_4:
- map2 = &ctx->EvalMap.Map2Vertex4;
- break;
- case GL_MAP2_INDEX:
- map2 = &ctx->EvalMap.Map2Index;
- break;
- case GL_MAP2_COLOR_4:
- map2 = &ctx->EvalMap.Map2Color4;
- break;
- case GL_MAP2_NORMAL:
- map2 = &ctx->EvalMap.Map2Normal;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- map2 = &ctx->EvalMap.Map2Texture1;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- map2 = &ctx->EvalMap.Map2Texture2;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- map2 = &ctx->EvalMap.Map2Texture3;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- map2 = &ctx->EvalMap.Map2Texture4;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "gl_free_control_points" );
- return;
- }
-
- if (map1) {
- if (data==map1->Points) {
- /* The control points in the display list are currently */
- /* being used so we can mark them as discard-able. */
- map1->Retain = GL_FALSE;
- }
- else {
- /* The control points in the display list are not currently */
- /* being used. */
- FREE( data );
- }
- }
- if (map2) {
- if (data==map2->Points) {
- /* The control points in the display list are currently */
- /* being used so we can mark them as discard-able. */
- map2->Retain = GL_FALSE;
- }
- else {
- /* The control points in the display list are not currently */
- /* being used. */
- FREE( data );
- }
- }
-
-}
-#endif
-
/**********************************************************************/
GET_CURRENT_CONTEXT(ctx);
GLint k;
GLfloat *pnts;
+ struct gl_1d_map *map = NULL;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap1");
-
- assert(type == GL_FLOAT || type == GL_DOUBLE);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
if (u1 == u2) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" );
return;
}
if (uorder < 1 || uorder > MAX_EVAL_ORDER) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap1(order)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(order)" );
return;
}
if (!points) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap1(points)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(points)" );
return;
}
k = _mesa_evaluator_components( target );
if (k == 0) {
- gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
}
if (ustride < k) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" );
+ return;
+ }
+
+ if (ctx->Texture.CurrentUnit != 0) {
+ /* See OpenGL 1.2.1 spec, section F.2.13 */
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" );
+ return;
+ }
+
+ map = get_1d_map(ctx, target);
+ if (!map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
return;
}
/* make copy of the control points */
if (type == GL_FLOAT)
- pnts = gl_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
+ pnts = _mesa_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
else
- pnts = gl_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
+ pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
- switch (target) {
- case GL_MAP1_VERTEX_3:
- ctx->EvalMap.Map1Vertex3.Order = uorder;
- ctx->EvalMap.Map1Vertex3.u1 = u1;
- ctx->EvalMap.Map1Vertex3.u2 = u2;
- ctx->EvalMap.Map1Vertex3.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Vertex3.Points)
- FREE( ctx->EvalMap.Map1Vertex3.Points );
- ctx->EvalMap.Map1Vertex3.Points = pnts;
- break;
- case GL_MAP1_VERTEX_4:
- ctx->EvalMap.Map1Vertex4.Order = uorder;
- ctx->EvalMap.Map1Vertex4.u1 = u1;
- ctx->EvalMap.Map1Vertex4.u2 = u2;
- ctx->EvalMap.Map1Vertex4.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Vertex4.Points)
- FREE( ctx->EvalMap.Map1Vertex4.Points );
- ctx->EvalMap.Map1Vertex4.Points = pnts;
- break;
- case GL_MAP1_INDEX:
- ctx->EvalMap.Map1Index.Order = uorder;
- ctx->EvalMap.Map1Index.u1 = u1;
- ctx->EvalMap.Map1Index.u2 = u2;
- ctx->EvalMap.Map1Index.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Index.Points)
- FREE( ctx->EvalMap.Map1Index.Points );
- ctx->EvalMap.Map1Index.Points = pnts;
- break;
- case GL_MAP1_COLOR_4:
- ctx->EvalMap.Map1Color4.Order = uorder;
- ctx->EvalMap.Map1Color4.u1 = u1;
- ctx->EvalMap.Map1Color4.u2 = u2;
- ctx->EvalMap.Map1Color4.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Color4.Points)
- FREE( ctx->EvalMap.Map1Color4.Points );
- ctx->EvalMap.Map1Color4.Points = pnts;
- break;
- case GL_MAP1_NORMAL:
- ctx->EvalMap.Map1Normal.Order = uorder;
- ctx->EvalMap.Map1Normal.u1 = u1;
- ctx->EvalMap.Map1Normal.u2 = u2;
- ctx->EvalMap.Map1Normal.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Normal.Points)
- FREE( ctx->EvalMap.Map1Normal.Points );
- ctx->EvalMap.Map1Normal.Points = pnts;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- ctx->EvalMap.Map1Texture1.Order = uorder;
- ctx->EvalMap.Map1Texture1.u1 = u1;
- ctx->EvalMap.Map1Texture1.u2 = u2;
- ctx->EvalMap.Map1Texture1.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Texture1.Points)
- FREE( ctx->EvalMap.Map1Texture1.Points );
- ctx->EvalMap.Map1Texture1.Points = pnts;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- ctx->EvalMap.Map1Texture2.Order = uorder;
- ctx->EvalMap.Map1Texture2.u1 = u1;
- ctx->EvalMap.Map1Texture2.u2 = u2;
- ctx->EvalMap.Map1Texture2.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Texture2.Points)
- FREE( ctx->EvalMap.Map1Texture2.Points );
- ctx->EvalMap.Map1Texture2.Points = pnts;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- ctx->EvalMap.Map1Texture3.Order = uorder;
- ctx->EvalMap.Map1Texture3.u1 = u1;
- ctx->EvalMap.Map1Texture3.u2 = u2;
- ctx->EvalMap.Map1Texture3.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Texture3.Points)
- FREE( ctx->EvalMap.Map1Texture3.Points );
- ctx->EvalMap.Map1Texture3.Points = pnts;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- ctx->EvalMap.Map1Texture4.Order = uorder;
- ctx->EvalMap.Map1Texture4.u1 = u1;
- ctx->EvalMap.Map1Texture4.u2 = u2;
- ctx->EvalMap.Map1Texture4.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Texture4.Points)
- FREE( ctx->EvalMap.Map1Texture4.Points );
- ctx->EvalMap.Map1Texture4.Points = pnts;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
- }
- ctx->NewState |= _NEW_EVAL;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ map->Order = uorder;
+ map->u1 = u1;
+ map->u2 = u2;
+ map->du = 1.0F / (u2 - u1);
+ if (map->Points)
+ FREE( map->Points );
+ map->Points = pnts;
}
_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
GLint order, const GLdouble *points )
{
- map1(target, u1, u2, stride, order, points, GL_DOUBLE);
+ map1(target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE);
}
GET_CURRENT_CONTEXT(ctx);
GLint k;
GLfloat *pnts;
+ struct gl_2d_map *map = NULL;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap2");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
if (u1==u2) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
return;
}
if (v1==v2) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" );
return;
}
if (uorder<1 || uorder>MAX_EVAL_ORDER) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" );
return;
}
if (vorder<1 || vorder>MAX_EVAL_ORDER) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" );
return;
}
k = _mesa_evaluator_components( target );
if (k==0) {
- gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
}
if (ustride < k) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" );
return;
}
if (vstride < k) {
- gl_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" );
+ return;
+ }
+
+ if (ctx->Texture.CurrentUnit != 0) {
+ /* See OpenGL 1.2.1 spec, section F.2.13 */
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" );
+ return;
+ }
+
+ map = get_2d_map(ctx, target);
+ if (!map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
return;
}
/* make copy of the control points */
if (type == GL_FLOAT)
- pnts = gl_copy_map_points2f(target, ustride, uorder,
+ pnts = _mesa_copy_map_points2f(target, ustride, uorder,
vstride, vorder, (GLfloat*) points);
else
- pnts = gl_copy_map_points2d(target, ustride, uorder,
+ pnts = _mesa_copy_map_points2d(target, ustride, uorder,
vstride, vorder, (GLdouble*) points);
- switch (target) {
- case GL_MAP2_VERTEX_3:
- ctx->EvalMap.Map2Vertex3.Uorder = uorder;
- ctx->EvalMap.Map2Vertex3.u1 = u1;
- ctx->EvalMap.Map2Vertex3.u2 = u2;
- ctx->EvalMap.Map2Vertex3.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Vertex3.Vorder = vorder;
- ctx->EvalMap.Map2Vertex3.v1 = v1;
- ctx->EvalMap.Map2Vertex3.v2 = v2;
- ctx->EvalMap.Map2Vertex3.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Vertex3.Points)
- FREE( ctx->EvalMap.Map2Vertex3.Points );
- ctx->EvalMap.Map2Vertex3.Points = pnts;
- break;
- case GL_MAP2_VERTEX_4:
- ctx->EvalMap.Map2Vertex4.Uorder = uorder;
- ctx->EvalMap.Map2Vertex4.u1 = u1;
- ctx->EvalMap.Map2Vertex4.u2 = u2;
- ctx->EvalMap.Map2Vertex4.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Vertex4.Vorder = vorder;
- ctx->EvalMap.Map2Vertex4.v1 = v1;
- ctx->EvalMap.Map2Vertex4.v2 = v2;
- ctx->EvalMap.Map2Vertex4.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Vertex4.Points)
- FREE( ctx->EvalMap.Map2Vertex4.Points );
- ctx->EvalMap.Map2Vertex4.Points = pnts;
- break;
- case GL_MAP2_INDEX:
- ctx->EvalMap.Map2Index.Uorder = uorder;
- ctx->EvalMap.Map2Index.u1 = u1;
- ctx->EvalMap.Map2Index.u2 = u2;
- ctx->EvalMap.Map2Index.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Index.Vorder = vorder;
- ctx->EvalMap.Map2Index.v1 = v1;
- ctx->EvalMap.Map2Index.v2 = v2;
- ctx->EvalMap.Map2Index.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Index.Points)
- FREE( ctx->EvalMap.Map2Index.Points );
- ctx->EvalMap.Map2Index.Points = pnts;
- break;
- case GL_MAP2_COLOR_4:
- ctx->EvalMap.Map2Color4.Uorder = uorder;
- ctx->EvalMap.Map2Color4.u1 = u1;
- ctx->EvalMap.Map2Color4.u2 = u2;
- ctx->EvalMap.Map2Color4.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Color4.Vorder = vorder;
- ctx->EvalMap.Map2Color4.v1 = v1;
- ctx->EvalMap.Map2Color4.v2 = v2;
- ctx->EvalMap.Map2Color4.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Color4.Points)
- FREE( ctx->EvalMap.Map2Color4.Points );
- ctx->EvalMap.Map2Color4.Points = pnts;
- break;
- case GL_MAP2_NORMAL:
- ctx->EvalMap.Map2Normal.Uorder = uorder;
- ctx->EvalMap.Map2Normal.u1 = u1;
- ctx->EvalMap.Map2Normal.u2 = u2;
- ctx->EvalMap.Map2Normal.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Normal.Vorder = vorder;
- ctx->EvalMap.Map2Normal.v1 = v1;
- ctx->EvalMap.Map2Normal.v2 = v2;
- ctx->EvalMap.Map2Normal.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Normal.Points)
- FREE( ctx->EvalMap.Map2Normal.Points );
- ctx->EvalMap.Map2Normal.Points = pnts;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- ctx->EvalMap.Map2Texture1.Uorder = uorder;
- ctx->EvalMap.Map2Texture1.u1 = u1;
- ctx->EvalMap.Map2Texture1.u2 = u2;
- ctx->EvalMap.Map2Texture1.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Texture1.Vorder = vorder;
- ctx->EvalMap.Map2Texture1.v1 = v1;
- ctx->EvalMap.Map2Texture1.v2 = v2;
- ctx->EvalMap.Map2Texture1.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Texture1.Points)
- FREE( ctx->EvalMap.Map2Texture1.Points );
- ctx->EvalMap.Map2Texture1.Points = pnts;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- ctx->EvalMap.Map2Texture2.Uorder = uorder;
- ctx->EvalMap.Map2Texture2.u1 = u1;
- ctx->EvalMap.Map2Texture2.u2 = u2;
- ctx->EvalMap.Map2Texture2.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Texture2.Vorder = vorder;
- ctx->EvalMap.Map2Texture2.v1 = v1;
- ctx->EvalMap.Map2Texture2.v2 = v2;
- ctx->EvalMap.Map2Texture2.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Texture2.Points)
- FREE( ctx->EvalMap.Map2Texture2.Points );
- ctx->EvalMap.Map2Texture2.Points = pnts;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- ctx->EvalMap.Map2Texture3.Uorder = uorder;
- ctx->EvalMap.Map2Texture3.u1 = u1;
- ctx->EvalMap.Map2Texture3.u2 = u2;
- ctx->EvalMap.Map2Texture3.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Texture3.Vorder = vorder;
- ctx->EvalMap.Map2Texture3.v1 = v1;
- ctx->EvalMap.Map2Texture3.v2 = v2;
- ctx->EvalMap.Map2Texture3.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Texture3.Points)
- FREE( ctx->EvalMap.Map2Texture3.Points );
- ctx->EvalMap.Map2Texture3.Points = pnts;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- ctx->EvalMap.Map2Texture4.Uorder = uorder;
- ctx->EvalMap.Map2Texture4.u1 = u1;
- ctx->EvalMap.Map2Texture4.u2 = u2;
- ctx->EvalMap.Map2Texture4.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Texture4.Vorder = vorder;
- ctx->EvalMap.Map2Texture4.v1 = v1;
- ctx->EvalMap.Map2Texture4.v2 = v2;
- ctx->EvalMap.Map2Texture4.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Texture4.Points)
- FREE( ctx->EvalMap.Map2Texture4.Points );
- ctx->EvalMap.Map2Texture4.Points = pnts;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
- }
- ctx->NewState |= _NEW_EVAL;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ map->Uorder = uorder;
+ map->u1 = u1;
+ map->u2 = u2;
+ map->du = 1.0F / (u2 - u1);
+ map->Vorder = vorder;
+ map->v1 = v1;
+ map->v2 = v2;
+ map->dv = 1.0F / (v2 - v1);
+ if (map->Points)
+ FREE( map->Points );
+ map->Points = pnts;
}
GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
const GLdouble *points )
{
- map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
- points, GL_DOUBLE);
+ map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder,
+ (GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE);
}
_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
{
GET_CURRENT_CONTEXT(ctx);
+ struct gl_1d_map *map1d;
+ struct gl_2d_map *map2d;
GLint i, n;
GLfloat *data;
+ GLuint comps;
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ comps = _mesa_evaluator_components(target);
+ if (!comps) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
+ return;
+ }
+
+ map1d = get_1d_map(ctx, target);
+ map2d = get_2d_map(ctx, target);
+ ASSERT(map1d || map2d);
switch (query) {
case GL_COEFF:
- switch (target) {
- case GL_MAP1_COLOR_4:
- data = ctx->EvalMap.Map1Color4.Points;
- n = ctx->EvalMap.Map1Color4.Order * 4;
- break;
- case GL_MAP1_INDEX:
- data = ctx->EvalMap.Map1Index.Points;
- n = ctx->EvalMap.Map1Index.Order;
- break;
- case GL_MAP1_NORMAL:
- data = ctx->EvalMap.Map1Normal.Points;
- n = ctx->EvalMap.Map1Normal.Order * 3;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- data = ctx->EvalMap.Map1Texture1.Points;
- n = ctx->EvalMap.Map1Texture1.Order * 1;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- data = ctx->EvalMap.Map1Texture2.Points;
- n = ctx->EvalMap.Map1Texture2.Order * 2;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- data = ctx->EvalMap.Map1Texture3.Points;
- n = ctx->EvalMap.Map1Texture3.Order * 3;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- data = ctx->EvalMap.Map1Texture4.Points;
- n = ctx->EvalMap.Map1Texture4.Order * 4;
- break;
- case GL_MAP1_VERTEX_3:
- data = ctx->EvalMap.Map1Vertex3.Points;
- n = ctx->EvalMap.Map1Vertex3.Order * 3;
- break;
- case GL_MAP1_VERTEX_4:
- data = ctx->EvalMap.Map1Vertex4.Points;
- n = ctx->EvalMap.Map1Vertex4.Order * 4;
- break;
- case GL_MAP2_COLOR_4:
- data = ctx->EvalMap.Map2Color4.Points;
- n = ctx->EvalMap.Map2Color4.Uorder
- * ctx->EvalMap.Map2Color4.Vorder * 4;
- break;
- case GL_MAP2_INDEX:
- data = ctx->EvalMap.Map2Index.Points;
- n = ctx->EvalMap.Map2Index.Uorder
- * ctx->EvalMap.Map2Index.Vorder;
- break;
- case GL_MAP2_NORMAL:
- data = ctx->EvalMap.Map2Normal.Points;
- n = ctx->EvalMap.Map2Normal.Uorder
- * ctx->EvalMap.Map2Normal.Vorder * 3;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- data = ctx->EvalMap.Map2Texture1.Points;
- n = ctx->EvalMap.Map2Texture1.Uorder
- * ctx->EvalMap.Map2Texture1.Vorder * 1;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- data = ctx->EvalMap.Map2Texture2.Points;
- n = ctx->EvalMap.Map2Texture2.Uorder
- * ctx->EvalMap.Map2Texture2.Vorder * 2;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- data = ctx->EvalMap.Map2Texture3.Points;
- n = ctx->EvalMap.Map2Texture3.Uorder
- * ctx->EvalMap.Map2Texture3.Vorder * 3;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- data = ctx->EvalMap.Map2Texture4.Points;
- n = ctx->EvalMap.Map2Texture4.Uorder
- * ctx->EvalMap.Map2Texture4.Vorder * 4;
- break;
- case GL_MAP2_VERTEX_3:
- data = ctx->EvalMap.Map2Vertex3.Points;
- n = ctx->EvalMap.Map2Vertex3.Uorder
- * ctx->EvalMap.Map2Vertex3.Vorder * 3;
- break;
- case GL_MAP2_VERTEX_4:
- data = ctx->EvalMap.Map2Vertex4.Points;
- n = ctx->EvalMap.Map2Vertex4.Uorder
- * ctx->EvalMap.Map2Vertex4.Vorder * 4;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
- return;
- }
+ if (map1d) {
+ data = map1d->Points;
+ n = map1d->Order * comps;
+ }
+ else {
+ data = map2d->Points;
+ n = map2d->Uorder * map2d->Vorder * comps;
+ }
if (data) {
for (i=0;i<n;i++) {
v[i] = data[i];
}
break;
case GL_ORDER:
- switch (target) {
- case GL_MAP1_COLOR_4:
- *v = ctx->EvalMap.Map1Color4.Order;
- break;
- case GL_MAP1_INDEX:
- *v = ctx->EvalMap.Map1Index.Order;
- break;
- case GL_MAP1_NORMAL:
- *v = ctx->EvalMap.Map1Normal.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- *v = ctx->EvalMap.Map1Texture1.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- *v = ctx->EvalMap.Map1Texture2.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- *v = ctx->EvalMap.Map1Texture3.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- *v = ctx->EvalMap.Map1Texture4.Order;
- break;
- case GL_MAP1_VERTEX_3:
- *v = ctx->EvalMap.Map1Vertex3.Order;
- break;
- case GL_MAP1_VERTEX_4:
- *v = ctx->EvalMap.Map1Vertex4.Order;
- break;
- case GL_MAP2_COLOR_4:
- v[0] = ctx->EvalMap.Map2Color4.Uorder;
- v[1] = ctx->EvalMap.Map2Color4.Vorder;
- break;
- case GL_MAP2_INDEX:
- v[0] = ctx->EvalMap.Map2Index.Uorder;
- v[1] = ctx->EvalMap.Map2Index.Vorder;
- break;
- case GL_MAP2_NORMAL:
- v[0] = ctx->EvalMap.Map2Normal.Uorder;
- v[1] = ctx->EvalMap.Map2Normal.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- v[0] = ctx->EvalMap.Map2Texture1.Uorder;
- v[1] = ctx->EvalMap.Map2Texture1.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- v[0] = ctx->EvalMap.Map2Texture2.Uorder;
- v[1] = ctx->EvalMap.Map2Texture2.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- v[0] = ctx->EvalMap.Map2Texture3.Uorder;
- v[1] = ctx->EvalMap.Map2Texture3.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- v[0] = ctx->EvalMap.Map2Texture4.Uorder;
- v[1] = ctx->EvalMap.Map2Texture4.Vorder;
- break;
- case GL_MAP2_VERTEX_3:
- v[0] = ctx->EvalMap.Map2Vertex3.Uorder;
- v[1] = ctx->EvalMap.Map2Vertex3.Vorder;
- break;
- case GL_MAP2_VERTEX_4:
- v[0] = ctx->EvalMap.Map2Vertex4.Uorder;
- v[1] = ctx->EvalMap.Map2Vertex4.Vorder;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
- return;
- }
+ if (map1d) {
+ v[0] = (GLdouble) map1d->Order;
+ }
+ else {
+ v[0] = (GLdouble) map2d->Uorder;
+ v[1] = (GLdouble) map2d->Vorder;
+ }
break;
case GL_DOMAIN:
- switch (target) {
- case GL_MAP1_COLOR_4:
- v[0] = ctx->EvalMap.Map1Color4.u1;
- v[1] = ctx->EvalMap.Map1Color4.u2;
- break;
- case GL_MAP1_INDEX:
- v[0] = ctx->EvalMap.Map1Index.u1;
- v[1] = ctx->EvalMap.Map1Index.u2;
- break;
- case GL_MAP1_NORMAL:
- v[0] = ctx->EvalMap.Map1Normal.u1;
- v[1] = ctx->EvalMap.Map1Normal.u2;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- v[0] = ctx->EvalMap.Map1Texture1.u1;
- v[1] = ctx->EvalMap.Map1Texture1.u2;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- v[0] = ctx->EvalMap.Map1Texture2.u1;
- v[1] = ctx->EvalMap.Map1Texture2.u2;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- v[0] = ctx->EvalMap.Map1Texture3.u1;
- v[1] = ctx->EvalMap.Map1Texture3.u2;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- v[0] = ctx->EvalMap.Map1Texture4.u1;
- v[1] = ctx->EvalMap.Map1Texture4.u2;
- break;
- case GL_MAP1_VERTEX_3:
- v[0] = ctx->EvalMap.Map1Vertex3.u1;
- v[1] = ctx->EvalMap.Map1Vertex3.u2;
- break;
- case GL_MAP1_VERTEX_4:
- v[0] = ctx->EvalMap.Map1Vertex4.u1;
- v[1] = ctx->EvalMap.Map1Vertex4.u2;
- break;
- case GL_MAP2_COLOR_4:
- v[0] = ctx->EvalMap.Map2Color4.u1;
- v[1] = ctx->EvalMap.Map2Color4.u2;
- v[2] = ctx->EvalMap.Map2Color4.v1;
- v[3] = ctx->EvalMap.Map2Color4.v2;
- break;
- case GL_MAP2_INDEX:
- v[0] = ctx->EvalMap.Map2Index.u1;
- v[1] = ctx->EvalMap.Map2Index.u2;
- v[2] = ctx->EvalMap.Map2Index.v1;
- v[3] = ctx->EvalMap.Map2Index.v2;
- break;
- case GL_MAP2_NORMAL:
- v[0] = ctx->EvalMap.Map2Normal.u1;
- v[1] = ctx->EvalMap.Map2Normal.u2;
- v[2] = ctx->EvalMap.Map2Normal.v1;
- v[3] = ctx->EvalMap.Map2Normal.v2;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- v[0] = ctx->EvalMap.Map2Texture1.u1;
- v[1] = ctx->EvalMap.Map2Texture1.u2;
- v[2] = ctx->EvalMap.Map2Texture1.v1;
- v[3] = ctx->EvalMap.Map2Texture1.v2;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- v[0] = ctx->EvalMap.Map2Texture2.u1;
- v[1] = ctx->EvalMap.Map2Texture2.u2;
- v[2] = ctx->EvalMap.Map2Texture2.v1;
- v[3] = ctx->EvalMap.Map2Texture2.v2;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- v[0] = ctx->EvalMap.Map2Texture3.u1;
- v[1] = ctx->EvalMap.Map2Texture3.u2;
- v[2] = ctx->EvalMap.Map2Texture3.v1;
- v[3] = ctx->EvalMap.Map2Texture3.v2;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- v[0] = ctx->EvalMap.Map2Texture4.u1;
- v[1] = ctx->EvalMap.Map2Texture4.u2;
- v[2] = ctx->EvalMap.Map2Texture4.v1;
- v[3] = ctx->EvalMap.Map2Texture4.v2;
- break;
- case GL_MAP2_VERTEX_3:
- v[0] = ctx->EvalMap.Map2Vertex3.u1;
- v[1] = ctx->EvalMap.Map2Vertex3.u2;
- v[2] = ctx->EvalMap.Map2Vertex3.v1;
- v[3] = ctx->EvalMap.Map2Vertex3.v2;
- break;
- case GL_MAP2_VERTEX_4:
- v[0] = ctx->EvalMap.Map2Vertex4.u1;
- v[1] = ctx->EvalMap.Map2Vertex4.u2;
- v[2] = ctx->EvalMap.Map2Vertex4.v1;
- v[3] = ctx->EvalMap.Map2Vertex4.v2;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
- }
+ if (map1d) {
+ v[0] = (GLdouble) map1d->u1;
+ v[1] = (GLdouble) map1d->u2;
+ }
+ else {
+ v[0] = (GLdouble) map2d->u1;
+ v[1] = (GLdouble) map2d->u2;
+ v[2] = (GLdouble) map2d->v1;
+ v[3] = (GLdouble) map2d->v2;
+ }
break;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" );
}
}
_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
+ struct gl_1d_map *map1d;
+ struct gl_2d_map *map2d;
GLint i, n;
GLfloat *data;
+ GLuint comps;
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ comps = _mesa_evaluator_components(target);
+ if (!comps) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
+ return;
+ }
+
+ map1d = get_1d_map(ctx, target);
+ map2d = get_2d_map(ctx, target);
+ ASSERT(map1d || map2d);
switch (query) {
case GL_COEFF:
- switch (target) {
- case GL_MAP1_COLOR_4:
- data = ctx->EvalMap.Map1Color4.Points;
- n = ctx->EvalMap.Map1Color4.Order * 4;
- break;
- case GL_MAP1_INDEX:
- data = ctx->EvalMap.Map1Index.Points;
- n = ctx->EvalMap.Map1Index.Order;
- break;
- case GL_MAP1_NORMAL:
- data = ctx->EvalMap.Map1Normal.Points;
- n = ctx->EvalMap.Map1Normal.Order * 3;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- data = ctx->EvalMap.Map1Texture1.Points;
- n = ctx->EvalMap.Map1Texture1.Order * 1;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- data = ctx->EvalMap.Map1Texture2.Points;
- n = ctx->EvalMap.Map1Texture2.Order * 2;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- data = ctx->EvalMap.Map1Texture3.Points;
- n = ctx->EvalMap.Map1Texture3.Order * 3;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- data = ctx->EvalMap.Map1Texture4.Points;
- n = ctx->EvalMap.Map1Texture4.Order * 4;
- break;
- case GL_MAP1_VERTEX_3:
- data = ctx->EvalMap.Map1Vertex3.Points;
- n = ctx->EvalMap.Map1Vertex3.Order * 3;
- break;
- case GL_MAP1_VERTEX_4:
- data = ctx->EvalMap.Map1Vertex4.Points;
- n = ctx->EvalMap.Map1Vertex4.Order * 4;
- break;
- case GL_MAP2_COLOR_4:
- data = ctx->EvalMap.Map2Color4.Points;
- n = ctx->EvalMap.Map2Color4.Uorder
- * ctx->EvalMap.Map2Color4.Vorder * 4;
- break;
- case GL_MAP2_INDEX:
- data = ctx->EvalMap.Map2Index.Points;
- n = ctx->EvalMap.Map2Index.Uorder
- * ctx->EvalMap.Map2Index.Vorder;
- break;
- case GL_MAP2_NORMAL:
- data = ctx->EvalMap.Map2Normal.Points;
- n = ctx->EvalMap.Map2Normal.Uorder
- * ctx->EvalMap.Map2Normal.Vorder * 3;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- data = ctx->EvalMap.Map2Texture1.Points;
- n = ctx->EvalMap.Map2Texture1.Uorder
- * ctx->EvalMap.Map2Texture1.Vorder * 1;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- data = ctx->EvalMap.Map2Texture2.Points;
- n = ctx->EvalMap.Map2Texture2.Uorder
- * ctx->EvalMap.Map2Texture2.Vorder * 2;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- data = ctx->EvalMap.Map2Texture3.Points;
- n = ctx->EvalMap.Map2Texture3.Uorder
- * ctx->EvalMap.Map2Texture3.Vorder * 3;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- data = ctx->EvalMap.Map2Texture4.Points;
- n = ctx->EvalMap.Map2Texture4.Uorder
- * ctx->EvalMap.Map2Texture4.Vorder * 4;
- break;
- case GL_MAP2_VERTEX_3:
- data = ctx->EvalMap.Map2Vertex3.Points;
- n = ctx->EvalMap.Map2Vertex3.Uorder
- * ctx->EvalMap.Map2Vertex3.Vorder * 3;
- break;
- case GL_MAP2_VERTEX_4:
- data = ctx->EvalMap.Map2Vertex4.Points;
- n = ctx->EvalMap.Map2Vertex4.Uorder
- * ctx->EvalMap.Map2Vertex4.Vorder * 4;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
- return;
- }
+ if (map1d) {
+ data = map1d->Points;
+ n = map1d->Order * comps;
+ }
+ else {
+ data = map2d->Points;
+ n = map2d->Uorder * map2d->Vorder * comps;
+ }
if (data) {
for (i=0;i<n;i++) {
v[i] = data[i];
}
break;
case GL_ORDER:
- switch (target) {
- case GL_MAP1_COLOR_4:
- *v = ctx->EvalMap.Map1Color4.Order;
- break;
- case GL_MAP1_INDEX:
- *v = ctx->EvalMap.Map1Index.Order;
- break;
- case GL_MAP1_NORMAL:
- *v = ctx->EvalMap.Map1Normal.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- *v = ctx->EvalMap.Map1Texture1.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- *v = ctx->EvalMap.Map1Texture2.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- *v = ctx->EvalMap.Map1Texture3.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- *v = ctx->EvalMap.Map1Texture4.Order;
- break;
- case GL_MAP1_VERTEX_3:
- *v = ctx->EvalMap.Map1Vertex3.Order;
- break;
- case GL_MAP1_VERTEX_4:
- *v = ctx->EvalMap.Map1Vertex4.Order;
- break;
- case GL_MAP2_COLOR_4:
- v[0] = ctx->EvalMap.Map2Color4.Uorder;
- v[1] = ctx->EvalMap.Map2Color4.Vorder;
- break;
- case GL_MAP2_INDEX:
- v[0] = ctx->EvalMap.Map2Index.Uorder;
- v[1] = ctx->EvalMap.Map2Index.Vorder;
- break;
- case GL_MAP2_NORMAL:
- v[0] = ctx->EvalMap.Map2Normal.Uorder;
- v[1] = ctx->EvalMap.Map2Normal.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- v[0] = ctx->EvalMap.Map2Texture1.Uorder;
- v[1] = ctx->EvalMap.Map2Texture1.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- v[0] = ctx->EvalMap.Map2Texture2.Uorder;
- v[1] = ctx->EvalMap.Map2Texture2.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- v[0] = ctx->EvalMap.Map2Texture3.Uorder;
- v[1] = ctx->EvalMap.Map2Texture3.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- v[0] = ctx->EvalMap.Map2Texture4.Uorder;
- v[1] = ctx->EvalMap.Map2Texture4.Vorder;
- break;
- case GL_MAP2_VERTEX_3:
- v[0] = ctx->EvalMap.Map2Vertex3.Uorder;
- v[1] = ctx->EvalMap.Map2Vertex3.Vorder;
- break;
- case GL_MAP2_VERTEX_4:
- v[0] = ctx->EvalMap.Map2Vertex4.Uorder;
- v[1] = ctx->EvalMap.Map2Vertex4.Vorder;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
- return;
- }
+ if (map1d) {
+ v[0] = (GLfloat) map1d->Order;
+ }
+ else {
+ v[0] = (GLfloat) map2d->Uorder;
+ v[1] = (GLfloat) map2d->Vorder;
+ }
break;
case GL_DOMAIN:
- switch (target) {
- case GL_MAP1_COLOR_4:
- v[0] = ctx->EvalMap.Map1Color4.u1;
- v[1] = ctx->EvalMap.Map1Color4.u2;
- break;
- case GL_MAP1_INDEX:
- v[0] = ctx->EvalMap.Map1Index.u1;
- v[1] = ctx->EvalMap.Map1Index.u2;
- break;
- case GL_MAP1_NORMAL:
- v[0] = ctx->EvalMap.Map1Normal.u1;
- v[1] = ctx->EvalMap.Map1Normal.u2;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- v[0] = ctx->EvalMap.Map1Texture1.u1;
- v[1] = ctx->EvalMap.Map1Texture1.u2;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- v[0] = ctx->EvalMap.Map1Texture2.u1;
- v[1] = ctx->EvalMap.Map1Texture2.u2;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- v[0] = ctx->EvalMap.Map1Texture3.u1;
- v[1] = ctx->EvalMap.Map1Texture3.u2;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- v[0] = ctx->EvalMap.Map1Texture4.u1;
- v[1] = ctx->EvalMap.Map1Texture4.u2;
- break;
- case GL_MAP1_VERTEX_3:
- v[0] = ctx->EvalMap.Map1Vertex3.u1;
- v[1] = ctx->EvalMap.Map1Vertex3.u2;
- break;
- case GL_MAP1_VERTEX_4:
- v[0] = ctx->EvalMap.Map1Vertex4.u1;
- v[1] = ctx->EvalMap.Map1Vertex4.u2;
- break;
- case GL_MAP2_COLOR_4:
- v[0] = ctx->EvalMap.Map2Color4.u1;
- v[1] = ctx->EvalMap.Map2Color4.u2;
- v[2] = ctx->EvalMap.Map2Color4.v1;
- v[3] = ctx->EvalMap.Map2Color4.v2;
- break;
- case GL_MAP2_INDEX:
- v[0] = ctx->EvalMap.Map2Index.u1;
- v[1] = ctx->EvalMap.Map2Index.u2;
- v[2] = ctx->EvalMap.Map2Index.v1;
- v[3] = ctx->EvalMap.Map2Index.v2;
- break;
- case GL_MAP2_NORMAL:
- v[0] = ctx->EvalMap.Map2Normal.u1;
- v[1] = ctx->EvalMap.Map2Normal.u2;
- v[2] = ctx->EvalMap.Map2Normal.v1;
- v[3] = ctx->EvalMap.Map2Normal.v2;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- v[0] = ctx->EvalMap.Map2Texture1.u1;
- v[1] = ctx->EvalMap.Map2Texture1.u2;
- v[2] = ctx->EvalMap.Map2Texture1.v1;
- v[3] = ctx->EvalMap.Map2Texture1.v2;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- v[0] = ctx->EvalMap.Map2Texture2.u1;
- v[1] = ctx->EvalMap.Map2Texture2.u2;
- v[2] = ctx->EvalMap.Map2Texture2.v1;
- v[3] = ctx->EvalMap.Map2Texture2.v2;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- v[0] = ctx->EvalMap.Map2Texture3.u1;
- v[1] = ctx->EvalMap.Map2Texture3.u2;
- v[2] = ctx->EvalMap.Map2Texture3.v1;
- v[3] = ctx->EvalMap.Map2Texture3.v2;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- v[0] = ctx->EvalMap.Map2Texture4.u1;
- v[1] = ctx->EvalMap.Map2Texture4.u2;
- v[2] = ctx->EvalMap.Map2Texture4.v1;
- v[3] = ctx->EvalMap.Map2Texture4.v2;
- break;
- case GL_MAP2_VERTEX_3:
- v[0] = ctx->EvalMap.Map2Vertex3.u1;
- v[1] = ctx->EvalMap.Map2Vertex3.u2;
- v[2] = ctx->EvalMap.Map2Vertex3.v1;
- v[3] = ctx->EvalMap.Map2Vertex3.v2;
- break;
- case GL_MAP2_VERTEX_4:
- v[0] = ctx->EvalMap.Map2Vertex4.u1;
- v[1] = ctx->EvalMap.Map2Vertex4.u2;
- v[2] = ctx->EvalMap.Map2Vertex4.v1;
- v[3] = ctx->EvalMap.Map2Vertex4.v2;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
- }
+ if (map1d) {
+ v[0] = map1d->u1;
+ v[1] = map1d->u2;
+ }
+ else {
+ v[0] = map2d->u1;
+ v[1] = map2d->u2;
+ v[2] = map2d->v1;
+ v[3] = map2d->v2;
+ }
break;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" );
}
}
_mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
{
GET_CURRENT_CONTEXT(ctx);
+ struct gl_1d_map *map1d;
+ struct gl_2d_map *map2d;
GLuint i, n;
GLfloat *data;
+ GLuint comps;
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ comps = _mesa_evaluator_components(target);
+ if (!comps) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
+ return;
+ }
+
+ map1d = get_1d_map(ctx, target);
+ map2d = get_2d_map(ctx, target);
+ ASSERT(map1d || map2d);
switch (query) {
case GL_COEFF:
- switch (target) {
- case GL_MAP1_COLOR_4:
- data = ctx->EvalMap.Map1Color4.Points;
- n = ctx->EvalMap.Map1Color4.Order * 4;
- break;
- case GL_MAP1_INDEX:
- data = ctx->EvalMap.Map1Index.Points;
- n = ctx->EvalMap.Map1Index.Order;
- break;
- case GL_MAP1_NORMAL:
- data = ctx->EvalMap.Map1Normal.Points;
- n = ctx->EvalMap.Map1Normal.Order * 3;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- data = ctx->EvalMap.Map1Texture1.Points;
- n = ctx->EvalMap.Map1Texture1.Order * 1;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- data = ctx->EvalMap.Map1Texture2.Points;
- n = ctx->EvalMap.Map1Texture2.Order * 2;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- data = ctx->EvalMap.Map1Texture3.Points;
- n = ctx->EvalMap.Map1Texture3.Order * 3;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- data = ctx->EvalMap.Map1Texture4.Points;
- n = ctx->EvalMap.Map1Texture4.Order * 4;
- break;
- case GL_MAP1_VERTEX_3:
- data = ctx->EvalMap.Map1Vertex3.Points;
- n = ctx->EvalMap.Map1Vertex3.Order * 3;
- break;
- case GL_MAP1_VERTEX_4:
- data = ctx->EvalMap.Map1Vertex4.Points;
- n = ctx->EvalMap.Map1Vertex4.Order * 4;
- break;
- case GL_MAP2_COLOR_4:
- data = ctx->EvalMap.Map2Color4.Points;
- n = ctx->EvalMap.Map2Color4.Uorder
- * ctx->EvalMap.Map2Color4.Vorder * 4;
- break;
- case GL_MAP2_INDEX:
- data = ctx->EvalMap.Map2Index.Points;
- n = ctx->EvalMap.Map2Index.Uorder
- * ctx->EvalMap.Map2Index.Vorder;
- break;
- case GL_MAP2_NORMAL:
- data = ctx->EvalMap.Map2Normal.Points;
- n = ctx->EvalMap.Map2Normal.Uorder
- * ctx->EvalMap.Map2Normal.Vorder * 3;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- data = ctx->EvalMap.Map2Texture1.Points;
- n = ctx->EvalMap.Map2Texture1.Uorder
- * ctx->EvalMap.Map2Texture1.Vorder * 1;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- data = ctx->EvalMap.Map2Texture2.Points;
- n = ctx->EvalMap.Map2Texture2.Uorder
- * ctx->EvalMap.Map2Texture2.Vorder * 2;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- data = ctx->EvalMap.Map2Texture3.Points;
- n = ctx->EvalMap.Map2Texture3.Uorder
- * ctx->EvalMap.Map2Texture3.Vorder * 3;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- data = ctx->EvalMap.Map2Texture4.Points;
- n = ctx->EvalMap.Map2Texture4.Uorder
- * ctx->EvalMap.Map2Texture4.Vorder * 4;
- break;
- case GL_MAP2_VERTEX_3:
- data = ctx->EvalMap.Map2Vertex3.Points;
- n = ctx->EvalMap.Map2Vertex3.Uorder
- * ctx->EvalMap.Map2Vertex3.Vorder * 3;
- break;
- case GL_MAP2_VERTEX_4:
- data = ctx->EvalMap.Map2Vertex4.Points;
- n = ctx->EvalMap.Map2Vertex4.Uorder
- * ctx->EvalMap.Map2Vertex4.Vorder * 4;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
- return;
- }
+ if (map1d) {
+ data = map1d->Points;
+ n = map1d->Order * comps;
+ }
+ else {
+ data = map2d->Points;
+ n = map2d->Uorder * map2d->Vorder * comps;
+ }
if (data) {
for (i=0;i<n;i++) {
v[i] = ROUNDF(data[i]);
}
break;
case GL_ORDER:
- switch (target) {
- case GL_MAP1_COLOR_4:
- *v = ctx->EvalMap.Map1Color4.Order;
- break;
- case GL_MAP1_INDEX:
- *v = ctx->EvalMap.Map1Index.Order;
- break;
- case GL_MAP1_NORMAL:
- *v = ctx->EvalMap.Map1Normal.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- *v = ctx->EvalMap.Map1Texture1.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- *v = ctx->EvalMap.Map1Texture2.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- *v = ctx->EvalMap.Map1Texture3.Order;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- *v = ctx->EvalMap.Map1Texture4.Order;
- break;
- case GL_MAP1_VERTEX_3:
- *v = ctx->EvalMap.Map1Vertex3.Order;
- break;
- case GL_MAP1_VERTEX_4:
- *v = ctx->EvalMap.Map1Vertex4.Order;
- break;
- case GL_MAP2_COLOR_4:
- v[0] = ctx->EvalMap.Map2Color4.Uorder;
- v[1] = ctx->EvalMap.Map2Color4.Vorder;
- break;
- case GL_MAP2_INDEX:
- v[0] = ctx->EvalMap.Map2Index.Uorder;
- v[1] = ctx->EvalMap.Map2Index.Vorder;
- break;
- case GL_MAP2_NORMAL:
- v[0] = ctx->EvalMap.Map2Normal.Uorder;
- v[1] = ctx->EvalMap.Map2Normal.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- v[0] = ctx->EvalMap.Map2Texture1.Uorder;
- v[1] = ctx->EvalMap.Map2Texture1.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- v[0] = ctx->EvalMap.Map2Texture2.Uorder;
- v[1] = ctx->EvalMap.Map2Texture2.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- v[0] = ctx->EvalMap.Map2Texture3.Uorder;
- v[1] = ctx->EvalMap.Map2Texture3.Vorder;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- v[0] = ctx->EvalMap.Map2Texture4.Uorder;
- v[1] = ctx->EvalMap.Map2Texture4.Vorder;
- break;
- case GL_MAP2_VERTEX_3:
- v[0] = ctx->EvalMap.Map2Vertex3.Uorder;
- v[1] = ctx->EvalMap.Map2Vertex3.Vorder;
- break;
- case GL_MAP2_VERTEX_4:
- v[0] = ctx->EvalMap.Map2Vertex4.Uorder;
- v[1] = ctx->EvalMap.Map2Vertex4.Vorder;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
- return;
- }
+ if (map1d) {
+ v[0] = map1d->Order;
+ }
+ else {
+ v[0] = map2d->Uorder;
+ v[1] = map2d->Vorder;
+ }
break;
case GL_DOMAIN:
- switch (target) {
- case GL_MAP1_COLOR_4:
- v[0] = ROUNDF(ctx->EvalMap.Map1Color4.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Color4.u2);
- break;
- case GL_MAP1_INDEX:
- v[0] = ROUNDF(ctx->EvalMap.Map1Index.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Index.u2);
- break;
- case GL_MAP1_NORMAL:
- v[0] = ROUNDF(ctx->EvalMap.Map1Normal.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Normal.u2);
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- v[0] = ROUNDF(ctx->EvalMap.Map1Texture1.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Texture1.u2);
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- v[0] = ROUNDF(ctx->EvalMap.Map1Texture2.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Texture2.u2);
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- v[0] = ROUNDF(ctx->EvalMap.Map1Texture3.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Texture3.u2);
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- v[0] = ROUNDF(ctx->EvalMap.Map1Texture4.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Texture4.u2);
- break;
- case GL_MAP1_VERTEX_3:
- v[0] = ROUNDF(ctx->EvalMap.Map1Vertex3.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Vertex3.u2);
- break;
- case GL_MAP1_VERTEX_4:
- v[0] = ROUNDF(ctx->EvalMap.Map1Vertex4.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map1Vertex4.u2);
- break;
- case GL_MAP2_COLOR_4:
- v[0] = ROUNDF(ctx->EvalMap.Map2Color4.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Color4.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Color4.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Color4.v2);
- break;
- case GL_MAP2_INDEX:
- v[0] = ROUNDF(ctx->EvalMap.Map2Index.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Index.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Index.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Index.v2);
- break;
- case GL_MAP2_NORMAL:
- v[0] = ROUNDF(ctx->EvalMap.Map2Normal.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Normal.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Normal.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Normal.v2);
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- v[0] = ROUNDF(ctx->EvalMap.Map2Texture1.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Texture1.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Texture1.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Texture1.v2);
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- v[0] = ROUNDF(ctx->EvalMap.Map2Texture2.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Texture2.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Texture2.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Texture2.v2);
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- v[0] = ROUNDF(ctx->EvalMap.Map2Texture3.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Texture3.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Texture3.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Texture3.v2);
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- v[0] = ROUNDF(ctx->EvalMap.Map2Texture4.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Texture4.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Texture4.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Texture4.v2);
- break;
- case GL_MAP2_VERTEX_3:
- v[0] = ROUNDF(ctx->EvalMap.Map2Vertex3.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Vertex3.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Vertex3.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Vertex3.v2);
- break;
- case GL_MAP2_VERTEX_4:
- v[0] = ROUNDF(ctx->EvalMap.Map2Vertex4.u1);
- v[1] = ROUNDF(ctx->EvalMap.Map2Vertex4.u2);
- v[2] = ROUNDF(ctx->EvalMap.Map2Vertex4.v1);
- v[3] = ROUNDF(ctx->EvalMap.Map2Vertex4.v2);
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
- }
+ if (map1d) {
+ v[0] = ROUNDF(map1d->u1);
+ v[1] = ROUNDF(map1d->u2);
+ }
+ else {
+ v[0] = ROUNDF(map2d->u1);
+ v[1] = ROUNDF(map2d->u2);
+ v[2] = ROUNDF(map2d->v1);
+ v[3] = ROUNDF(map2d->v2);
+ }
break;
default:
- gl_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" );
}
}
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid1f");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (un<1) {
- gl_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" );
return;
}
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.MapGrid1un = un;
ctx->Eval.MapGrid1u1 = u1;
ctx->Eval.MapGrid1u2 = u2;
ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un;
-
- ctx->NewState |= _NEW_EVAL;
}
void
_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
{
- _mesa_MapGrid1f( un, u1, u2 );
+ _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 );
}
GLint vn, GLfloat v1, GLfloat v2 )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid2f");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
if (un<1) {
- gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
return;
}
if (vn<1) {
- gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" );
return;
}
+
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.MapGrid2un = un;
ctx->Eval.MapGrid2u1 = u1;
ctx->Eval.MapGrid2u2 = u2;
ctx->Eval.MapGrid2v1 = v1;
ctx->Eval.MapGrid2v2 = v2;
ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn;
-
- ctx->NewState |= _NEW_EVAL;
}
_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
GLint vn, GLdouble v1, GLdouble v2 )
{
- _mesa_MapGrid2f( un, u1, u2, vn, v1, v2 );
+ _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2,
+ vn, (GLfloat) v1, (GLfloat) v2 );
}
-
-
-
-