Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1901 serge 1
 
2
 * Mesa 3-D graphics library
3
 * Version:  5.0.1
4
 *
5
 * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
6
 *
7
 * Permission is hereby granted, free of charge, to any person obtaining a
8
 * copy of this software and associated documentation files (the "Software"),
9
 * to deal in the Software without restriction, including without limitation
10
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
 * and/or sell copies of the Software, and to permit persons to whom the
12
 * Software is furnished to do so, subject to the following conditions:
13
 *
14
 * The above copyright notice and this permission notice shall be included
15
 * in all copies or substantial portions of the Software.
16
 *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
 *
24
 * Authors:
25
 *    Keith Whitwell 
26
 */
27
28
 
29
 
30
 * underlying hardware.  Specifically it assumes a d3d-like vertex
31
 * format, with a layout more or less constrained to look like the
32
 * following:
33
 *
34
 * union {
35
 *    struct {
36
 *        float x, y, z, w;
37
 *        struct { char r, g, b, a; } color;
38
 *        struct { char r, g, b, fog; } spec;
39
 *        float u0, v0;
40
 *        float u1, v1;
41
 *        float u2, v2;
42
 *        float u3, v3;
43
 *    } v;
44
 *    struct {
45
 *        float x, y, z, w;
46
 *        struct { char r, g, b, a; } color;
47
 *        struct { char r, g, b, fog; } spec;
48
 *        float u0, v0, q0;
49
 *        float u1, v1, q1;
50
 *        float u2, v2, q2;
51
 *        float u3, v3, q3;
52
 *    } pv;
53
 *    struct {
54
 *        float x, y, z;
55
 *        struct { char r, g, b, a; } color;
56
 *    } tv;
57
 *    float f[16];
58
 *    unsigned int ui[16];
59
 *    unsigned char ub4[4][16];
60
 * }
61
 *
62
63
 
64
 * VERTEX_COLOR: hw color struct type in VERTEX
65
 *
66
 * DO_XYZW:  Emit xyz and maybe w coordinates.
67
 * DO_RGBA:  Emit color.
68
 * DO_SPEC:  Emit specular color.
69
 * DO_FOG:   Emit fog coordinate in specular alpha.
70
 * DO_TEX0:  Emit tex0 u,v coordinates.
71
 * DO_TEX1:  Emit tex1 u,v coordinates.
72
 * DO_TEX2:  Emit tex2 u,v coordinates.
73
 * DO_TEX3:  Emit tex3 u,v coordinates.
74
 * DO_PTEX:  Emit tex0,1,2,3 q coordinates where possible.
75
 *
76
 * HAVE_RGBA_COLOR: Hardware takes color in rgba order (else bgra).
77
 *
78
 * HAVE_HW_VIEWPORT:  Hardware performs viewport transform.
79
 * HAVE_HW_DIVIDE:  Hardware performs perspective divide.
80
 *
81
 * HAVE_TINY_VERTICES:  Hardware understands v.tv format.
82
 * HAVE_PTEX_VERTICES:  Hardware understands v.pv format.
83
 * HAVE_NOTEX_VERTICES:  Hardware understands v.v format with texcount 0.
84
 *
85
 * Additionally, this template assumes it is emitting *transformed*
86
 * vertices; the modifications to emit untransformed vertices (ie. to
87
 * t&l hardware) are probably too great to cooexist with the code
88
 * already in this file.
89
 *
90
 * NOTE: The PTEX vertex format always includes TEX0 and TEX1, even if
91
 * only TEX0 is enabled, in order to maintain a vertex size which is
92
 * an exact number of quadwords.
93
 */
94
95
 
96
#define VIEWPORT_X(dst,x) dst = x
97
#define VIEWPORT_Y(dst,y) dst = y
98
#define VIEWPORT_Z(dst,z) dst = z
99
#else
100
#define VIEWPORT_X(dst,x) dst = s[0]  * x + s[12]
101
#define VIEWPORT_Y(dst,y) dst = s[5]  * y + s[13]
102
#define VIEWPORT_Z(dst,z) dst = s[10] * z + s[14]
103
#endif
104
105
 
106
#error "can't cope with this combination"
107
#endif
108
109
 
110
#define LOCALVARS
111
#endif
112
113
 
114
#define CHECK_HW_DIVIDE 1
115
#endif
116
117
 
118
119
 
120
		       GLuint start, GLuint end,
121
		       void *dest,
122
		       GLuint stride )
123
{
124
   LOCALVARS
125
      struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
126
   GLfloat (*tc0)[4], (*tc1)[4], (*fog)[4];
127
   GLfloat (*tc2)[4], (*tc3)[4];
128
   GLfloat (*col)[4], (*spec)[4];
129
   GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride;
130
   GLuint tc2_stride, tc3_stride;
131
   GLuint tc0_size, tc1_size, col_size;
132
   GLuint tc2_size, tc3_size;
133
   GLfloat (*coord)[4];
134
   GLuint coord_stride;
135
   VERTEX *v = (VERTEX *)dest;
136
   const GLfloat *s = GET_VIEWPORT_MAT();
137
   const GLubyte *mask = VB->ClipMask;
138
   int i;
139
140
 
141
/*  	   __FUNCTION__, VB->importable_data, start, end); */
142
143
 
144
      (void) s;
145
      coord = VB->ClipPtr->data;
146
      coord_stride = VB->ClipPtr->stride;
147
   }
148
   else {
149
      coord = VB->NdcPtr->data;
150
      coord_stride = VB->NdcPtr->stride;
151
   }
152
153
 
154
      const GLuint t3 = GET_TEXSOURCE(3);
155
      tc3 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->data;
156
      tc3_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->stride;
157
      if (DO_PTEX)
158
	 tc3_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->size;
159
   }
160
161
 
162
      const GLuint t2 = GET_TEXSOURCE(2);
163
      tc2 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->data;
164
      tc2_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->stride;
165
      if (DO_PTEX)
166
	 tc2_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size;
167
   }
168
169
 
170
      const GLuint t1 = GET_TEXSOURCE(1);
171
      tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data;
172
      tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride;
173
      if (DO_PTEX)
174
	 tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size;
175
   }
176
177
 
178
      const GLuint t0 = GET_TEXSOURCE(0);
179
      tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride;
180
      tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data;
181
      if (DO_PTEX)
182
	 tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size;
183
   }
184
185
 
186
      col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
187
      col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
188
      col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
189
   }
190
191
 
192
      if (VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
193
	 spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride;
194
	 spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data;
195
      } else {
196
	 spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
197
	 spec_stride = 0;
198
      }
199
   }
200
201
 
202
      if (VB->AttribPtr[_TNL_ATTRIB_FOG]) {
203
	 fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data;
204
	 fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride;
205
      }
206
      else {
207
	 static GLfloat tmp[4] = {0, 0, 0, 0};
208
	 fog = &tmp;
209
	 fog_stride = 0;
210
      }
211
   }
212
213
 
214
    */
215
   if (start) {
216
      STRIDE_4F(coord, start * coord_stride);
217
      if (DO_TEX0)
218
	 STRIDE_4F(tc0, start * tc0_stride);
219
      if (DO_TEX1)
220
	 STRIDE_4F(tc1, start * tc1_stride);
221
      if (DO_TEX2)
222
	 STRIDE_4F(tc2, start * tc2_stride);
223
      if (DO_TEX3)
224
	 STRIDE_4F(tc3, start * tc3_stride);
225
      if (DO_RGBA)
226
	 STRIDE_4F(col, start * col_stride);
227
      if (DO_SPEC)
228
	 STRIDE_4F(spec, start * spec_stride);
229
      if (DO_FOG)
230
	 STRIDE_4F(fog, start * fog_stride);
231
   }
232
233
 
234
      if (DO_XYZW) {
235
	 if (HAVE_HW_VIEWPORT || mask[i] == 0) {
236
	    VIEWPORT_X(v->v.x, coord[0][0]);
237
	    VIEWPORT_Y(v->v.y, coord[0][1]);
238
	    VIEWPORT_Z(v->v.z, coord[0][2]);
239
	    v->v.w = coord[0][3];
240
	 }
241
	 STRIDE_4F(coord, coord_stride);
242
      }
243
      if (DO_RGBA) {
244
	 UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.red, col[0][0]);
245
	 UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.green, col[0][1]);
246
	 UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.blue, col[0][2]);
247
	 if (col_size == 4) {
248
	    UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.alpha, col[0][3]);
249
	 } else {
250
	    v->v.color.alpha = CHAN_MAX;
251
	 }
252
	 STRIDE_4F(col, col_stride);
253
      }
254
      if (DO_SPEC) {
255
	 UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.red, spec[0][0]);
256
	 UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.green, spec[0][1]);
257
	 UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.blue, spec[0][2]);
258
	 STRIDE_4F(spec, spec_stride);
259
      }
260
      if (DO_FOG) {
261
	 UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.alpha, fog[0][0]);
262
	 STRIDE_4F(fog, fog_stride);
263
      }
264
      if (DO_TEX0) {
265
	 v->v.u0 = tc0[0][0];
266
	 v->v.v0 = tc0[0][1];
267
	 if (DO_PTEX) {
268
	    if (HAVE_PTEX_VERTICES) {
269
	       if (tc0_size == 4)
270
		  v->pv.q0 = tc0[0][3];
271
	       else
272
		  v->pv.q0 = 1.0;
273
	    }
274
	    else if (tc0_size == 4) {
275
	       float rhw = 1.0 / tc0[0][3];
276
	       v->v.w *= tc0[0][3];
277
	       v->v.u0 *= rhw;
278
	       v->v.v0 *= rhw;
279
	    }
280
	 }
281
	 STRIDE_4F(tc0, tc0_stride);
282
      }
283
      if (DO_TEX1) {
284
	 if (DO_PTEX) {
285
	    v->pv.u1 = tc1[0][0];
286
	    v->pv.v1 = tc1[0][1];
287
	    if (tc1_size == 4)
288
	       v->pv.q1 = tc1[0][3];
289
	    else
290
	       v->pv.q1 = 1.0;
291
	 }
292
	 else {
293
	    v->v.u1 = tc1[0][0];
294
	    v->v.v1 = tc1[0][1];
295
	 }
296
	 STRIDE_4F(tc1, tc1_stride);
297
      }
298
      else if (DO_PTEX) {
299
	 *(GLuint *)&v->pv.q1 = 0;	/* avoid culling on radeon */
300
      }
301
      if (DO_TEX2) {
302
	 if (DO_PTEX) {
303
	    v->pv.u2 = tc2[0][0];
304
	    v->pv.v2 = tc2[0][1];
305
	    if (tc2_size == 4)
306
	       v->pv.q2 = tc2[0][3];
307
	    else
308
	       v->pv.q2 = 1.0;
309
	 }
310
	 else {
311
	    v->v.u2 = tc2[0][0];
312
	    v->v.v2 = tc2[0][1];
313
	 }
314
	 STRIDE_4F(tc2, tc2_stride);
315
      }
316
      if (DO_TEX3) {
317
	 if (DO_PTEX) {
318
	    v->pv.u3 = tc3[0][0];
319
	    v->pv.v3 = tc3[0][1];
320
	    if (tc3_size == 4)
321
	       v->pv.q3 = tc3[0][3];
322
	    else
323
	       v->pv.q3 = 1.0;
324
	 }
325
	 else {
326
	    v->v.u3 = tc3[0][0];
327
	    v->v.v3 = tc3[0][1];
328
	 }
329
	 STRIDE_4F(tc3, tc3_stride);
330
      }
331
   }
332
333
 
334
#else
335
336
 
337
#error "cannot use tiny vertices with hw perspective divide"
338
#endif
339
340
 
341
		       void *dest, GLuint stride )
342
{
343
   LOCALVARS
344
      struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
345
   GLfloat (*col)[4];
346
   GLuint col_stride, col_size;
347
   GLfloat (*coord)[4] = VB->NdcPtr->data;
348
   GLuint coord_stride = VB->NdcPtr->stride;
349
   GLfloat *v = (GLfloat *)dest;
350
   const GLubyte *mask = VB->ClipMask;
351
   const GLfloat *s = GET_VIEWPORT_MAT();
352
   int i;
353
354
 
355
356
 
357
358
 
359
   col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
360
   col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
361
362
 
363
/*  	   __FUNCTION__, VB->importable_data); */
364
365
 
366
    * place, and there is no 'w' coordinate.
367
    */
368
   if (start) {
369
      STRIDE_4F(coord, start * coord_stride);
370
      STRIDE_4F(col, start * col_stride);
371
   }
372
373
 
374
      if (DO_XYZW) {
375
	 if (HAVE_HW_VIEWPORT || mask[i] == 0) {
376
	    VIEWPORT_X(v[0], coord[0][0]);
377
	    VIEWPORT_Y(v[1], coord[0][1]);
378
	    VIEWPORT_Z(v[2], coord[0][2]);
379
	 }
380
	 STRIDE_4F( coord, coord_stride );
381
      }
382
      if (DO_RGBA) {
383
	 VERTEX_COLOR *c = (VERTEX_COLOR *)&v[3];
384
	 UNCLAMPED_FLOAT_TO_UBYTE(c->red, col[0][0]);
385
	 UNCLAMPED_FLOAT_TO_UBYTE(c->green, col[0][1]);
386
	 UNCLAMPED_FLOAT_TO_UBYTE(c->blue, col[0][2]);
387
	 if (col_size == 4) {
388
	    UNCLAMPED_FLOAT_TO_UBYTE(c->alpha, col[0][3]);
389
	 } else {
390
	    c->alpha = CHAN_MAX;
391
	 }
392
	 STRIDE_4F( col, col_stride );
393
      }
394
/*  	 fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n",  */
395
/*  		 i, v[0], v[1], v[2], *(int *)&v[3]); */
396
   }
397
}
398
399
 
400
401
 
402
403
 
404
 
405
static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx )
406
{
407
   LOCALVARS
408
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
409
410
 
411
    */
412
   if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] == 0)
413
      VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 3];
414
415
 
416
      VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2];
417
418
 
419
      VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1];
420
421
 
422
      return GL_TRUE;
423
424
 
425
       (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) ||
426
       (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4) ||
427
       (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4))
428
      return GL_FALSE;
429
430
 
431
}
432
#else
433
static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx )
434
{
435
   LOCALVARS
436
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
437
438
 
439
    */
440
   if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] == 0)
441
      VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 3];
442
443
 
444
      VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2];
445
446
 
447
      VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1];
448
449
 
450
      return GL_TRUE;
451
452
 
453
    * TEX0 only.
454
    */
455
   if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) ||
456
       (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) ||
457
       (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4)) {
458
      PTEX_FALLBACK();
459
      return GL_FALSE;
460
   }
461
462
 
463
      if (DO_TEX1 || DO_TEX2 || DO_TEX3) {
464
	 PTEX_FALLBACK();
465
      }
466
      return GL_FALSE;
467
   }
468
469
 
470
}
471
#endif /* ptex */
472
473
 
474
 
475
			 GLfloat t,
476
			 GLuint edst, GLuint eout, GLuint ein,
477
			 GLboolean force_boundary )
478
{
479
   LOCALVARS
480
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
481
   GLubyte *ddverts = GET_VERTEX_STORE();
482
   GLuint size = GET_VERTEX_SIZE();
483
   const GLfloat *dstclip = VB->ClipPtr->data[edst];
484
   GLfloat w;
485
   const GLfloat *s = GET_VIEWPORT_MAT();
486
487
 
488
   VERTEX *in  = (VERTEX *)(ddverts + (ein * size));
489
   VERTEX *out = (VERTEX *)(ddverts + (eout * size));
490
491
 
492
493
 
494
      VIEWPORT_X( dst->v.x, dstclip[0] );
495
      VIEWPORT_Y( dst->v.y, dstclip[1] );
496
      VIEWPORT_Z( dst->v.z, dstclip[2] );
497
      w = dstclip[3];
498
   }
499
   else {
500
      w = 1.0 / dstclip[3];
501
      VIEWPORT_X( dst->v.x, dstclip[0] * w );
502
      VIEWPORT_Y( dst->v.y, dstclip[1] * w );
503
      VIEWPORT_Z( dst->v.z, dstclip[2] * w );
504
   }
505
506
 
507
       DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 ||
508
       DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES) {
509
510
 
511
512
 
513
      INTERP_UB( t, dst->ub4[4][1], out->ub4[4][1], in->ub4[4][1] );
514
      INTERP_UB( t, dst->ub4[4][2], out->ub4[4][2], in->ub4[4][2] );
515
      INTERP_UB( t, dst->ub4[4][3], out->ub4[4][3], in->ub4[4][3] );
516
517
 
518
	 INTERP_UB( t, dst->v.specular.red,   out->v.specular.red,   in->v.specular.red );
519
	 INTERP_UB( t, dst->v.specular.green, out->v.specular.green, in->v.specular.green );
520
	 INTERP_UB( t, dst->v.specular.blue,  out->v.specular.blue,  in->v.specular.blue );
521
      }
522
      if (DO_FOG) {
523
	 INTERP_UB( t, dst->v.specular.alpha, out->v.specular.alpha, in->v.specular.alpha );
524
      }
525
      if (DO_TEX0) {
526
	 if (DO_PTEX) {
527
	    if (HAVE_PTEX_VERTICES) {
528
	       INTERP_F( t, dst->pv.u0, out->pv.u0, in->pv.u0 );
529
	       INTERP_F( t, dst->pv.v0, out->pv.v0, in->pv.v0 );
530
	       INTERP_F( t, dst->pv.q0, out->pv.q0, in->pv.q0 );
531
	    } else {
532
	       GLfloat wout = VB->NdcPtr->data[eout][3];
533
	       GLfloat win = VB->NdcPtr->data[ein][3];
534
	       GLfloat qout = out->pv.w / wout;
535
	       GLfloat qin = in->pv.w / win;
536
	       GLfloat qdst, rqdst;
537
538
 
539
540
 
541
	       INTERP_F( t, dst->v.v0, out->v.v0 * qout, in->v.v0 * qin );
542
	       INTERP_F( t, qdst, qout, qin );
543
544
 
545
	       dst->v.u0 *= rqdst;
546
	       dst->v.v0 *= rqdst;
547
	       dst->v.w *= rqdst;
548
	    }
549
	 }
550
	 else {
551
	    INTERP_F( t, dst->v.u0, out->v.u0, in->v.u0 );
552
	    INTERP_F( t, dst->v.v0, out->v.v0, in->v.v0 );
553
	 }
554
      }
555
      if (DO_TEX1) {
556
	 if (DO_PTEX) {
557
	    INTERP_F( t, dst->pv.u1, out->pv.u1, in->pv.u1 );
558
	    INTERP_F( t, dst->pv.v1, out->pv.v1, in->pv.v1 );
559
	    INTERP_F( t, dst->pv.q1, out->pv.q1, in->pv.q1 );
560
	 } else {
561
	    INTERP_F( t, dst->v.u1, out->v.u1, in->v.u1 );
562
	    INTERP_F( t, dst->v.v1, out->v.v1, in->v.v1 );
563
	 }
564
      }
565
      else if (DO_PTEX) {
566
	 dst->pv.q1 = 0.0;	/* must be a valid float on radeon */
567
      }
568
      if (DO_TEX2) {
569
	 if (DO_PTEX) {
570
	    INTERP_F( t, dst->pv.u2, out->pv.u2, in->pv.u2 );
571
	    INTERP_F( t, dst->pv.v2, out->pv.v2, in->pv.v2 );
572
	    INTERP_F( t, dst->pv.q2, out->pv.q2, in->pv.q2 );
573
	 } else {
574
	    INTERP_F( t, dst->v.u2, out->v.u2, in->v.u2 );
575
	    INTERP_F( t, dst->v.v2, out->v.v2, in->v.v2 );
576
	 }
577
      }
578
      if (DO_TEX3) {
579
	 if (DO_PTEX) {
580
	    INTERP_F( t, dst->pv.u3, out->pv.u3, in->pv.u3 );
581
	    INTERP_F( t, dst->pv.v3, out->pv.v3, in->pv.v3 );
582
	    INTERP_F( t, dst->pv.q3, out->pv.q3, in->pv.q3 );
583
	 } else {
584
	    INTERP_F( t, dst->v.u3, out->v.u3, in->v.u3 );
585
	    INTERP_F( t, dst->v.v3, out->v.v3, in->v.v3 );
586
	 }
587
      }
588
   } else {
589
      /* 4-dword vertex.  Color is in v[3] and there is no oow coordinate.
590
       */
591
      INTERP_UB( t, dst->ub4[3][0], out->ub4[3][0], in->ub4[3][0] );
592
      INTERP_UB( t, dst->ub4[3][1], out->ub4[3][1], in->ub4[3][1] );
593
      INTERP_UB( t, dst->ub4[3][2], out->ub4[3][2], in->ub4[3][2] );
594
      INTERP_UB( t, dst->ub4[3][3], out->ub4[3][3], in->ub4[3][3] );
595
   }
596
}
597
598
 
599
600
 
601
 
602
{
603
   setup_tab[IND].emit = TAG(emit);
604
605
 
606
   setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes);
607
   setup_tab[IND].interp = TAG(interp);
608
#endif
609
610
 
611
      setup_tab[IND].copy_pv = copy_pv_rgba4_spec5;
612
   else if (HAVE_HW_DIVIDE || DO_SPEC || DO_FOG || DO_TEX0 || DO_TEX1 ||
613
	    DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES)
614
      setup_tab[IND].copy_pv = copy_pv_rgba4;
615
   else
616
      setup_tab[IND].copy_pv = copy_pv_rgba3;
617
618
 
619
      if (DO_PTEX) {
620
	 ASSERT(HAVE_PTEX_VERTICES);
621
	 setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT;
622
	 setup_tab[IND].vertex_size = 18;
623
      }
624
      else {
625
	 setup_tab[IND].vertex_format = TEX3_VERTEX_FORMAT;
626
	 setup_tab[IND].vertex_size = 14;
627
      }
628
   }
629
   else if (DO_TEX2) {
630
      if (DO_PTEX) {
631
	 ASSERT(HAVE_PTEX_VERTICES);
632
	 setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT;
633
	 setup_tab[IND].vertex_size = 18;
634
      }
635
      else {
636
	 setup_tab[IND].vertex_format = TEX2_VERTEX_FORMAT;
637
	 setup_tab[IND].vertex_size = 12;
638
      }
639
   }
640
   else if (DO_TEX1) {
641
      if (DO_PTEX) {
642
	 ASSERT(HAVE_PTEX_VERTICES);
643
	 setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT;
644
	 setup_tab[IND].vertex_size = 12;
645
      }
646
      else {
647
	 setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT;
648
	 setup_tab[IND].vertex_size = 10;
649
      }
650
   }
651
   else if (DO_TEX0) {
652
      if (DO_PTEX && HAVE_PTEX_VERTICES) {
653
	 setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT;
654
	 setup_tab[IND].vertex_size = 12;
655
      } else {
656
	 setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
657
	 setup_tab[IND].vertex_size = 8;
658
      }
659
   }
660
   else if (!HAVE_HW_DIVIDE && !DO_SPEC && !DO_FOG && HAVE_TINY_VERTICES) {
661
      setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT;
662
      setup_tab[IND].vertex_size = 4;
663
   } else if (HAVE_NOTEX_VERTICES) {
664
      setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT;
665
      setup_tab[IND].vertex_size = 6;
666
   } else {
667
      setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
668
      setup_tab[IND].vertex_size = 8;
669
   }
670
}
671
672
 
673
 
674
#undef TAG
675