Merge branch 'crestline' into crestline-qa
[mesa.git] / src / mesa / drivers / dri / r200 / r200_maos_arrays.c
1 /* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c,v 1.3 2003/02/23 23:59:01 dawes Exp $ */
2 /*
3 Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
4
5 The Weather Channel (TM) funded Tungsten Graphics to develop the
6 initial release of the Radeon 8500 driver under the XFree86 license.
7 This notice must be preserved.
8
9 Permission is hereby granted, free of charge, to any person obtaining
10 a copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16
17 The above copyright notice and this permission notice (including the
18 next paragraph) shall be included in all copies or substantial
19 portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
25 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
29 **************************************************************************/
30
31 /*
32 * Authors:
33 * Keith Whitwell <keith@tungstengraphics.com>
34 */
35
36 #include "glheader.h"
37 #include "mtypes.h"
38 #include "colormac.h"
39 #include "imports.h"
40 #include "macros.h"
41
42 #include "swrast_setup/swrast_setup.h"
43 #include "math/m_translate.h"
44 #include "tnl/tnl.h"
45 #include "tnl/t_context.h"
46
47 #include "r200_context.h"
48 #include "r200_ioctl.h"
49 #include "r200_state.h"
50 #include "r200_swtcl.h"
51 #include "r200_maos.h"
52 #include "r200_tcl.h"
53
54
55 #if 0
56 /* Usage:
57 * - from r200_tcl_render
58 * - call r200EmitArrays to ensure uptodate arrays in dma
59 * - emit primitives (new type?) which reference the data
60 * -- need to use elts for lineloop, quads, quadstrip/flat
61 * -- other primitives are all well-formed (need tristrip-1,fake-poly)
62 *
63 */
64 static void emit_ubyte_rgba3( GLcontext *ctx,
65 struct r200_dma_region *rvb,
66 char *data,
67 int stride,
68 int count )
69 {
70 int i;
71 r200_color_t *out = (r200_color_t *)(rvb->start + rvb->address);
72
73 if (R200_DEBUG & DEBUG_VERTS)
74 fprintf(stderr, "%s count %d stride %d out %p\n",
75 __FUNCTION__, count, stride, (void *)out);
76
77 for (i = 0; i < count; i++) {
78 out->red = *data;
79 out->green = *(data+1);
80 out->blue = *(data+2);
81 out->alpha = 0xFF;
82 out++;
83 data += stride;
84 }
85 }
86
87 static void emit_ubyte_rgba4( GLcontext *ctx,
88 struct r200_dma_region *rvb,
89 char *data,
90 int stride,
91 int count )
92 {
93 int i;
94 int *out = (int *)(rvb->address + rvb->start);
95
96 if (R200_DEBUG & DEBUG_VERTS)
97 fprintf(stderr, "%s count %d stride %d\n",
98 __FUNCTION__, count, stride);
99
100 if (stride == 4) {
101 for (i = 0; i < count; i++)
102 ((int *)out)[i] = LE32_TO_CPU(((int *)data)[i]);
103 } else {
104 for (i = 0; i < count; i++) {
105 *(int *)out++ = LE32_TO_CPU(*(int *)data);
106 data += stride;
107 }
108 }
109 }
110
111
112 static void emit_ubyte_rgba( GLcontext *ctx,
113 struct r200_dma_region *rvb,
114 char *data,
115 int size,
116 int stride,
117 int count )
118 {
119 r200ContextPtr rmesa = R200_CONTEXT(ctx);
120
121 if (R200_DEBUG & DEBUG_VERTS)
122 fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
123
124 assert (!rvb->buf);
125
126 if (stride == 0) {
127 r200AllocDmaRegion( rmesa, rvb, 4, 4 );
128 count = 1;
129 rvb->aos_start = GET_START(rvb);
130 rvb->aos_stride = 0;
131 rvb->aos_size = 1;
132 }
133 else {
134 r200AllocDmaRegion( rmesa, rvb, 4 * count, 4 ); /* alignment? */
135 rvb->aos_start = GET_START(rvb);
136 rvb->aos_stride = 1;
137 rvb->aos_size = 1;
138 }
139
140 /* Emit the data
141 */
142 switch (size) {
143 case 3:
144 emit_ubyte_rgba3( ctx, rvb, data, stride, count );
145 break;
146 case 4:
147 emit_ubyte_rgba4( ctx, rvb, data, stride, count );
148 break;
149 default:
150 assert(0);
151 exit(1);
152 break;
153 }
154 }
155 #endif
156
157
158 #if defined(USE_X86_ASM)
159 #define COPY_DWORDS( dst, src, nr ) \
160 do { \
161 int __tmp; \
162 __asm__ __volatile__( "rep ; movsl" \
163 : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
164 : "0" (nr), \
165 "D" ((long)dst), \
166 "S" ((long)src) ); \
167 } while (0)
168 #else
169 #define COPY_DWORDS( dst, src, nr ) \
170 do { \
171 int j; \
172 for ( j = 0 ; j < nr ; j++ ) \
173 dst[j] = ((int *)src)[j]; \
174 dst += nr; \
175 } while (0)
176 #endif
177
178
179 static void emit_vecfog( GLcontext *ctx,
180 struct r200_dma_region *rvb,
181 char *data,
182 int stride,
183 int count )
184 {
185 int i;
186 GLfloat *out;
187
188 r200ContextPtr rmesa = R200_CONTEXT(ctx);
189
190 if (R200_DEBUG & DEBUG_VERTS)
191 fprintf(stderr, "%s count %d stride %d\n",
192 __FUNCTION__, count, stride);
193
194 assert (!rvb->buf);
195
196 if (stride == 0) {
197 r200AllocDmaRegion( rmesa, rvb, 4, 4 );
198 count = 1;
199 rvb->aos_start = GET_START(rvb);
200 rvb->aos_stride = 0;
201 rvb->aos_size = 1;
202 }
203 else {
204 r200AllocDmaRegion( rmesa, rvb, count * 4, 4 ); /* alignment? */
205 rvb->aos_start = GET_START(rvb);
206 rvb->aos_stride = 1;
207 rvb->aos_size = 1;
208 }
209
210 /* Emit the data
211 */
212 out = (GLfloat *)(rvb->address + rvb->start);
213 for (i = 0; i < count; i++) {
214 out[0] = r200ComputeFogBlendFactor( ctx, *(GLfloat *)data );
215 out++;
216 data += stride;
217 }
218
219 }
220
221
222 static void emit_vec4( GLcontext *ctx,
223 struct r200_dma_region *rvb,
224 char *data,
225 int stride,
226 int count )
227 {
228 int i;
229 int *out = (int *)(rvb->address + rvb->start);
230
231 if (R200_DEBUG & DEBUG_VERTS)
232 fprintf(stderr, "%s count %d stride %d\n",
233 __FUNCTION__, count, stride);
234
235 if (stride == 4)
236 COPY_DWORDS( out, data, count );
237 else
238 for (i = 0; i < count; i++) {
239 out[0] = *(int *)data;
240 out++;
241 data += stride;
242 }
243 }
244
245
246 static void emit_vec8( GLcontext *ctx,
247 struct r200_dma_region *rvb,
248 char *data,
249 int stride,
250 int count )
251 {
252 int i;
253 int *out = (int *)(rvb->address + rvb->start);
254
255 if (R200_DEBUG & DEBUG_VERTS)
256 fprintf(stderr, "%s count %d stride %d\n",
257 __FUNCTION__, count, stride);
258
259 if (stride == 8)
260 COPY_DWORDS( out, data, count*2 );
261 else
262 for (i = 0; i < count; i++) {
263 out[0] = *(int *)data;
264 out[1] = *(int *)(data+4);
265 out += 2;
266 data += stride;
267 }
268 }
269
270 static void emit_vec12( GLcontext *ctx,
271 struct r200_dma_region *rvb,
272 char *data,
273 int stride,
274 int count )
275 {
276 int i;
277 int *out = (int *)(rvb->address + rvb->start);
278
279 if (R200_DEBUG & DEBUG_VERTS)
280 fprintf(stderr, "%s count %d stride %d out %p data %p\n",
281 __FUNCTION__, count, stride, (void *)out, (void *)data);
282
283 if (stride == 12)
284 COPY_DWORDS( out, data, count*3 );
285 else
286 for (i = 0; i < count; i++) {
287 out[0] = *(int *)data;
288 out[1] = *(int *)(data+4);
289 out[2] = *(int *)(data+8);
290 out += 3;
291 data += stride;
292 }
293 }
294
295 static void emit_vec16( GLcontext *ctx,
296 struct r200_dma_region *rvb,
297 char *data,
298 int stride,
299 int count )
300 {
301 int i;
302 int *out = (int *)(rvb->address + rvb->start);
303
304 if (R200_DEBUG & DEBUG_VERTS)
305 fprintf(stderr, "%s count %d stride %d\n",
306 __FUNCTION__, count, stride);
307
308 if (stride == 16)
309 COPY_DWORDS( out, data, count*4 );
310 else
311 for (i = 0; i < count; i++) {
312 out[0] = *(int *)data;
313 out[1] = *(int *)(data+4);
314 out[2] = *(int *)(data+8);
315 out[3] = *(int *)(data+12);
316 out += 4;
317 data += stride;
318 }
319 }
320
321
322 static void emit_vector( GLcontext *ctx,
323 struct r200_dma_region *rvb,
324 char *data,
325 int size,
326 int stride,
327 int count )
328 {
329 r200ContextPtr rmesa = R200_CONTEXT(ctx);
330
331 if (R200_DEBUG & DEBUG_VERTS)
332 fprintf(stderr, "%s count %d size %d stride %d\n",
333 __FUNCTION__, count, size, stride);
334
335 assert (!rvb->buf);
336
337 if (stride == 0) {
338 r200AllocDmaRegion( rmesa, rvb, size * 4, 4 );
339 count = 1;
340 rvb->aos_start = GET_START(rvb);
341 rvb->aos_stride = 0;
342 rvb->aos_size = size;
343 }
344 else {
345 r200AllocDmaRegion( rmesa, rvb, size * count * 4, 4 ); /* alignment? */
346 rvb->aos_start = GET_START(rvb);
347 rvb->aos_stride = size;
348 rvb->aos_size = size;
349 }
350
351 /* Emit the data
352 */
353 switch (size) {
354 case 1:
355 emit_vec4( ctx, rvb, data, stride, count );
356 break;
357 case 2:
358 emit_vec8( ctx, rvb, data, stride, count );
359 break;
360 case 3:
361 emit_vec12( ctx, rvb, data, stride, count );
362 break;
363 case 4:
364 emit_vec16( ctx, rvb, data, stride, count );
365 break;
366 default:
367 assert(0);
368 exit(1);
369 break;
370 }
371
372 }
373
374
375
376 /* Emit any changed arrays to new GART memory, re-emit a packet to
377 * update the arrays.
378 */
379 void r200EmitArrays( GLcontext *ctx, GLuint inputs )
380 {
381 r200ContextPtr rmesa = R200_CONTEXT( ctx );
382 struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
383 struct r200_dma_region **component = rmesa->tcl.aos_components;
384 GLuint nr = 0;
385 GLuint vfmt0 = 0, vfmt1 = 0;
386 GLuint count = VB->Count;
387 GLuint i;
388 GLuint generic_in_mapped = 0;
389 struct r200_vertex_program *vp = NULL;
390
391 /* this looks way more complicated than necessary... */
392 if (ctx->VertexProgram._Enabled) {
393 vp = rmesa->curr_vp_hw;
394 generic_in_mapped = vp->gen_inputs_mapped;
395 }
396
397 if (inputs & VERT_BIT_POS) {
398 if (!rmesa->tcl.obj.buf)
399 emit_vector( ctx,
400 &rmesa->tcl.obj,
401 (char *)VB->ObjPtr->data,
402 VB->ObjPtr->size,
403 VB->ObjPtr->stride,
404 count);
405
406 switch( VB->ObjPtr->size ) {
407 case 4: vfmt0 |= R200_VTX_W0;
408 case 3: vfmt0 |= R200_VTX_Z0;
409 case 2:
410 default:
411 break;
412 }
413 component[nr++] = &rmesa->tcl.obj;
414 }
415 else if (generic_in_mapped & (1 << 0)) {
416 int geninput = vp->rev_inputs[0] - VERT_ATTRIB_GENERIC0;
417 if (!rmesa->tcl.generic[geninput].buf) {
418 emit_vector( ctx,
419 &(rmesa->tcl.generic[geninput]),
420 (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
421 4,
422 VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
423 count );
424 }
425 component[nr++] = &rmesa->tcl.generic[geninput];
426 vfmt0 |= R200_VTX_W0 | R200_VTX_Z0;
427 }
428
429 if (inputs & VERT_BIT_WEIGHT) {
430 if (!rmesa->tcl.weight.buf)
431 emit_vector( ctx,
432 &rmesa->tcl.weight,
433 (char *)VB->AttribPtr[VERT_ATTRIB_WEIGHT]->data,
434 VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size,
435 VB->AttribPtr[VERT_ATTRIB_WEIGHT]->stride,
436 count);
437
438 assert(VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size <= 4);
439 vfmt0 |= VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size << R200_VTX_WEIGHT_COUNT_SHIFT;
440 component[nr++] = &rmesa->tcl.weight;
441 }
442
443 if (inputs & VERT_BIT_NORMAL) {
444 if (!rmesa->tcl.norm.buf)
445 emit_vector( ctx,
446 &(rmesa->tcl.norm),
447 (char *)VB->NormalPtr->data,
448 3,
449 VB->NormalPtr->stride,
450 count);
451
452 vfmt0 |= R200_VTX_N0;
453 component[nr++] = &rmesa->tcl.norm;
454 }
455
456 if (inputs & VERT_BIT_FOG) {
457 if (!rmesa->tcl.fog.buf) {
458 if (ctx->VertexProgram._Enabled)
459 emit_vector( ctx,
460 &(rmesa->tcl.fog),
461 (char *)VB->FogCoordPtr->data,
462 1,
463 VB->FogCoordPtr->stride,
464 count);
465 else
466 emit_vecfog( ctx,
467 &(rmesa->tcl.fog),
468 (char *)VB->FogCoordPtr->data,
469 VB->FogCoordPtr->stride,
470 count);
471 }
472
473 vfmt0 |= R200_VTX_DISCRETE_FOG;
474 component[nr++] = &rmesa->tcl.fog;
475 }
476
477 if (inputs & VERT_BIT_COLOR0) {
478 int emitsize;
479
480 if (VB->ColorPtr[0]->size == 4 &&
481 (VB->ColorPtr[0]->stride != 0 ||
482 VB->ColorPtr[0]->data[0][3] != 1.0)) {
483 vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
484 emitsize = 4;
485 }
486 else {
487 vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT;
488 emitsize = 3;
489 }
490
491 if (!rmesa->tcl.rgba.buf)
492 emit_vector( ctx,
493 &(rmesa->tcl.rgba),
494 (char *)VB->ColorPtr[0]->data,
495 emitsize,
496 VB->ColorPtr[0]->stride,
497 count);
498
499 component[nr++] = &rmesa->tcl.rgba;
500 }
501 /* vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT;
502 emit_ubyte_rgba( ctx, &rmesa->tcl.rgba,
503 (char *)VB->ColorPtr[0]->data, 4,
504 VB->ColorPtr[0]->stride, count);*/
505 else if (generic_in_mapped & (1 << 2)) {
506 int geninput = vp->rev_inputs[2] - VERT_ATTRIB_GENERIC0;
507 if (!rmesa->tcl.generic[geninput].buf) {
508 emit_vector( ctx,
509 &(rmesa->tcl.generic[geninput]),
510 (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
511 4,
512 VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
513 count );
514 }
515 component[nr++] = &rmesa->tcl.generic[geninput];
516 vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
517 }
518
519
520 if (inputs & VERT_BIT_COLOR1) {
521 if (!rmesa->tcl.spec.buf) {
522 emit_vector( ctx,
523 &rmesa->tcl.spec,
524 (char *)VB->SecondaryColorPtr[0]->data,
525 3,
526 VB->SecondaryColorPtr[0]->stride,
527 count);
528 }
529
530 /* How does this work?
531 */
532 vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_1_SHIFT;
533 component[nr++] = &rmesa->tcl.spec;
534 }
535 else if (generic_in_mapped & (1 << 3)) {
536 int geninput = vp->rev_inputs[3] - VERT_ATTRIB_GENERIC0;
537 if (!rmesa->tcl.generic[geninput].buf) {
538 emit_vector( ctx,
539 &(rmesa->tcl.generic[geninput]),
540 (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
541 4,
542 VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
543 count );
544 }
545 component[nr++] = &rmesa->tcl.generic[geninput];
546 vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT;
547 }
548
549 if (generic_in_mapped & (1 << 4)) {
550 int geninput = vp->rev_inputs[4] - VERT_ATTRIB_GENERIC0;
551 if (!rmesa->tcl.generic[geninput].buf) {
552 emit_vector( ctx,
553 &(rmesa->tcl.generic[geninput]),
554 (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
555 4,
556 VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
557 count );
558 }
559 component[nr++] = &rmesa->tcl.generic[geninput];
560 vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_2_SHIFT;
561 }
562
563 if (generic_in_mapped & (1 << 5)) {
564 int geninput = vp->rev_inputs[5] - VERT_ATTRIB_GENERIC0;
565 if (!rmesa->tcl.generic[geninput].buf) {
566 emit_vector( ctx,
567 &(rmesa->tcl.generic[geninput]),
568 (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
569 4,
570 VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
571 count );
572 }
573 component[nr++] = &rmesa->tcl.generic[geninput];
574 vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_3_SHIFT;
575 }
576
577 for ( i = 0 ; i < 6 ; i++ ) {
578 if (inputs & (VERT_BIT_TEX0 << i)) {
579 if (!rmesa->tcl.tex[i].buf)
580 emit_vector( ctx,
581 &(rmesa->tcl.tex[i]),
582 (char *)VB->TexCoordPtr[i]->data,
583 VB->TexCoordPtr[i]->size,
584 VB->TexCoordPtr[i]->stride,
585 count );
586
587 vfmt1 |= VB->TexCoordPtr[i]->size << (i * 3);
588 component[nr++] = &rmesa->tcl.tex[i];
589 }
590 else if (generic_in_mapped & (1 << (i + 6))) {
591 int geninput = vp->rev_inputs[i + 6] - VERT_ATTRIB_GENERIC0;
592 if (!rmesa->tcl.generic[geninput].buf) {
593 emit_vector( ctx,
594 &(rmesa->tcl.generic[geninput]),
595 (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
596 4,
597 VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
598 count );
599 }
600 component[nr++] = &rmesa->tcl.generic[geninput];
601 vfmt1 |= 4 << (R200_VTX_TEX0_COMP_CNT_SHIFT + (i * 3));
602 }
603 }
604
605 if (generic_in_mapped & (1 << 13)) {
606 int geninput = vp->rev_inputs[13] - VERT_ATTRIB_GENERIC0;
607 if (!rmesa->tcl.generic[geninput].buf) {
608 emit_vector( ctx,
609 &(rmesa->tcl.generic[geninput]),
610 (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
611 4,
612 VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
613 count );
614 }
615 component[nr++] = &rmesa->tcl.generic[geninput];
616 vfmt0 |= R200_VTX_XY1 | R200_VTX_Z1 | R200_VTX_W1;
617 }
618
619 /* doesn't work. Wrong order with mixed generic & conventional! */
620 /*
621 if (ctx->VertexProgram._Enabled) {
622 int *vp_inputs = rmesa->curr_vp_hw->inputs;
623 for ( i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++ ) {
624 if (inputs & (1 << i)) {
625 int geninput = i - VERT_ATTRIB_GENERIC0;
626 if (!rmesa->tcl.generic[geninput].buf) {
627 emit_vector( ctx,
628 &(rmesa->tcl.generic[geninput]),
629 (char *)VB->AttribPtr[i]->data,
630 4,
631 VB->AttribPtr[i]->stride,
632 count );
633 }
634 component[nr++] = &rmesa->tcl.generic[geninput];
635 switch (vp_inputs[i]) {
636 case 0:
637 vfmt0 |= R200_VTX_W0 | R200_VTX_Z0;
638 break;
639 case 2:
640 case 3:
641 case 4:
642 case 5:
643 vfmt0 |= R200_VTX_FP_RGBA << (R200_VTX_COLOR_0_SHIFT + (vp_inputs[i] - 2) * 2);
644 break;
645 case 6:
646 case 7:
647 case 8:
648 case 9:
649 case 10:
650 case 11:
651 vfmt1 |= 4 << (R200_VTX_TEX0_COMP_CNT_SHIFT + (vp_inputs[i] - 6) * 3);
652 break;
653 case 13:
654 vfmt0 |= R200_VTX_XY1 | R200_VTX_Z1 | R200_VTX_W1;
655 break;
656 case 1:
657 case 12:
658 default:
659 assert(0);
660 }
661 }
662 }
663 }
664 */
665
666 if (vfmt0 != rmesa->hw.vtx.cmd[VTX_VTXFMT_0] ||
667 vfmt1 != rmesa->hw.vtx.cmd[VTX_VTXFMT_1]) {
668 R200_STATECHANGE( rmesa, vtx );
669 rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = vfmt0;
670 rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = vfmt1;
671 }
672
673 rmesa->tcl.nr_aos_components = nr;
674 rmesa->tcl.vertex_format = vfmt0;
675 }
676
677
678 void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
679 {
680 GLuint unit;
681 r200ContextPtr rmesa = R200_CONTEXT( ctx );
682
683 /* if (R200_DEBUG & DEBUG_VERTS) */
684 /* _tnl_print_vert_flags( __FUNCTION__, newinputs ); */
685
686 if (newinputs & VERT_BIT_POS)
687 r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
688
689 if (newinputs & VERT_BIT_WEIGHT)
690 r200ReleaseDmaRegion( rmesa, &rmesa->tcl.weight, __FUNCTION__ );
691
692 if (newinputs & VERT_BIT_NORMAL)
693 r200ReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
694
695 if (newinputs & VERT_BIT_FOG)
696 r200ReleaseDmaRegion( rmesa, &rmesa->tcl.fog, __FUNCTION__ );
697
698 if (newinputs & VERT_BIT_COLOR0)
699 r200ReleaseDmaRegion( rmesa, &rmesa->tcl.rgba, __FUNCTION__ );
700
701 if (newinputs & VERT_BIT_COLOR1)
702 r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
703
704 for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
705 if (newinputs & VERT_BIT_TEX(unit))
706 r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[unit], __FUNCTION__ );
707 }
708
709 if (ctx->VertexProgram._Enabled) {
710 int i;
711 for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
712 if (newinputs & (1 << i))
713 r200ReleaseDmaRegion( rmesa,
714 &rmesa->tcl.generic[i - VERT_ATTRIB_GENERIC0], __FUNCTION__ );
715 }
716 }
717
718 }