aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl/t_imm_eval.c
blob: 419f449f0336d6c42dd39aa8e4a685d8e1c93267 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
/* $Id: t_imm_eval.c,v 1.2 2000/12/27 22:30:29 keithw Exp $ */

/*
 * Mesa 3-D graphics library
 * Version:  3.5
 *
 * Copyright (C) 1999-2000  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"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * 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.
 */


#include "glheader.h"
#include "colormac.h"
#include "context.h"
#include "macros.h"
#include "mem.h"
#include "mmath.h"
#include "mtypes.h"
#include "math/m_eval.h"

#include "t_context.h"
#include "t_imm_eval.h"
#include "t_imm_exec.h"
#include "t_imm_fixup.h"


static void eval_points1( GLfloat outcoord[][4],
			  GLfloat coord[][4],
			  const GLuint *flags,
			  GLfloat du, GLfloat u1 )
{
   GLuint i;
   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & VERT_EVAL_ANY) {
	 outcoord[i][0] = coord[i][0];
	 outcoord[i][1] = coord[i][1];
	 if (flags[i] & VERT_EVAL_P1)
	    outcoord[i][0] = coord[i][0] * du + u1;
      }
}

static void eval_points2( GLfloat outcoord[][4],
			  GLfloat coord[][4],
			  const GLuint *flags,
			  GLfloat du, GLfloat u1,
			  GLfloat dv, GLfloat v1 )
{
   GLuint i;
   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) {
      if (flags[i] & VERT_EVAL_ANY) {
	 outcoord[i][0] = coord[i][0];
	 outcoord[i][1] = coord[i][1];
	 if (flags[i] & VERT_EVAL_P2) {
	    outcoord[i][0] = coord[i][0] * du + u1;
	    outcoord[i][1] = coord[i][1] * dv + v1;
	 }
      }
   }
}

static const GLubyte dirty_flags[5] = {
   0,				/* not possible */
   VEC_DIRTY_0,
   VEC_DIRTY_1,
   VEC_DIRTY_2,
   VEC_DIRTY_3
};


static void eval1_4f( GLvector4f *dest,
			     GLfloat coord[][4],
			     const GLuint *flags,
			     GLuint dimension,
			     struct gl_1d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   GLfloat (*to)[4] = dest->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 ASSIGN_4V(to[i], 0,0,0,1);
	 _math_horner_bezier_curve(map->Points, to[i], u, 
				   dimension, map->Order);
      }

   dest->size = MAX2(dest->size, dimension);
   dest->flags |= dirty_flags[dimension];
}


static void eval1_1ui( GLvector1ui *dest,
		       GLfloat coord[][4],
		       const GLuint *flags,
		       struct gl_1d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   GLuint *to = dest->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 GLfloat tmp;
	 _math_horner_bezier_curve(map->Points, &tmp, u, 1, map->Order);
	 to[i] = (GLuint) (GLint) tmp;
      }

}

static void eval1_norm( GLvector3f *dest,
			GLfloat coord[][4],
			const GLuint *flags, 
			struct gl_1d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   GLfloat (*to)[3] = dest->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 _math_horner_bezier_curve(map->Points, to[i], u, 3, map->Order);
      }
}

static void eval1_color( GLvector4ub *dest,
			 GLfloat coord[][4],
			 const GLuint *flags,
			 struct gl_1d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   GLubyte (*to)[4] = dest->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 GLfloat fcolor[4];
	 _math_horner_bezier_curve(map->Points, fcolor, u, 4, map->Order);
	 FLOAT_RGBA_TO_CHAN_RGBA(to[i], fcolor);
      }
}




static void eval2_obj_norm( GLvector4f *obj_ptr,
			    GLvector3f *norm_ptr,
			    GLfloat coord[][4],
			    GLuint *flags,
			    GLuint dimension,
			    struct gl_2d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   const GLfloat v1 = map->v1;
   const GLfloat dv = map->dv;
   GLfloat (*obj)[4] = obj_ptr->data;
   GLfloat (*normal)[3] = norm_ptr->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 GLfloat v = (coord[i][1] - v1) * dv;
	 GLfloat du[4], dv[4];

	 ASSIGN_4V(obj[i], 0,0,0,1);
	 _math_de_casteljau_surf(map->Points, obj[i], du, dv, u, v, dimension,
				 map->Uorder, map->Vorder);

	 CROSS3(normal[i], du, dv);
	 NORMALIZE_3FV(normal[i]);
      }

   obj_ptr->size = MAX2(obj_ptr->size, dimension);
   obj_ptr->flags |= dirty_flags[dimension];
}


static void eval2_4f( GLvector4f *dest,
		      GLfloat coord[][4],
		      const GLuint *flags,
		      GLuint dimension,
		      struct gl_2d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   const GLfloat v1 = map->v1;
   const GLfloat dv = map->dv;
   GLfloat (*to)[4] = dest->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 GLfloat v = (coord[i][1] - v1) * dv;
	 _math_horner_bezier_surf(map->Points, to[i], u, v, dimension,
				  map->Uorder, map->Vorder);
      }

   dest->size = MAX2(dest->size, dimension);
   dest->flags |= dirty_flags[dimension];
}


static void eval2_norm( GLvector3f *dest,
			GLfloat coord[][4],
			GLuint *flags,
			struct gl_2d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   const GLfloat v1 = map->v1;
   const GLfloat dv = map->dv;
   GLfloat (*to)[3] = dest->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 GLfloat v = (coord[i][1] - v1) * dv;
	 _math_horner_bezier_surf(map->Points, to[i], u, v, 3,
				  map->Uorder, map->Vorder);
     }

}


static void eval2_1ui( GLvector1ui *dest,
		       GLfloat coord[][4],
		       const GLuint *flags,
		       struct gl_2d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   const GLfloat v1 = map->v1;
   const GLfloat dv = map->dv;
   GLuint *to = dest->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 GLfloat v = (coord[i][1] - v1) * dv;
	 GLfloat tmp;
	 _math_horner_bezier_surf(map->Points, &tmp, u, v, 1,
				  map->Uorder, map->Vorder);

	 to[i] = (GLuint) (GLint) tmp;
      }
}



static void eval2_color( GLvector4ub *dest,
			 GLfloat coord[][4],
			 GLuint *flags,
			 struct gl_2d_map *map )
{
   const GLfloat u1 = map->u1;
   const GLfloat du = map->du;
   const GLfloat v1 = map->v1;
   const GLfloat dv = map->dv;
   GLubyte (*to)[4] = dest->data;
   GLuint i;

   for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
      if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
	 GLfloat u = (coord[i][0] - u1) * du;
	 GLfloat v = (coord[i][1] - v1) * dv;
	 GLfloat fcolor[4];
	 _math_horner_bezier_surf(map->Points, fcolor, u, v, 4,
				  map->Uorder, map->Vorder);
	 FLOAT_RGBA_TO_CHAN_RGBA(to[i], fcolor);
      }

}



static void copy_4f( GLfloat to[][4], GLfloat from[][4], GLuint count )
{
   MEMCPY( to, from, count * sizeof(to[0])); 
}

static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count )
{
   MEMCPY( to, from, (count) * sizeof(to[0])); 
}

static void copy_4ub( GLubyte to[][4], GLubyte from[][4], GLuint count )
{
   MEMCPY( to, from, (count) * sizeof(to[0])); 
}

static void copy_1ui( GLuint to[], GLuint from[], GLuint count )
{
   MEMCPY( to, from, (count) * sizeof(to[0])); 
}



/* Translate eval enabled flags to VERT_* flags.
 */
static void update_eval( GLcontext *ctx )
{
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   GLuint eval1 = 0, eval2 = 0;

   if (ctx->Eval.Map1Index)
      eval1 |= VERT_INDEX;

   if (ctx->Eval.Map2Index)
      eval2 |= VERT_INDEX;

   if (ctx->Eval.Map1Color4)
      eval1 |= VERT_RGBA;

   if (ctx->Eval.Map2Color4)
      eval2 |= VERT_RGBA;

   if (ctx->Eval.Map1Normal)
      eval1 |= VERT_NORM;

   if (ctx->Eval.Map2Normal)
      eval2 |= VERT_NORM;

   if (ctx->Eval.Map1TextureCoord4 ||
       ctx->Eval.Map1TextureCoord3 ||
       ctx->Eval.Map1TextureCoord2 ||
       ctx->Eval.Map1TextureCoord1)
      eval1 |= VERT_TEX0;

   if (ctx->Eval.Map2TextureCoord4 ||
       ctx->Eval.Map2TextureCoord3 ||
       ctx->Eval.Map2TextureCoord2 ||
       ctx->Eval.Map2TextureCoord1)
      eval2 |= VERT_TEX0;

   if (ctx->Eval.Map1Vertex4)
      eval1 |= VERT_OBJ_234;

   if (ctx->Eval.Map1Vertex3)
      eval1 |= VERT_OBJ_23;

   if (ctx->Eval.Map2Vertex4) {
      if (ctx->Eval.AutoNormal) 
	 eval2 |= VERT_OBJ_234 | VERT_NORM;
      else
	 eval2 |= VERT_OBJ_234;
   }
   else if (ctx->Eval.Map2Vertex3) {
      if (ctx->Eval.AutoNormal) 
	 eval2 |= VERT_OBJ_23 | VERT_NORM;
      else
	 eval2 |= VERT_OBJ_23;
   }

   tnl->eval.EvalMap1Flags = eval1;
   tnl->eval.EvalMap2Flags = eval2;
   tnl->eval.EvalNewState = 0;
}


/* This looks a lot like a pipeline stage, but for various reasons is
 * better handled outside the pipeline, and considered the final stage
 * of fixing up an immediate struct for execution.  
 *
 * Really want to cache the results of this function in display lists,
 * at least for EvalMesh commands.  
 */
void _tnl_eval_vb( GLcontext *ctx, 
		   GLfloat (*coord)[4],
		   GLuint orflag, 
		   GLuint andflag )
{
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   struct vertex_arrays *tmp = &tnl->imm_inputs;
   struct tnl_eval_store *store = &tnl->eval;
   GLuint *flags = tnl->vb.Flag;
   GLuint count = tnl->vb.Count;
   GLuint any_eval1 = orflag & (VERT_EVAL_C1|VERT_EVAL_P1);
   GLuint any_eval2 = orflag & (VERT_EVAL_C2|VERT_EVAL_P2);
   GLuint all_eval = andflag & VERT_EVAL_ANY; /* may have false negatives */
   GLuint req = 0;
   GLuint purge_flags = 0;

   if (tnl->eval.EvalNewState & _NEW_EVAL)
      update_eval( ctx );

   /* Handle the degenerate cases.
    */
   if (any_eval1 && !ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3)
      purge_flags = (VERT_EVAL_P1|VERT_EVAL_C1);

   if (any_eval2 && !ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3) 
      purge_flags |= (VERT_EVAL_P1|VERT_EVAL_C1);

   if (any_eval1) 
      req |= tnl->pipeline.inputs & tnl->eval.EvalMap1Flags;

   if (any_eval2) 
      req |= tnl->pipeline.inputs & tnl->eval.EvalMap2Flags;

   
   /* Translate points into coords.  Use store->Coord to hold the
    * new data.  
    */
   if (any_eval1 && (orflag & VERT_EVAL_P1))
   {
      eval_points1( store->Coord, coord, flags,
		    ctx->Eval.MapGrid1du,
		    ctx->Eval.MapGrid1u1);

      coord = store->Coord;
   }

   if (any_eval2 && (orflag & VERT_EVAL_P2))
   {
      eval_points2( store->Coord, coord, flags,
		    ctx->Eval.MapGrid2du,
		    ctx->Eval.MapGrid2u1,
		    ctx->Eval.MapGrid2dv,
		    ctx->Eval.MapGrid2v1 );

      coord = store->Coord;
   }


   /* Perform the evaluations on active data elements.
    */
   if (req & VERT_INDEX)
   {
      if (!all_eval) 
	 copy_1ui( store->Index, tmp->Index.data, count );

      tmp->Index.data = store->Index;
      tmp->Index.start = store->Index;

      if (ctx->Eval.Map1Index && any_eval1) 
	 eval1_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map1Index );

      if (ctx->Eval.Map2Index && any_eval2)
	 eval2_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map2Index );

   }

   if (req & VERT_RGBA)
   {
      if (!all_eval)
	 copy_4ub( store->Color, tmp->Color.data, count );

      tmp->Color.data = store->Color;
      tmp->Color.start = (GLubyte *)store->Color;

      if (ctx->Eval.Map1Color4 && any_eval1)
	 eval1_color( &tmp->Color, coord, flags, &ctx->EvalMap.Map1Color4 );

      if (ctx->Eval.Map2Color4 && any_eval2)
	 eval2_color( &tmp->Color, coord, flags, &ctx->EvalMap.Map2Color4 );
   }


   if (req & VERT_TEX(0))
   {
      if (!all_eval) 
	 copy_4f( store->TexCoord, tmp->TexCoord[0].data, count );
      else 
	 tmp->TexCoord[0].size = 0;
	 
      tmp->TexCoord[0].data = store->TexCoord;
      tmp->TexCoord[0].start = (GLfloat *)store->TexCoord;

      if (any_eval1) {
	 if (ctx->Eval.Map1TextureCoord4) {
	    eval1_4f( &tmp->TexCoord[0], coord, flags, 4,
		      &ctx->EvalMap.Map1Texture4 );
	 }
	 else if (ctx->Eval.Map1TextureCoord3) {
	    eval1_4f( &tmp->TexCoord[0], coord, flags, 3,
		      &ctx->EvalMap.Map1Texture3 );
	 }
	 else if (ctx->Eval.Map1TextureCoord2) {
	    eval1_4f( &tmp->TexCoord[0], coord, flags, 2,
		      &ctx->EvalMap.Map1Texture2 );
	 } 
	 else if (ctx->Eval.Map1TextureCoord1) {
	    eval1_4f( &tmp->TexCoord[0], coord, flags, 1,
		      &ctx->EvalMap.Map1Texture1 );
	 }
      }

      if (any_eval2) {
	 if (ctx->Eval.Map2TextureCoord4) {
	    eval2_4f( &tmp->TexCoord[0], coord, flags, 4,
		      &ctx->EvalMap.Map2Texture4 );
	 }
	 else if (ctx->Eval.Map2TextureCoord3) {
	    eval2_4f( &tmp->TexCoord[0], coord, flags, 3, 
		      &ctx->EvalMap.Map2Texture3 );
	 }
	 else if (ctx->Eval.Map2TextureCoord2) {
	    eval2_4f( &tmp->TexCoord[0], coord, flags, 2,
		      &ctx->EvalMap.Map2Texture2 );
	 }
	 else if (ctx->Eval.Map2TextureCoord1) {
	    eval2_4f( &tmp->TexCoord[0], coord, flags, 1,
		      &ctx->EvalMap.Map2Texture1 );
	 }
      }
   }


   if (req & VERT_NORM)
   {
      if (!all_eval)
	 copy_3f( store->Normal, tmp->Normal.data, count );

      tmp->Normal.data = store->Normal;
      tmp->Normal.start = (GLfloat *)store->Normal;

      if (ctx->Eval.Map1Normal && any_eval1)
	 eval1_norm( &tmp->Normal, coord, flags,
		     &ctx->EvalMap.Map1Normal );

      if (ctx->Eval.Map2Normal && any_eval2)
	 eval2_norm( &tmp->Normal, coord, flags,
		     &ctx->EvalMap.Map2Normal );
   }



   /* In the AutoNormal case, the copy and assignment of tmp->NormalPtr
    * are done above.
    */
   if (req & VERT_OBJ)
   {
      if (!all_eval) {
	 copy_4f( store->Obj, tmp->Obj.data, count );
      } else
	 tmp->Obj.size = 0;

      tmp->Obj.data = store->Obj;
      tmp->Obj.start = (GLfloat *)store->Obj;

      if (any_eval1) {
	 if (ctx->Eval.Map1Vertex4) {
	    eval1_4f( &tmp->Obj, coord, flags, 4, 
		      &ctx->EvalMap.Map1Vertex4 );
	 }
	 else if (ctx->Eval.Map1Vertex3) {
	    eval1_4f( &tmp->Obj, coord, flags, 3,
		      &ctx->EvalMap.Map1Vertex3 );
	 }
      }

      if (any_eval2) {
	 if (ctx->Eval.Map2Vertex4)
	 {
	    if (ctx->Eval.AutoNormal && (req & VERT_NORM)) 
	       eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4, 
			       &ctx->EvalMap.Map2Vertex4 );
	    else
	       eval2_4f( &tmp->Obj, coord, flags, 4, 
			 &ctx->EvalMap.Map2Vertex4 );
	 }
	 else if (ctx->Eval.Map2Vertex3)
	 {
	    if (ctx->Eval.AutoNormal && (req & VERT_NORM)) 
	       eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 3,
			       &ctx->EvalMap.Map2Vertex3 );
	    else
	       eval2_4f( &tmp->Obj, coord, flags, 3,
			 &ctx->EvalMap.Map2Vertex3 );
	 }
      }
   }


   {
      GLuint i;
      copy_1ui( store->Flag, flags, count );
      tnl->vb.Flag = store->Flag;
      
      /* This is overkill, but correct as fixup will have copied the
       * values to all vertices in the VB - we may be falsely stating
       * that some repeated values are new, but doing so is fairly
       * harmless.
       */
      for (i = 0 ; i < count ; i++)
	 store->Flag[i] |= req;
   }
}