Changeset 3598 for trunk/src/opengl/mesa/span.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/span.c
r2938 r3598 1 /* $Id: span.c,v 1. 1 2000-02-29 00:50:10 sandervlExp $ */1 /* $Id: span.c,v 1.2 2000-05-23 20:40:53 jeroen Exp $ */ 2 2 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. … … 26 26 27 27 28 29 30 31 28 /* 32 29 * pixel span rasterization: 33 * These functions simulatethe rasterization pipeline.30 * These functions implement the rasterization pipeline. 34 31 */ 35 32 … … 38 35 #include "all.h" 39 36 #else 40 #ifndef XFree86Server 41 #include <assert.h> 42 #include <string.h> 43 #else 44 #include "GL/xf86glx.h" 45 #endif 37 #include "glheader.h" 46 38 #include "alpha.h" 47 39 #include "alphabuf.h" … … 52 44 #include "macros.h" 53 45 #include "masking.h" 46 #include "mem.h" 54 47 #include "scissor.h" 55 48 #include "span.h" … … 75 68 for (i=0;i<n;i++) { 76 69 if ((m & stipple)==0) { 77 70 mask[i] = 0; 78 71 } 79 72 m = m >> 1; 80 73 if (m==0) { 81 74 m = 0x80000000; 82 75 } 83 76 } … … 97 90 98 91 /* Clip to top and bottom */ 99 if (y <0 || y>=ctx->Buffer->Height) {92 if (y < 0 || y >= ctx->DrawBuffer->Height) { 100 93 return 0; 101 94 } 102 95 103 96 /* Clip to left and right */ 104 if (x >=0 && x+n<=ctx->Buffer->Width) {97 if (x >= 0 && x + n <= ctx->DrawBuffer->Width) { 105 98 /* no clipping needed */ 106 99 return 1; 107 100 } 108 else if (x +n<=0) {101 else if (x + n <= 0) { 109 102 /* completely off left side */ 110 103 return 0; 111 104 } 112 else if (x >=ctx->Buffer->Width) {105 else if (x >= ctx->DrawBuffer->Width) { 113 106 /* completely off right side */ 114 107 return 0; … … 117 110 /* clip-test each pixel, this could be done better */ 118 111 for (i=0;i<n;i++) { 119 if (x +i<0 || x+i>=ctx->Buffer->Width) {112 if (x + i < 0 || x + i >= ctx->DrawBuffer->Width) { 120 113 mask[i] = 0; 121 114 } … … 146 139 147 140 if (bufferBit == FRONT_LEFT_BIT) 148 ( *ctx->Driver.SetBuffer)( ctx, GL_FRONT_LEFT);141 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); 149 142 else if (bufferBit == FRONT_RIGHT_BIT) 150 ( *ctx->Driver.SetBuffer)( ctx, GL_FRONT_RIGHT);143 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); 151 144 else if (bufferBit == BACK_LEFT_BIT) 152 ( *ctx->Driver.SetBuffer)( ctx, GL_BACK_LEFT);145 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); 153 146 else 154 ( *ctx->Driver.SetBuffer)( ctx, GL_BACK_RIGHT);147 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); 155 148 156 149 /* make copy of incoming indexes */ … … 167 160 168 161 /* restore default dest buffer */ 169 (void) (*ctx->Driver.Set Buffer)( ctx, ctx->Color.DriverDrawBuffer);162 (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer); 170 163 } 171 164 … … 183 176 void gl_write_index_span( GLcontext *ctx, 184 177 GLuint n, GLint x, GLint y, const GLdepth z[], 185 178 GLuint indexIn[], GLenum primitive ) 186 179 { 187 180 GLubyte mask[MAX_WIDTH]; … … 194 187 if ((ctx->RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { 195 188 if (clip_span(ctx,n,x,y,mask)==0) { 196 189 return; 197 190 } 198 191 } … … 210 203 /* Per-pixel fog */ 211 204 if (ctx->Fog.Enabled && (primitive==GL_BITMAP || ctx->FogMode == FOG_FRAGMENT)) { 212 gl_fog_ci_pixels( ctx, n, z, index );205 _mesa_fog_ci_pixels( ctx, n, z, index ); 213 206 } 214 207 … … 216 209 if (ctx->Scissor.Enabled) { 217 210 if (gl_scissor_span( ctx, n, x, y, mask )==0) { 218 211 return; 219 212 } 220 213 } … … 227 220 if (ctx->Stencil.Enabled) { 228 221 /* first stencil test */ 229 if (gl_stencil_span( ctx, n, x, y, mask )==0) { 230 return; 231 } 232 /* depth buffering w/ stencil */ 233 gl_depth_stencil_span( ctx, n, x, y, z, mask ); 222 if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { 223 return; 224 } 234 225 } 235 226 else if (ctx->Depth.Test) { 236 227 /* regular depth testing */ 237 if ((*ctx->Driver.DepthTestSpan)( ctx, n, x, y, z, mask )==0) return; 238 } 228 if (_mesa_depth_test_span( ctx, n, x, y, z, mask )==0) return; 229 } 230 231 /* if we get here, something passed the depth test */ 232 ctx->OcclusionResult = GL_TRUE; 239 233 240 234 if (ctx->RasterMask & MULTI_DRAW_BIT) { … … 261 255 void gl_write_monoindex_span( GLcontext *ctx, 262 256 GLuint n, GLint x, GLint y, const GLdepth z[], 263 257 GLuint index, GLenum primitive ) 264 258 { 265 259 GLubyte mask[MAX_WIDTH]; … … 271 265 if ((ctx->RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { 272 266 if (clip_span( ctx, n, x, y, mask)==0) { 273 267 return; 274 268 } 275 269 } … … 278 272 if (ctx->Scissor.Enabled) { 279 273 if (gl_scissor_span( ctx, n, x, y, mask )==0) { 280 274 return; 281 275 } 282 276 } … … 289 283 if (ctx->Stencil.Enabled) { 290 284 /* first stencil test */ 291 if (gl_stencil_span( ctx, n, x, y, mask )==0) { 292 return; 293 } 294 /* depth buffering w/ stencil */ 295 gl_depth_stencil_span( ctx, n, x, y, z, mask ); 285 if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { 286 return; 287 } 296 288 } 297 289 else if (ctx->Depth.Test) { 298 290 /* regular depth testing */ 299 if ((*ctx->Driver.DepthTestSpan)( ctx, n, x, y, z, mask )==0) return; 300 } 291 if (_mesa_depth_test_span( ctx, n, x, y, z, mask )==0) return; 292 } 293 294 /* if we get here, something passed the depth test */ 295 ctx->OcclusionResult = GL_TRUE; 301 296 302 297 if (ctx->Color.DrawBuffer == GL_NONE) { … … 310 305 GLuint indexes[MAX_WIDTH]; 311 306 for (i=0;i<n;i++) { 312 307 indexes[i] = index; 313 308 } 314 309 315 310 if (ctx->Fog.Enabled && (primitive==GL_BITMAP || ctx->FogMode==FOG_FRAGMENT)) { 316 gl_fog_ci_pixels( ctx, n, z, indexes );311 _mesa_fog_ci_pixels( ctx, n, z, indexes ); 317 312 } 318 313 319 314 if (ctx->Color.SWLogicOpEnabled) { 320 315 gl_logicop_ci_span( ctx, n, x, y, indexes, mask ); 321 316 } 322 317 … … 379 374 380 375 if (bufferBit == FRONT_LEFT_BIT) { 381 ( *ctx->Driver.SetBuffer)( ctx, GL_FRONT_LEFT);382 ctx-> Buffer->Alpha = ctx->Buffer->FrontLeftAlpha;376 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); 377 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontLeftAlpha; 383 378 } 384 379 else if (bufferBit == FRONT_RIGHT_BIT) { 385 ( *ctx->Driver.SetBuffer)( ctx, GL_FRONT_RIGHT);386 ctx-> Buffer->Alpha = ctx->Buffer->FrontRightAlpha;380 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); 381 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontRightAlpha; 387 382 } 388 383 else if (bufferBit == BACK_LEFT_BIT) { 389 ( *ctx->Driver.SetBuffer)( ctx, GL_BACK_LEFT);390 ctx-> Buffer->Alpha = ctx->Buffer->BackLeftAlpha;384 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); 385 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackLeftAlpha; 391 386 } 392 387 else { 393 ( *ctx->Driver.SetBuffer)( ctx, GL_BACK_RIGHT);394 ctx-> Buffer->Alpha = ctx->Buffer->BackRightAlpha;388 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); 389 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackRightAlpha; 395 390 } 396 391 … … 402 397 } 403 398 else if (ctx->Color.BlendEnabled) { 404 gl_blend_span( ctx, n, x, y, rgbaTmp, mask );399 _mesa_blend_span( ctx, n, x, y, rgbaTmp, mask ); 405 400 } 406 401 if (ctx->Color.SWmasking) { … … 409 404 410 405 (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, 411 406 (const GLubyte (*)[4]) rgbaTmp, mask ); 412 407 if (ctx->RasterMask & ALPHABUF_BIT) { 413 408 gl_write_alpha_span( ctx, n, x, y, 414 409 (const GLubyte (*)[4])rgbaTmp, mask ); 415 410 } 416 411 } … … 418 413 419 414 /* restore default dest buffer */ 420 (void) (*ctx->Driver.Set Buffer)( ctx, ctx->Color.DriverDrawBuffer );415 (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer ); 421 416 } 422 417 … … 439 434 if ((ctx->RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { 440 435 if (clip_span( ctx,n,x,y,mask)==0) { 441 436 return; 442 437 } 443 438 write_all = GL_FALSE; … … 456 451 /* Per-pixel fog */ 457 452 if (ctx->Fog.Enabled && (primitive==GL_BITMAP || ctx->FogMode==FOG_FRAGMENT)) { 458 gl_fog_rgba_pixels( ctx, n, z, rgba );453 _mesa_fog_rgba_pixels( ctx, n, z, rgba ); 459 454 } 460 455 … … 462 457 if (ctx->Scissor.Enabled) { 463 458 if (gl_scissor_span( ctx, n, x, y, mask )==0) { 464 459 return; 465 460 } 466 461 write_all = GL_FALSE; … … 475 470 /* Do the alpha test */ 476 471 if (ctx->Color.AlphaEnabled) { 477 if ( gl_alpha_test( ctx, n, (const GLubyte (*)[4]) rgba, mask )==0) {478 472 if (_mesa_alpha_test( ctx, n, (const GLubyte (*)[4]) rgba, mask )==0) { 473 return; 479 474 } 480 475 write_all = GL_FALSE; … … 483 478 if (ctx->Stencil.Enabled) { 484 479 /* first stencil test */ 485 if (gl_stencil_span( ctx, n, x, y, mask )==0) { 486 return; 487 } 488 /* depth buffering w/ stencil */ 489 gl_depth_stencil_span( ctx, n, x, y, z, mask ); 480 if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { 481 return; 482 } 490 483 write_all = GL_FALSE; 491 484 } 492 485 else if (ctx->Depth.Test) { 493 486 /* regular depth testing */ 494 GLuint m = (*ctx->Driver.DepthTestSpan)( ctx, n, x, y, z, mask );487 GLuint m = _mesa_depth_test_span( ctx, n, x, y, z, mask ); 495 488 if (m==0) { 496 489 return; … … 501 494 } 502 495 496 /* if we get here, something passed the depth test */ 497 ctx->OcclusionResult = GL_TRUE; 498 503 499 if (ctx->RasterMask & MULTI_DRAW_BIT) { 504 500 multi_write_rgba_span( ctx, n, x, y, 505 506 501 (const GLubyte (*)[4]) rgba, 502 write_all ? Null : mask ); 507 503 } 508 504 else { … … 513 509 } 514 510 else if (ctx->Color.BlendEnabled) { 515 gl_blend_span( ctx, n, x, y, rgba, mask );511 _mesa_blend_span( ctx, n, x, y, rgba, mask ); 516 512 } 517 513 … … 523 519 /* write pixels */ 524 520 (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, 525 526 521 (const GLubyte (*)[4]) rgba, 522 write_all ? Null : mask ); 527 523 528 524 if (ctx->RasterMask & ALPHABUF_BIT) { 529 525 gl_write_alpha_span( ctx, n, x, y, 530 531 526 (const GLubyte (*)[4]) rgba, 527 write_all ? Null : mask ); 532 528 } 533 529 … … 549 545 void gl_write_monocolor_span( GLcontext *ctx, 550 546 GLuint n, GLint x, GLint y, const GLdepth z[], 551 547 const GLubyte color[4], 552 548 GLenum primitive ) 553 549 { … … 563 559 if ((ctx->RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { 564 560 if (clip_span( ctx,n,x,y,mask)==0) { 565 561 return; 566 562 } 567 563 write_all = GL_FALSE; … … 571 567 if (ctx->Scissor.Enabled) { 572 568 if (gl_scissor_span( ctx, n, x, y, mask )==0) { 573 569 return; 574 570 } 575 571 write_all = GL_FALSE; … … 587 583 rgba[i][ACOMP] = color[ACOMP]; 588 584 } 589 if ( gl_alpha_test( ctx, n, (const GLubyte (*)[4])rgba, mask )==0) {590 585 if (_mesa_alpha_test( ctx, n, (const GLubyte (*)[4])rgba, mask )==0) { 586 return; 591 587 } 592 588 write_all = GL_FALSE; … … 595 591 if (ctx->Stencil.Enabled) { 596 592 /* first stencil test */ 597 if (gl_stencil_span( ctx, n, x, y, mask )==0) { 598 return; 599 } 600 /* depth buffering w/ stencil */ 601 gl_depth_stencil_span( ctx, n, x, y, z, mask ); 593 if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { 594 return; 595 } 602 596 write_all = GL_FALSE; 603 597 } 604 598 else if (ctx->Depth.Test) { 605 599 /* regular depth testing */ 606 GLuint m = (*ctx->Driver.DepthTestSpan)( ctx, n, x, y, z, mask );600 GLuint m = _mesa_depth_test_span( ctx, n, x, y, z, mask ); 607 601 if (m==0) { 608 602 return; … … 612 606 } 613 607 } 608 609 /* if we get here, something passed the depth test */ 610 ctx->OcclusionResult = GL_TRUE; 614 611 615 612 if (ctx->Color.DrawBuffer == GL_NONE) { … … 622 619 /* assign same color to each pixel */ 623 620 for (i=0;i<n;i++) { 624 621 if (mask[i]) { 625 622 COPY_4UBV(rgba[i], color); 626 623 } 627 624 } 628 625 629 626 if (ctx->RasterMask & MULTI_DRAW_BIT) { 630 627 multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, 631 628 mask ); 632 629 } 633 630 else { … … 637 634 } 638 635 else if (ctx->Color.BlendEnabled) { 639 gl_blend_span( ctx, n, x, y, rgba, mask );636 _mesa_blend_span( ctx, n, x, y, rgba, mask ); 640 637 } 641 638 … … 647 644 /* write pixels */ 648 645 (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, 649 650 646 (const GLubyte (*)[4]) rgba, 647 write_all ? Null : mask ); 651 648 if (ctx->RasterMask & ALPHABUF_BIT) { 652 649 gl_write_alpha_span( ctx, n, x, y, 653 654 650 (const GLubyte (*)[4]) rgba, 651 write_all ? Null : mask ); 655 652 } 656 653 } … … 669 666 } 670 667 multi_write_rgba_span( ctx, n, x, y, 671 672 668 (const GLubyte (*)[4]) rgba, 669 mask ); 673 670 } 674 671 else { … … 717 714 void gl_write_texture_span( GLcontext *ctx, 718 715 GLuint n, GLint x, GLint y, const GLdepth z[], 719 716 const GLfloat s[], const GLfloat t[], 720 717 const GLfloat u[], GLfloat lambda[], 721 722 718 GLubyte rgbaIn[][4], CONST GLubyte spec[][4], 719 GLenum primitive ) 723 720 { 724 721 GLubyte mask[MAX_WIDTH]; … … 733 730 if ((ctx->RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { 734 731 if (clip_span(ctx, n, x, y, mask)==0) { 735 732 return; 736 733 } 737 734 write_all = GL_FALSE; … … 741 738 if (primitive==GL_BITMAP || (ctx->RasterMask & MULTI_DRAW_BIT)) { 742 739 /* must make a copy of the colors since they may be modified */ 743 MEMCPY(rgbaBackup, rgbaIn, 4 * sizeof(GLubyte));740 MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte)); 744 741 rgba = rgbaBackup; 745 742 } … … 755 752 if (spec && ctx->Light.Enabled 756 753 && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) 757 add_colors( n, rgba, spec ); /* rgba = rgba + spec*/754 add_colors( n, rgba, spec ); /* rgba = rgba + spec*/ 758 755 759 756 /* Per-pixel fog */ 760 757 if (ctx->Fog.Enabled && (primitive==GL_BITMAP || ctx->FogMode==FOG_FRAGMENT)) { 761 gl_fog_rgba_pixels( ctx, n, z, rgba );758 _mesa_fog_rgba_pixels( ctx, n, z, rgba ); 762 759 } 763 760 … … 765 762 if (ctx->Scissor.Enabled) { 766 763 if (gl_scissor_span( ctx, n, x, y, mask )==0) { 767 764 return; 768 765 } 769 766 write_all = GL_FALSE; … … 778 775 /* Do the alpha test */ 779 776 if (ctx->Color.AlphaEnabled) { 780 if ( gl_alpha_test( ctx, n, (const GLubyte (*)[4]) rgba, mask )==0) {781 777 if (_mesa_alpha_test( ctx, n, (const GLubyte (*)[4]) rgba, mask )==0) { 778 return; 782 779 } 783 780 write_all = GL_FALSE; … … 786 783 if (ctx->Stencil.Enabled) { 787 784 /* first stencil test */ 788 if (gl_stencil_span( ctx, n, x, y, mask )==0) { 789 return; 790 } 791 /* depth buffering w/ stencil */ 792 gl_depth_stencil_span( ctx, n, x, y, z, mask ); 785 if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { 786 return; 787 } 793 788 write_all = GL_FALSE; 794 789 } 795 790 else if (ctx->Depth.Test) { 796 791 /* regular depth testing */ 797 GLuint m = (*ctx->Driver.DepthTestSpan)( ctx, n, x, y, z, mask );792 GLuint m = _mesa_depth_test_span( ctx, n, x, y, z, mask ); 798 793 if (m==0) { 799 794 return; … … 804 799 } 805 800 801 /* if we get here, something passed the depth test */ 802 ctx->OcclusionResult = GL_TRUE; 803 806 804 if (ctx->RasterMask & MULTI_DRAW_BIT) { 807 805 multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4])rgba, 808 806 write_all ? Null : mask ); 809 807 } 810 808 else { … … 814 812 } 815 813 else if (ctx->Color.BlendEnabled) { 816 gl_blend_span( ctx, n, x, y, rgba, mask );814 _mesa_blend_span( ctx, n, x, y, rgba, mask ); 817 815 } 818 816 if (ctx->Color.SWmasking) { … … 821 819 822 820 (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4])rgba, 823 821 write_all ? Null : mask ); 824 822 if (ctx->RasterMask & ALPHABUF_BIT) { 825 823 gl_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, 826 824 write_all ? Null : mask ); 827 825 } 828 826 } … … 835 833 * Input: texUnits - number of texture units to apply 836 834 */ 837 void gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, 838 GLuint n, GLint x, GLint y, 839 const GLdepth z[], 840 CONST GLfloat s[][MAX_WIDTH], 841 CONST GLfloat t[][MAX_WIDTH], 842 CONST GLfloat u[][MAX_WIDTH], 843 GLfloat lambda[][MAX_WIDTH], 844 GLubyte rgbaIn[][4], CONST GLubyte spec[][4], 845 GLenum primitive ) 835 void 836 gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, 837 GLuint n, GLint x, GLint y, 838 const GLdepth z[], 839 CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH], 840 CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH], 841 CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH], 842 GLfloat lambda[][MAX_WIDTH], 843 GLubyte rgbaIn[MAX_TEXTURE_UNITS][4], 844 CONST GLubyte spec[MAX_TEXTURE_UNITS][4], 845 GLenum primitive ) 846 846 { 847 847 GLubyte mask[MAX_WIDTH]; … … 857 857 if ((ctx->RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { 858 858 if (clip_span(ctx, n, x, y, mask)==0) { 859 859 return; 860 860 } 861 861 write_all = GL_FALSE; … … 865 865 if (primitive==GL_BITMAP || (ctx->RasterMask & MULTI_DRAW_BIT)) { 866 866 /* must make a copy of the colors since they may be modified */ 867 MEMCPY(rgbaBackup, rgbaIn, 4 * sizeof(GLubyte));867 MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte)); 868 868 rgba = rgbaBackup; 869 869 } … … 882 882 if (spec && ctx->Light.Enabled 883 883 && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) 884 add_colors( n, rgba, spec ); /* rgba = rgba + spec*/884 add_colors( n, rgba, spec ); /* rgba = rgba + spec*/ 885 885 886 886 /* Per-pixel fog */ 887 887 if (ctx->Fog.Enabled && (primitive==GL_BITMAP || ctx->FogMode==FOG_FRAGMENT)) { 888 gl_fog_rgba_pixels( ctx, n, z, rgba );888 _mesa_fog_rgba_pixels( ctx, n, z, rgba ); 889 889 } 890 890 … … 892 892 if (ctx->Scissor.Enabled) { 893 893 if (gl_scissor_span( ctx, n, x, y, mask )==0) { 894 894 return; 895 895 } 896 896 write_all = GL_FALSE; … … 905 905 /* Do the alpha test */ 906 906 if (ctx->Color.AlphaEnabled) { 907 if ( gl_alpha_test( ctx, n, (const GLubyte (*)[4])rgba, mask )==0) {908 907 if (_mesa_alpha_test( ctx, n, (const GLubyte (*)[4])rgba, mask )==0) { 908 return; 909 909 } 910 910 write_all = GL_FALSE; … … 913 913 if (ctx->Stencil.Enabled) { 914 914 /* first stencil test */ 915 if (gl_stencil_span( ctx, n, x, y, mask )==0) { 916 return; 917 } 918 /* depth buffering w/ stencil */ 919 gl_depth_stencil_span( ctx, n, x, y, z, mask ); 915 if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { 916 return; 917 } 920 918 write_all = GL_FALSE; 921 919 } 922 920 else if (ctx->Depth.Test) { 923 921 /* regular depth testing */ 924 GLuint m = (*ctx->Driver.DepthTestSpan)( ctx, n, x, y, z, mask );922 GLuint m = _mesa_depth_test_span( ctx, n, x, y, z, mask ); 925 923 if (m==0) { 926 924 return; … … 931 929 } 932 930 931 /* if we get here, something passed the depth test */ 932 ctx->OcclusionResult = GL_TRUE; 933 933 934 if (ctx->RasterMask & MULTI_DRAW_BIT) { 934 multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, write_all ? Null : mask ); 935 multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, 936 write_all ? Null : mask ); 935 937 } 936 938 else { … … 941 943 } 942 944 else if (ctx->Color.BlendEnabled) { 943 gl_blend_span( ctx, n, x, y, rgba, mask );945 _mesa_blend_span( ctx, n, x, y, rgba, mask ); 944 946 } 945 947 if (ctx->Color.SWmasking) { … … 950 952 if (ctx->RasterMask & ALPHABUF_BIT) { 951 953 gl_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4])rgba, 952 954 write_all ? Null : mask ); 953 955 } 954 956 } … … 961 963 * reading ouside the buffer's boundaries. 962 964 */ 963 void gl_read_rgba_span( GLcontext *ctx, 965 void gl_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, 964 966 GLuint n, GLint x, GLint y, 965 967 GLubyte rgba[][4] ) 966 968 { 967 if (y<0 || y>=ctx->Buffer->Height || x>=ctx->Buffer->Width) { 969 if (y < 0 || y >= buffer->Height 970 || x + (GLint) n < 0 || x >= buffer->Width) { 968 971 /* completely above, below, or right */ 969 MEMSET( rgba, 0, 4 * n * sizeof(GLubyte)); /*XXX maybe leave undefined?*/ 972 /* XXX maybe leave undefined? */ 973 MEMSET( rgba, 0, 4 * n * sizeof(GLubyte)); 970 974 } 971 975 else { … … 979 983 return; 980 984 } 981 if (length > ctx->Buffer->Width) {982 length = ctx->Buffer->Width;983 } 984 } 985 else if ((GLint) (x + n) > ctx->Buffer->Width) {985 if (length > buffer->Width) { 986 length = buffer->Width; 987 } 988 } 989 else if ((GLint) (x + n) > buffer->Width) { 986 990 /* right edge clipping */ 987 991 skip = 0; 988 length = ctx->Buffer->Width - x;992 length = buffer->Width - x; 989 993 if (length < 0) { 990 994 /* completely to right of window */ … … 1012 1016 * reading ouside the buffer's boundaries. 1013 1017 */ 1014 void gl_read_index_span( GLcontext *ctx, 1018 void gl_read_index_span( GLcontext *ctx, GLframebuffer *buffer, 1015 1019 GLuint n, GLint x, GLint y, GLuint indx[] ) 1016 1020 { 1017 register GLuint i; 1018 1019 if (y<0 || y>=ctx->Buffer->Height || x>=ctx->Buffer->Width) { 1021 if (y < 0 || y >= buffer->Height 1022 || x + (GLint) n < 0 || x >= buffer->Width) { 1020 1023 /* completely above, below, or right */ 1021 for (i=0;i<n;i++) { 1022 indx[i] = 0; 1023 } 1024 MEMSET(indx, 0, n * sizeof(GLuint)); 1024 1025 } 1025 1026 else { … … 1033 1034 return; 1034 1035 } 1035 if (length > ctx->Buffer->Width) {1036 length = ctx->Buffer->Width;1037 } 1038 } 1039 else if ((GLint) (x + n) > ctx->Buffer->Width) {1036 if (length > buffer->Width) { 1037 length = buffer->Width; 1038 } 1039 } 1040 else if ((GLint) (x + n) > buffer->Width) { 1040 1041 /* right edge clipping */ 1041 1042 skip = 0; 1042 length = ctx->Buffer->Width - x;1043 length = buffer->Width - x; 1043 1044 if (length < 0) { 1044 1045 /* completely to right of window */
Note:
See TracChangeset
for help on using the changeset viewer.