bl.c
20.9 KB
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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*
* Blend Unit - also contains depth buffer and write enable generation
* logic.
*
*
* 8/15/94 RJM
*/
#include <stdio.h>
#include <stdlib.h>
#include "bl.h"
static int bl_dump = 0;
/*
* D e f i n e s
*/
#define ONE_POINT_OH 0xff
#define ZERO 0x0
#define POSEDGE (save_clk && !save_clk_old)
#define NEGEDGE (!save_clk && save_clk_old)
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MIN(a, b) (((a) > (b)) ? (b) : (a))
#define CLAMP(x, min, max) (MAX(MIN(x,max),min))
/***************************************************************************
* four_to_one(), 4:1 mux
***************************************************************************
*/
static int
four_to_one( int sel, int a, int b, int c, int d )
{
switch(sel & 3)
{
case 0:
return(a);
case 1:
return(b);
case 2:
return(c);
case 3:
return(d);
}
}
/***************************************************************************
* normalize_a():
*
* input precision: 0.5
***************************************************************************/
static int
normalize_a(int value, int shift)
{
if(shift > 4) shift = 4;
return(value >> shift) & 0x3C;
}
/***************************************************************************
* normalize_b():
*
* input precision: 1.5
***************************************************************************/
static int
normalize_b(int value, int shift)
{
if(shift > 4) shift = 4;
return(value >> shift) & 0x1C;
}
/***************************************************************************
* numerator_calc():
*
* assumed input precision:
* p 0.8
* a 1.5
* m 0.8
* b 0.5
*
* output precision: 0.11
*
***************************************************************************/
static int
numerator_calc(int p, int a, int m, int b, int b_sel)
{
int mul1, mul2, res, mtimes1;
mul1 = p * a; /* 1.13 */
mul2 = m * b; /* 0.13 */
mtimes1 = (b_sel==1) ? (m<<2) : m;
res = mul1 + mul2 + mtimes1; /* 0.13, msb can't be one */
return(res >> 2); /* 0.11 */
}
/***************************************************************************
* denominator_calc():
* inputs are a: 0.5
* b: 1.5
*
* does (0.3 + 1.3 + lsb), returns 1.3 result.
*
* Hi Norm!
***************************************************************************/
static int
denominator_calc(int norm_a, int norm_b)
{
return(((norm_a >> 2) + (norm_b >> 2) + 1) & 0xf);
}
/***************************************************************************
* quantize_2n():
***************************************************************************/
static int
quantize_2n(int n)
{
int i;
if((n & 0x8000) || (n & 0x4000))
return(0x8000);
else
{
for(i = 0x2000; i > 0; i >>= 1)
{
if(i & n)
return(i << 1);
}
}
/* no bits set */
return(1);
}
/***************************************************************************
* priority_encode():
***************************************************************************/
static int
priority_encode(int x)
{
int res;
for(res = 0; x > 1; x >>= 1, res++)
;
return(res);
}
/***************************************************************************
* decode_float(): mem_z format is:
* [17:15] exponent shift
* [14:4] mantissa
* [3:0] delta_z (not used in this function)
***************************************************************************/
static int
decode_float(int mem_z)
{
int shift = (mem_z >> 15) & 7; /* 3 bits */
int mant = (mem_z >> 4) & 0x7ff; /* 11 bits */
int mask = 0x7f;
if(shift > 6) /* clamp shift */
{
mask <<= 11;
}
else
{
mant <<= (6 - shift);
mask <<= 18 - shift;
}
return((mask | mant) & 0x3ffff); /* 18 bits */
}
/***************************************************************************
* fix_to_float(): mem_z format is:
* [17:15] exponent shift
* [14:4] mantissa
* [3:0] delta_z (not used in this function)
*
* This function take a 15.3 number and converts it to the
* floating point format shown above.
***************************************************************************/
static int
fix_to_float( int x )
{
int exp;
int mant;
for( exp = 0; exp < 8; exp++)
if(!((0x20000 >> exp) & x)) /* find first zero */
break;
mant = (x >> (6 - CLAMP(exp, 0, 6))) & 0x7ff;
return((CLAMP(exp, 0, 7) << 11) | mant);
}
/***************************************************************************
* four_to_sixteen(): four to sixteen decode
***************************************************************************/
static int
four_to_sixteen(int x)
{
return(1 << x);
}
/***************************************************************************
* bl() - main blend unit interface function
***************************************************************************/
void
bl(bl_t **pp0, bl_t **pp1)
{
bl_t *p0, *p1;
int save_clk;
int save_clk_old;
/* temporary sigs */
/* page 1 */
int mux_zero_r;
int mux_zero_g;
int mux_zero_b;
int p_mux_r;
int p_mux_g;
int p_mux_b;
int m_mux_r;
int m_mux_g;
int m_mux_b;
int a_mux_a;
int b_mux_a;
int pixel_alpha;
int norm_a;
int norm_b;
int span_r;
int span_g;
int span_b;
/* page 2 */
int sx;
int pre_cvg_wrap;
int we_cvg;
int pcvg;
int mcvg;
int cvgsum;
/* page 3 */
int new_z;
int new_delta_z;
int memory_delta_z;
int dzdx_t;
int dzdy_t;
int max_delta_z;
int span_z;
int span_delta_z;
int trans;
int decal;
int opaque_inter;
int force_nearfar;
static int memz_d1=7;
/*
* Get Pointers, clocks
*/
p0 = *pp0;
p1 = *pp1;
save_clk = p0->gclk;
save_clk_old = p1->gclk_old;
if(POSEDGE)
{
/* transfer all next-clock register values to register outputs. */
*pp0 = p1; /* swap */
*pp1 = p0;
p0 = *pp0; /* fix pointers */
p1 = *pp1;
/* Update all next-clock register values */
/*
* Blend Unit Page 1
*
* This section contains input muxes, lerps, divide, and
* blend masking/bypass stuff.
*
*/
/* generate cycle signal */
p0->cycle = !((p1->cycle || p1->st_span) || !p1->ncyc);
/* delay cycle */
p0->cycle_d1 = p1->cycle;
/* choose and delay modeword */
p0->mode_p_r = p1->cycle ? p1->bl_p_sel_1_r : p1->bl_p_sel_0_r;
p0->mode_m_r = p1->cycle ? p1->bl_m_sel_1_r : p1->bl_m_sel_0_r;
p0->mode_a_r = p1->cycle ? p1->bl_a_sel_1_r : p1->bl_a_sel_0_r;
p0->mode_b_r = p1->cycle ? p1->bl_b_sel_1_r : p1->bl_b_sel_0_r;
/* choose between feedback path and CC pixel */
if(p1->cycle_d1)
{
mux_zero_r = (p1->blended_r >> 3) & 0xff; /* 0.11 -> .8 */
mux_zero_g = (p1->blended_g >> 3) & 0xff; /* 0.11 -> .8 */
mux_zero_b = (p1->blended_b >> 3) & 0xff; /* 0.11 -> .8 */
pixel_alpha = p1->pixel_a_d1;
}
else
{
mux_zero_r = p1->pixel_r;
mux_zero_g = p1->pixel_g;
mux_zero_b = p1->pixel_b;
pixel_alpha = p1->pixel_a;
}
p0->pixel_a_d1 = p1->pixel_a;
/* get mux P output */
p_mux_r = four_to_one(p1->mode_p_r, mux_zero_r, p1->mem_r, p1->blend_r, p1->fog_r);
p_mux_g = four_to_one(p1->mode_p_r, mux_zero_g, p1->mem_g, p1->blend_g, p1->fog_g);
p_mux_b = four_to_one(p1->mode_p_r, mux_zero_b, p1->mem_b, p1->blend_b, p1->fog_b);
m_mux_r = four_to_one(p1->mode_m_r, mux_zero_r, p1->mem_r, p1->blend_r, p1->fog_r);
m_mux_g = four_to_one(p1->mode_m_r, mux_zero_g, p1->mem_g, p1->blend_g, p1->fog_g);
m_mux_b = four_to_one(p1->mode_m_r, mux_zero_b, p1->mem_b, p1->blend_b, p1->fog_b);
a_mux_a = four_to_one(p1->mode_a_r, pixel_alpha>>3, p1->fog_a>>3, p1->shade_a>>3, ZERO);
b_mux_a = four_to_one(p1->mode_b_r, ~a_mux_a & 0x1f, p1->mem_a<<2, ONE_POINT_OH & 0x1f, ZERO);
if((p1->mode_a_r == 0) && (p1->mode_b_r == 0) && (pixel_alpha >= 0xff))
p0->bypass_bl = 1;
else
p0->bypass_bl = 0;
/* delay bypass signal */
p0->bypass_bl_d1 = p1->bypass_bl;
if(p1->mode_b_r != 1)
{
/* don't molest a, b */
norm_a = a_mux_a;
norm_b = b_mux_a;
}
else
{
/* jam 2 lsbs of a, b to be zero and normalize */
norm_a = normalize_a(a_mux_a, p1->norm_a);
norm_b = normalize_b(b_mux_a, p1->norm_b);
}
/* do numerator calc per component */
p0->blended_r = numerator_calc(p_mux_r, norm_a, m_mux_r, norm_b, p1->mode_b_r);
p0->blended_g = numerator_calc(p_mux_g, norm_a, m_mux_g, norm_b, p1->mode_b_r);
p0->blended_b = numerator_calc(p_mux_b, norm_a, m_mux_b, norm_b, p1->mode_b_r);
/* do denominator calc */
p0->denom = denominator_calc(norm_a, norm_b);
/* latch mux outputs */
p0->p_r = p_mux_r;
p0->p_g = p_mux_g;
p0->p_b = p_mux_b;
p0->m_r = m_mux_r;
p0->m_g = m_mux_g;
p0->m_b = m_mux_b;
/* do divide */
if(p1->denom)
{
p0->dividend_r = p1->blended_r / p1->denom;
p0->dividend_g = p1->blended_g / p1->denom;
p0->dividend_b = p1->blended_b / p1->denom;
}
else
{
p0->dividend_r = 0xff;
p0->dividend_g = 0xff;
p0->dividend_b = 0xff;
}
/* delay mux outputs while doing divide */
p0->p_r_d1 = p1->p_r;
p0->p_g_d1 = p1->p_g;
p0->p_b_d1 = p1->p_b;
p0->m_r_d1 = p1->m_r;
p0->m_g_d1 = p1->m_g;
p0->m_b_d1 = p1->m_b;
p0->blended_r_d1 = p1->blended_r >> 3;
p0->blended_g_d1 = p1->blended_g >> 3;
p0->blended_b_d1 = p1->blended_b >> 3;
p0->force_blend_d1 = p1->force_blend;
/* output muxes, blend masking */
if(p1->force_blend_d1)
{
span_r = p1->blended_r_d1;
span_g = p1->blended_g_d1;
span_b = p1->blended_b_d1;
}
else
{
span_r = p1->dividend_r;
span_g = p1->dividend_g;
span_b = p1->dividend_b;
}
if(p1->blend_en && !p1->bypass_bl_d1)
{
span_r = span_r;
span_g = span_g;
span_b = span_b;
}
else
{
span_r = p1->p_r_d1;
span_g = p1->p_g_d1;
span_b = p1->p_b_d1;
}
if(p1->color_on_cvg && !p1->cvg_wrap)
{
span_r = p1->m_r_d1;
span_g = p1->m_g_d1;
span_b = p1->m_b_d1;
}
/* output result */
p0->span_r = span_r;
p0->span_g = span_g;
p0->span_b = span_b;
/*
* Blend Unit Page 2
*
* This section contains pixel coverage mangelization logic
* Main outputs are pre_cvg_wrap, cvg_wrap, we_cvg, and the
* all important span_alpha.
*
*
*/
/* delay pixel coverage and memory alpha */
p0->pixel_cvg_d2 = p1->pixel_cvg;
if(p1->cycle_d1)
p0->pixel_cvg_d1 = p1->pixel_cvg_d2 & 0xf;
else
p0->pixel_cvg_d1 = p1->pixel_cvg & 0xf;
p0->mem_a_d1 = p1->mem_a;
p0->mem_a_d2 = p1->mem_a_d1;
/* generate coverage wrap bit */
pre_cvg_wrap = ((p1->pixel_cvg_d1 + p1->mem_a_d1) & 0x8)>0;
p0->cvg_wrap = pre_cvg_wrap;
if(pre_cvg_wrap && p1->z_mode == 1 && p1->in_front && p1->farther)
{
/* do interpenetration calc */
sx = (((p1->old_z>>p1->delta_z)) - ((p1->new_z>>p1->delta_z)))&0xF;
p0->zcvg = ((sx * p1->pixel_cvg_d1) >> 3) & 0xf;
}
else
{
p0->zcvg = p1->pixel_cvg_d1;
sx = 0xf;
}
/* generate coverage write enable */
we_cvg = p0->zcvg > 0;
/* calc span alpha */
pcvg = p1->cvg_dest & 2 ? 0 : p1->zcvg;
mcvg = !(p1->blend_en || (p1->cvg_dest & 1)) ? -1 : p1->mem_a_d2;
cvgsum = pcvg + mcvg;
if(p1->cvg_dest == 2)
p0->span_a = 0x7;
else if((cvgsum & 0x8) && !(p1->cvg_dest & 1))
p0->span_a = 0x7;
else
p0->span_a = cvgsum & 0x7;
/*
* Blend Unit Page 3
*
* This section contains depth buffering, blend enable generation,
* and write enable generation for depth and color.
*
* NOTE: This section is very order dependent so be careful
* when rearranging code.
*/
/* select source Z, dZ */
p0->z_source_d1 = p1->z_source_select;
new_z = p1->z_source_d1 ? (p1->prim_z << 3) & 0x3ffff : p1->st_z;
p0->new_z = new_z;
if(p1->z_source_select)
new_delta_z = p1->prim_delta_z;
else
{
/* do pixel delta z calc */
dzdx_t = (p1->dzdx & 0x8000) ? ~p1->dzdx & 0x7fff : p1->dzdx;
dzdy_t = (p1->dzdy & 0x8000) ? ~p1->dzdy & 0x7fff : p1->dzdy;
new_delta_z = quantize_2n(dzdx_t + dzdy_t);
}
p0->new_dz_d1 = new_delta_z; /* order important here */
p0->new_dz_d2 = p1->new_dz_d1;
new_delta_z = priority_encode(new_delta_z);
/* convert mem Z from float to fix */
p0->mem_z_d1 = decode_float(p1->mem_z);
/* unencode memory dZ */
p0->mem_dz_d1 = four_to_sixteen(p1->mem_z & 0xf);
/* make deltaz bigger if precision lost in floating point z neccessitates */
force_nearfar=0;
switch((memz_d1>>15) & 0xF) {
case 0:
if (p1->mem_dz_d1==0x8000) force_nearfar=1;
p1->mem_dz_d1 = MAX(p1->mem_dz_d1,four_to_sixteen(3))<<1;
if (p1->mem_dz_d1==0) p1->mem_dz_d1=0xFFFF;
break;
case 1:
if (p1->mem_dz_d1==0x8000) force_nearfar=1;
p1->mem_dz_d1 = MAX(p1->mem_dz_d1,four_to_sixteen(2))<<1;
if (p1->mem_dz_d1==0) p1->mem_dz_d1=0xFFFF;
break;
case 2:
if (p1->mem_dz_d1==0x8000) force_nearfar=1;
p1->mem_dz_d1 = MAX(p1->mem_dz_d1,four_to_sixteen(1))<<1;
if (p1->mem_dz_d1==0) p1->mem_dz_d1=0xFFFF;
break;
default:
break;
}
if (p0->mem_dz_d1>0x8000)
p0->mem_dz_d1=0xFFFF;
memz_d1 = p1->mem_z;
/* find norm a,b */
memory_delta_z = p1->mem_z & 0xf;
p0->norm_a = CLAMP(new_delta_z - memory_delta_z, 0, 4);
p0->norm_b = CLAMP(memory_delta_z - new_delta_z, 0, 4);
/* find span z */
span_z = fix_to_float(p1->new_z);
span_delta_z = priority_encode(p1->new_dz_d2);
p0->span_z = (span_z << 4) | span_delta_z;
/* find delta z, old z */
max_delta_z = MAX(p1->mem_dz_d1, p1->new_dz_d1);
p0->delta_z = priority_encode(max_delta_z);
/* p0->old_z = p1->mem_dz_d1 >> 3;*/
p0->old_z = p1->mem_z_d1;
/* Generate Flags */
p0->max_z = p1->mem_z_d1 == 0x3ffff;
p0->farther = ((int) new_z + ((int) max_delta_z << 3)) >= (int) p1->mem_z_d1;
p0->nearer = ((int) new_z - ((int) max_delta_z << 3)) <= (int) p1->mem_z_d1;
p0->in_front = new_z < p1->mem_z_d1;
if (force_nearfar) {
p0->farther = 1;
p0->nearer = 1;
}
/* Generate blend enable */
trans = (p1->z_mode == 2) && (p1->max_z || p1->in_front);
decal = (p1->z_mode == 3) && p1->nearer && p1->farther && !p1->max_z;
opaque_inter = ((pre_cvg_wrap ? p1->in_front : p1->nearer) || p1->max_z)
&& !(p1->z_mode & 2);
p0->blend_en = (!pre_cvg_wrap && p1->antialias_enable && p1->farther) || p1->force_blend;
/* write enables */
if(p1->antialias_enable)
{
p0->span_color_we_m1 = we_cvg && (trans || decal || opaque_inter || !p1->z_compare_enable);
p0->span_depth_we = p0->span_color_we_m1 && p1->z_update_enable;
}
else
{
p0->span_color_we_m1 = p1->mask15b && (trans || decal || opaque_inter || !p1->z_compare_enable);
p0->span_depth_we = p0->span_color_we_m1 && p1->z_update_enable;
}
p0->span_color_we = p1->span_color_we_m1;
} /* exec module */
/*
* Save clock
*/
p0->gclk_old = p1->gclk_old = save_clk;
}
/***************************************************************************
* bl_init() - required init function for blend unit
***************************************************************************/
void
bl_init(bl_t *p0, bl_t *p1)
{
p1->gclk = p0->gclk = 0;
p1->gclk_old = p0->gclk_old = 0;
}
#ifdef DUMP_ON
{
char *bl_dump_str;
if (bl_dump_str=getenv("BLENDER_DUMP")) {
if (!(sscanf(bl_dump_str,"%i",&bl_dump)))
bl_dump=0;
} else
bl_dump=0;
}
int verb,verb2;
#define VERBNUM 50
static int va[VERBNUM],vb[VERBNUM],vc[VERBNUM],vd[VERBNUM],ve[VERBNUM],vf[VERBNUM];
static int *v0=va,*v1=vb,*v2=vc,*v3=vd,*v4=ve,*v5=vf,*vt;
int i;
static int verbcount=-1;
verb=(bl_dump&1);
verb2=(bl_dump&2);
if (verb || verb2) {
if (!verbcount) for(i=0;i<VERBNUM;i++){v0[i]=0;v1[i]=0;v2[i]=0;v3[i]=0;v4[i]=0;v5[i]=0;}
v0[0]=verbcount++;
if (verb)
printf("#! {%d} ",v5[0]);
}
if (verb) {
v3[7]=p1->blended_r;
v3[8]=p1->blended_g;
v3[9]=p1->blended_b;
printf("mp_rgb\\.11=0x%03X, 0x%03X, 0x%03X ",v5[7],v5[8],v5[9]);
v3[10]=p1->denom;
printf("mp_c\\1.3=0x%01X ",v5[10]);
v3[4]=p0->dividend_r;
v3[5]=p0->dividend_g;
v3[6]=p0->dividend_b;
printf("dv\\.8=0x%02X, 0x%02X, 0x%02X ",v5[4],v5[5],v5[6]);
v4[1]=p0->span_r;
v4[2]=p0->span_g;
v4[3]=p0->span_b;
printf("span_rgb=0x%02X, 0x%02X, 0x%02X ",v5[1],v5[2],v5[3]);
v4[11]=p1->cvg_wrap;
printf("cvg_wrap=%d ",v5[11]);
v4[14]=(p1->color_on_cvg && !p1->cvg_wrap);
printf("coc=%d ",v5[14]);
v4[15]=p1->blend_en;
printf("bl_en=%d ",v5[15]);
v3[12]=opaque_inter;
printf("op_int=%d ",v5[12]);
v3[13]=p0->span_color_we_m1;
printf("clr_we=%d ",v5[13]);
v3[16]=we_cvg;
printf("we_cvg=%d ",v5[16]);
v4[17]=p1->zcvg;
printf("pcvgafter\\1.3=0x%01X ",v5[17]);
printf("\n");
printf("#! {%d} ",v5[0]);
v3[18]=p1->old_z;
v3[19]=p1->new_z;
v3[20]=p1->delta_z;
v2[34]=(max_delta_z << 3);
v2[35]=((int) p1->new_z) - ((int)(max_delta_z << 3));
v2[36]=((int) p1->new_z) + ((int)(max_delta_z << 3));
printf("oldz=0x%05X newz=0x%05X maxdz=0x%X maxdz\\16.3=0x%05X new-dz=0x%05X new+dz=0x%05X ",v5[18],v5[19],v5[20],v5[34],v5[35],v5[36]);
v3[21]=sx;
printf("sx\\1.3=0x%01X ",v5[21]);
v2[22]=p0->farther;
printf("farther=%d ",v5[22]);
v2[23]=p_mux_r;
v2[24]=m_mux_r;
v2[25]=norm_a;
v2[26]=norm_b;
printf("p_r\\0.8=0x%02X m_r\\0.8=0x%02X norm_a\\1.5=0x%02X norm_b\\0.5=0x%02X ",v5[23],v5[24],v5[25],v5[26]);
v2[27]=p1->norm_a;
v2[28]=p1->norm_b;
printf("norm_A(0-4)=%d norm_Bi(0-4)=%d ",v5[27],v5[28]);
v2[29]=a_mux_a;
v2[30]=b_mux_a;
printf("mux_a\\1.5=0x%02X mux_b\\.5=0x%02X ",v5[29],v5[30]);
printf("\n");
printf("#! {%d} ",v5[0]);
v4[33]=p1->cycle_d1;
printf("cycle=%d ",v5[33]);
vt=v5;v5=v4;v4=v3;v3=v2;v2=v1;v1=v0;v0=vt;
printf("\n");
}
if (verb2) {
static int pc2,pc3,pc4,pc5;
static int mc2,mc3,mc4,mc5;
static int wz5,wz4,wc5;
static int wv3,wv4,wv5;
static int at3,at4,at5;
static int au1,au2,au3,au4,au5;
static int as3,as4,as5;
static int c01,c02,c03,c04,c05;
static int c11,c12,c13,c14,c15;
static int pr4,pr5,pg4,pg5,pb4,pb5;
static int pxr5,pxr4,pxr3,pxr2;
static int pxg5,pxg4,pxg3,pxg2;
static int pxb5,pxb4,pxb3,pxb2;
printf("bl[%d]: ",verbcount);
pc5=pc4;pc4=pc3;pc3=pc2;pc2=p1->pixel_cvg_d1;
printf("p_cvg=%X ",pc5);
mc5=mc4;mc4=mc3;mc3=mc2;mc2=p1->mem_a;
printf("m_cvg=%X ",mc5);
printf("sp_a=%X ",p1->span_a);
printf("sp_b:g:r=%02X%02X%02X ",
p1->span_b,p1->span_g,p1->span_r);
wz5=wz4;wz4=p1->span_depth_we;
wc5=p1->span_color_we;
printf("we_c:z=%d%d ",wc5,wz5);
wv5=wv4;wv4=wv3;wv3=we_cvg;
printf("we_cvg=%d ",wv5);
au5=au4;
au4=au3;
au3=au2;
au2=au1;
au1= p1->z_source_select << (0);
as5=as4;
as4=as3;
as3= (p1->z_mode << (0))
| (p1->z_update_enable << (4*1))
| (p1->z_compare_enable << (4*2))
| (p1->antialias_enable << (4*3));
at5=at4;
at4=at3 | (p1->color_on_cvg << (4*2))
| (p1->cvg_dest << (4*3));
at3= (p1->mask15b )
| (p1->force_blend << (4*1));
printf("Zss::M15=%01X%04X%04X ",au5,as5,at5);
c05=c04;c04=c03;c03=c02=c02=c01;
c15=c14;c14=c13;c13=c12=c12=c11;
c01= (p1->bl_p_sel_0_r << 12)
| (p1->bl_m_sel_0_r << 8)
| (p1->bl_a_sel_0_r << 4)
| (p1->bl_b_sel_0_r << 0);
c11= (p1->bl_p_sel_1_r << 12)
| (p1->bl_m_sel_1_r << 8)
| (p1->bl_a_sel_1_r << 4)
| (p1->bl_b_sel_1_r << 0);
printf("pmab=%04X%04X ",c05,c15);
pr5=pr4;pr4=p1->p_r_d1;
pg5=pg4;pg4=p1->p_g_d1;
pb5=pb4;pb4=p1->p_b_d1;
printf("pmux=%x,%x,%x ",pr5,pg5,pb5);
pxr5=pxr4;pxr4=pxr3;pxr3=pxr2;pxr2=p1->pixel_r;
pxg5=pxg4;pxg4=pxg3;pxg3=pxg2;pxg2=p1->pixel_g;
pxb5=pxb4;pxb4=pxb3;pxb3=pxb2;pxb2=p1->pixel_b;
printf("pix=%x,%x,%x ",pxr5,pxg5,pxb5);
printf("\n");
}
#endif /* DUMP_ON */