Changeset 3598 for trunk/src/opengl/mesa/varray.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/varray.c
r2962 r3598 1 /* $Id: varray.c,v 1. 2 2000-03-01 18:49:38jeroen Exp $ */1 /* $Id: varray.c,v 1.3 2000-05-23 20:40:59 jeroen Exp $ */ 2 2 3 3 /* … … 28 28 #include "all.h" 29 29 #else 30 #ifndef XFree86Server 31 #include <stdlib.h> 32 #include <stdio.h> 33 #include <string.h> 34 #else 35 #include "GL/xf86glx.h" 36 #endif 30 #include "glheader.h" 37 31 #include "types.h" 38 32 #include "context.h" 39 #include "api.h"40 33 #include "cva.h" 41 34 #include "enable.h" … … 55 48 #include "vbxform.h" 56 49 #include "xform.h" 57 #ifdef XFree86Server 58 #include "GL/xf86glx.h" 50 #include "state.h" 59 51 #endif 60 #endif 61 62 #if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) && !defined(GLX_USE_DLOPEN) 63 #define NEED_MESA_FUNCS_WRAPPED 64 #include "mesa_api.h" 65 #endif 66 67 68 void GLAPIENTRY glVertexPointer(CTX_ARG GLint size, GLenum type, GLsizei stride, 69 const GLvoid *ptr ) 70 { 71 GLcontext *ctx; 72 GET_CONTEXT; 73 CHECK_CONTEXT; 74 ctx = CC; 52 53 void 54 _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) 55 { 56 GET_CURRENT_CONTEXT(ctx); 75 57 76 58 if (size<2 || size>4) { … … 85 67 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) 86 68 fprintf(stderr, "glVertexPointer( sz %d type %s stride %d )\n", size, 87 88 69 gl_lookup_enum_by_nr( type ), 70 stride); 89 71 90 72 ctx->Array.Vertex.StrideB = stride; … … 121 103 122 104 123 void GLAPIENTRY glNormalPointer(CTX_ARG GLenum type, GLsizei stride, 124 const GLvoid *ptr ) 125 { 126 GLcontext *ctx; 127 GET_CONTEXT; 128 CHECK_CONTEXT; 129 ctx = CC; 105 void 106 _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) 107 { 108 GET_CURRENT_CONTEXT(ctx); 130 109 131 110 if (stride<0) { … … 136 115 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) 137 116 fprintf(stderr, "glNormalPointer( type %s stride %d )\n", 138 139 117 gl_lookup_enum_by_nr( type ), 118 stride); 140 119 141 120 ctx->Array.Normal.StrideB = stride; … … 173 152 174 153 175 void GLAPIENTRY glColorPointer(CTX_ARG GLint size, GLenum type, GLsizei stride, 176 const GLvoid *ptr ) 177 { 178 GLcontext *ctx; 179 GET_CONTEXT; 180 CHECK_CONTEXT; 181 ctx = CC; 154 void 155 _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride,const GLvoid *ptr ) 156 { 157 GET_CURRENT_CONTEXT(ctx); 158 182 159 if (size<3 || size>4) { 183 160 gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); … … 191 168 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) 192 169 fprintf(stderr, "glColorPointer( sz %d type %s stride %d )\n", size, 193 194 170 gl_lookup_enum_by_nr( type ), 171 stride); 195 172 196 173 ctx->Array.Color.StrideB = stride; … … 238 215 239 216 240 void GLAPIENTRY glIndexPointer(CTX_ARG GLenum type, GLsizei stride, 241 const GLvoid *ptr ) 242 { 243 GLcontext *ctx; 244 GET_CONTEXT; 245 CHECK_CONTEXT; 246 ctx = CC; 217 void 218 _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) 219 { 220 GET_CURRENT_CONTEXT(ctx); 247 221 248 222 if (stride<0) { … … 285 259 286 260 287 void GLAPIENTRY glTexCoordPointer(CTX_ARG GLint size, GLenum type, 288 GLsizei stride, const GLvoid *ptr ) 289 { 261 void 262 _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) 263 { 264 GET_CURRENT_CONTEXT(ctx); 290 265 GLuint texUnit; 291 292 GLcontext *ctx;293 GET_CONTEXT;294 CHECK_CONTEXT;295 ctx = CC;296 266 297 267 texUnit = ctx->Array.ActiveTexture; … … 308 278 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) 309 279 fprintf(stderr, "glTexCoordPointer( unit %u sz %d type %s stride %d )\n", 310 311 312 313 280 texUnit, 281 size, 282 gl_lookup_enum_by_nr( type ), 283 stride); 314 284 315 285 ctx->Array.TexCoord[texUnit].StrideB = stride; … … 347 317 348 318 349 void GLAPIENTRY glEdgeFlagPointer(CTX_ARG GLsizei stride, const void *vptr ) 350 { 319 void 320 _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr ) 321 { 322 GET_CURRENT_CONTEXT(ctx); 351 323 const GLboolean *ptr = (GLboolean *)vptr; 352 353 GLcontext *ctx;354 GET_CONTEXT;355 CHECK_CONTEXT;356 ctx = CC;357 324 358 325 if (stride<0) { … … 373 340 } 374 341 375 342 #if 0 376 343 /* Called only from gl_DrawElements 377 344 */ 378 void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr )345 static void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr ) 379 346 { 380 347 switch (type) { … … 396 363 ctx->CVA.Elt.Ptr = (void *) ptr; 397 364 ctx->CVA.EltFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; 398 ctx->Array.NewArrayState |= VERT_ELT; /* ???*/399 } 400 365 ctx->Array.NewArrayState |= VERT_ELT; /* ???*/ 366 } 367 #endif 401 368 402 369 … … 409 376 */ 410 377 void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM, 411 412 378 GLuint start, 379 GLuint count) 413 380 { 414 381 GLuint *flags = IM->Flag; … … 422 389 if (translate & VERT_OBJ_ANY) 423 390 (ctx->Array.VertexEltFunc)( IM->Obj, 424 425 426 391 &ctx->Array.Vertex, 392 flags, elts, (VERT_ELT|VERT_OBJ_ANY), 393 start, count); 427 394 428 395 if (translate & VERT_NORM) 429 396 (ctx->Array.NormalEltFunc)( IM->Normal, 430 431 432 397 &ctx->Array.Normal, 398 flags, elts, (VERT_ELT|VERT_NORM), 399 start, count); 433 400 434 401 if (translate & VERT_EDGE) 435 402 (ctx->Array.EdgeFlagEltFunc)( IM->EdgeFlag, 436 437 438 403 &ctx->Array.EdgeFlag, 404 flags, elts, (VERT_ELT|VERT_EDGE), 405 start, count); 439 406 440 407 if (translate & VERT_RGBA) 441 408 (ctx->Array.ColorEltFunc)( IM->Color, 442 443 444 409 &ctx->Array.Color, 410 flags, elts, (VERT_ELT|VERT_RGBA), 411 start, count); 445 412 446 413 if (translate & VERT_INDEX) 447 414 (ctx->Array.IndexEltFunc)( IM->Index, 448 449 450 415 &ctx->Array.Index, 416 flags, elts, (VERT_ELT|VERT_INDEX), 417 start, count); 451 418 452 419 if (translate & VERT_TEX0_ANY) 453 420 (ctx->Array.TexCoordEltFunc[0])( IM->TexCoord[0], 454 455 456 421 &ctx->Array.TexCoord[0], 422 flags, elts, (VERT_ELT|VERT_TEX0_ANY), 423 start, count); 457 424 458 425 if (translate & VERT_TEX1_ANY) 459 426 (ctx->Array.TexCoordEltFunc[1])( IM->TexCoord[1], 460 461 462 427 &ctx->Array.TexCoord[1], 428 flags, elts, (VERT_ELT|VERT_TEX1_ANY), 429 start, count); 463 430 464 431 465 432 for (i = start ; i < count ; i++) 466 433 if (flags[i] & VERT_ELT) 467 flags[i] |= translate; 468 469 } 470 471 472 473 void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count ) 474 { 434 flags[i] |= translate; 435 436 } 437 438 439 440 /* Enough funny business going on in here it might be quicker to use a 441 * function pointer. 442 */ 443 #define ARRAY_ELT( IM, i ) \ 444 { \ 445 GLuint count = IM->Count; \ 446 IM->Elt[count] = i; \ 447 IM->Flag[count] = ((IM->Flag[count] & IM->ArrayAndFlags) | \ 448 VERT_ELT); \ 449 IM->FlushElt |= IM->ArrayEltFlush; \ 450 IM->Count = count += IM->ArrayIncr; \ 451 if (count == VB_MAX) \ 452 IM->maybe_transform_vb( IM ); \ 453 } 454 455 456 void 457 _mesa_ArrayElement( GLint i ) 458 { 459 GET_IMMEDIATE; 460 ARRAY_ELT( IM, i ); 461 } 462 463 464 static void 465 gl_ArrayElement( GLcontext *CC, GLint i ) 466 { 467 struct immediate *im = CC->input; 468 ARRAY_ELT( im, i ); 469 } 470 471 472 473 void 474 _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) 475 { 476 GET_CURRENT_CONTEXT(ctx); 475 477 struct vertex_buffer *VB = ctx->VB; 476 478 GLint i; … … 498 500 499 501 if (ctx->NewState) 500 gl_update_state( ctx ); 502 gl_update_state( ctx ); 501 503 502 504 /* Just turn off cva on this path. Could be useful for multipass … … 506 508 507 509 if (relock) { 508 509 510 ctx->CompileCVAFlag = 0; 511 elt->pipeline_valid = 0; 510 512 } 511 513 512 514 if (!elt->pipeline_valid) 513 515 gl_build_immediate_pipeline( ctx ); 514 516 515 517 required = elt->inputs; … … 523 525 if (required & VERT_RGBA) 524 526 { 525 526 527 528 529 530 527 Color = &ctx->Array.Color; 528 if (fallback & VERT_RGBA) { 529 Color = &ctx->Fallback.Color; 530 ctx->Array.ColorFunc = 531 gl_trans_4ub_tab[4][TYPE_IDX(GL_UNSIGNED_BYTE)]; 532 } 531 533 } 532 534 533 535 if (required & VERT_INDEX) 534 536 { 535 536 537 538 539 537 Index = &ctx->Array.Index; 538 if (fallback & VERT_INDEX) { 539 Index = &ctx->Fallback.Index; 540 ctx->Array.IndexFunc = gl_trans_1ui_tab[TYPE_IDX(GL_UNSIGNED_INT)]; 541 } 540 542 } 541 543 542 544 for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) 543 545 { 544 545 546 547 548 549 550 551 552 553 554 555 556 557 546 GLuint flag = VERT_TEX_ANY(i); 547 548 if (required & flag) { 549 TexCoord[i] = &ctx->Array.TexCoord[i]; 550 551 if (fallback & flag) 552 { 553 TexCoord[i] = &ctx->Fallback.TexCoord[i]; 554 TexCoord[i]->Size = gl_texcoord_size( ctx->Current.Flag, i ); 555 556 ctx->Array.TexCoordFunc[i] = 557 gl_trans_4f_tab[TexCoord[i]->Size][TYPE_IDX(GL_FLOAT)]; 558 } 559 } 558 560 } 559 561 560 562 if (ctx->Array.Flags != ctx->Array.Flag[0]) 561 562 563 for (i = 0 ; i < VB_MAX ; i++) 564 ctx->Array.Flag[i] = ctx->Array.Flags; 563 565 564 566 565 567 if (required & VERT_NORM) 566 568 { 567 568 569 570 571 569 Normal = &ctx->Array.Normal; 570 if (fallback & VERT_NORM) { 571 Normal = &ctx->Fallback.Normal; 572 ctx->Array.NormalFunc = gl_trans_3f_tab[TYPE_IDX(GL_FLOAT)]; 573 } 572 574 } 573 575 574 576 if ( required & VERT_EDGE ) 575 577 { 576 577 578 579 580 581 582 583 584 585 586 587 588 578 if (mode == GL_TRIANGLES || 579 mode == GL_QUADS || 580 mode == GL_POLYGON) 581 { 582 EdgeFlag = &ctx->Array.EdgeFlag; 583 if (fallback & VERT_EDGE) { 584 EdgeFlag = &ctx->Fallback.EdgeFlag; 585 ctx->Array.EdgeFlagFunc = 586 gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; 587 } 588 } 589 else 590 required &= ~VERT_EDGE; 589 591 } 590 592 … … 597 599 while (remaining > 0) { 598 600 GLint vbspace = VB_MAX - VB_START; 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 601 GLuint count, n; 602 603 if (vbspace >= remaining) { 604 n = remaining; 605 VB->LastPrimitive = VB_START + n; 606 } else { 607 n = vbspace; 608 VB->LastPrimitive = VB_START; 609 } 610 611 VB->CullMode = 0; 612 613 ctx->Array.VertexFunc( IM->Obj + VB_START, 614 &ctx->Array.Vertex, start, n ); 615 616 if (required & VERT_NORM) { 617 ctx->Array.NormalFunc( IM->Normal + VB_START, 618 Normal, start, n ); 619 } 620 621 if (required & VERT_EDGE) { 622 ctx->Array.EdgeFlagFunc( IM->EdgeFlag + VB_START, 623 EdgeFlag, start, n ); 624 } 625 626 if (required & VERT_RGBA) { 627 ctx->Array.ColorFunc( IM->Color + VB_START, 628 Color, start, n ); 629 } 630 631 if (required & VERT_INDEX) { 632 ctx->Array.IndexFunc( IM->Index + VB_START, 633 Index, start, n ); 634 } 635 636 if (required & VERT_TEX0_ANY) { 637 IM->v.TexCoord[0].size = TexCoord[0]->Size; 638 ctx->Array.TexCoordFunc[0]( IM->TexCoord[0] + VB_START, 639 TexCoord[0], start, n ); 640 } 641 642 if (required & VERT_TEX1_ANY) { 643 IM->v.TexCoord[1].size = TexCoord[1]->Size; 644 ctx->Array.TexCoordFunc[1]( IM->TexCoord[1] + VB_START, 645 TexCoord[1], start, n ); 646 } 647 648 VB->ObjPtr = &IM->v.Obj; 649 VB->NormalPtr = &IM->v.Normal; 650 VB->ColorPtr = &IM->v.Color; 651 VB->Color[0] = VB->Color[1] = VB->ColorPtr; 652 VB->IndexPtr = &IM->v.Index; 653 VB->EdgeFlagPtr = &IM->v.EdgeFlag; 654 VB->TexCoordPtr[0] = &IM->v.TexCoord[0]; 655 VB->TexCoordPtr[1] = &IM->v.TexCoord[1]; 656 657 VB->Flag = ctx->Array.Flag; 658 VB->OrFlag = ctx->Array.Flags; 659 660 VB->Start = IM->Start = VB_START; 661 count = VB->Count = IM->Count = VB_START + n; 660 662 661 663 #define RESET_VEC(v, t, s, c) (v.start = t v.data[s], v.count = c) 662 664 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 665 RESET_VEC(IM->v.Obj, (GLfloat *), VB_START, count); 666 RESET_VEC(IM->v.Normal, (GLfloat *), VB_START, count); 667 RESET_VEC(IM->v.TexCoord[0], (GLfloat *), VB_START, count); 668 RESET_VEC(IM->v.TexCoord[1], (GLfloat *), VB_START, count); 669 RESET_VEC(IM->v.Index, &, VB_START, count); 670 RESET_VEC(IM->v.Elt, &, VB_START, count); 671 RESET_VEC(IM->v.EdgeFlag, &, VB_START, count); 672 RESET_VEC(IM->v.Color, (GLubyte *), VB_START, count); 673 RESET_VEC(VB->Clip, (GLfloat *), VB_START, count); 674 RESET_VEC(VB->Eye, (GLfloat *), VB_START, count); 675 RESET_VEC(VB->Win, (GLfloat *), VB_START, count); 676 RESET_VEC(VB->BColor, (GLubyte *), VB_START, count); 677 RESET_VEC(VB->BIndex, &, VB_START, count); 678 679 VB->NextPrimitive[VB->CopyStart] = VB->Count; 680 VB->Primitive[VB->CopyStart] = mode; 681 ctx->Array.Flag[count] |= VERT_END_VB; 680 682 681 683 /* Transform and render. 682 684 */ 683 685 gl_run_pipeline( VB ); 684 685 686 687 686 gl_reset_vb( VB ); 687 688 ctx->Array.Flag[count] = ctx->Array.Flags; 689 ctx->Array.Flag[VB_START] = ctx->Array.Flags; 688 690 689 691 start += n; … … 694 696 695 697 if (relock) { 696 697 698 ctx->CompileCVAFlag = relock; 699 elt->pipeline_valid = 0; 698 700 } 699 701 } … … 729 731 */ 730 732 #if 1 731 #define DRAW_ELT(FUNC, TYPE) 732 static void FUNC( GLcontext *ctx, GLenum mode, 733 TYPE *indices, GLuint count )\734 { 735 GLuint i,j; 736 737 gl_Begin( ctx, mode ); 738 739 for (j = 0 ; j < count ; ) { 740 struct immediate *IM = ctx->input; 741 GLuint start = IM->Start; 742 GLuint nr = MIN2( VB_MAX, count - j + start ); 743 GLuint sf = IM->Flag[start]; 744 IM->FlushElt |= IM->ArrayEltFlush; 745 746 for (i = start ; i < nr ; i++) { 747 IM->Elt[i] = (GLuint) *indices++;\748 IM->Flag[i] = VERT_ELT;\749 } 750 751 if (j == 0) IM->Flag[start] |= sf; 752 753 IM->Count = nr; 754 j += nr - start; 755 756 if (j == count) gl_End( ctx ); 757 IM->maybe_transform_vb( IM ); 758 } 733 #define DRAW_ELT(FUNC, TYPE) \ 734 static void FUNC( GLcontext *ctx, GLenum mode, \ 735 TYPE *indices, GLuint count ) \ 736 { \ 737 GLuint i,j; \ 738 \ 739 gl_Begin( ctx, mode ); \ 740 \ 741 for (j = 0 ; j < count ; ) { \ 742 struct immediate *IM = ctx->input; \ 743 GLuint start = IM->Start; \ 744 GLuint nr = MIN2( VB_MAX, count - j + start ); \ 745 GLuint sf = IM->Flag[start]; \ 746 IM->FlushElt |= IM->ArrayEltFlush; \ 747 \ 748 for (i = start ; i < nr ; i++) { \ 749 IM->Elt[i] = (GLuint) *indices++; \ 750 IM->Flag[i] = VERT_ELT; \ 751 } \ 752 \ 753 if (j == 0) IM->Flag[start] |= sf; \ 754 \ 755 IM->Count = nr; \ 756 j += nr - start; \ 757 \ 758 if (j == count) gl_End( ctx ); \ 759 IM->maybe_transform_vb( IM ); \ 760 } \ 759 761 } 760 762 #else 761 #define DRAW_ELT(FUNC, TYPE) 762 static void FUNC( GLcontext *ctx, GLenum mode, 763 TYPE *indices, GLuint count )\764 { 765 int i; 766 glBegin(mode); 767 for (i = 0 ; i < count ; i++) 768 glArrayElement( indices[i] ); 769 glEnd(); 763 #define DRAW_ELT(FUNC, TYPE) \ 764 static void FUNC( GLcontext *ctx, GLenum mode, \ 765 TYPE *indices, GLuint count ) \ 766 { \ 767 int i; \ 768 glBegin(mode); \ 769 for (i = 0 ; i < count ; i++) \ 770 glArrayElement( indices[i] ); \ 771 glEnd(); \ 770 772 } 771 773 #endif 772 774 773 775 774 776 DRAW_ELT( draw_elt_ubyte, GLubyte ) … … 779 781 static GLuint natural_stride[0x10] = 780 782 { 781 sizeof(GLbyte), 782 sizeof(GLubyte), 783 sizeof(GLshort), 784 sizeof(GLushort), 785 sizeof(GLint), 786 sizeof(GLuint), 787 sizeof(GLfloat), 788 2 * sizeof(GLbyte), 789 3 * sizeof(GLbyte), 790 4 * sizeof(GLbyte), 791 sizeof(GLdouble), 792 0, 793 0, 794 0, 795 0, 796 0 783 sizeof(GLbyte), /* 0 */ 784 sizeof(GLubyte), /* 1 */ 785 sizeof(GLshort), /* 2 */ 786 sizeof(GLushort), /* 3 */ 787 sizeof(GLint), /* 4 */ 788 sizeof(GLuint), /* 5 */ 789 sizeof(GLfloat), /* 6 */ 790 2 * sizeof(GLbyte), /* 7 */ 791 3 * sizeof(GLbyte), /* 8 */ 792 4 * sizeof(GLbyte), /* 9 */ 793 sizeof(GLdouble), /* a */ 794 0, /* b */ 795 0, /* c */ 796 0, /* d */ 797 0, /* e */ 798 0 /* f */ 797 799 }; 798 800 799 void GLAPIENTRY glDrawElements(CTX_ARG GLenum mode, GLsizei count, 800 GLenum type, const GLvoid *indices ) 801 { 802 GLcontext *ctx; 801 802 void 803 _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) 804 { 805 GET_CURRENT_CONTEXT(ctx); 803 806 struct gl_cva *cva; 804 805 GET_CONTEXT;806 CHECK_CONTEXT;807 ctx = CC;808 807 809 808 cva = &ctx->CVA; … … 812 811 if (count <= 0) { 813 812 if (count < 0) 814 813 gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); 815 814 return; 816 815 } … … 850 849 851 850 if (!cva->pre.pipeline_valid) 852 851 gl_build_precalc_pipeline( ctx ); 853 852 else if (MESA_VERBOSE & VERBOSE_PIPELINE) 854 853 fprintf(stderr, ": dont rebuild\n"); 855 854 856 855 gl_cva_force_precalc( ctx ); … … 859 858 */ 860 859 if (ctx->CVA.pre.ops & PIPE_OP_RENDER) { 861 862 863 864 860 ctx->Array.NewArrayState |= VERT_ELT; 861 ctx->Array.Summary &= ~VERT_ELT; 862 ctx->Array.Flags &= ~VERT_ELT; 863 return; 865 864 } 866 865 867 866 if ( (MESA_VERBOSE&VERBOSE_VARRAY) ) 868 867 printf("using immediate\n"); 869 868 } 870 869 … … 877 876 GLubyte *ub_indices = (GLubyte *) indices; 878 877 if (ctx->Array.Summary & VERT_OBJ_ANY) { 879 878 draw_elt_ubyte( ctx, mode, ub_indices, count ); 880 879 } else { 881 880 gl_ArrayElement( ctx, (GLuint) ub_indices[count-1] ); 882 881 } 883 882 } … … 887 886 GLushort *us_indices = (GLushort *) indices; 888 887 if (ctx->Array.Summary & VERT_OBJ_ANY) { 889 888 draw_elt_ushort( ctx, mode, us_indices, count ); 890 889 } else { 891 890 gl_ArrayElement( ctx, (GLuint) us_indices[count-1] ); 892 891 } 893 892 } … … 897 896 GLuint *ui_indices = (GLuint *) indices; 898 897 if (ctx->Array.Summary & VERT_OBJ_ANY) { 899 898 draw_elt_uint( ctx, mode, ui_indices, count ); 900 899 } else { 901 900 gl_ArrayElement( ctx, ui_indices[count-1] ); 902 901 } 903 902 } … … 916 915 917 916 918 void GLAPIENTRY glInterleavedArrays(CTX_ARG GLenum format, GLsizei stride,919 920 { 921 G Lcontext *ctx;917 void 918 _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer ) 919 { 920 GET_CURRENT_CONTEXT(ctx); 922 921 GLboolean tflag, cflag, nflag; /* enable/disable flags */ 923 922 GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */ … … 928 927 GLint c, f; 929 928 GLint coordUnitSave; 930 931 GET_CONTEXT;932 CHECK_CONTEXT;933 ctx = CC;934 935 929 936 930 f = sizeof(GLfloat); … … 1057 1051 } 1058 1052 1059 gl_DisableClientState( ctx,GL_EDGE_FLAG_ARRAY );1060 gl_DisableClientState( ctx,GL_INDEX_ARRAY );1053 _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY ); 1054 _mesa_DisableClientState( GL_INDEX_ARRAY ); 1061 1055 1062 1056 /* Texcoords */ … … 1066 1060 GLint factor = ctx->Array.TexCoordInterleaveFactor; 1067 1061 for (i = 0; i < factor; i++) { 1068 gl_ClientActiveTexture( ctx,(GLenum) (GL_TEXTURE0_ARB + i) );1069 gl_EnableClientState( ctx,GL_TEXTURE_COORD_ARRAY );1070 glTexCoordPointer( CTX_PRMtcomps, GL_FLOAT, stride,1062 _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); 1063 _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY ); 1064 glTexCoordPointer( tcomps, GL_FLOAT, stride, 1071 1065 (GLubyte *) pointer + i * coffset ); 1072 1066 } 1073 1067 for (i = factor; i < ctx->Const.MaxTextureUnits; i++) { 1074 gl_ClientActiveTexture( ctx,(GLenum) (GL_TEXTURE0_ARB + i) );1075 gl_DisableClientState( ctx,GL_TEXTURE_COORD_ARRAY );1068 _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); 1069 _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY ); 1076 1070 } 1077 1071 } … … 1079 1073 GLint i; 1080 1074 for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { 1081 gl_ClientActiveTexture( ctx,(GLenum) (GL_TEXTURE0_ARB + i) );1082 gl_DisableClientState( ctx,GL_TEXTURE_COORD_ARRAY );1075 _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); 1076 _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY ); 1083 1077 } 1084 1078 } 1085 1079 /* Restore texture coordinate unit index */ 1086 gl_ClientActiveTexture( ctx,(GLenum) (GL_TEXTURE0_ARB + coordUnitSave) );1080 _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) ); 1087 1081 1088 1082 1089 1083 /* Color */ 1090 1084 if (cflag) { 1091 gl_EnableClientState( ctx,GL_COLOR_ARRAY );1092 glColorPointer( CTX_PRMccomps, ctype, stride,1085 _mesa_EnableClientState( GL_COLOR_ARRAY ); 1086 glColorPointer( ccomps, ctype, stride, 1093 1087 (GLubyte*) pointer + coffset ); 1094 1088 } 1095 1089 else { 1096 gl_DisableClientState( ctx,GL_COLOR_ARRAY );1090 _mesa_DisableClientState( GL_COLOR_ARRAY ); 1097 1091 } 1098 1092 … … 1100 1094 /* Normals */ 1101 1095 if (nflag) { 1102 gl_EnableClientState( ctx,GL_NORMAL_ARRAY );1103 glNormalPointer( CTX_PRMGL_FLOAT, stride,1096 _mesa_EnableClientState( GL_NORMAL_ARRAY ); 1097 glNormalPointer( GL_FLOAT, stride, 1104 1098 (GLubyte*) pointer + noffset ); 1105 1099 } 1106 1100 else { 1107 gl_DisableClientState( ctx,GL_NORMAL_ARRAY );1108 } 1109 1110 gl_EnableClientState( ctx,GL_VERTEX_ARRAY );1111 glVertexPointer( CTX_PRMvcomps, GL_FLOAT, stride,1101 _mesa_DisableClientState( GL_NORMAL_ARRAY ); 1102 } 1103 1104 _mesa_EnableClientState( GL_VERTEX_ARRAY ); 1105 glVertexPointer( vcomps, GL_FLOAT, stride, 1112 1106 (GLubyte *) pointer + voffset ); 1113 1107 } … … 1115 1109 1116 1110 1117 void GLAPIENTRY glDrawRangeElements(CTX_ARG GLenum mode, GLuint start, 1118 GLuint end, GLsizei count, 1119 GLenum type, const GLvoid *indices ) 1120 { 1121 GLcontext *ctx; 1122 GET_CONTEXT; 1123 CHECK_CONTEXT; 1124 ctx = CC; 1111 void 1112 _mesa_DrawRangeElements(GLenum mode, GLuint start, 1113 GLuint end, GLsizei count, 1114 GLenum type, const GLvoid *indices) 1115 { 1116 GET_CURRENT_CONTEXT(ctx); 1125 1117 1126 1118 if (end < start) { … … 1129 1121 } 1130 1122 1123 #if 0 1124 /* 1125 * XXX something in locked arrays is broken! If start = 0, 1126 * end = 1 and count = 2 we'll take the LockArrays path and 1127 * get incorrect results. See Scott McMillan's bug of 3 Jan 2000. 1128 * For now, don't use locked arrays. 1129 */ 1131 1130 if (!ctx->Array.LockCount && 2*count > (GLint) 3*(end-start)) { 1132 glLockArraysEXT( CTX_PRMstart, end );1133 glDrawElements( CTX_PRMmode, count, type, indices );1134 glUnlockArraysEXT( CTX_VPRM);1131 glLockArraysEXT( start, end ); 1132 glDrawElements( mode, count, type, indices ); 1133 glUnlockArraysEXT(); 1135 1134 } else { 1136 glDrawElements(CTX_PRM mode, count, type, indices ); 1137 } 1135 glDrawElements( mode, count, type, indices ); 1136 } 1137 #else 1138 glDrawElements( mode, count, type, indices ); 1139 #endif 1138 1140 } 1139 1141 … … 1143 1145 { 1144 1146 static GLuint sz_flags[5] = { 0, 1145 1146 1147 1148 1147 0, 1148 VERT_OBJ_2, 1149 VERT_OBJ_23, 1150 VERT_OBJ_234 }; 1149 1151 1150 1152 static GLuint tc_flags[5] = { 0, 1151 1152 1153 1154 1153 VERT_TEX0_1, 1154 VERT_TEX0_12, 1155 VERT_TEX0_123, 1156 VERT_TEX0_1234 }; 1155 1157 1156 1158 ctx->Array.Flags = 0;
Note:
See TracChangeset
for help on using the changeset viewer.