Changeset 78375 in vbox for trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_transform.c
- Timestamp:
- May 3, 2019 9:51:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_transform.c
r78263 r78375 19 19 */ 20 20 static INLINE void 21 LOADMATRIX( const CRmatrix *a )21 LOADMATRIX(PCRStateTracker pState, const CRmatrix *a ) 22 22 { 23 23 if (a->m00 == 1.0F && a->m01 == 0.0F && a->m02 == 0.0F && a->m03 == 0.0F && … … 25 25 a->m20 == 0.0F && a->m21 == 0.0F && a->m22 == 1.0F && a->m23 == 0.0F && 26 26 a->m30 == 0.0F && a->m31 == 0.0F && a->m32 == 0.0F && a->m33 == 1.0F) { 27 diff_api.LoadIdentity();27 pState->diff_api.LoadIdentity(); 28 28 } 29 29 else { … … 33 33 f[8] = a->m20; f[9] = a->m21; f[10] = a->m22; f[11] = a->m23; 34 34 f[12] = a->m30; f[13] = a->m31; f[14] = a->m32; f[15] = a->m33; 35 diff_api.LoadMatrixf(f);35 pState->diff_api.LoadMatrixf(f); 36 36 } 37 37 } … … 116 116 CRLimitsState *limits = &ctx->limits; 117 117 CRTransformState *t = &ctx->transform; 118 CRStateBits *sb = GetCurrentBits( );118 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 119 119 CRTransformBits *tb = &(sb->transform); 120 120 unsigned int i; … … 215 215 } 216 216 217 void STATE_APIENTRY crStateClipPlane ( GLenum plane, const GLdouble *equation)218 { 219 CRContext *g = GetCurrentContext( );217 void STATE_APIENTRY crStateClipPlane (PCRStateTracker pState, GLenum plane, const GLdouble *equation) 218 { 219 CRContext *g = GetCurrentContext(pState); 220 220 CRTransformState *t = &g->transform; 221 CRStateBits *sb = GetCurrentBits( );221 CRStateBits *sb = GetCurrentBits(pState); 222 222 CRTransformBits *tb = &(sb->transform); 223 223 GLvectord e; … … 232 232 if (g->current.inBeginEnd) 233 233 { 234 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,234 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 235 235 "ClipPlane called in begin/end"); 236 236 return; … … 242 242 if (i >= g->limits.maxClipPlanes) 243 243 { 244 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,244 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 245 245 "ClipPlane called with bad enumerant: %d", plane); 246 246 return; … … 254 254 } 255 255 256 void STATE_APIENTRY crStateMatrixMode( GLenum e)257 { 258 CRContext *g = GetCurrentContext( );256 void STATE_APIENTRY crStateMatrixMode(PCRStateTracker pState, GLenum e) 257 { 258 CRContext *g = GetCurrentContext(pState); 259 259 CRTransformState *t = &(g->transform); 260 260 CRTextureState *tex = &(g->texture); 261 CRStateBits *sb = GetCurrentBits( );262 CRTransformBits *tb = &(sb->transform); 263 264 if (g->current.inBeginEnd) 265 { 266 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "MatrixMode called in begin/end");261 CRStateBits *sb = GetCurrentBits(pState); 262 CRTransformBits *tb = &(sb->transform); 263 264 if (g->current.inBeginEnd) 265 { 266 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "MatrixMode called in begin/end"); 267 267 return; 268 268 } … … 307 307 } 308 308 else { 309 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid matrix mode: %d", e);309 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid matrix mode: %d", e); 310 310 return; 311 311 } … … 329 329 } 330 330 else { 331 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid matrix mode: %d", e);331 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid matrix mode: %d", e); 332 332 return; 333 333 } 334 334 break; 335 335 default: 336 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid matrix mode: %d", e);336 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid matrix mode: %d", e); 337 337 return; 338 338 } … … 343 343 } 344 344 345 void STATE_APIENTRY crStateLoadIdentity( void)346 { 347 CRContext *g = GetCurrentContext( );348 CRTransformState *t = &(g->transform); 349 CRStateBits *sb = GetCurrentBits( );350 CRTransformBits *tb = &(sb->transform); 351 352 if (g->current.inBeginEnd) 353 { 354 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,345 void STATE_APIENTRY crStateLoadIdentity(PCRStateTracker pState) 346 { 347 CRContext *g = GetCurrentContext(pState); 348 CRTransformState *t = &(g->transform); 349 CRStateBits *sb = GetCurrentBits(pState); 350 CRTransformBits *tb = &(sb->transform); 351 352 if (g->current.inBeginEnd) 353 { 354 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 355 355 "LoadIdentity called in begin/end"); 356 356 return; … … 366 366 } 367 367 368 void STATE_APIENTRY crStatePopMatrix( void)369 { 370 CRContext *g = GetCurrentContext( );368 void STATE_APIENTRY crStatePopMatrix(PCRStateTracker pState) 369 { 370 CRContext *g = GetCurrentContext(pState); 371 371 CRTransformState *t = &g->transform; 372 CRStateBits *sb = GetCurrentBits( );373 CRTransformBits *tb = &(sb->transform); 374 375 if (g->current.inBeginEnd) 376 { 377 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "PopMatrix called in begin/end");372 CRStateBits *sb = GetCurrentBits(pState); 373 CRTransformBits *tb = &(sb->transform); 374 375 if (g->current.inBeginEnd) 376 { 377 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "PopMatrix called in begin/end"); 378 378 return; 379 379 } … … 383 383 if (t->currentStack->depth == 0) 384 384 { 385 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "PopMatrix of empty stack.");385 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "PopMatrix of empty stack."); 386 386 return; 387 387 } … … 398 398 } 399 399 400 void STATE_APIENTRY crStatePushMatrix( void)401 { 402 CRContext *g = GetCurrentContext( );400 void STATE_APIENTRY crStatePushMatrix(PCRStateTracker pState) 401 { 402 CRContext *g = GetCurrentContext(pState); 403 403 CRTransformState *t = &g->transform; 404 CRStateBits *sb = GetCurrentBits( );405 CRTransformBits *tb = &(sb->transform); 406 407 if (g->current.inBeginEnd) 408 { 409 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "PushMatrix called in begin/end");404 CRStateBits *sb = GetCurrentBits(pState); 405 CRTransformBits *tb = &(sb->transform); 406 407 if (g->current.inBeginEnd) 408 { 409 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "PushMatrix called in begin/end"); 410 410 return; 411 411 } … … 415 415 if (t->currentStack->depth + 1 >= t->currentStack->maxDepth) 416 416 { 417 crStateError( __LINE__, __FILE__, GL_STACK_OVERFLOW, "PushMatrix pass the end of allocated stack");417 crStateError(pState, __LINE__, __FILE__, GL_STACK_OVERFLOW, "PushMatrix pass the end of allocated stack"); 418 418 return; 419 419 } … … 433 433 434 434 /* Load a CRMatrix */ 435 void crStateLoadMatrix( const CRmatrix *m)436 { 437 CRContext *g = GetCurrentContext( );438 CRTransformState *t = &(g->transform); 439 CRStateBits *sb = GetCurrentBits( );440 CRTransformBits *tb = &(sb->transform); 441 442 if (g->current.inBeginEnd) 443 { 444 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,435 void crStateLoadMatrix(PCRStateTracker pState, const CRmatrix *m) 436 { 437 CRContext *g = GetCurrentContext(pState); 438 CRTransformState *t = &(g->transform); 439 CRStateBits *sb = GetCurrentBits(pState); 440 CRTransformBits *tb = &(sb->transform); 441 442 if (g->current.inBeginEnd) 443 { 444 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 445 445 "LoadMatrix called in begin/end"); 446 446 return; … … 458 458 459 459 460 void STATE_APIENTRY crStateLoadMatrixf( const GLfloat *m1)461 { 462 CRContext *g = GetCurrentContext( );463 CRTransformState *t = &(g->transform); 464 CRStateBits *sb = GetCurrentBits( );465 CRTransformBits *tb = &(sb->transform); 466 467 if (g->current.inBeginEnd) 468 { 469 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,460 void STATE_APIENTRY crStateLoadMatrixf(PCRStateTracker pState, const GLfloat *m1) 461 { 462 CRContext *g = GetCurrentContext(pState); 463 CRTransformState *t = &(g->transform); 464 CRStateBits *sb = GetCurrentBits(pState); 465 CRTransformBits *tb = &(sb->transform); 466 467 if (g->current.inBeginEnd) 468 { 469 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 470 470 "LoadMatrixf called in begin/end"); 471 471 return; … … 481 481 482 482 483 void STATE_APIENTRY crStateLoadMatrixd( const GLdouble *m1)484 { 485 CRContext *g = GetCurrentContext( );486 CRTransformState *t = &(g->transform); 487 CRStateBits *sb = GetCurrentBits( );488 CRTransformBits *tb = &(sb->transform); 489 490 if (g->current.inBeginEnd) 491 { 492 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,483 void STATE_APIENTRY crStateLoadMatrixd(PCRStateTracker pState, const GLdouble *m1) 484 { 485 CRContext *g = GetCurrentContext(pState); 486 CRTransformState *t = &(g->transform); 487 CRStateBits *sb = GetCurrentBits(pState); 488 CRTransformBits *tb = &(sb->transform); 489 490 if (g->current.inBeginEnd) 491 { 492 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 493 493 "LoadMatrixd called in begin/end"); 494 494 return; … … 504 504 505 505 506 void STATE_APIENTRY crStateLoadTransposeMatrixfARB( const GLfloat *m1)506 void STATE_APIENTRY crStateLoadTransposeMatrixfARB(PCRStateTracker pState, const GLfloat *m1) 507 507 { 508 508 GLfloat tm[16]; 509 509 if (!m1) return; 510 510 _math_transposef(tm, m1); 511 crStateLoadMatrixf( tm);512 } 513 514 void STATE_APIENTRY crStateLoadTransposeMatrixdARB( const GLdouble *m1)511 crStateLoadMatrixf(pState, tm); 512 } 513 514 void STATE_APIENTRY crStateLoadTransposeMatrixdARB(PCRStateTracker pState, const GLdouble *m1) 515 515 { 516 516 GLdouble tm[16]; 517 517 if (!m1) return; 518 518 _math_transposed(tm, m1); 519 crStateLoadMatrixd( tm);519 crStateLoadMatrixd(pState, tm); 520 520 } 521 521 … … 527 527 ** that this really helps. 528 528 */ 529 void STATE_APIENTRY crStateMultMatrixf( const GLfloat *m1)530 { 531 CRContext *g = GetCurrentContext( );532 CRTransformState *t = &(g->transform); 533 CRStateBits *sb = GetCurrentBits( );529 void STATE_APIENTRY crStateMultMatrixf(PCRStateTracker pState, const GLfloat *m1) 530 { 531 CRContext *g = GetCurrentContext(pState); 532 CRTransformState *t = &(g->transform); 533 CRStateBits *sb = GetCurrentBits(pState); 534 534 CRTransformBits *tb = &(sb->transform); 535 535 CRmatrix *m = t->currentStack->top; … … 570 570 if (g->current.inBeginEnd) 571 571 { 572 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "MultMatrixf called in begin/end");572 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "MultMatrixf called in begin/end"); 573 573 return; 574 574 } … … 599 599 } 600 600 601 void STATE_APIENTRY crStateMultMatrixd( const GLdouble *m1)602 { 603 CRContext *g = GetCurrentContext( );604 CRTransformState *t = &(g->transform); 605 CRStateBits *sb = GetCurrentBits( );601 void STATE_APIENTRY crStateMultMatrixd(PCRStateTracker pState, const GLdouble *m1) 602 { 603 CRContext *g = GetCurrentContext(pState); 604 CRTransformState *t = &(g->transform); 605 CRStateBits *sb = GetCurrentBits(pState); 606 606 CRTransformBits *tb = &(sb->transform); 607 607 CRmatrix *m = t->currentStack->top; … … 641 641 if (g->current.inBeginEnd) 642 642 { 643 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "MultMatrixd called in begin/end");643 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "MultMatrixd called in begin/end"); 644 644 return; 645 645 } … … 670 670 } 671 671 672 void STATE_APIENTRY crStateMultTransposeMatrixfARB( const GLfloat *m1)672 void STATE_APIENTRY crStateMultTransposeMatrixfARB(PCRStateTracker pState, const GLfloat *m1) 673 673 { 674 674 GLfloat tm[16]; 675 675 if (!m1) return; 676 676 _math_transposef(tm, m1); 677 crStateMultMatrixf( tm);678 } 679 680 void STATE_APIENTRY crStateMultTransposeMatrixdARB( const GLdouble *m1)677 crStateMultMatrixf(pState, tm); 678 } 679 680 void STATE_APIENTRY crStateMultTransposeMatrixdARB(PCRStateTracker pState, const GLdouble *m1) 681 681 { 682 682 GLdouble tm[16]; 683 683 if (!m1) return; 684 684 _math_transposed(tm, m1); 685 crStateMultMatrixd( tm);686 } 687 688 void STATE_APIENTRY crStateTranslatef( GLfloat x_arg, GLfloat y_arg, GLfloat z_arg)689 { 690 CRContext *g = GetCurrentContext( );691 CRTransformState *t = &(g->transform); 692 CRStateBits *sb = GetCurrentBits( );693 CRTransformBits *tb = &(sb->transform); 694 695 if (g->current.inBeginEnd) 696 { 697 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,685 crStateMultMatrixd(pState, tm); 686 } 687 688 void STATE_APIENTRY crStateTranslatef(PCRStateTracker pState, GLfloat x_arg, GLfloat y_arg, GLfloat z_arg) 689 { 690 CRContext *g = GetCurrentContext(pState); 691 CRTransformState *t = &(g->transform); 692 CRStateBits *sb = GetCurrentBits(pState); 693 CRTransformBits *tb = &(sb->transform); 694 695 if (g->current.inBeginEnd) 696 { 697 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 698 698 "Translatef called in begin/end"); 699 699 return; … … 709 709 710 710 711 void STATE_APIENTRY crStateTranslated( GLdouble x_arg, GLdouble y_arg, GLdouble z_arg)712 { 713 CRContext *g = GetCurrentContext( );714 CRTransformState *t = &(g->transform); 715 CRStateBits *sb = GetCurrentBits( );716 CRTransformBits *tb = &(sb->transform); 717 718 if (g->current.inBeginEnd) 719 { 720 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,711 void STATE_APIENTRY crStateTranslated(PCRStateTracker pState, GLdouble x_arg, GLdouble y_arg, GLdouble z_arg) 712 { 713 CRContext *g = GetCurrentContext(pState); 714 CRTransformState *t = &(g->transform); 715 CRStateBits *sb = GetCurrentBits(pState); 716 CRTransformBits *tb = &(sb->transform); 717 718 if (g->current.inBeginEnd) 719 { 720 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 721 721 "Translated called in begin/end"); 722 722 return; … … 732 732 733 733 734 void STATE_APIENTRY crStateRotatef( GLfloat ang, GLfloat x, GLfloat y, GLfloat z)735 { 736 CRContext *g = GetCurrentContext( );737 CRTransformState *t = &(g->transform); 738 CRStateBits *sb = GetCurrentBits( );739 CRTransformBits *tb = &(sb->transform); 740 741 if (g->current.inBeginEnd) 742 { 743 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,734 void STATE_APIENTRY crStateRotatef(PCRStateTracker pState, GLfloat ang, GLfloat x, GLfloat y, GLfloat z) 735 { 736 CRContext *g = GetCurrentContext(pState); 737 CRTransformState *t = &(g->transform); 738 CRStateBits *sb = GetCurrentBits(pState); 739 CRTransformBits *tb = &(sb->transform); 740 741 if (g->current.inBeginEnd) 742 { 743 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 744 744 "Rotatef called in begin/end"); 745 745 return; … … 754 754 } 755 755 756 void STATE_APIENTRY crStateRotated( GLdouble ang, GLdouble x, GLdouble y, GLdouble z)757 { 758 CRContext *g = GetCurrentContext( );759 CRTransformState *t = &(g->transform); 760 CRStateBits *sb = GetCurrentBits( );761 CRTransformBits *tb = &(sb->transform); 762 763 if (g->current.inBeginEnd) 764 { 765 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,756 void STATE_APIENTRY crStateRotated(PCRStateTracker pState, GLdouble ang, GLdouble x, GLdouble y, GLdouble z) 757 { 758 CRContext *g = GetCurrentContext(pState); 759 CRTransformState *t = &(g->transform); 760 CRStateBits *sb = GetCurrentBits(pState); 761 CRTransformBits *tb = &(sb->transform); 762 763 if (g->current.inBeginEnd) 764 { 765 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 766 766 "Rotated called in begin/end"); 767 767 return; … … 776 776 } 777 777 778 void STATE_APIENTRY crStateScalef ( GLfloat x_arg, GLfloat y_arg, GLfloat z_arg)779 { 780 CRContext *g = GetCurrentContext( );781 CRTransformState *t = &(g->transform); 782 CRStateBits *sb = GetCurrentBits( );783 CRTransformBits *tb = &(sb->transform); 784 785 if (g->current.inBeginEnd) 786 { 787 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,778 void STATE_APIENTRY crStateScalef (PCRStateTracker pState, GLfloat x_arg, GLfloat y_arg, GLfloat z_arg) 779 { 780 CRContext *g = GetCurrentContext(pState); 781 CRTransformState *t = &(g->transform); 782 CRStateBits *sb = GetCurrentBits(pState); 783 CRTransformBits *tb = &(sb->transform); 784 785 if (g->current.inBeginEnd) 786 { 787 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 788 788 "Scalef called in begin/end"); 789 789 return; … … 798 798 } 799 799 800 void STATE_APIENTRY crStateScaled ( GLdouble x_arg, GLdouble y_arg, GLdouble z_arg)801 { 802 CRContext *g = GetCurrentContext( );803 CRTransformState *t = &(g->transform); 804 CRStateBits *sb = GetCurrentBits( );805 CRTransformBits *tb = &(sb->transform); 806 807 if (g->current.inBeginEnd) 808 { 809 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,800 void STATE_APIENTRY crStateScaled (PCRStateTracker pState, GLdouble x_arg, GLdouble y_arg, GLdouble z_arg) 801 { 802 CRContext *g = GetCurrentContext(pState); 803 CRTransformState *t = &(g->transform); 804 CRStateBits *sb = GetCurrentBits(pState); 805 CRTransformBits *tb = &(sb->transform); 806 807 if (g->current.inBeginEnd) 808 { 809 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 810 810 "Scaled called in begin/end"); 811 811 return; … … 820 820 } 821 821 822 void STATE_APIENTRY crStateFrustum( GLdouble left, GLdouble right,822 void STATE_APIENTRY crStateFrustum(PCRStateTracker pState, GLdouble left, GLdouble right, 823 823 GLdouble bottom, GLdouble top, 824 824 GLdouble zNear, GLdouble zFar) 825 825 { 826 CRContext *g = GetCurrentContext( );827 CRTransformState *t = &(g->transform); 828 CRStateBits *sb = GetCurrentBits( );829 CRTransformBits *tb = &(sb->transform); 830 831 if (g->current.inBeginEnd) 832 { 833 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,826 CRContext *g = GetCurrentContext(pState); 827 CRTransformState *t = &(g->transform); 828 CRStateBits *sb = GetCurrentBits(pState); 829 CRTransformBits *tb = &(sb->transform); 830 831 if (g->current.inBeginEnd) 832 { 833 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 834 834 "Frustum called in begin/end"); 835 835 return; … … 844 844 } 845 845 846 void STATE_APIENTRY crStateOrtho( GLdouble left, GLdouble right,846 void STATE_APIENTRY crStateOrtho(PCRStateTracker pState, GLdouble left, GLdouble right, 847 847 GLdouble bottom, GLdouble top, 848 848 GLdouble zNear, GLdouble zFar) 849 849 { 850 CRContext *g = GetCurrentContext( );851 CRTransformState *t = &(g->transform); 852 CRStateBits *sb = GetCurrentBits( );853 CRTransformBits *tb = &(sb->transform); 854 855 if (g->current.inBeginEnd) 856 { 857 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,850 CRContext *g = GetCurrentContext(pState); 851 CRTransformState *t = &(g->transform); 852 CRStateBits *sb = GetCurrentBits(pState); 853 CRTransformBits *tb = &(sb->transform); 854 855 if (g->current.inBeginEnd) 856 { 857 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 858 858 "Ortho called in begin/end"); 859 859 return; … … 868 868 } 869 869 870 void STATE_APIENTRY crStateGetClipPlane( GLenum plane, GLdouble *equation)871 { 872 CRContext *g = GetCurrentContext( );870 void STATE_APIENTRY crStateGetClipPlane(PCRStateTracker pState, GLenum plane, GLdouble *equation) 871 { 872 CRContext *g = GetCurrentContext(pState); 873 873 CRTransformState *t = &g->transform; 874 874 unsigned int i; … … 876 876 if (g->current.inBeginEnd) 877 877 { 878 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,878 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 879 879 "glGetClipPlane called in begin/end"); 880 880 return; … … 884 884 if (i >= g->limits.maxClipPlanes) 885 885 { 886 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,886 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 887 887 "GetClipPlane called with bad enumerant: %d", plane); 888 888 return; … … 898 898 CRContext *fromCtx, CRContext *toCtx ) 899 899 { 900 PCRStateTracker pState = fromCtx->pStateTracker; 900 901 const GLuint maxTextureUnits = toCtx->limits.maxTextureUnits; 901 902 CRTransformState *from = &(fromCtx->transform); … … 905 906 CRbitvalue nbitID[CR_MAX_BITARRAY]; 906 907 908 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 909 907 910 for (j=0;j<CR_MAX_BITARRAY;j++) 908 911 nbitID[j] = ~bitID[j]; … … 911 914 { 912 915 glAble able[2]; 913 able[0] = diff_api.Disable;914 able[1] = diff_api.Enable;916 able[0] = pState->diff_api.Disable; 917 able[1] = pState->diff_api.Enable; 915 918 if (from->normalize != to->normalize) { 916 919 if (to->normalize == GL_TRUE) 917 diff_api.Enable(GL_NORMALIZE);920 pState->diff_api.Enable(GL_NORMALIZE); 918 921 else 919 diff_api.Disable(GL_NORMALIZE);922 pState->diff_api.Disable(GL_NORMALIZE); 920 923 FILLDIRTY(t->enable); 921 924 FILLDIRTY(t->dirty); … … 943 946 944 947 if (CHECKDIRTY(t->clipPlane, bitID)) { 945 diff_api.MatrixMode(GL_MODELVIEW);946 diff_api.PushMatrix();947 diff_api.LoadIdentity();948 pState->diff_api.MatrixMode(GL_MODELVIEW); 949 pState->diff_api.PushMatrix(); 950 pState->diff_api.LoadIdentity(); 948 951 for (i=0; i<CR_MAX_CLIP_PLANES; i++) { 949 952 if (from->clipPlane[i].x != to->clipPlane[i].x || … … 958 961 cp[3] = to->clipPlane[i].w; 959 962 960 diff_api.ClipPlane(GL_CLIP_PLANE0 + i, (const GLdouble *)(cp));963 pState->diff_api.ClipPlane(GL_CLIP_PLANE0 + i, (const GLdouble *)(cp)); 961 964 962 965 FILLDIRTY(t->clipPlane); … … 964 967 } 965 968 } 966 diff_api.PopMatrix();969 pState->diff_api.PopMatrix(); 967 970 CLEARDIRTY(t->clipPlane, nbitID); 968 971 } … … 986 989 !crMatrixIsEqual(to->modelViewStack.top, from->modelViewStack.top)) 987 990 { 988 diff_api.MatrixMode(GL_MODELVIEW);991 pState->diff_api.MatrixMode(GL_MODELVIEW); 989 992 990 993 if (fd > td) … … 992 995 for (i = td; i < fd; i++) 993 996 { 994 diff_api.PopMatrix();997 pState->diff_api.PopMatrix(); 995 998 } 996 999 fd = td; … … 999 1002 for (i = fd; i <= td; i++) 1000 1003 { 1001 LOADMATRIX( to->modelViewStack.stack + i);1004 LOADMATRIX(pState, to->modelViewStack.stack + i); 1002 1005 FILLDIRTY(t->modelviewMatrix); 1003 1006 FILLDIRTY(t->dirty); … … 1005 1008 /* Don't want to push on the current matrix */ 1006 1009 if (i != to->modelViewStack.depth) 1007 diff_api.PushMatrix();1010 pState->diff_api.PushMatrix(); 1008 1011 } 1009 1012 } … … 1021 1024 !crMatrixIsEqual(to->projectionStack.top, from->projectionStack.top)) { 1022 1025 1023 diff_api.MatrixMode(GL_PROJECTION);1026 pState->diff_api.MatrixMode(GL_PROJECTION); 1024 1027 1025 1028 if (fd > td) … … 1027 1030 for (i = td; i < fd; i++) 1028 1031 { 1029 diff_api.PopMatrix();1032 pState->diff_api.PopMatrix(); 1030 1033 } 1031 1034 fd = td; … … 1034 1037 for (i = fd; i <= td; i++) 1035 1038 { 1036 LOADMATRIX( to->projectionStack.stack + i);1039 LOADMATRIX(pState, to->projectionStack.stack + i); 1037 1040 FILLDIRTY(t->projectionMatrix); 1038 1041 FILLDIRTY(t->dirty); … … 1040 1043 /* Don't want to push on the current matrix */ 1041 1044 if (i != to->projectionStack.depth) 1042 diff_api.PushMatrix();1045 pState->diff_api.PushMatrix(); 1043 1046 } 1044 1047 } … … 1061 1064 !crMatrixIsEqual(to->textureStack[j].top, from->textureStack[j].top)) 1062 1065 { 1063 diff_api.MatrixMode(GL_TEXTURE);1066 pState->diff_api.MatrixMode(GL_TEXTURE); 1064 1067 1065 1068 if (fd > td) … … 1067 1070 for (i = td; i < fd; i++) 1068 1071 { 1069 diff_api.PopMatrix();1072 pState->diff_api.PopMatrix(); 1070 1073 } 1071 1074 fd = td; 1072 1075 } 1073 1076 1074 diff_api.ActiveTextureARB( j + GL_TEXTURE0_ARB );1077 pState->diff_api.ActiveTextureARB( j + GL_TEXTURE0_ARB ); 1075 1078 for (i = fd; i <= td; i++) 1076 1079 { 1077 LOADMATRIX( to->textureStack[j].stack + i);1080 LOADMATRIX(pState, to->textureStack[j].stack + i); 1078 1081 FILLDIRTY(t->textureMatrix); 1079 1082 FILLDIRTY(t->dirty); … … 1081 1084 /* Don't want to push on the current matrix */ 1082 1085 if (i != to->textureStack[j].depth) 1083 diff_api.PushMatrix();1086 pState->diff_api.PushMatrix(); 1084 1087 } 1085 1088 } … … 1088 1091 * proper value now. 1089 1092 */ 1090 diff_api.ActiveTextureARB(GL_TEXTURE0_ARB + toCtx->texture.curTextureUnit);1093 pState->diff_api.ActiveTextureARB(GL_TEXTURE0_ARB + toCtx->texture.curTextureUnit); 1091 1094 CLEARDIRTY(t->textureMatrix, nbitID); 1092 1095 } … … 1100 1103 if (td != fd || !crMatrixIsEqual(to->colorStack.top, from->colorStack.top)) 1101 1104 { 1102 diff_api.MatrixMode(GL_COLOR);1105 pState->diff_api.MatrixMode(GL_COLOR); 1103 1106 1104 1107 if (fd > td) … … 1106 1109 for (i = td; i < fd; i++) 1107 1110 { 1108 diff_api.PopMatrix();1111 pState->diff_api.PopMatrix(); 1109 1112 } 1110 1113 fd = td; … … 1113 1116 for (i = fd; i <= td; i++) 1114 1117 { 1115 LOADMATRIX( to->colorStack.stack + i);1118 LOADMATRIX(pState, to->colorStack.stack + i); 1116 1119 FILLDIRTY(t->colorMatrix); 1117 1120 FILLDIRTY(t->dirty); … … 1119 1122 /* Don't want to push on the current matrix */ 1120 1123 if (i != to->colorStack.depth) 1121 diff_api.PushMatrix();1124 pState->diff_api.PushMatrix(); 1122 1125 } 1123 1126 } … … 1131 1134 * set it to the proper value now. 1132 1135 */ 1133 diff_api.MatrixMode(to->matrixMode);1136 pState->diff_api.MatrixMode(to->matrixMode); 1134 1137 1135 1138 /* sanity tests */ … … 1143 1146 CRContext *fromCtx, CRContext *toCtx ) 1144 1147 { 1148 PCRStateTracker pState = fromCtx->pStateTracker; 1145 1149 const GLuint maxTextureUnits = toCtx->limits.maxTextureUnits; 1146 1150 CRTransformState *from = &(fromCtx->transform); … … 1151 1155 CRbitvalue nbitID[CR_MAX_BITARRAY]; 1152 1156 1157 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 1158 1153 1159 for (j=0;j<CR_MAX_BITARRAY;j++) 1154 1160 nbitID[j] = ~bitID[j]; … … 1156 1162 if (CHECKDIRTY(t->enable, bitID)) { 1157 1163 glAble able[2]; 1158 able[0] = diff_api.Disable;1159 able[1] = diff_api.Enable;1164 able[0] = pState->diff_api.Disable; 1165 able[1] = pState->diff_api.Enable; 1160 1166 for (i=0; i<CR_MAX_CLIP_PLANES; i++) { 1161 1167 if (from->clip[i] != to->clip[i]) { 1162 1168 if (to->clip[i] == GL_TRUE) 1163 diff_api.Enable(GL_CLIP_PLANE0 + i);1169 pState->diff_api.Enable(GL_CLIP_PLANE0 + i); 1164 1170 else 1165 diff_api.Disable(GL_CLIP_PLANE0 + i);1171 pState->diff_api.Disable(GL_CLIP_PLANE0 + i); 1166 1172 from->clip[i] = to->clip[i]; 1167 1173 } … … 1169 1175 if (from->normalize != to->normalize) { 1170 1176 if (to->normalize == GL_TRUE) 1171 diff_api.Enable(GL_NORMALIZE);1177 pState->diff_api.Enable(GL_NORMALIZE); 1172 1178 else 1173 diff_api.Disable(GL_NORMALIZE);1179 pState->diff_api.Disable(GL_NORMALIZE); 1174 1180 from->normalize = to->normalize; 1175 1181 } … … 1194 1200 if (CHECKDIRTY(t->clipPlane, bitID)) { 1195 1201 if (from->matrixMode != GL_MODELVIEW) { 1196 diff_api.MatrixMode(GL_MODELVIEW);1202 pState->diff_api.MatrixMode(GL_MODELVIEW); 1197 1203 from->matrixMode = GL_MODELVIEW; 1198 1204 } 1199 diff_api.PushMatrix();1200 diff_api.LoadIdentity();1205 pState->diff_api.PushMatrix(); 1206 pState->diff_api.LoadIdentity(); 1201 1207 for (i=0; i<CR_MAX_CLIP_PLANES; i++) { 1202 1208 if (from->clipPlane[i].x != to->clipPlane[i].x || … … 1211 1217 cp[3] = to->clipPlane[i].w; 1212 1218 1213 diff_api.ClipPlane(GL_CLIP_PLANE0 + i, (const GLdouble *)(cp));1219 pState->diff_api.ClipPlane(GL_CLIP_PLANE0 + i, (const GLdouble *)(cp)); 1214 1220 from->clipPlane[i] = to->clipPlane[i]; 1215 1221 } 1216 1222 } 1217 diff_api.PopMatrix();1223 pState->diff_api.PopMatrix(); 1218 1224 CLEARDIRTY(t->clipPlane, nbitID); 1219 1225 } … … 1232 1238 { 1233 1239 if (from->matrixMode != GL_MODELVIEW) { 1234 diff_api.MatrixMode(GL_MODELVIEW);1240 pState->diff_api.MatrixMode(GL_MODELVIEW); 1235 1241 from->matrixMode = GL_MODELVIEW; 1236 1242 } … … 1240 1246 for (i = to->modelViewStack.depth; i < from->modelViewStack.depth; i++) 1241 1247 { 1242 diff_api.PopMatrix();1248 pState->diff_api.PopMatrix(); 1243 1249 } 1244 1250 … … 1248 1254 for (i = from->modelViewStack.depth; i <= to->modelViewStack.depth; i++) 1249 1255 { 1250 LOADMATRIX( to->modelViewStack.stack + i);1256 LOADMATRIX(pState, to->modelViewStack.stack + i); 1251 1257 from->modelViewStack.stack[i] = to->modelViewStack.stack[i]; 1252 1258 1253 1259 /* Don't want to push on the current matrix */ 1254 1260 if (i != to->modelViewStack.depth) 1255 diff_api.PushMatrix();1261 pState->diff_api.PushMatrix(); 1256 1262 } 1257 1263 from->modelViewStack.depth = to->modelViewStack.depth; … … 1266 1272 { 1267 1273 if (from->matrixMode != GL_PROJECTION) { 1268 diff_api.MatrixMode(GL_PROJECTION);1274 pState->diff_api.MatrixMode(GL_PROJECTION); 1269 1275 from->matrixMode = GL_PROJECTION; 1270 1276 } … … 1274 1280 for (i = to->projectionStack.depth; i < from->projectionStack.depth; i++) 1275 1281 { 1276 diff_api.PopMatrix();1282 pState->diff_api.PopMatrix(); 1277 1283 } 1278 1284 … … 1282 1288 for (i = from->projectionStack.depth; i <= to->projectionStack.depth; i++) 1283 1289 { 1284 LOADMATRIX( to->projectionStack.stack + i);1290 LOADMATRIX(pState, to->projectionStack.stack + i); 1285 1291 from->projectionStack.stack[i] = to->projectionStack.stack[i]; 1286 1292 1287 1293 /* Don't want to push on the current matrix */ 1288 1294 if (i != to->projectionStack.depth) 1289 diff_api.PushMatrix();1295 pState->diff_api.PushMatrix(); 1290 1296 } 1291 1297 from->projectionStack.depth = to->projectionStack.depth; … … 1303 1309 { 1304 1310 if (from->matrixMode != GL_TEXTURE) { 1305 diff_api.MatrixMode(GL_TEXTURE);1311 pState->diff_api.MatrixMode(GL_TEXTURE); 1306 1312 from->matrixMode = GL_TEXTURE; 1307 1313 } … … 1311 1317 { 1312 1318 if (textureFrom->curTextureUnit != j) { 1313 diff_api.ActiveTextureARB( j + GL_TEXTURE0_ARB );1319 pState->diff_api.ActiveTextureARB( j + GL_TEXTURE0_ARB ); 1314 1320 textureFrom->curTextureUnit = j; 1315 1321 } 1316 1322 for (i = to->textureStack[j].depth; i < from->textureStack[j].depth; i++) 1317 1323 { 1318 diff_api.PopMatrix();1324 pState->diff_api.PopMatrix(); 1319 1325 } 1320 1326 … … 1325 1331 { 1326 1332 if (textureFrom->curTextureUnit != j) { 1327 diff_api.ActiveTextureARB( j + GL_TEXTURE0_ARB );1333 pState->diff_api.ActiveTextureARB( j + GL_TEXTURE0_ARB ); 1328 1334 textureFrom->curTextureUnit = j; 1329 1335 } 1330 LOADMATRIX( to->textureStack[j].stack + i);1336 LOADMATRIX(pState, to->textureStack[j].stack + i); 1331 1337 from->textureStack[j].stack[i] = to->textureStack[j].stack[i]; 1332 1338 1333 1339 /* Don't want to push on the current matrix */ 1334 1340 if (i != to->textureStack[j].depth) 1335 diff_api.PushMatrix();1341 pState->diff_api.PushMatrix(); 1336 1342 } 1337 1343 from->textureStack[j].depth = to->textureStack[j].depth; … … 1341 1347 1342 1348 /* Restore proper active texture unit */ 1343 diff_api.ActiveTextureARB(GL_TEXTURE0_ARB + toCtx->texture.curTextureUnit);1349 pState->diff_api.ActiveTextureARB(GL_TEXTURE0_ARB + toCtx->texture.curTextureUnit); 1344 1350 } 1345 1351 … … 1349 1355 { 1350 1356 if (from->matrixMode != GL_COLOR) { 1351 diff_api.MatrixMode(GL_COLOR);1357 pState->diff_api.MatrixMode(GL_COLOR); 1352 1358 from->matrixMode = GL_COLOR; 1353 1359 } … … 1357 1363 for (i = to->colorStack.depth; i < from->colorStack.depth; i++) 1358 1364 { 1359 diff_api.PopMatrix();1365 pState->diff_api.PopMatrix(); 1360 1366 } 1361 1367 … … 1365 1371 for (i = to->colorStack.depth; i <= to->colorStack.depth; i++) 1366 1372 { 1367 LOADMATRIX( to->colorStack.stack + i);1373 LOADMATRIX(pState, to->colorStack.stack + i); 1368 1374 from->colorStack.stack[i] = to->colorStack.stack[i]; 1369 1375 1370 1376 /* Don't want to push on the current matrix */ 1371 1377 if (i != to->colorStack.depth) 1372 diff_api.PushMatrix();1378 pState->diff_api.PushMatrix(); 1373 1379 } 1374 1380 from->colorStack.depth = to->colorStack.depth; … … 1383 1389 /* update MatrixMode now */ 1384 1390 if (from->matrixMode != to->matrixMode) { 1385 diff_api.MatrixMode(to->matrixMode);1391 pState->diff_api.MatrixMode(to->matrixMode); 1386 1392 from->matrixMode = to->matrixMode; 1387 1393 }
Note:
See TracChangeset
for help on using the changeset viewer.