Changeset 3598 for trunk/src/opengl/mesa/3dfx/fxddspan.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/3dfx/fxddspan.c
r2938 r3598 3 3 /* 4 4 * Mesa 3-D graphics library 5 * Version: 3. 15 * Version: 3.3 6 6 * 7 7 * Copyright (C) 1999 Brian Paul All Rights Reserved. … … 65 65 66 66 67 #if !defined(FXMESA_USE_ARGB) 67 #if !defined(FXMESA_USE_ARGB) 68 68 69 69 … … 71 71 72 72 static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, 73 FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, 74 FxU32 src_width, FxU32 src_height, FxI32 src_stride, 75 void *src_data); 76 77 FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, 78 FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, 79 FxU32 src_width, FxU32 src_height, FxI32 src_stride, 80 void *src_data) 81 { 82 int i, x, w; 73 FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, 74 FxU32 src_width, FxU32 src_height, FxI32 src_stride, 75 void *src_data) 76 { 77 int i, x, w, srcElt; 83 78 void *data; 84 79 85 80 if (src_width==1 && src_height==1) { /* Easy case writing a point */ 86 81 for (i=0; i<fxMesa->numClipRects; i++) { 87 if ((dst_x>=fxMesa->pClipRects[i].x1) && 88 89 (dst_y>=fxMesa->pClipRects[i].y1) && 90 91 92 src_width, src_height, src_stride, src_data);93 82 if ((dst_x>=fxMesa->pClipRects[i].x1) && 83 (dst_x<fxMesa->pClipRects[i].x2) && 84 (dst_y>=fxMesa->pClipRects[i].y1) && 85 (dst_y<fxMesa->pClipRects[i].y2)) { 86 FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format, 87 1, 1, src_stride, src_data); 88 return GL_TRUE; 94 89 } 95 90 } 96 91 } else if (src_height==1) { /* Writing a span */ 92 if (src_format==GR_LFB_SRC_FMT_8888) srcElt=4; 93 else if (src_format==GR_LFB_SRC_FMT_ZA16) srcElt=2; 94 else { 95 fprintf(stderr, "Unknown src_format passed to writeRegionClipped\n"); 96 return GL_FALSE; 97 } 97 98 for (i=0; i<fxMesa->numClipRects; i++) { 98 99 if (dst_y>=fxMesa->pClipRects[i].y1 && dst_y<fxMesa->pClipRects[i].y2) { 99 100 101 data=((char*)src_data)+2*(dst_x-x);102 103 104 105 106 107 108 109 110 111 FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, src_height,112 100 if (dst_x<fxMesa->pClipRects[i].x1) { 101 x=fxMesa->pClipRects[i].x1; 102 data=((char*)src_data)+srcElt*(dst_x-x); 103 w=src_width-(x-dst_x); 104 } else { 105 x=dst_x; 106 data=src_data; 107 w=src_width; 108 } 109 if (x+w>fxMesa->pClipRects[i].x2) { 110 w=fxMesa->pClipRects[i].x2-x; 111 } 112 FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, 1, 113 src_stride, data); 113 114 } 114 115 } … … 121 122 #else 122 123 123 #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) 124 #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ 124 125 FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) 125 126 … … 129 130 /* KW: Rearranged the args in the call to grLfbWriteRegion(). 130 131 */ 131 #define LFB_WRITE_SPAN_MESA(dst_buffer, 132 dst_x,\133 dst_y,\134 src_width,\135 src_stride,\136 src_data)\137 writeRegionClipped(fxMesa, dst_buffer, 138 dst_x,\139 dst_y,\140 GR_LFB_SRC_FMT_8888,\141 src_width,\142 1,\143 src_stride,\144 src_data)\132 #define LFB_WRITE_SPAN_MESA(dst_buffer, \ 133 dst_x, \ 134 dst_y, \ 135 src_width, \ 136 src_stride, \ 137 src_data) \ 138 writeRegionClipped(fxMesa, dst_buffer, \ 139 dst_x, \ 140 dst_y, \ 141 GR_LFB_SRC_FMT_8888, \ 142 src_width, \ 143 1, \ 144 src_stride, \ 145 src_data) \ 145 146 146 147 147 148 #else /* !defined(FXMESA_USE_RGBA) */ 148 149 149 #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) 150 #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ 150 151 FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) 151 152 152 153 153 #define MESACOLOR_TO_ARGB(c) ( 154 ( ((unsigned int)(c[ACOMP]))<<24 ) | 155 ( ((unsigned int)(c[RCOMP]))<<16 ) | 156 ( ((unsigned int)(c[GCOMP]))<<8 ) | 154 #define MESACOLOR_TO_ARGB(c) ( \ 155 ( ((unsigned int)(c[ACOMP]))<<24 ) | \ 156 ( ((unsigned int)(c[RCOMP]))<<16 ) | \ 157 ( ((unsigned int)(c[GCOMP]))<<8 ) | \ 157 158 ( (unsigned int)(c[BCOMP])) ) 158 159 inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer, 160 FxU32 dst_x, 161 FxU32 dst_y, 162 163 FxI32 src_stride, 164 159 160 inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer, 161 FxU32 dst_x, 162 FxU32 dst_y, 163 FxU32 src_width, 164 FxI32 src_stride, 165 void *src_data ) 165 166 { 166 167 /* Covert to ARGB */ … … 168 169 GLuint argb[MAX_WIDTH]; 169 170 int i; 170 171 171 172 for (i = 0; i < src_width; i++) 172 173 { … … 174 175 } 175 176 writeRegionClipped( /*fxMesa,*/ NULL, dst_buffer, 176 177 178 179 180 181 182 183 } 184 177 dst_x, 178 dst_y, 179 GR_LFB_SRC_FMT_8888, 180 src_width, 181 1, 182 src_stride, 183 (void*)argb); 184 } 185 185 186 #endif /* !defined(FXMESA_USE_RGBA) */ 186 187 … … 191 192 192 193 193 static void fxDDWriteRGBASpan(const GLcontext *ctx, 194 static void fxDDWriteRGBASpan(const GLcontext *ctx, 194 195 GLuint n, GLint x, GLint y, 195 196 const GLubyte rgba[][4], const GLubyte mask[]) … … 197 198 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 198 199 GLuint i; 199 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 200 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 200 201 201 202 if (MESA_VERBOSE&VERBOSE_DRIVER) { … … 209 210 for (i=0;i<n;i++) { 210 211 if (mask[i]) { 211 ++span; 212 ++span; 212 213 } else { 213 214 if (span > 0) { … … 228 229 229 230 230 static void fxDDWriteRGBSpan(const GLcontext *ctx, 231 static void fxDDWriteRGBSpan(const GLcontext *ctx, 231 232 GLuint n, GLint x, GLint y, 232 233 const GLubyte rgb[][3], const GLubyte mask[]) … … 278 279 279 280 280 static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, 281 static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, 281 282 GLuint n, GLint x, GLint y, 282 283 const GLubyte mask[]) … … 324 325 325 326 326 static void fxDDReadRGBASpan(const GLcontext *ctx, 327 static void fxDDReadRGBASpan(const GLcontext *ctx, 327 328 GLuint n, GLint x, GLint y, GLubyte rgba[][4]) 328 329 { … … 419 420 /************************************************************************/ 420 421 421 void fxDDReadDepthSpanFloat(GLcontext *ctx, 422 GLuint n, GLint x, GLint y, GLfloat depth[]) 423 { 424 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 425 GLuint i; 426 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 427 GLushort data[MAX_WIDTH]; 428 429 if (MESA_VERBOSE&VERBOSE_DRIVER) { 430 fprintf(stderr,"fxmesa: fxDDReadDepthSpanFloat(...)\n"); 431 } 432 433 x+=fxMesa->x_offset; 434 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data); 435 436 /* 437 convert the read values to float values [0.0 .. 1.0]. 438 */ 439 for(i=0;i<n;i++) 440 depth[i]=data[i]/65535.0f; 441 } 442 443 void fxDDReadDepthSpanInt(GLcontext *ctx, 444 GLuint n, GLint x, GLint y, GLdepth depth[]) 445 { 446 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 447 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 448 449 if (MESA_VERBOSE&VERBOSE_DRIVER) { 450 fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n"); 451 } 452 453 x+=fxMesa->x_offset; 454 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth); 455 } 456 457 GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx, 458 GLuint n, GLint x, GLint y, const GLdepth z[], 459 GLubyte mask[]) 460 { 461 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 462 GLushort depthdata[MAX_WIDTH]; 463 GLdepth *zptr=depthdata; 464 GLubyte *m=mask; 465 GLuint i; 466 GLuint passed=0; 467 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 468 469 if (MESA_VERBOSE&VERBOSE_DRIVER) { 470 fprintf(stderr,"fxmesa: fxDDDepthTestSpanGeneric(...)\n"); 471 } 472 473 x+=fxMesa->x_offset; 474 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata); 475 476 /* switch cases ordered from most frequent to less frequent */ 477 switch (ctx->Depth.Func) { 478 case GL_LESS: 479 if (ctx->Depth.Mask) { 480 /* Update Z buffer */ 481 for (i=0; i<n; i++,zptr++,m++) { 482 if (*m) { 483 if (z[i] < *zptr) { 484 /* pass */ 485 *zptr = z[i]; 486 passed++; 487 } else { 488 /* fail */ 489 *m = 0; 490 } 491 } 422 void fxDDWriteDepthSpan(GLcontext *ctx, 423 GLuint n, GLint x, GLint y, const GLdepth depth[], 424 const GLubyte mask[]) 425 { 426 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 427 GLint bottom = fxMesa->height + fxMesa->y_offset - 1; 428 429 if (MESA_VERBOSE & VERBOSE_DRIVER) { 430 fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n"); 431 } 432 433 x += fxMesa->x_offset; 434 435 if (mask) { 436 GLint i; 437 for (i = 0; i < n; i++) { 438 if (mask[i]) { 439 GLshort d = depth[i]; 440 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom - y, 441 GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d); 492 442 } 493 } else { 494 /* Don't update Z buffer */ 495 for (i=0; i<n; i++,zptr++,m++) { 496 if (*m) { 497 if (z[i] < *zptr) { 498 /* pass */ 499 passed++; 500 } else { 501 *m = 0; 502 } 503 } 504 } 505 } 506 break; 507 case GL_LEQUAL: 508 if (ctx->Depth.Mask) { 509 /* Update Z buffer */ 510 for (i=0;i<n;i++,zptr++,m++) { 511 if (*m) { 512 if (z[i] <= *zptr) { 513 *zptr = z[i]; 514 passed++; 515 } else { 516 *m = 0; 517 } 518 } 519 } 520 } else { 521 /* Don't update Z buffer */ 522 for (i=0;i<n;i++,zptr++,m++) { 523 if (*m) { 524 if (z[i] <= *zptr) { 525 /* pass */ 526 passed++; 527 } else { 528 *m = 0; 529 } 530 } 531 } 532 } 533 break; 534 case GL_GEQUAL: 535 if (ctx->Depth.Mask) { 536 /* Update Z buffer */ 537 for (i=0;i<n;i++,zptr++,m++) { 538 if (*m) { 539 if (z[i] >= *zptr) { 540 *zptr = z[i]; 541 passed++; 542 } else { 543 *m = 0; 544 } 545 } 546 } 547 } else { 548 /* Don't update Z buffer */ 549 for (i=0;i<n;i++,zptr++,m++) { 550 if (*m) { 551 if (z[i] >= *zptr) { 552 /* pass */ 553 passed++; 554 } else { 555 *m = 0; 556 } 557 } 558 } 559 } 560 break; 561 case GL_GREATER: 562 if (ctx->Depth.Mask) { 563 /* Update Z buffer */ 564 for (i=0;i<n;i++,zptr++,m++) { 565 if (*m) { 566 if (z[i] > *zptr) { 567 *zptr = z[i]; 568 passed++; 569 } else { 570 *m = 0; 571 } 572 } 573 } 574 } else { 575 /* Don't update Z buffer */ 576 for (i=0;i<n;i++,zptr++,m++) { 577 if (*m) { 578 if (z[i] > *zptr) { 579 /* pass */ 580 passed++; 581 } else { 582 *m = 0; 583 } 584 } 585 } 586 } 587 break; 588 case GL_NOTEQUAL: 589 if (ctx->Depth.Mask) { 590 /* Update Z buffer */ 591 for (i=0;i<n;i++,zptr++,m++) { 592 if (*m) { 593 if (z[i] != *zptr) { 594 *zptr = z[i]; 595 passed++; 596 } else { 597 *m = 0; 598 } 599 } 600 } 601 } else { 602 /* Don't update Z buffer */ 603 for (i=0;i<n;i++,zptr++,m++) { 604 if (*m) { 605 if (z[i] != *zptr) { 606 /* pass */ 607 passed++; 608 } else { 609 *m = 0; 610 } 611 } 612 } 613 } 614 break; 615 case GL_EQUAL: 616 if (ctx->Depth.Mask) { 617 /* Update Z buffer */ 618 for (i=0;i<n;i++,zptr++,m++) { 619 if (*m) { 620 if (z[i] == *zptr) { 621 *zptr = z[i]; 622 passed++; 623 } else { 624 *m =0; 625 } 626 } 627 } 628 } else { 629 /* Don't update Z buffer */ 630 for (i=0;i<n;i++,zptr++,m++) { 631 if (*m) { 632 if (z[i] == *zptr) { 633 /* pass */ 634 passed++; 635 } else { 636 *m =0; 637 } 638 } 639 } 640 } 641 break; 642 case GL_ALWAYS: 643 if (ctx->Depth.Mask) { 644 /* Update Z buffer */ 645 for (i=0;i<n;i++,zptr++,m++) { 646 if (*m) { 647 *zptr = z[i]; 648 passed++; 649 } 650 } 651 } else { 652 /* Don't update Z buffer or mask */ 653 passed = n; 654 } 655 break; 656 case GL_NEVER: 657 for (i=0;i<n;i++) { 658 mask[i] = 0; 659 } 660 break; 661 default: 662 ; 663 } /*switch*/ 664 665 if(passed) 666 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata); 667 668 return passed; 669 } 670 671 void fxDDDepthTestPixelsGeneric(GLcontext* ctx, 672 GLuint n, const GLint x[], const GLint y[], 673 const GLdepth z[], GLubyte mask[]) 674 { 675 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 676 GLdepth zval; 677 GLuint i; 678 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 679 680 if (MESA_VERBOSE&VERBOSE_DRIVER) { 681 fprintf(stderr,"fxmesa: fxDDDepthTestPixelsGeneric(...)\n"); 682 } 683 684 /* switch cases ordered from most frequent to less frequent */ 685 switch (ctx->Depth.Func) { 686 case GL_LESS: 687 if (ctx->Depth.Mask) { 688 /* Update Z buffer */ 689 for (i=0; i<n; i++) { 690 if (mask[i]) { 691 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 692 if (z[i] < zval) { 693 /* pass */ 694 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 695 } else { 696 /* fail */ 697 mask[i] = 0; 698 } 699 } 700 } 701 } else { 702 /* Don't update Z buffer */ 703 for (i=0; i<n; i++) { 704 if (mask[i]) { 705 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 706 if (z[i] < zval) { 707 /* pass */ 708 } 709 else { 710 /* fail */ 711 mask[i] = 0; 712 } 713 } 714 } 715 } 716 break; 717 case GL_LEQUAL: 718 if (ctx->Depth.Mask) { 719 /* Update Z buffer */ 720 for (i=0; i<n; i++) { 721 if (mask[i]) { 722 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 723 if (z[i] <= zval) { 724 /* pass */ 725 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 726 } else { 727 /* fail */ 728 mask[i] = 0; 729 } 730 } 731 } 732 } else { 733 /* Don't update Z buffer */ 734 for (i=0; i<n; i++) { 735 if (mask[i]) { 736 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 737 if (z[i] <= zval) { 738 /* pass */ 739 } else { 740 /* fail */ 741 mask[i] = 0; 742 } 743 } 744 } 745 } 746 break; 747 case GL_GEQUAL: 748 if (ctx->Depth.Mask) { 749 /* Update Z buffer */ 750 for (i=0; i<n; i++) { 751 if (mask[i]) { 752 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 753 if (z[i] >= zval) { 754 /* pass */ 755 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 756 } else { 757 /* fail */ 758 mask[i] = 0; 759 } 760 } 761 } 762 } else { 763 /* Don't update Z buffer */ 764 for (i=0; i<n; i++) { 765 if (mask[i]) { 766 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 767 if (z[i] >= zval) { 768 /* pass */ 769 } else { 770 /* fail */ 771 mask[i] = 0; 772 } 773 } 774 } 775 } 776 break; 777 case GL_GREATER: 778 if (ctx->Depth.Mask) { 779 /* Update Z buffer */ 780 for (i=0; i<n; i++) { 781 if (mask[i]) { 782 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 783 if (z[i] > zval) { 784 /* pass */ 785 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 786 } else { 787 /* fail */ 788 mask[i] = 0; 789 } 790 } 791 } 792 } else { 793 /* Don't update Z buffer */ 794 for (i=0; i<n; i++) { 795 if (mask[i]) { 796 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 797 if (z[i] > zval) { 798 /* pass */ 799 } else { 800 /* fail */ 801 mask[i] = 0; 802 } 803 } 804 } 805 } 806 break; 807 case GL_NOTEQUAL: 808 if (ctx->Depth.Mask) { 809 /* Update Z buffer */ 810 for (i=0; i<n; i++) { 811 if (mask[i]) { 812 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 813 if (z[i] != zval) { 814 /* pass */ 815 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 816 } else { 817 /* fail */ 818 mask[i] = 0; 819 } 820 } 821 } 822 } else { 823 /* Don't update Z buffer */ 824 for (i=0; i<n; i++) { 825 if (mask[i]) { 826 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 827 if (z[i] != zval) { 828 /* pass */ 829 } 830 else { 831 /* fail */ 832 mask[i] = 0; 833 } 834 } 835 } 836 } 837 break; 838 case GL_EQUAL: 839 if (ctx->Depth.Mask) { 840 /* Update Z buffer */ 841 for (i=0; i<n; i++) { 842 if (mask[i]) { 843 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 844 if (z[i] == zval) { 845 /* pass */ 846 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 847 } else { 848 /* fail */ 849 mask[i] = 0; 850 } 851 } 852 } 853 } else { 854 /* Don't update Z buffer */ 855 for (i=0; i<n; i++) { 856 if (mask[i]) { 857 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 858 if (z[i] == zval) { 859 /* pass */ 860 } else { 861 /* fail */ 862 mask[i] = 0; 863 } 864 } 865 } 866 } 867 break; 868 case GL_ALWAYS: 869 if (ctx->Depth.Mask) { 870 /* Update Z buffer */ 871 for (i=0; i<n; i++) { 872 if (mask[i]) { 873 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 874 } 875 } 876 } else { 877 /* Don't update Z buffer or mask */ 878 } 879 break; 880 case GL_NEVER: 881 /* depth test never passes */ 882 for (i=0;i<n;i++) { 883 mask[i] = 0; 884 } 885 break; 886 default: 887 ; 888 } /*switch*/ 889 } 443 } 444 } 445 else { 446 GLushort depth16[MAX_WIDTH]; 447 GLint i; 448 for (i = 0; i < n; i++) { 449 depth16[i] = depth[i]; 450 } 451 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom - y, 452 GR_LFB_SRC_FMT_ZA16, n, 1, 0, (void *) depth16); 453 } 454 } 455 456 457 void fxDDReadDepthSpan(GLcontext *ctx, 458 GLuint n, GLint x, GLint y, GLdepth depth[]) 459 { 460 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 461 GLint bottom = fxMesa->height + fxMesa->y_offset - 1; 462 GLushort depth16[MAX_WIDTH]; 463 GLuint i; 464 465 if (MESA_VERBOSE & VERBOSE_DRIVER) { 466 fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n"); 467 } 468 469 x += fxMesa->x_offset; 470 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16); 471 for (i = 0; i < n; i++) { 472 depth[i] = depth16[i]; 473 } 474 } 475 476 477 478 void fxDDWriteDepthPixels(GLcontext *ctx, 479 GLuint n, const GLint x[], const GLint y[], 480 const GLdepth depth[], const GLubyte mask[]) 481 { 482 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 483 GLint bottom = fxMesa->height + fxMesa->y_offset - 1; 484 GLuint i; 485 486 if (MESA_VERBOSE & VERBOSE_DRIVER) { 487 fprintf(stderr, "fxmesa: fxDDWriteDepthPixels(...)\n"); 488 } 489 490 for (i = 0; i < n; i++) { 491 if (mask[i]) { 492 int xpos = x[i] + fxMesa->x_offset; 493 int ypos = bottom - y[i]; 494 GLushort d = depth[i]; 495 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos, 496 GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d); 497 } 498 } 499 } 500 501 502 void fxDDReadDepthPixels(GLcontext *ctx, GLuint n, 503 const GLint x[], const GLint y[], GLdepth depth[]) 504 { 505 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 506 GLint bottom = fxMesa->height + fxMesa->y_offset - 1; 507 GLuint i; 508 509 if (MESA_VERBOSE & VERBOSE_DRIVER) { 510 fprintf(stderr, "fxmesa: fxDDReadDepthPixels(...)\n"); 511 } 512 513 for (i = 0; i < n; i++) { 514 int xpos = x[i] + fxMesa->x_offset; 515 int ypos = bottom - y[i]; 516 GLushort d; 517 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, xpos, ypos, 1, 1, 0, &d); 518 depth[i] = d; 519 } 520 } 521 522 523 890 524 891 525 /************************************************************************/
Note:
See TracChangeset
for help on using the changeset viewer.