- Timestamp:
- May 3, 2019 9:51:02 PM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 113 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedback.py
r63942 r78375 94 94 } 95 95 96 return crStateRenderMode( mode );96 return crStateRenderMode(&feedback_spu.StateTracker, mode ); 97 97 } 98 98 … … 100 100 { 101 101 if (feedback_spu.render_mode == GL_FEEDBACK) 102 crStateFeedbackBegin( mode );103 else if (feedback_spu.render_mode == GL_SELECT) 104 crStateSelectBegin( mode );102 crStateFeedbackBegin(&feedback_spu.StateTracker, mode ); 103 else if (feedback_spu.render_mode == GL_SELECT) 104 crStateSelectBegin(&feedback_spu.StateTracker, mode ); 105 105 else 106 106 { 107 crStateBegin( mode );107 crStateBegin(&feedback_spu.StateTracker, mode ); 108 108 feedback_spu.super.Begin( mode ); 109 109 } … … 113 113 { 114 114 if (feedback_spu.render_mode == GL_FEEDBACK) 115 crStateFeedbackEnd( 116 else if (feedback_spu.render_mode == GL_SELECT) 117 crStateSelectEnd( 115 crStateFeedbackEnd(&feedback_spu.StateTracker); 116 else if (feedback_spu.render_mode == GL_SELECT) 117 crStateSelectEnd(&feedback_spu.StateTracker); 118 118 else 119 119 { 120 crStateEnd( 120 crStateEnd(&feedback_spu.StateTracker); 121 121 feedback_spu.super.End( ); 122 122 } … … 125 125 static void FEEDBACKSPU_APIENTRY feedbackspu_Bitmap ( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ) 126 126 { 127 crStateBitmap( width, height, xorig, yorig, xmove, ymove, bitmap );128 129 if (feedback_spu.render_mode == GL_FEEDBACK) 130 crStateFeedbackBitmap( width, height, xorig, yorig, xmove, ymove, bitmap );131 else if (feedback_spu.render_mode == GL_SELECT) 132 crStateSelectBitmap( width, height, xorig, yorig, xmove, ymove, bitmap );127 crStateBitmap(&feedback_spu.StateTracker, width, height, xorig, yorig, xmove, ymove, bitmap ); 128 129 if (feedback_spu.render_mode == GL_FEEDBACK) 130 crStateFeedbackBitmap(&feedback_spu.StateTracker, width, height, xorig, yorig, xmove, ymove, bitmap ); 131 else if (feedback_spu.render_mode == GL_SELECT) 132 crStateSelectBitmap(&feedback_spu.StateTracker, width, height, xorig, yorig, xmove, ymove, bitmap ); 133 133 else 134 134 feedback_spu.super.Bitmap( width, height, xorig, yorig, xmove, ymove, bitmap ); … … 138 138 { 139 139 if (feedback_spu.render_mode == GL_FEEDBACK) 140 crStateFeedbackCopyPixels( x, y, width, height, type );141 else if (feedback_spu.render_mode == GL_SELECT) 142 crStateSelectCopyPixels( x, y, width, height, type );140 crStateFeedbackCopyPixels(&feedback_spu.StateTracker, x, y, width, height, type ); 141 else if (feedback_spu.render_mode == GL_SELECT) 142 crStateSelectCopyPixels(&feedback_spu.StateTracker, x, y, width, height, type ); 143 143 else 144 144 feedback_spu.super.CopyPixels( x, y, width, height, type ); … … 148 148 { 149 149 if (feedback_spu.render_mode == GL_FEEDBACK) 150 crStateFeedbackDrawPixels( width, height, format, type, pixels );151 else if (feedback_spu.render_mode == GL_SELECT) 152 crStateSelectDrawPixels( width, height, format, type, pixels );150 crStateFeedbackDrawPixels(&feedback_spu.StateTracker, width, height, format, type, pixels ); 151 else if (feedback_spu.render_mode == GL_SELECT) 152 crStateSelectDrawPixels(&feedback_spu.StateTracker, width, height, format, type, pixels ); 153 153 else 154 154 feedback_spu.super.DrawPixels( width, height, format, type, pixels ); … … 161 161 pname == GL_FEEDBACK_BUFFER_TYPE || 162 162 pname == GL_SELECTION_BUFFER_SIZE) 163 crStateFeedbackGetBooleanv( pname, params );164 else 165 if (pname == GL_VIEWPORT && feedback_spu.default_viewport) 166 crStateGetBooleanv( pname, params );163 crStateFeedbackGetBooleanv(&feedback_spu.StateTracker, pname, params ); 164 else 165 if (pname == GL_VIEWPORT && feedback_spu.default_viewport) 166 crStateGetBooleanv(&feedback_spu.StateTracker, pname, params ); 167 167 else 168 168 feedback_spu.super.GetBooleanv( pname, params ); … … 175 175 pname == GL_FEEDBACK_BUFFER_TYPE || 176 176 pname == GL_SELECTION_BUFFER_SIZE) 177 crStateFeedbackGetDoublev( pname, params );178 else 179 if (pname == GL_VIEWPORT && feedback_spu.default_viewport) 180 crStateGetDoublev( pname, params );177 crStateFeedbackGetDoublev(&feedback_spu.StateTracker, pname, params ); 178 else 179 if (pname == GL_VIEWPORT && feedback_spu.default_viewport) 180 crStateGetDoublev(&feedback_spu.StateTracker, pname, params ); 181 181 else 182 182 feedback_spu.super.GetDoublev( pname, params ); … … 189 189 pname == GL_FEEDBACK_BUFFER_TYPE || 190 190 pname == GL_SELECTION_BUFFER_SIZE) 191 crStateFeedbackGetFloatv( pname, params );192 else 193 if (pname == GL_VIEWPORT && feedback_spu.default_viewport) 194 crStateGetFloatv( pname, params );191 crStateFeedbackGetFloatv(&feedback_spu.StateTracker, pname, params ); 192 else 193 if (pname == GL_VIEWPORT && feedback_spu.default_viewport) 194 crStateGetFloatv(&feedback_spu.StateTracker, pname, params ); 195 195 else 196 196 feedback_spu.super.GetFloatv( pname, params ); … … 203 203 pname == GL_FEEDBACK_BUFFER_TYPE || 204 204 pname == GL_SELECTION_BUFFER_SIZE) 205 crStateFeedbackGetIntegerv( pname, params );206 else 207 if (pname == GL_VIEWPORT && feedback_spu.default_viewport) 208 crStateGetIntegerv( pname, params );205 crStateFeedbackGetIntegerv(&feedback_spu.StateTracker, pname, params ); 206 else 207 if (pname == GL_VIEWPORT && feedback_spu.default_viewport) 208 crStateGetIntegerv(&feedback_spu.StateTracker, pname, params ); 209 209 else 210 210 feedback_spu.super.GetIntegerv( pname, params ); -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c
r78341 r78375 50 50 } 51 51 52 feedback_spu.context[slot].clientState = crStateCreateContext( NULL, visual, NULL);52 feedback_spu.context[slot].clientState = crStateCreateContext(&feedback_spu.StateTracker, NULL, visual, NULL); 53 53 feedback_spu.context[slot].clientCtx = ctx; 54 54 … … 77 77 CRASSERT(slot < feedback_spu.numContexts); 78 78 79 crStateMakeCurrent( feedback_spu.context[slot].clientState);79 crStateMakeCurrent(&feedback_spu.StateTracker, feedback_spu.context[slot].clientState); 80 80 81 crStateGetIntegerv( GL_RENDER_MODE, &oldmode);81 crStateGetIntegerv(&feedback_spu.StateTracker, GL_RENDER_MODE, &oldmode); 82 82 83 83 if (oldmode!=feedback_spu.render_mode) … … 88 88 else 89 89 { 90 crStateMakeCurrent( NULL);90 crStateMakeCurrent(&feedback_spu.StateTracker, NULL); 91 91 } 92 92 … … 107 107 CRASSERT(slot < feedback_spu.numContexts); 108 108 109 crStateDestroyContext( feedback_spu.context[slot].clientState);109 crStateDestroyContext(&feedback_spu.StateTracker, feedback_spu.context[slot].clientState); 110 110 111 111 feedback_spu.context[slot].clientState = NULL; -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedback_state.py
r63942 r78375 29 29 print('%s FEEDBACKSPU_APIENTRY feedbackspu_%s(%s)' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 30 30 print('{') 31 print('\tcrState%s(%s);' % (func_name, apiutil.MakeCallString(params))) 31 if len(params) == 0: 32 print('\tcrState%s(&feedback_spu.StateTracker);' % (func_name,)) 33 else: 34 print('\tcrState%s(&feedback_spu.StateTracker, %s);' % (func_name, apiutil.MakeCallString(params))) 32 35 print('') 33 36 print('\tfeedback_spu.super.%s(%s);' % (func_name, apiutil.MakeCallString(params))) -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h
r78341 r78375 43 43 44 44 CRmutex mutex; 45 46 /** The state tracker state. */ 47 CRStateTracker StateTracker; 45 48 } feedbackSPU; 46 49 -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c
r78341 r78375 45 45 46 46 /* create/init default state tracker */ 47 crStateInit( );47 crStateInit(&feedback_spu.StateTracker); 48 48 49 feedback_spu.defaultctx = crStateCreateContext( NULL, 0, NULL);50 crStateSetCurrent( feedback_spu.defaultctx);49 feedback_spu.defaultctx = crStateCreateContext(&feedback_spu.StateTracker, NULL, 0, NULL); 50 crStateSetCurrent(&feedback_spu.StateTracker, feedback_spu.defaultctx); 51 51 52 52 feedback_spu.numContexts = 0; -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h
r78341 r78375 109 109 int numContexts; 110 110 ContextInfo context[CR_MAX_CONTEXTS]; 111 112 /** State tracker state. */ 113 CRStateTracker StateTracker; 111 114 } PackSPU; 112 115 -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py
r78190 r78375 36 36 GLboolean serverArrays = GL_FALSE; 37 37 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 38 serverArrays = crStateUseServerArrays( );38 serverArrays = crStateUseServerArrays(&pack_spu.StateTracker); 39 39 if (serverArrays) { 40 40 CRClientState *clientState = &(ctx->clientState->client); -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c
r78190 r78375 31 31 32 32 CRASSERT(GL_TRUE == ctx->clientState->bufferobject.retainBufferData); 33 buffer = crStateMapBufferARB( target, access);33 buffer = crStateMapBufferARB(&pack_spu.StateTracker, target, access); 34 34 35 35 #ifdef CR_ARB_pixel_buffer_object … … 67 67 #endif 68 68 69 crStateGetBufferSubDataARB( target, offset, size, data);69 crStateGetBufferSubDataARB(&pack_spu.StateTracker, target, offset, size, data); 70 70 } 71 71 … … 86 86 87 87 CRASSERT(GL_TRUE == ctx->clientState->bufferobject.retainBufferData); 88 crStateUnmapBufferARB( target );88 crStateUnmapBufferARB(&pack_spu.StateTracker, target ); 89 89 90 90 return GL_TRUE; … … 96 96 { 97 97 /*crDebug("packspu_BufferDataARB size:%d", size);*/ 98 crStateBufferDataARB( target, size, data, usage);98 crStateBufferDataARB(&pack_spu.StateTracker,target, size, data, usage); 99 99 crPackBufferDataARB(target, size, data, usage); 100 100 } … … 104 104 { 105 105 /*crDebug("packspu_BufferSubDataARB size:%d", size);*/ 106 crStateBufferSubDataARB( target, offset, size, data);106 crStateBufferSubDataARB(&pack_spu.StateTracker,target, offset, size, data); 107 107 crPackBufferSubDataARB(target, offset, size, data); 108 108 } … … 112 112 packspu_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) 113 113 { 114 crStateGetBufferPointervARB( target, pname, params );114 crStateGetBufferPointervARB(&pack_spu.StateTracker, target, pname, params ); 115 115 } 116 116 … … 119 119 packspu_GetBufferParameterivARB( GLenum target, GLenum pname, GLint * params ) 120 120 { 121 crStateGetBufferParameterivARB( target, pname, params );121 crStateGetBufferParameterivARB(&pack_spu.StateTracker, target, pname, params ); 122 122 } 123 123 … … 128 128 packspu_BindBufferARB( GLenum target, GLuint buffer ) 129 129 { 130 crStateBindBufferARB( target, buffer);130 crStateBindBufferARB(&pack_spu.StateTracker, target, buffer); 131 131 crPackBindBufferARB(target, buffer); 132 132 } … … 145 145 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 146 146 147 crStateRegBuffers( n, buffer);147 crStateRegBuffers(&pack_spu.StateTracker,n, buffer); 148 148 } 149 149 150 150 void PACKSPU_APIENTRY packspu_DeleteBuffersARB( GLsizei n, const GLuint * buffer ) 151 151 { 152 crStateDeleteBuffersARB( n, buffer );152 crStateDeleteBuffersARB(&pack_spu.StateTracker, n, buffer ); 153 153 crPackDeleteBuffersARB(n, buffer); 154 154 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c
r78190 r78375 19 19 } 20 20 #endif 21 crStateFogCoordPointerEXT( type, stride, pointer );21 crStateFogCoordPointerEXT(&pack_spu.StateTracker, type, stride, pointer ); 22 22 } 23 23 … … 30 30 } 31 31 #endif 32 crStateColorPointer( size, type, stride, pointer );32 crStateColorPointer(&pack_spu.StateTracker, size, type, stride, pointer ); 33 33 } 34 34 … … 41 41 } 42 42 #endif 43 crStateSecondaryColorPointerEXT( size, type, stride, pointer );43 crStateSecondaryColorPointerEXT(&pack_spu.StateTracker, size, type, stride, pointer ); 44 44 } 45 45 … … 53 53 } 54 54 #endif 55 crStateVertexPointer( size, type, stride, pointer );55 crStateVertexPointer(&pack_spu.StateTracker, size, type, stride, pointer ); 56 56 } 57 57 … … 64 64 } 65 65 #endif 66 crStateTexCoordPointer( size, type, stride, pointer );66 crStateTexCoordPointer(&pack_spu.StateTracker, size, type, stride, pointer ); 67 67 } 68 68 … … 75 75 } 76 76 #endif 77 crStateNormalPointer( type, stride, pointer );77 crStateNormalPointer(&pack_spu.StateTracker, type, stride, pointer ); 78 78 } 79 79 … … 86 86 } 87 87 #endif 88 crStateEdgeFlagPointer( stride, pointer );88 crStateEdgeFlagPointer(&pack_spu.StateTracker, stride, pointer ); 89 89 } 90 90 … … 97 97 } 98 98 #endif 99 crStateVertexAttribPointerARB( index, size, type, normalized, stride, pointer );99 crStateVertexAttribPointerARB(&pack_spu.StateTracker, index, size, type, normalized, stride, pointer ); 100 100 } 101 101 … … 108 108 } 109 109 #endif 110 crStateVertexAttribPointerNV( index, size, type, stride, pointer );110 crStateVertexAttribPointerNV(&pack_spu.StateTracker, index, size, type, stride, pointer ); 111 111 } 112 112 … … 119 119 } 120 120 #endif 121 crStateIndexPointer( type, stride, pointer);121 crStateIndexPointer(&pack_spu.StateTracker, type, stride, pointer); 122 122 } 123 123 124 124 void PACKSPU_APIENTRY packspu_GetPointerv( GLenum pname, GLvoid **params ) 125 125 { 126 crStateGetPointerv( pname, params );126 crStateGetPointerv(&pack_spu.StateTracker, pname, params ); 127 127 } 128 128 … … 138 138 /*crDebug("packspu_InterleavedArrays");*/ 139 139 140 crStateInterleavedArrays( format, stride, pointer );140 crStateInterleavedArrays(&pack_spu.StateTracker, format, stride, pointer ); 141 141 } 142 142 … … 219 219 #ifdef DEBUG 220 220 { 221 CRContext *pCurState = crStateGetCurrent( );221 CRContext *pCurState = crStateGetCurrent(&pack_spu.StateTracker); 222 222 223 223 Assert(g == pCurState); … … 282 282 { 283 283 CRContext *g = pRestoreCtx->pCtx->clientState; 284 CRContext *pCurState = crStateGetCurrent( );284 CRContext *pCurState = crStateGetCurrent(&pack_spu.StateTracker); 285 285 286 286 Assert(g == pCurState); … … 319 319 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 320 320 { 321 serverArrays = crStateUseServerArrays( );321 serverArrays = crStateUseServerArrays(&pack_spu.StateTracker); 322 322 if (ctx->fCheckZerroVertAttr) 323 323 cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib); … … 395 395 { 396 396 GET_CONTEXT(ctx); 397 elementsBuffer = crStateGetCurrent( )->bufferobject.elementsBuffer;397 elementsBuffer = crStateGetCurrent(&pack_spu.StateTracker)->bufferobject.elementsBuffer; 398 398 /*crDebug("DrawElements count=%d, indices=%p", count, indices);*/ 399 399 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 400 400 { 401 serverArrays = crStateUseServerArrays( );401 serverArrays = crStateUseServerArrays(&pack_spu.StateTracker); 402 402 if (ctx->fCheckZerroVertAttr) 403 403 cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib); … … 452 452 if ((max-min)<(GLuint)(2*count)) 453 453 { 454 crStateLockArraysEXT( min, max-min+1);454 crStateLockArraysEXT(&pack_spu.StateTracker, min, max-min+1); 455 455 456 456 serverArrays = crStateUseServerArrays(); … … 461 461 else 462 462 { 463 crStateUnlockArraysEXT( );463 crStateUnlockArraysEXT(&pack_spu.StateTracker); 464 464 } 465 465 } … … 539 539 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 540 540 { 541 serverArrays = crStateUseServerArrays( );541 serverArrays = crStateUseServerArrays(&pack_spu.StateTracker); 542 542 if (ctx->fCheckZerroVertAttr) 543 543 cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib); … … 608 608 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 609 609 { 610 serverArrays = crStateUseServerArrays( );610 serverArrays = crStateUseServerArrays(&pack_spu.StateTracker); 611 611 if (ctx->fCheckZerroVertAttr) 612 612 cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib); … … 617 617 if (!serverArrays && !ctx->clientState->client.array.locked && (count>3)) 618 618 { 619 crStateLockArraysEXT( first, count);620 serverArrays = crStateUseServerArrays( );619 crStateLockArraysEXT(&pack_spu.StateTracker, first, count); 620 serverArrays = crStateUseServerArrays(&pack_spu.StateTracker); 621 621 if (serverArrays) 622 622 { … … 625 625 else 626 626 { 627 crStateUnlockArraysEXT( );627 crStateUnlockArraysEXT(&pack_spu.StateTracker); 628 628 } 629 629 } … … 714 714 void PACKSPU_APIENTRY packspu_EnableClientState( GLenum array ) 715 715 { 716 crStateEnableClientState( array);716 crStateEnableClientState(&pack_spu.StateTracker, array); 717 717 crPackEnableClientState(array); 718 718 } … … 720 720 void PACKSPU_APIENTRY packspu_DisableClientState( GLenum array ) 721 721 { 722 crStateDisableClientState( array);722 crStateDisableClientState(&pack_spu.StateTracker, array); 723 723 crPackDisableClientState(array); 724 724 } … … 726 726 void PACKSPU_APIENTRY packspu_ClientActiveTextureARB( GLenum texUnit ) 727 727 { 728 crStateClientActiveTextureARB( texUnit);728 crStateClientActiveTextureARB(&pack_spu.StateTracker, texUnit); 729 729 crPackClientActiveTextureARB(texUnit); 730 730 } … … 732 732 void PACKSPU_APIENTRY packspu_EnableVertexAttribArrayARB(GLuint index) 733 733 { 734 crStateEnableVertexAttribArrayARB( index);734 crStateEnableVertexAttribArrayARB(&pack_spu.StateTracker, index); 735 735 crPackEnableVertexAttribArrayARB(index); 736 736 } … … 739 739 void PACKSPU_APIENTRY packspu_DisableVertexAttribArrayARB(GLuint index) 740 740 { 741 crStateDisableVertexAttribArrayARB( index);741 crStateDisableVertexAttribArrayARB(&pack_spu.StateTracker, index); 742 742 crPackDisableVertexAttribArrayARB(index); 743 743 } … … 747 747 if (cap!=GL_LIGHT_MODEL_TWO_SIDE) 748 748 { 749 crStateEnable( cap);749 crStateEnable(&pack_spu.StateTracker, cap); 750 750 crPackEnable(cap); 751 751 } … … 758 758 g_glmts1_warn=1; 759 759 } 760 crStateLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 1);760 crStateLightModeli(&pack_spu.StateTracker, GL_LIGHT_MODEL_TWO_SIDE, 1); 761 761 crPackLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1); 762 762 } … … 768 768 if (cap!=GL_LIGHT_MODEL_TWO_SIDE) 769 769 { 770 crStateDisable( cap);770 crStateDisable(&pack_spu.StateTracker, cap); 771 771 crPackDisable(cap); 772 772 } … … 779 779 g_glmts0_warn=1; 780 780 } 781 crStateLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 0);781 crStateLightModeli(&pack_spu.StateTracker, GL_LIGHT_MODEL_TWO_SIDE, 0); 782 782 crPackLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); 783 783 } … … 786 786 GLboolean PACKSPU_APIENTRY packspu_IsEnabled(GLenum cap) 787 787 { 788 GLboolean res = crStateIsEnabled( cap);788 GLboolean res = crStateIsEnabled(&pack_spu.StateTracker, cap); 789 789 #ifdef DEBUG 790 790 { … … 804 804 void PACKSPU_APIENTRY packspu_PushClientAttrib( GLbitfield mask ) 805 805 { 806 crStatePushClientAttrib( mask);806 crStatePushClientAttrib(&pack_spu.StateTracker, mask); 807 807 crPackPushClientAttrib(mask); 808 808 } … … 810 810 void PACKSPU_APIENTRY packspu_PopClientAttrib( void ) 811 811 { 812 crStatePopClientAttrib( );812 crStatePopClientAttrib(&pack_spu.StateTracker); 813 813 crPackPopClientAttrib(); 814 814 } … … 818 818 if (first>=0 && count>0) 819 819 { 820 crStateLockArraysEXT( first, count);820 crStateLockArraysEXT(&pack_spu.StateTracker, first, count); 821 821 /*Note: this is a workaround for quake3 based apps. 822 822 It's modifying vertex data between glLockArraysEXT and glDrawElements calls, … … 838 838 } 839 839 840 crStateUnlockArraysEXT( );841 } 840 crStateUnlockArraysEXT(&pack_spu.StateTracker); 841 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
r78341 r78375 394 394 /* Fill in the new context info */ 395 395 /* XXX fix-up sharedCtx param here */ 396 pack_spu.context[slot].clientState = crStateCreateContext( NULL, visual, NULL);396 pack_spu.context[slot].clientState = crStateCreateContext(&pack_spu.StateTracker, NULL, visual, NULL); 397 397 pack_spu.context[slot].clientState->bufferobject.retainBufferData = GL_TRUE; 398 398 pack_spu.context[slot].serverCtx = serverCtx; … … 442 442 443 443 crPackDestroyContext( context->serverCtx ); 444 crStateDestroyContext( context->clientState );444 crStateDestroyContext(&pack_spu.StateTracker, context->clientState ); 445 445 446 446 context->clientState = NULL; … … 463 463 crPackSetContext(NULL); 464 464 } 465 crStateMakeCurrent( NULL);465 crStateMakeCurrent(&pack_spu.StateTracker, NULL); 466 466 } 467 467 else … … 540 540 } 541 541 542 crStateMakeCurrent( newCtx->clientState );542 crStateMakeCurrent(&pack_spu.StateTracker, newCtx->clientState ); 543 543 //crStateSetCurrentPointers(newCtx->clientState, &thread->packer->current); 544 544 serverCtx = pack_spu.context[slot].serverCtx; 545 545 } 546 546 else { 547 crStateMakeCurrent( NULL );547 crStateMakeCurrent(&pack_spu.StateTracker, NULL ); 548 548 if (CRPACKSPU_IS_WDDM_CRHGSMI()) 549 549 { -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c
r78190 r78375 25 25 packspu_FramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 26 26 { 27 crStateFramebufferTexture1DEXT( target, attachment, textarget, texture, level);27 crStateFramebufferTexture1DEXT(&pack_spu.StateTracker, target, attachment, textarget, texture, level); 28 28 crPackFramebufferTexture1DEXT(target, attachment, textarget, texture, level); 29 29 } … … 32 32 packspu_FramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 33 33 { 34 crStateFramebufferTexture2DEXT( target, attachment, textarget, texture, level);34 crStateFramebufferTexture2DEXT(&pack_spu.StateTracker, target, attachment, textarget, texture, level); 35 35 crPackFramebufferTexture2DEXT(target, attachment, textarget, texture, level); 36 36 } … … 39 39 packspu_FramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) 40 40 { 41 crStateFramebufferTexture3DEXT( target, attachment, textarget, texture, level, zoffset);41 crStateFramebufferTexture3DEXT(&pack_spu.StateTracker, target, attachment, textarget, texture, level, zoffset); 42 42 crPackFramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset); 43 43 } … … 46 46 packspu_BindFramebufferEXT(GLenum target, GLuint framebuffer) 47 47 { 48 crStateBindFramebufferEXT(target, framebuffer);48 crStateBindFramebufferEXT(&pack_spu.StateTracker, target, framebuffer); 49 49 crPackBindFramebufferEXT(target, framebuffer); 50 50 } … … 53 53 packspu_DeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers) 54 54 { 55 crStateDeleteFramebuffersEXT(n, framebuffers);55 crStateDeleteFramebuffersEXT(&pack_spu.StateTracker, n, framebuffers); 56 56 crPackDeleteFramebuffersEXT(n, framebuffers); 57 57 } … … 60 60 packspu_DeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers) 61 61 { 62 crStateDeleteRenderbuffersEXT(n, renderbuffers);62 crStateDeleteRenderbuffersEXT(&pack_spu.StateTracker, n, renderbuffers); 63 63 crPackDeleteRenderbuffersEXT(n, renderbuffers); 64 64 } … … 67 67 packspu_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) 68 68 { 69 crStateFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);69 crStateFramebufferRenderbufferEXT(&pack_spu.StateTracker, target, attachment, renderbuffertarget, renderbuffer); 70 70 crPackFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer); 71 71 } … … 74 74 packspu_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) 75 75 { 76 crStateBindRenderbufferEXT( target, renderbuffer);76 crStateBindRenderbufferEXT(&pack_spu.StateTracker, target, renderbuffer); 77 77 crPackBindRenderbufferEXT(target, renderbuffer); 78 78 } … … 81 81 packspu_CheckFramebufferStatusEXT(GLenum target) 82 82 { 83 84 85 GLenum status = crStateCheckFramebufferStatusEXT( target);83 GET_THREAD(thread); 84 int writeback = 1; 85 GLenum status = crStateCheckFramebufferStatusEXT(&pack_spu.StateTracker, target); 86 86 87 87 if (status!=GL_FRAMEBUFFER_UNDEFINED) … … 92 92 crPackCheckFramebufferStatusEXT(target, &status, &writeback); 93 93 94 94 packspuFlush((void *) thread); 95 95 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 96 96 97 crStateSetFramebufferStatus( target, status);97 crStateSetFramebufferStatus(&pack_spu.StateTracker, target, status); 98 98 return status; 99 99 } … … 112 112 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 113 113 114 crStateRegFramebuffers( n, framebuffers);114 crStateRegFramebuffers(&pack_spu.StateTracker, n, framebuffers); 115 115 } 116 116 … … 128 128 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 129 129 130 crStateRegRenderbuffers( n, renderbuffers);130 crStateRegRenderbuffers(&pack_spu.StateTracker, n, renderbuffers); 131 131 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
r78190 r78375 118 118 %s localparams; 119 119 localparams = (%s) crAlloc(__numValues(pname) * sizeof(*localparams)); 120 crState%s( pname, localparams);120 crState%s(&pack_spu.StateTracker, pname, localparams); 121 121 crPack%s(%s, &writeback); 122 122 packspuFlush( (void *) thread ); … … 136 136 #endif 137 137 { 138 crState%s( pname, params);138 crState%s(&pack_spu.StateTracker, pname, params); 139 139 return; 140 140 } … … 150 150 %s localparams; 151 151 localparams = (%s) crAlloc(__numValues(pname) * sizeof(*localparams)); 152 crState%s( index, pname, localparams);152 crState%s(&pack_spu.StateTracker, index, pname, localparams); 153 153 crPack%s(index, %s, &writeback); 154 154 packspuFlush( (void *) thread ); … … 164 164 crFree(localparams); 165 165 #else 166 crState%s( pname, params);166 crState%s(&pack_spu.StateTracker, pname, params); 167 167 #endif 168 168 return; -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c
r78190 r78375 149 149 #endif 150 150 { 151 return crStateGetString( name);151 return crStateGetString(&pack_spu.StateTracker, name); 152 152 } 153 153 case GL_RENDERER: … … 161 161 #endif 162 162 { 163 return crStateGetString( name);163 return crStateGetString(&pack_spu.StateTracker, name); 164 164 } 165 165 … … 188 188 #endif 189 189 default: 190 return crStateGetString( name);190 return crStateGetString(&pack_spu.StateTracker, name); 191 191 } 192 192 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
r78190 r78375 36 36 packspuFlush((void *) thread); 37 37 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 38 crStateCreateProgram( return_val);38 crStateCreateProgram(&pack_spu.StateTracker, return_val); 39 39 40 40 return return_val; … … 59 59 GLint PACKSPU_APIENTRY packspu_GetUniformLocation(GLuint program, const char * name) 60 60 { 61 if (!crStateIsProgramUniformsCached( program))61 if (!crStateIsProgramUniformsCached(&pack_spu.StateTracker, program)) 62 62 { 63 63 GET_THREAD(thread); … … 82 82 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 83 83 84 crStateGLSLProgramCacheUniforms( program, pData[0], &pData[1]);85 86 CRASSERT(crStateIsProgramUniformsCached( program));84 crStateGLSLProgramCacheUniforms(&pack_spu.StateTracker, program, pData[0], &pData[1]); 85 86 CRASSERT(crStateIsProgramUniformsCached(&pack_spu.StateTracker, program)); 87 87 88 88 crFree(pData); … … 90 90 91 91 /*crDebug("packspu_GetUniformLocation(%d, %s)=%i", program, name, crStateGetUniformLocation(program, name));*/ 92 return crStateGetUniformLocation( program, name);92 return crStateGetUniformLocation(&pack_spu.StateTracker, program, name); 93 93 } 94 94 … … 114 114 return packspu_GetAttribLocationUnchached(program, name); 115 115 116 if (!crStateIsProgramAttribsCached( program))116 if (!crStateIsProgramAttribsCached(&pack_spu.StateTracker, program)) 117 117 { 118 118 GET_THREAD(thread); … … 137 137 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 138 138 139 crStateGLSLProgramCacheAttribs( program, pData[0], &pData[1]);140 141 CRASSERT(crStateIsProgramAttribsCached( program));139 crStateGLSLProgramCacheAttribs(&pack_spu.StateTracker, program, pData[0], &pData[1]); 140 141 CRASSERT(crStateIsProgramAttribsCached(&pack_spu.StateTracker, program)); 142 142 143 143 crFree(pData); … … 145 145 146 146 /*crDebug("packspu_GetAttribLocation(%d, %s)=%i", program, name, crStateGetAttribLocation(program, name));*/ 147 return crStateGetAttribLocation( program, name);147 return crStateGetAttribLocation(&pack_spu.StateTracker, program, name); 148 148 } 149 149 … … 168 168 void PACKSPU_APIENTRY packspu_DeleteProgram(GLuint program) 169 169 { 170 crStateDeleteProgram( program);170 crStateDeleteProgram(&pack_spu.StateTracker, program); 171 171 crPackDeleteProgram(program); 172 172 } … … 174 174 void PACK_APIENTRY packspu_DeleteObjectARB(VBoxGLhandleARB obj) 175 175 { 176 GLuint hwid = crStateGetProgramHWID( obj);176 GLuint hwid = crStateGetProgramHWID(&pack_spu.StateTracker, obj); 177 177 178 178 CRASSERT(obj); … … 182 182 if (hwid) 183 183 { 184 crStateDeleteProgram( obj);184 crStateDeleteProgram(&pack_spu.StateTracker, obj); 185 185 } 186 186 … … 206 206 #endif 207 207 208 crStateLinkProgram( program);208 crStateLinkProgram(&pack_spu.StateTracker, program); 209 209 crPackLinkProgram(program); 210 210 … … 214 214 if (!linkStatus) 215 215 { 216 CRContext *ctx = crStateGetCurrent( );216 CRContext *ctx = crStateGetCurrent(&pack_spu.StateTracker); 217 217 packspu_RecCheckInitRec(); 218 218 crRecDumpProgram(&pack_spu.Recorder, ctx, program, program); … … 235 235 if (!compileStatus) 236 236 { 237 CRContext *ctx = crStateGetCurrent( );237 CRContext *ctx = crStateGetCurrent(&pack_spu.StateTracker); 238 238 packspu_RecCheckInitRec(); 239 239 crRecDumpShader(&pack_spu.Recorder, ctx, shader, shader); -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
r78341 r78375 7 7 #include "cr_mem.h" 8 8 #include "cr_spu.h" 9 #include "cr_glstate.h"10 9 #include "packspu.h" 11 10 #include "cr_packfunctions.h" … … 21 20 22 21 PackSPU pack_spu; 22 DECLHIDDEN(PCRStateTracker) g_pStateTracker; 23 23 24 24 CRtsd _PackTSD; … … 93 93 94 94 packspuCreateFunctions(); 95 crStateInit(); 95 crStateInit(&pack_spu.StateTracker); 96 g_pStateTracker = &pack_spu.StateTracker; 96 97 97 98 return &pack_functions; -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
r78341 r78375 98 98 GLint buffer; 99 99 100 crStateGetIntegerv( GL_DRAW_BUFFER, &buffer);100 crStateGetIntegerv(&pack_spu.StateTracker, GL_DRAW_BUFFER, &buffer); 101 101 /*Usually buffer==GL_BACK, so put this extra check to simplify boolean eval on runtime*/ 102 102 return (buffer != GL_BACK) … … 116 116 hadtoflush = packspuSyncOnFlushes(); 117 117 118 crStateDrawBuffer( mode);118 crStateDrawBuffer(&pack_spu.StateTracker, mode); 119 119 crPackDrawBuffer(mode); 120 120 … … 197 197 void PACKSPU_APIENTRY packspu_NewList(GLuint list, GLenum mode) 198 198 { 199 crStateNewList( list, mode);199 crStateNewList(&pack_spu.StateTracker, list, mode); 200 200 crPackNewList(list, mode); 201 201 } … … 203 203 void PACKSPU_APIENTRY packspu_EndList() 204 204 { 205 crStateEndList( );205 crStateEndList(&pack_spu.StateTracker); 206 206 crPackEndList(); 207 207 } … … 366 366 crPackGetPolygonStipple( mask, &writeback ); 367 367 #ifdef CR_ARB_pixel_buffer_object 368 if (!crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))368 if (!crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 369 369 #endif 370 370 { … … 381 381 crPackGetPixelMapfv( map, values, &writeback ); 382 382 #ifdef CR_ARB_pixel_buffer_object 383 if (!crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))383 if (!crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 384 384 #endif 385 385 { … … 397 397 398 398 #ifdef CR_ARB_pixel_buffer_object 399 if (!crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))399 if (!crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 400 400 #endif 401 401 { … … 412 412 crPackGetPixelMapusv( map, values, &writeback ); 413 413 #ifdef CR_ARB_pixel_buffer_object 414 if (!crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))414 if (!crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 415 415 #endif 416 416 { … … 449 449 return; 450 450 case GL_SHARE_CONTEXT_RESOURCES_CR: 451 crStateShareContext( value);451 crStateShareContext(&pack_spu.StateTracker, value); 452 452 break; 453 453 case GL_RCUSAGE_TEXTURE_SET_CR: 454 454 { 455 455 Assert(value); 456 crStateSetTextureUsed( value, GL_TRUE);456 crStateSetTextureUsed(&pack_spu.StateTracker, value, GL_TRUE); 457 457 break; 458 458 } … … 462 462 #ifdef DEBUG 463 463 { 464 CRContext *pCurState = crStateGetCurrent( );464 CRContext *pCurState = crStateGetCurrent(&pack_spu.StateTracker); 465 465 CRTextureObj *tobj = (CRTextureObj*)crHashtableSearch(pCurState->shared->textureTable, value); 466 466 Assert(tobj); 467 467 } 468 468 #endif 469 crStateSetTextureUsed( value, GL_FALSE);469 crStateSetTextureUsed(&pack_spu.StateTracker, value, GL_FALSE); 470 470 break; 471 471 } … … 481 481 int writeback = 1; 482 482 GLenum return_val = (GLenum) 0; 483 CRContext *pCurState = crStateGetCurrent( );483 CRContext *pCurState = crStateGetCurrent(&pack_spu.StateTracker); 484 484 NOREF(pCurState); /* it's unused, but I don't know about side effects.. */ 485 485 … … 620 620 crSetTSD(&_PackTSD, NULL); 621 621 622 crStateVBoxAttachThread( );622 crStateVBoxAttachThread(&pack_spu.StateTracker); 623 623 } 624 624 … … 701 701 } 702 702 703 crStateVBoxDetachThread( );703 crStateVBoxDetachThread(&pack_spu.StateTracker); 704 704 } 705 705 -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c
r78190 r78375 269 269 * image in a canonical layout (see util/pixel.c). 270 270 */ 271 crStatePixelStoref( pname, param );271 crStatePixelStoref(&pack_spu.StateTracker, pname, param ); 272 272 } 273 273 274 274 void PACKSPU_APIENTRY packspu_PixelStorei( GLenum pname, GLint param ) 275 275 { 276 crStatePixelStorei( pname, param );276 crStatePixelStorei(&pack_spu.StateTracker, pname, param ); 277 277 } 278 278 … … 283 283 CRClientState *clientState = &(ctx->clientState->client); 284 284 285 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))285 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 286 286 { 287 287 packspu_ApplyUnpackState(); … … 290 290 crPackDrawPixels( width, height, format, type, pixels, &(clientState->unpack) ); 291 291 292 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))292 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 293 293 { 294 294 packspu_RestoreUnpackState(); … … 303 303 int writeback; 304 304 305 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))305 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 306 306 { 307 307 packspu_ApplyPackState(); … … 310 310 crPackReadPixels(x, y, width, height, format, type, pixels, &(clientState->pack), &writeback); 311 311 312 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))312 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 313 313 { 314 314 packspu_RestorePackState(); … … 316 316 317 317 #ifdef CR_ARB_pixel_buffer_object 318 if (!crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))318 if (!crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 319 319 #endif 320 320 { … … 340 340 CRClientState *clientState = &(ctx->clientState->client); 341 341 342 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))342 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 343 343 { 344 344 packspu_ApplyUnpackState(); … … 347 347 crPackBitmap(width, height, xorig, yorig, xmove, ymove, bitmap, &(clientState->unpack)); 348 348 349 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))349 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 350 350 { 351 351 packspu_RestoreUnpackState(); … … 360 360 if (!packspu_CheckTexImageParams(internalformat, format, type)) 361 361 { 362 if (pixels || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))362 if (pixels || crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 363 363 { 364 364 crWarning("packspu_TexImage1D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type); … … 370 370 } 371 371 372 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))372 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 373 373 { 374 374 packspu_ApplyUnpackState(); … … 376 376 377 377 crPackTexImage1D( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) ); 378 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))378 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 379 379 { 380 380 packspu_RestoreUnpackState(); … … 389 389 if (!packspu_CheckTexImageParams(internalformat, format, type)) 390 390 { 391 if (pixels || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))391 if (pixels || crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 392 392 { 393 393 crWarning("packspu_TexImage2D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type); … … 399 399 } 400 400 401 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))401 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 402 402 { 403 403 packspu_ApplyUnpackState(); … … 405 405 406 406 crPackTexImage2D( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) ); 407 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))407 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 408 408 { 409 409 packspu_RestoreUnpackState(); … … 417 417 CRClientState *clientState = &(ctx->clientState->client); 418 418 419 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))419 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 420 420 { 421 421 packspu_ApplyUnpackState(); … … 423 423 424 424 crPackTexImage3DEXT( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) ); 425 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))425 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 426 426 { 427 427 packspu_RestoreUnpackState(); … … 436 436 CRClientState *clientState = &(ctx->clientState->client); 437 437 438 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))438 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 439 439 { 440 440 packspu_ApplyUnpackState(); … … 442 442 443 443 crPackTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) ); 444 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))444 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 445 445 { 446 446 packspu_RestoreUnpackState(); … … 460 460 } 461 461 462 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))462 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 463 463 { 464 464 packspu_ApplyUnpackState(); … … 466 466 467 467 crPackTexSubImage1D( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) ); 468 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))468 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 469 469 { 470 470 packspu_RestoreUnpackState(); … … 483 483 } 484 484 485 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))485 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 486 486 { 487 487 packspu_ApplyUnpackState(); … … 489 489 490 490 crPackTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) ); 491 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))491 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 492 492 { 493 493 packspu_RestoreUnpackState(); … … 501 501 CRClientState *clientState = &(ctx->clientState->client); 502 502 503 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))503 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 504 504 { 505 505 packspu_ApplyUnpackState(); … … 507 507 508 508 crPackTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) ); 509 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))509 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 510 510 { 511 511 packspu_RestoreUnpackState(); … … 533 533 */ 534 534 535 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))535 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 536 536 { 537 537 packspu_ApplyPackState(); … … 539 539 540 540 crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback ); 541 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))541 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 542 542 { 543 543 packspu_RestorePackState(); … … 545 545 546 546 #ifdef CR_ARB_pixel_buffer_object 547 if (!crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))547 if (!crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 548 548 #endif 549 549 { … … 558 558 int writeback = 1; 559 559 560 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))560 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 561 561 { 562 562 packspu_ApplyPackState(); … … 564 564 565 565 crPackGetCompressedTexImageARB( target, level, img, &writeback ); 566 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))566 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 567 567 { 568 568 packspu_RestorePackState(); … … 570 570 571 571 #ifdef CR_ARB_pixel_buffer_object 572 if (!crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))572 if (!crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 573 573 #endif 574 574 { … … 582 582 GLint border, GLsizei imagesize, const GLvoid *data) 583 583 { 584 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))584 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 585 585 { 586 586 packspu_ApplyUnpackState(); … … 589 589 crPackCompressedTexImage1DARB(target, level, internalformat, width, border, imagesize, data); 590 590 591 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))591 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 592 592 { 593 593 packspu_RestoreUnpackState(); … … 599 599 GLsizei height, GLint border, GLsizei imagesize, const GLvoid *data) 600 600 { 601 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))601 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 602 602 { 603 603 packspu_ApplyUnpackState(); … … 606 606 crPackCompressedTexImage2DARB(target, level, internalformat, width, height, border, imagesize, data); 607 607 608 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))608 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 609 609 { 610 610 packspu_RestoreUnpackState(); … … 616 616 GLsizei height, GLsizei depth, GLint border, GLsizei imagesize, const GLvoid *data) 617 617 { 618 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))618 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 619 619 { 620 620 packspu_ApplyUnpackState(); … … 623 623 crPackCompressedTexImage3DARB(target, level, internalformat, width, height, depth, border, imagesize, data); 624 624 625 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))625 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 626 626 { 627 627 packspu_RestoreUnpackState(); … … 633 633 GLenum format, GLsizei imagesize, const GLvoid *data) 634 634 { 635 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))635 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 636 636 { 637 637 packspu_ApplyUnpackState(); … … 640 640 crPackCompressedTexSubImage1DARB(target, level, xoffset, width, format, imagesize, data); 641 641 642 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))642 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 643 643 { 644 644 packspu_RestoreUnpackState(); … … 650 650 GLsizei width, GLsizei height, GLenum format, GLsizei imagesize, const GLvoid *data) 651 651 { 652 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))652 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 653 653 { 654 654 packspu_ApplyUnpackState(); … … 657 657 crPackCompressedTexSubImage2DARB(target, level, xoffset, yoffset, width, height, format, imagesize, data); 658 658 659 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))659 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 660 660 { 661 661 packspu_RestoreUnpackState(); … … 668 668 GLsizei imagesize, const GLvoid *data) 669 669 { 670 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))670 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 671 671 { 672 672 packspu_ApplyUnpackState(); … … 675 675 crPackCompressedTexSubImage3DARB(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imagesize, data); 676 676 677 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))678 { 679 packspu_RestoreUnpackState(); 680 } 681 } 677 if (crStateIsBufferBound(&pack_spu.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 678 { 679 packspu_RestoreUnpackState(); 680 } 681 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c
r78190 r78375 24 24 void PACKSPU_APIENTRY packspu_ActiveTextureARB(GLenum texture) 25 25 { 26 crStateActiveTextureARB( texture);26 crStateActiveTextureARB(&pack_spu.StateTracker, texture); 27 27 crPackActiveTextureARB(texture); 28 28 } … … 30 30 void PACKSPU_APIENTRY packspu_BindTexture(GLenum target, GLuint texture) 31 31 { 32 crStateBindTexture( target, texture);32 crStateBindTexture(&pack_spu.StateTracker, target, texture); 33 33 crPackBindTexture(target, texture); 34 34 } … … 36 36 void PACKSPU_APIENTRY packspu_DeleteTextures(GLsizei n, const GLuint * textures) 37 37 { 38 crStateDeleteTextures( n, textures);38 crStateDeleteTextures(&pack_spu.StateTracker, n, textures); 39 39 crPackDeleteTextures(n, textures); 40 40 } … … 52 52 packspuFlush( (void *) thread ); 53 53 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 54 crStateRegTextures( n, textures);54 crStateRegTextures(&pack_spu.StateTracker, n, textures); 55 55 } -
trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h
r78341 r78375 192 192 #endif 193 193 194 /** The state tracker the context is attached to. */ 195 PCRStateTracker pStateTracker; 196 194 197 /** For buffering vertices for selection/feedback */ 195 198 /*@{*/ … … 202 205 203 206 204 DECLEXPORT(void) crStateInit(void); 205 DECLEXPORT(void) crStateDestroy(void); 206 DECLEXPORT(void) crStateVBoxDetachThread(void); 207 DECLEXPORT(void) crStateVBoxAttachThread(void); 208 DECLEXPORT(CRContext *) crStateCreateContext(const CRLimitsState *limits, GLint visBits, CRContext *share); 209 DECLEXPORT(CRContext *) crStateCreateContextEx(const CRLimitsState *limits, GLint visBits, CRContext *share, GLint presetID); 210 DECLEXPORT(void) crStateMakeCurrent(CRContext *ctx); 211 DECLEXPORT(void) crStateSetCurrent(CRContext *ctx); 212 DECLEXPORT(void) crStateCleanupCurrent(void); 213 DECLEXPORT(CRContext *) crStateGetCurrent(void); 214 DECLEXPORT(void) crStateDestroyContext(CRContext *ctx); 215 DECLEXPORT(GLboolean) crStateEnableDiffOnMakeCurrent(GLboolean fEnable); 207 /** 208 * CR state tracker. 209 */ 210 typedef struct CRStateTracker 211 { 212 bool fContextTLSInit; 213 CRtsd contextTSD; 214 CRStateBits *pCurrentBits; 215 CRContext *apAvailableContexts[CR_MAX_CONTEXTS]; 216 uint32_t cContexts; 217 CRSharedState *pSharedState; 218 CRContext *pDefaultContext; 219 GLboolean fVBoxEnableDiffOnMakeCurrent; 220 SPUDispatchTable diff_api; 221 } CRStateTracker; 222 /** Pointer to a state tracker state. */ 223 typedef CRStateTracker *PCRStateTracker; 224 225 DECLEXPORT(void) crStateInit(PCRStateTracker pState); 226 DECLEXPORT(void) crStateDestroy(PCRStateTracker pState); 227 DECLEXPORT(void) crStateVBoxDetachThread(PCRStateTracker pState); 228 DECLEXPORT(void) crStateVBoxAttachThread(PCRStateTracker pState); 229 DECLEXPORT(CRContext *) crStateCreateContext(PCRStateTracker pState, const CRLimitsState *limits, GLint visBits, CRContext *share); 230 DECLEXPORT(CRContext *) crStateCreateContextEx(PCRStateTracker pState, const CRLimitsState *limits, GLint visBits, CRContext *share, GLint presetID); 231 DECLEXPORT(void) crStateMakeCurrent(PCRStateTracker pState, CRContext *ctx); 232 DECLEXPORT(void) crStateSetCurrent(PCRStateTracker pState, CRContext *ctx); 233 DECLEXPORT(void) crStateCleanupCurrent(PCRStateTracker pState); 234 DECLEXPORT(CRContext *) crStateGetCurrent(PCRStateTracker pState); 235 DECLEXPORT(void) crStateDestroyContext(PCRStateTracker pState, CRContext *ctx); 236 DECLEXPORT(GLboolean) crStateEnableDiffOnMakeCurrent(PCRStateTracker pState, GLboolean fEnable); 216 237 217 238 void crStateSwitchPrepare(CRContext *toCtx, CRContext *fromCtx, GLuint idDrawFBO, GLuint idReadFBO); … … 219 240 220 241 void crStateSyncHWErrorState(CRContext *ctx); 221 GLenum crStateCleanHWErrorState( void);222 223 #define CR_STATE_CLEAN_HW_ERR_WARN( _s) do {\224 GLenum _err = crStateCleanHWErrorState( ); \242 GLenum crStateCleanHWErrorState(PCRStateTracker pState); 243 244 #define CR_STATE_CLEAN_HW_ERR_WARN(a_pState, _s) do {\ 245 GLenum _err = crStateCleanHWErrorState((a_pState)); \ 225 246 if (_err != GL_NO_ERROR) { \ 226 247 static int _cErrPrints = 0; \ … … 232 253 } while (0) 233 254 234 DECLEXPORT(void) crStateFlushFunc( CRStateFlushFunc ff);235 DECLEXPORT(void) crStateFlushArg( void *arg );236 DECLEXPORT(void) crStateDiffAPI( SPUDispatchTable *api);237 DECLEXPORT(void) crStateUpdateColorBits( void);238 239 DECLEXPORT(void) crStateSetCurrentPointers( CRContext *ctx, CRCurrentStatePointers *current);240 DECLEXPORT(void) crStateResetCurrentPointers( CRCurrentStatePointers *current);241 242 DECLEXPORT(void) crStateSetExtensionString( CRContext *ctx, const GLubyte *extensions);243 244 DECLEXPORT(void) crStateDiffContext( CRContext *from, CRContext *to);245 DECLEXPORT(void) crStateSwitchContext( CRContext *from, CRContext *to);246 247 DECLEXPORT(unsigned int) crStateHlpComponentsCount( GLenum pname);255 DECLEXPORT(void) crStateFlushFunc(PCRStateTracker pState, CRStateFlushFunc ff); 256 DECLEXPORT(void) crStateFlushArg(PCRStateTracker pState, void *arg ); 257 DECLEXPORT(void) crStateDiffAPI(PCRStateTracker pState, SPUDispatchTable *api); 258 DECLEXPORT(void) crStateUpdateColorBits(PCRStateTracker pState); 259 260 DECLEXPORT(void) crStateSetCurrentPointers(CRContext *ctx, CRCurrentStatePointers *current); 261 DECLEXPORT(void) crStateResetCurrentPointers(CRCurrentStatePointers *current); 262 263 DECLEXPORT(void) crStateSetExtensionString(CRContext *ctx, const GLubyte *extensions); 264 265 DECLEXPORT(void) crStateDiffContext(CRContext *from, CRContext *to); 266 DECLEXPORT(void) crStateSwitchContext(CRContext *from, CRContext *to); 267 268 DECLEXPORT(unsigned int) crStateHlpComponentsCount(GLenum pname); 248 269 249 270 typedef struct CRFBDataElement … … 277 298 278 299 DECLEXPORT(void) crStateGetTextureObjectAndImage(CRContext *g, GLenum texTarget, GLint level, 279 CRTextureObj **obj, CRTextureLevel **img);300 CRTextureObj **obj, CRTextureLevel **img); 280 301 281 302 … … 287 308 typedef FNCRSTATE_CONTEXT_GET *PFNCRSTATE_CONTEXT_GET; 288 309 DECLEXPORT(int32_t) crStateLoadContext(CRContext *pContext, CRHashTable * pCtxTable, PFNCRSTATE_CONTEXT_GET pfnCtxGet, PSSMHANDLE pSSM, uint32_t u32Version); 289 DECLEXPORT(void) crStateFreeShared( CRContext *pContext, CRSharedState *s);290 291 DECLEXPORT(int32_t) crStateLoadGlobals(P SSMHANDLE pSSM, uint32_t u32Version);292 DECLEXPORT(int32_t) crStateSaveGlobals(P SSMHANDLE pSSM);293 294 DECLEXPORT(CRSharedState *) crStateGlobalSharedAcquire( void);295 DECLEXPORT(void) crStateGlobalSharedRelease( void);296 #endif 297 298 DECLEXPORT(void) crStateSetTextureUsed( GLuint texture, GLboolean used);299 DECLEXPORT(void) crStatePinTexture( GLuint texture, GLboolean pin);300 DECLEXPORT(void) crStateDeleteTextureCallback(void *texObj );310 DECLEXPORT(void) crStateFreeShared(PCRStateTracker pState, CRContext *pContext, CRSharedState *s); 311 312 DECLEXPORT(int32_t) crStateLoadGlobals(PCRStateTracker pState, PSSMHANDLE pSSM, uint32_t u32Version); 313 DECLEXPORT(int32_t) crStateSaveGlobals(PCRStateTracker pState, PSSMHANDLE pSSM); 314 315 DECLEXPORT(CRSharedState *) crStateGlobalSharedAcquire(PCRStateTracker pState); 316 DECLEXPORT(void) crStateGlobalSharedRelease(PCRStateTracker pState); 317 #endif 318 319 DECLEXPORT(void) crStateSetTextureUsed(PCRStateTracker pState, GLuint texture, GLboolean used); 320 DECLEXPORT(void) crStatePinTexture(PCRStateTracker pState, GLuint texture, GLboolean pin); 321 DECLEXPORT(void) crStateDeleteTextureCallback(void *texObj, void *pvUser); 301 322 302 323 /* XXX move these! */ 303 324 304 DECLEXPORT(void) STATE_APIENTRY 305 crStateChromiumParameteriCR( GLenum target, GLint value ); 306 307 DECLEXPORT(void) STATE_APIENTRY 308 crStateChromiumParameterfCR( GLenum target, GLfloat value ); 309 310 DECLEXPORT(void) STATE_APIENTRY 311 crStateChromiumParametervCR( GLenum target, GLenum type, GLsizei count, const GLvoid *values ); 312 313 DECLEXPORT(void) STATE_APIENTRY 314 crStateGetChromiumParametervCR( GLenum target, GLuint index, GLenum type, 315 GLsizei count, GLvoid *values ); 316 317 DECLEXPORT(void) STATE_APIENTRY 318 crStateReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, 319 GLenum format, GLenum type, GLvoid *pixels ); 320 321 DECLEXPORT(void) STATE_APIENTRY crStateShareContext(GLboolean value); 325 DECLEXPORT(void) STATE_APIENTRY crStateChromiumParameteriCR(PCRStateTracker pState, GLenum target, GLint value ); 326 DECLEXPORT(void) STATE_APIENTRY crStateChromiumParameterfCR(PCRStateTracker pState, GLenum target, GLfloat value ); 327 DECLEXPORT(void) STATE_APIENTRY crStateChromiumParametervCR(PCRStateTracker pState, GLenum target, GLenum type, GLsizei count, const GLvoid *values ); 328 DECLEXPORT(void) STATE_APIENTRY crStateGetChromiumParametervCR(PCRStateTracker pState, GLenum target, GLuint index, GLenum type, 329 GLsizei count, GLvoid *values ); 330 DECLEXPORT(void) STATE_APIENTRY crStateReadPixels(PCRStateTracker pState, GLint x, GLint y, GLsizei width, GLsizei height, 331 GLenum format, GLenum type, GLvoid *pixels ); 332 DECLEXPORT(void) STATE_APIENTRY crStateShareContext(PCRStateTracker pState, GLboolean value); 322 333 DECLEXPORT(void) STATE_APIENTRY crStateShareLists(CRContext *pContext1, CRContext *pContext2); 323 334 DECLEXPORT(void) STATE_APIENTRY crStateSetSharedContext(CRContext *pCtx); 324 335 DECLEXPORT(GLboolean) STATE_APIENTRY crStateContextIsShared(CRContext *pCtx); 325 326 DECLEXPORT(void) STATE_APIENTRY crStateQueryHWState(GLuint fbFbo, GLuint bbFbo); 336 DECLEXPORT(void) STATE_APIENTRY crStateQueryHWState(PCRStateTracker pState, GLuint fbFbo, GLuint bbFbo); 327 337 #ifdef __cplusplus 328 338 } -
trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h
r78342 r78375 12 12 #include "cr_protocol.h" 13 13 #include "cr_opcodes.h" 14 #ifndef IN_RING0 15 # include "cr_glstate.h" 16 #endif 14 17 #include "state/cr_statetypes.h" 15 18 #include "state/cr_currentpointers.h" … … 98 101 # define CR_PACKER_CONTEXT_ARGCTX(C) 99 102 extern CRtsd _PackerTSD; 103 #ifndef IN_RING0 104 extern DECLHIDDEN(PCRStateTracker) g_pStateTracker; /** Hack to make the state tracker available to pack_client.c which uses crStateGetCurrent(). */ 105 #endif 100 106 # define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = (CRPackContext *) crGetTSD(&_PackerTSD) 101 107 # define CR_LOCK_PACKER_CONTEXT(PC) crLockMutex(&((PC)->mutex)) -
trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h
r78190 r78375 408 408 /* visBits -> dummy mural association */ 409 409 CRHashTable *dummyMuralTable; 410 411 /** State tracker state. */ 412 CRStateTracker StateTracker; 410 413 411 414 GLboolean fRootVrOn; … … 594 597 extern int crVBoxServerHostCtl(VBOXCRCMDCTL *pCtl, uint32_t cbCtl); 595 598 599 extern DECLEXPORT(void) crVBoxServerDetachThread(void); 600 extern DECLEXPORT(void) crVBoxServerAttachThread(void); 601 596 602 #ifdef __cplusplus 597 603 } -
trunk/src/VBox/GuestHost/OpenGL/include/cr_unpack.h
r78263 r78375 13 13 #include "cr_mem.h" 14 14 #include "cr_opcodes.h" 15 #include "cr_glstate.h" 15 16 16 17 #include <iprt/types.h> … … 42 43 * on error if one unpacker detected out of bounds buffer access). */ 43 44 int rcUnpack; 45 /** Attached state tracker. */ 46 PCRStateTracker pStateTracker; 44 47 } CrUnpackerState; 45 48 /** Pointer to an unpacker state. */ -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_bufferobject.h
r69474 r78375 54 54 55 55 CRBufferObject *nullBuffer; /* name = 0 */ 56 /** Attached state tracker. */ 57 PCRStateTracker pStateTracker; 56 58 } CRBufferObjectState; 57 59 58 60 DECLEXPORT(CRBufferObject *) crStateGetBoundBufferObject(GLenum target, CRBufferObjectState *b); 59 DECLEXPORT(GLboolean) crStateIsBufferBound( GLenum target);61 DECLEXPORT(GLboolean) crStateIsBufferBound(PCRStateTracker pState, GLenum target); 60 62 struct CRContext; 61 63 DECLEXPORT(GLboolean) crStateIsBufferBoundForCtx(struct CRContext *g, GLenum target); 62 64 63 DECLEXPORT(GLuint) STATE_APIENTRY crStateBufferHWIDtoID( GLuint hwid);64 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetBufferHWID( GLuint id);65 DECLEXPORT(GLuint) STATE_APIENTRY crStateBufferHWIDtoID(PCRStateTracker pState, GLuint hwid); 66 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetBufferHWID(PCRStateTracker pState, GLuint id); 65 67 66 DECLEXPORT(void) crStateRegBuffers( GLsizei n, GLuint *buffers);68 DECLEXPORT(void) crStateRegBuffers(PCRStateTracker pState, GLsizei n, GLuint *buffers); 67 69 #ifdef __cplusplus 68 70 } -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_client.h
r78116 r78375 139 139 DECLEXPORT(void) crStateClientDestroy(struct CRContext *g); 140 140 141 DECLEXPORT(GLboolean) crStateUseServerArrays( void);142 DECLEXPORT(GLboolean) crStateUseServerArrayElements( void);141 DECLEXPORT(GLboolean) crStateUseServerArrays(PCRStateTracker pState); 142 DECLEXPORT(GLboolean) crStateUseServerArrayElements(PCRStateTracker pState); 143 143 DECLEXPORT(CRClientPointer*) crStateGetClientPointerByIndex(int index, CRVertexArrays *array); 144 144 -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_current.h
r69474 r78375 88 88 DECLEXPORT(void) crStateCurrentInit( CRContext *ctx ); 89 89 90 DECLEXPORT(void) crStateCurrentRecover( void);90 DECLEXPORT(void) crStateCurrentRecover(PCRStateTracker pState); 91 91 92 92 DECLEXPORT(void) crStateCurrentRecoverNew(CRContext *g, CRCurrentStatePointers *current); … … 97 97 CRContext *fromCtx, CRContext *toCtx); 98 98 99 DECLEXPORT(void) crStateRasterPosUpdate( GLfloat x, GLfloat y, GLfloat z, GLfloat w);99 DECLEXPORT(void) crStateRasterPosUpdate(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z, GLfloat w); 100 100 101 101 DECLEXPORT(GLuint) crStateNeedDummyZeroVertexArray(CRContext *g, CRCurrentStatePointers *current, GLfloat *pZva); -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_framebuffer.h
r76553 r78375 75 75 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx, GLuint idDrawFBO, GLuint idReadFBO); 76 76 77 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetFramebufferHWID( GLuint id);78 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetRenderbufferHWID( GLuint id);77 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetFramebufferHWID(PCRStateTracker pState, GLuint id); 78 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetRenderbufferHWID(PCRStateTracker pState, GLuint id); 79 79 80 DECLEXPORT(void) STATE_APIENTRY crStateBindRenderbufferEXT( GLenum target, GLuint renderbuffer);81 DECLEXPORT(void) STATE_APIENTRY crStateDeleteRenderbuffersEXT( GLsizei n, const GLuint *renderbuffers);82 DECLEXPORT(void) STATE_APIENTRY crStateRenderbufferStorageEXT( GLenum target, GLenum internalformat, GLsizei width, GLsizei height);83 DECLEXPORT(void) STATE_APIENTRY crStateGetRenderbufferParameterivEXT( GLenum target, GLenum pname, GLint *params);84 DECLEXPORT(void) STATE_APIENTRY crStateBindFramebufferEXT( GLenum target, GLuint framebuffer);85 DECLEXPORT(void) STATE_APIENTRY crStateDeleteFramebuffersEXT( GLsizei n, const GLuint *framebuffers);86 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture1DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);87 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture2DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);88 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture3DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);89 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferRenderbufferEXT( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);90 DECLEXPORT(void) STATE_APIENTRY crStateGetFramebufferAttachmentParameterivEXT( GLenum target, GLenum attachment, GLenum pname, GLint *params);91 DECLEXPORT(void) STATE_APIENTRY crStateGenerateMipmapEXT( GLenum target);80 DECLEXPORT(void) STATE_APIENTRY crStateBindRenderbufferEXT(PCRStateTracker pState, GLenum target, GLuint renderbuffer); 81 DECLEXPORT(void) STATE_APIENTRY crStateDeleteRenderbuffersEXT(PCRStateTracker pState, GLsizei n, const GLuint *renderbuffers); 82 DECLEXPORT(void) STATE_APIENTRY crStateRenderbufferStorageEXT(PCRStateTracker pState, GLenum target, GLenum internalformat, GLsizei width, GLsizei height); 83 DECLEXPORT(void) STATE_APIENTRY crStateGetRenderbufferParameterivEXT(PCRStateTracker pState, GLenum target, GLenum pname, GLint *params); 84 DECLEXPORT(void) STATE_APIENTRY crStateBindFramebufferEXT(PCRStateTracker pState, GLenum target, GLuint framebuffer); 85 DECLEXPORT(void) STATE_APIENTRY crStateDeleteFramebuffersEXT(PCRStateTracker pState, GLsizei n, const GLuint *framebuffers); 86 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture1DEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); 87 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture2DEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); 88 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture3DEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); 89 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferRenderbufferEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); 90 DECLEXPORT(void) STATE_APIENTRY crStateGetFramebufferAttachmentParameterivEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum pname, GLint *params); 91 DECLEXPORT(void) STATE_APIENTRY crStateGenerateMipmapEXT(PCRStateTracker pState, GLenum target); 92 92 93 DECLEXPORT(GLuint) STATE_APIENTRY crStateFBOHWIDtoID( GLuint hwid);94 DECLEXPORT(GLuint) STATE_APIENTRY crStateRBOHWIDtoID( GLuint hwid);93 DECLEXPORT(GLuint) STATE_APIENTRY crStateFBOHWIDtoID(PCRStateTracker pState, GLuint hwid); 94 DECLEXPORT(GLuint) STATE_APIENTRY crStateRBOHWIDtoID(PCRStateTracker pState, GLuint hwid); 95 95 96 DECLEXPORT(void) crStateRegFramebuffers( GLsizei n, GLuint *buffers);97 DECLEXPORT(void) crStateRegRenderbuffers( GLsizei n, GLuint *buffers);96 DECLEXPORT(void) crStateRegFramebuffers(PCRStateTracker pState, GLsizei n, GLuint *buffers); 97 DECLEXPORT(void) crStateRegRenderbuffers(PCRStateTracker pState, GLsizei n, GLuint *buffers); 98 98 99 99 #ifdef IN_GUEST 100 DECLEXPORT(GLenum) STATE_APIENTRY crStateCheckFramebufferStatusEXT( GLenum target);101 DECLEXPORT(GLenum) STATE_APIENTRY crStateSetFramebufferStatus( GLenum target, GLenum status);100 DECLEXPORT(GLenum) STATE_APIENTRY crStateCheckFramebufferStatusEXT(PCRStateTracker pState, GLenum target); 101 DECLEXPORT(GLenum) STATE_APIENTRY crStateSetFramebufferStatus(PCRStateTracker pState, GLenum target, GLenum status); 102 102 #endif 103 103 -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_glsl.h
r76553 r78375 93 93 DECLEXPORT(void) STATE_APIENTRY crStateGLSLSwitch(CRContext *from, CRContext *to); 94 94 95 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetShaderHWID( GLuint id);96 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetProgramHWID( GLuint id);97 DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLProgramHWIDtoID( GLuint hwid);98 DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLShaderHWIDtoID( GLuint hwid);95 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetShaderHWID(PCRStateTracker pState, GLuint id); 96 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetProgramHWID(PCRStateTracker pState, GLuint id); 97 DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLProgramHWIDtoID(PCRStateTracker pState, GLuint hwid); 98 DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLShaderHWIDtoID(PCRStateTracker pState, GLuint hwid); 99 99 100 DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformSize( GLenum type);101 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsIntUniform( GLenum type);100 DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformSize(PCRStateTracker pState, GLenum type); 101 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsIntUniform(PCRStateTracker pState, GLenum type); 102 102 103 DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateShader( GLuint id, GLenum type);104 DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateProgram( GLuint id);105 DECLEXPORT(GLuint) STATE_APIENTRY crStateDeleteObjectARB( VBoxGLhandleARB obj );103 DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateShader(PCRStateTracker pState, GLuint id, GLenum type); 104 DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateProgram(PCRStateTracker pState, GLuint id); 105 DECLEXPORT(GLuint) STATE_APIENTRY crStateDeleteObjectARB(PCRStateTracker pState, VBoxGLhandleARB obj ); 106 106 107 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramUniformsCached( GLuint program);108 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramAttribsCached( GLuint program);107 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramUniformsCached(PCRStateTracker pState, GLuint program); 108 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramAttribsCached(PCRStateTracker pState, GLuint program); 109 109 110 110 #ifdef IN_GUEST 111 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheUniforms( GLuint program, GLsizei cbData, GLvoid *pData);112 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheAttribs( GLuint program, GLsizei cbData, GLvoid *pData);111 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheUniforms(PCRStateTracker pState, GLuint program, GLsizei cbData, GLvoid *pData); 112 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheAttribs(PCRStateTracker pState, GLuint program, GLsizei cbData, GLvoid *pData); 113 113 #else 114 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheUniforms( GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData);115 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheAttribs( GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData);114 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheUniforms(PCRStateTracker pState, GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData); 115 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheAttribs(PCRStateTracker pState, GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData); 116 116 #endif 117 117 -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_lighting.h
r69474 r78375 84 84 CRContext *fromCtx, CRContext *toCtx); 85 85 86 DECLEXPORT(void) crStateColorMaterialRecover( void);86 DECLEXPORT(void) crStateColorMaterialRecover(PCRStateTracker pState); 87 87 88 88 #ifdef __cplusplus -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_stateerror.h
r69474 r78375 12 12 #include <iprt/cdefs.h> 13 13 14 DECLEXPORT(void) crStateError( int line, const char *file, GLenum err, const char *format, ... );14 DECLEXPORT(void) crStateError(PCRStateTracker pState, int line, const char *file, GLenum err, const char *format, ... ); 15 15 16 16 #endif /* CR_STATE_ERROR_H */ -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_statetypes.h
r69474 r78375 15 15 extern "C" { 16 16 #endif 17 18 typedef struct CRStateTracker *PCRStateTracker; 17 19 18 20 typedef GLfloat GLdefault; -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_texture.h
r69474 r78375 217 217 DECLEXPORT(CRTextureObj *) crStateTextureAllocate(GLuint name); 218 218 /*void crStateTextureDelete(GLuint name);*/ 219 DECLEXPORT(CRTextureObj *) crStateTextureGet( GLenum target, GLuint textureid);219 DECLEXPORT(CRTextureObj *) crStateTextureGet(PCRStateTracker pState, GLenum target, GLuint textureid); 220 220 DECLEXPORT(int) crStateTextureGetSize(GLenum target, GLenum level); 221 221 DECLEXPORT(const GLvoid *) crStateTextureGetData(GLenum target, GLenum level); … … 238 238 DECLEXPORT(void) crStateDeleteTextureObject(CRTextureObj *tobj); 239 239 240 DECLEXPORT(GLuint) STATE_APIENTRY crStateTextureHWIDtoID( GLuint hwid);241 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetTextureHWID( GLuint id);242 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetTextureObjHWID( CRTextureObj *tobj);243 244 void crStateRegTextures( GLsizei n, GLuint *names);240 DECLEXPORT(GLuint) STATE_APIENTRY crStateTextureHWIDtoID(PCRStateTracker pState, GLuint hwid); 241 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetTextureHWID(PCRStateTracker pState, GLuint id); 242 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetTextureObjHWID(PCRStateTracker pState, CRTextureObj *tobj); 243 244 void crStateRegTextures(PCRStateTracker pState, GLsizei n, GLuint *names); 245 245 246 246 #ifdef __cplusplus -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_transform.h
r69474 r78375 71 71 DECLEXPORT(void) crStateInitMatrixStack(CRMatrixStack *stack, int maxDepth); 72 72 73 DECLEXPORT(void) crStateLoadMatrix( const CRmatrix *m);73 DECLEXPORT(void) crStateLoadMatrix(PCRStateTracker pState, const CRmatrix *m); 74 74 75 75 DECLEXPORT(void) crStateTransformUpdateTransform(CRTransformState *t); -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_client.c
r69392 r78375 308 308 unsigned int unit, attr; 309 309 const CRVertexArrays *array = &(c->array); 310 const GLboolean vpEnabled = crStateGetCurrent( )->program.vpEnabled;310 const GLboolean vpEnabled = crStateGetCurrent(g_pStateTracker)->program.vpEnabled; 311 311 312 312 /*crDebug("crPackExpandArrayElement(%i)", index);*/ … … 669 669 GLsizei indexsize; 670 670 #ifdef CR_ARB_vertex_buffer_object 671 CRBufferObject *elementsBuffer = crStateGetCurrent( )->bufferobject.elementsBuffer;671 CRBufferObject *elementsBuffer = crStateGetCurrent(g_pStateTracker)->bufferobject.elementsBuffer; 672 672 packet_length += sizeof(GLint); 673 673 if (elementsBuffer && elementsBuffer->id) … … 708 708 void PACK_APIENTRY 709 709 crPackDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, 710 710 GLenum type, const GLvoid *indices) 711 711 { 712 712 unsigned char *data_ptr, *start_ptr; … … 716 716 717 717 #ifdef CR_ARB_vertex_buffer_object 718 CRBufferObject *elementsBuffer = crStateGetCurrent( )->bufferobject.elementsBuffer;718 CRBufferObject *elementsBuffer = crStateGetCurrent(g_pStateTracker)->bufferobject.elementsBuffer; 719 719 packet_length += sizeof(GLint); 720 720 if (elementsBuffer && elementsBuffer->id) … … 762 762 void 763 763 crPackExpandDrawElements(GLenum mode, GLsizei count, GLenum type, 764 764 const GLvoid *indices, CRClientState *c, const GLfloat *pZva) 765 765 { 766 766 int i; 767 767 GLubyte *p = (GLubyte *)indices; 768 768 #ifdef CR_ARB_vertex_buffer_object 769 CRBufferObject *elementsBuffer = crStateGetCurrent( )->bufferobject.elementsBuffer;769 CRBufferObject *elementsBuffer = crStateGetCurrent(g_pStateTracker)->bufferobject.elementsBuffer; 770 770 #endif 771 771 … … 1065 1065 void PACK_APIENTRY crPackLockArraysEXT(GLint first, GLint count) 1066 1066 { 1067 CRContext *g = crStateGetCurrent( );1067 CRContext *g = crStateGetCurrent(g_pStateTracker); 1068 1068 CRClientState *c = &g->client; 1069 1069 unsigned char *data_ptr, *start_ptr; -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_pixelmap.c
r69392 r78375 11 11 static unsigned char * __gl_HandlePixelMapData(GLenum map, GLsizei mapsize, int size_of_value, const GLvoid *values) 12 12 { 13 int nodata = (values == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);13 int nodata = (values == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 14 14 int packet_length = 15 15 sizeof( map ) + -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_pixels.c
r69392 r78375 19 19 unsigned char *data_ptr; 20 20 int packet_length, imagesize; 21 int noimagedata = (pixels == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);21 int noimagedata = (pixels == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 22 22 23 23 packet_length = … … 115 115 const GLubyte *bitmap, const CRPixelPackState *unpack ) 116 116 { 117 const int noimagedata = (bitmap == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);117 const int noimagedata = (bitmap == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 118 118 unsigned char *data_ptr; 119 119 int data_length = 0; -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_stipple.c
r69392 r78375 14 14 CR_GET_PACKER_CONTEXT(pc); 15 15 unsigned char *data_ptr; 16 int nodata = crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);16 int nodata = crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 17 17 int packet_length = sizeof(int); 18 18 -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_texture.c
r69392 r78375 20 20 unsigned char *data_ptr; 21 21 int packet_length; 22 int noimagedata = (pixels == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);22 int noimagedata = (pixels == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 23 23 24 24 packet_length = … … 63 63 unsigned char *data_ptr; 64 64 int packet_length; 65 const int noimagedata = (pixels == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);65 const int noimagedata = (pixels == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 66 66 const int is_distrib = ((type == GL_TRUE) || (type == GL_FALSE)); 67 67 int distrib_buf_len = 0; … … 139 139 unsigned char *data_ptr; 140 140 int packet_length; 141 int noimagedata = (pixels == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);141 int noimagedata = (pixels == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 142 142 int is_distrib = ( (type == GL_TRUE) || (type == GL_FALSE) ) ; 143 143 int distrib_buf_len = 0; … … 215 215 unsigned char *data_ptr; 216 216 int packet_length; 217 int noimagedata = (pixels == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);217 int noimagedata = (pixels == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 218 218 int is_distrib = ( (type == GL_TRUE) || (type == GL_FALSE) ) ; 219 219 int distrib_buf_len = 0; … … 561 561 unsigned char *data_ptr; 562 562 int packet_length; 563 int noimagedata = (pixels == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);563 int noimagedata = (pixels == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 564 564 565 565 packet_length = … … 614 614 unsigned char *data_ptr; 615 615 int packet_length; 616 int noimagedata = (pixels == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);616 int noimagedata = (pixels == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 617 617 618 618 packet_length = … … 660 660 unsigned char *data_ptr; 661 661 int packet_length; 662 int noimagedata = (pixels == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);662 int noimagedata = (pixels == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 663 663 664 664 packet_length = … … 732 732 unsigned char *data_ptr; 733 733 int packet_length; 734 int noimagedata = (data == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);734 int noimagedata = (data == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 735 735 736 736 /* All extended opcodes have their first 8 bytes predefined: … … 777 777 unsigned char *data_ptr; 778 778 int packet_length; 779 int noimagedata = (data == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);779 int noimagedata = (data == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 780 780 781 781 /* All extended opcodes have their first 8 bytes predefined: … … 825 825 unsigned char *data_ptr; 826 826 int packet_length; 827 int noimagedata = (data == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);827 int noimagedata = (data == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 828 828 829 829 /* All extended opcodes have their first 8 bytes predefined: … … 873 873 unsigned char *data_ptr; 874 874 int packet_length; 875 int noimagedata = (data == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);875 int noimagedata = (data == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 876 876 877 877 /* All extended opcodes have their first 8 bytes predefined: … … 917 917 unsigned char *data_ptr; 918 918 int packet_length; 919 int noimagedata = (data == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);919 int noimagedata = (data == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 920 920 921 921 /* All extended opcodes have their first 8 bytes predefined: … … 965 965 unsigned char *data_ptr; 966 966 int packet_length; 967 int noimagedata = (data == NULL) || crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);967 int noimagedata = (data == NULL) || crStateIsBufferBound(g_pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB); 968 968 969 969 /* All extended opcodes have their first 8 bytes predefined: -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/gendiffcode.py
r69392 r78375 20 20 CRContext *fromCtx, CRContext *toCtx) 21 21 { 22 PCRStateTracker pState = fromCtx->pStateTracker; 22 23 CR%(Name)sState *from = &(fromCtx->%(name)s); 23 24 CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars()) … … 28 29 CRContext *fromCtx, CRContext *toCtx) 29 30 { 31 PCRStateTracker pState = fromCtx->pStateTracker; 30 32 CR%(Name)sState *from = &(fromCtx->%(name)s); 31 33 CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars()) … … 58 60 print(""" unsigned int j, i; 59 61 CRbitvalue nbitID[CR_MAX_BITARRAY]; 62 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 60 63 for (j = 0; j<CR_MAX_BITARRAY; j++) 61 64 nbitID[j] = ~bitID[j]; … … 151 154 if members[0] != "*" and guardbit[0:6] == "enable": 152 155 print(tab+"glAble able[2];") 153 print(tab+"able[0] = diff_api.Disable;")154 print(tab+"able[1] = diff_api.Enable;")156 print(tab+"able[0] = pState->diff_api.Disable;") 157 print(tab+"able[1] = pState->diff_api.Enable;") 155 158 156 159 current_dependency = dependency … … 226 229 i += 1 227 230 228 sys.stdout.write(tab+" diff_api.%(func)s("%vars())231 sys.stdout.write(tab+"pState->diff_api.%(func)s("%vars()) 229 232 for funcarg in funcargs: 230 233 sys.stdout.write(funcarg+", ") -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state.h
r78341 r78375 12 12 #define CRSTATE_CHECKERR_RET(expr, result, message, ret) \ 13 13 if (expr) { \ 14 crStateError( __LINE__, __FILE__, result, message); \14 crStateError(pState, __LINE__, __FILE__, result, message); \ 15 15 return ret; \ 16 16 } … … 22 22 typedef struct _crCheckIDHWID { 23 23 GLuint id, hwid; 24 PCRStateTracker pState; 24 25 } crCheckIDHWID_t; 25 26 26 extern SPUDispatchTable diff_api; 27 extern CRStateBits *__currentBits; 28 29 #define GetCurrentBits() __currentBits 27 #define GetCurrentBits(a_pState) (a_pState)->pCurrentBits 30 28 31 29 #include <cr_threads.h> 32 30 33 extern CRtsd __contextTSD; 34 #define GetCurrentContext() VBoxTlsRefGetCurrent(CRContext, &__contextTSD) 31 #define GetCurrentContext(a_pState) VBoxTlsRefGetCurrent(CRContext, &((a_pState)->contextTSD)) 35 32 36 33 /* NOTE: below SetCurrentContext stuff is supposed to be used only internally!! 37 34 * it is placed here only to simplify things since some code besides state_init.c 38 35 * (i.e. state_glsl.c) is using it */ 39 #define SetCurrentContext(_ctx) VBoxTlsRefSetCurrent(CRContext, &__contextTSD, _ctx) 40 41 extern GLboolean g_bVBoxEnableDiffOnMakeCurrent; 42 43 extern CRContext *g_pAvailableContexts[CR_MAX_CONTEXTS]; 44 extern uint32_t g_cContexts; 36 #define SetCurrentContext(a_pState, _ctx) VBoxTlsRefSetCurrent(CRContext, &((a_pState)->contextTSD), _ctx) 45 37 46 38 extern void crStateTextureInitTextureObj (CRContext *ctx, CRTextureObj *tobj, GLuint name, GLenum target); … … 66 58 void crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, CRContext *from, CRContext *to); 67 59 68 void crStateFreeBufferObject(void *data );69 void crStateFreeFBO(void *data );70 void crStateFreeRBO(void *data );60 void crStateFreeBufferObject(void *data, void *pvUser); 61 void crStateFreeFBO(void *data, void *pvUser); 62 void crStateFreeRBO(void *data, void *pvUser); 71 63 72 64 void crStateGenNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names); 73 65 void crStateRegNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names); 74 void crStateOnTextureUsageRelease( CRSharedState *pS, CRTextureObj *pObj);66 void crStateOnTextureUsageRelease(PCRStateTracker pState, CRSharedState *pS, CRTextureObj *pObj); 75 67 #endif -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_attrib.c
r69392 r78375 83 83 84 84 static void 85 copy_texobj( CRTextureObj *dest, CRTextureObj *src, GLboolean copyName)85 copy_texobj(PCRStateTracker pState, CRTextureObj *dest, CRTextureObj *src, GLboolean copyName) 86 86 { 87 87 if (copyName) 88 88 { 89 89 dest->id = src->id; 90 dest->hwid = crStateGetTextureObjHWID( src);90 dest->hwid = crStateGetTextureObjHWID(pState, src); 91 91 } 92 92 … … 109 109 } 110 110 111 void STATE_APIENTRY crStatePushAttrib( GLbitfield mask)111 void STATE_APIENTRY crStatePushAttrib(PCRStateTracker pState, GLbitfield mask) 112 112 { 113 CRContext *g = GetCurrentContext( );113 CRContext *g = GetCurrentContext(pState); 114 114 CRAttribState *a = &(g->attrib); 115 CRStateBits *sb = GetCurrentBits( );115 CRStateBits *sb = GetCurrentBits(pState); 116 116 CRAttribBits *ab = &(sb->attrib); 117 117 unsigned int i; … … 119 119 if (g->current.inBeginEnd) 120 120 { 121 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glPushAttrib called in Begin/End");121 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glPushAttrib called in Begin/End"); 122 122 return; 123 123 } … … 125 125 if (a->attribStackDepth == CR_MAX_ATTRIB_STACK_DEPTH - 1) 126 126 { 127 crStateError( __LINE__, __FILE__, GL_STACK_OVERFLOW, "glPushAttrib called with a full stack!" );127 crStateError(pState, __LINE__, __FILE__, GL_STACK_OVERFLOW, "glPushAttrib called with a full stack!" ); 128 128 return; 129 129 } … … 462 462 copy_texunit(&tState->unit[i], &g->texture.unit[i]); 463 463 /* texture object state */ 464 copy_texobj( &tState->unit[i].Saved1D, g->texture.unit[i].currentTexture1D, GL_TRUE);465 copy_texobj( &tState->unit[i].Saved2D, g->texture.unit[i].currentTexture2D, GL_TRUE);464 copy_texobj(pState, &tState->unit[i].Saved1D, g->texture.unit[i].currentTexture1D, GL_TRUE); 465 copy_texobj(pState, &tState->unit[i].Saved2D, g->texture.unit[i].currentTexture2D, GL_TRUE); 466 466 #ifdef CR_OPENGL_VERSION_1_2 467 copy_texobj( &tState->unit[i].Saved3D, g->texture.unit[i].currentTexture3D, GL_TRUE);467 copy_texobj(pState, &tState->unit[i].Saved3D, g->texture.unit[i].currentTexture3D, GL_TRUE); 468 468 #endif 469 469 #ifdef CR_ARB_texture_cube_map 470 copy_texobj( &tState->unit[i].SavedCubeMap, g->texture.unit[i].currentTextureCubeMap, GL_TRUE);470 copy_texobj(pState, &tState->unit[i].SavedCubeMap, g->texture.unit[i].currentTextureCubeMap, GL_TRUE); 471 471 #endif 472 472 #ifdef CR_NV_texture_rectangle 473 copy_texobj( &tState->unit[i].SavedRect, g->texture.unit[i].currentTextureRect, GL_TRUE);473 copy_texobj(pState, &tState->unit[i].SavedRect, g->texture.unit[i].currentTextureRect, GL_TRUE); 474 474 #endif 475 475 } … … 512 512 } 513 513 514 void STATE_APIENTRY crStatePopAttrib( void)514 void STATE_APIENTRY crStatePopAttrib(PCRStateTracker pState) 515 515 { 516 CRContext *g = GetCurrentContext( );516 CRContext *g = GetCurrentContext(pState); 517 517 CRAttribState *a = &(g->attrib); 518 CRStateBits *sb = GetCurrentBits( );518 CRStateBits *sb = GetCurrentBits(pState); 519 519 CRAttribBits *ab = &(sb->attrib); 520 520 CRbitvalue mask; … … 523 523 if (g->current.inBeginEnd) 524 524 { 525 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glPopAttrib called in Begin/End");525 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glPopAttrib called in Begin/End"); 526 526 return; 527 527 } … … 529 529 if (a->attribStackDepth == 0) 530 530 { 531 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty stack!" );531 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty stack!" ); 532 532 return; 533 533 } … … 541 541 if (a->accumBufferStackDepth == 0) 542 542 { 543 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty accum buffer stack!" );543 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty accum buffer stack!" ); 544 544 return; 545 545 } … … 553 553 if (a->colorBufferStackDepth == 0) 554 554 { 555 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty color buffer stack!" );555 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty color buffer stack!" ); 556 556 return; 557 557 } … … 604 604 if (a->currentStackDepth == 0) 605 605 { 606 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty current stack!" );606 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty current stack!" ); 607 607 return; 608 608 } … … 626 626 if (a->depthBufferStackDepth == 0) 627 627 { 628 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty depth buffer stack!" );628 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty depth buffer stack!" ); 629 629 return; 630 630 } … … 644 644 if (a->enableStackDepth == 0) 645 645 { 646 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty enable stack!" );646 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty enable stack!" ); 647 647 return; 648 648 } … … 738 738 if (a->evalStackDepth == 0) 739 739 { 740 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty eval stack!" );740 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty eval stack!" ); 741 741 return; 742 742 } … … 787 787 if (a->fogStackDepth == 0) 788 788 { 789 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty fog stack!" );789 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty fog stack!" ); 790 790 return; 791 791 } … … 811 811 if (a->hintStackDepth == 0) 812 812 { 813 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty hint stack!" );813 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty hint stack!" ); 814 814 return; 815 815 } … … 842 842 if (a->lightingStackDepth == 0) 843 843 { 844 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty lighting stack!" );844 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty lighting stack!" ); 845 845 return; 846 846 } … … 903 903 if (a->lineStackDepth == 0) 904 904 { 905 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty line stack!" );905 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty line stack!" ); 906 906 return; 907 907 } … … 921 921 if (a->listStackDepth == 0) 922 922 { 923 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty list stack!" );923 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty list stack!" ); 924 924 return; 925 925 } … … 932 932 if (a->pixelModeStackDepth == 0) 933 933 { 934 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty pixel mode stack!" );934 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty pixel mode stack!" ); 935 935 return; 936 936 } … … 955 955 if (a->pointStackDepth == 0) 956 956 { 957 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty point stack!" );957 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty point stack!" ); 958 958 return; 959 959 } … … 977 977 if (a->polygonStackDepth == 0) 978 978 { 979 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty polygon stack!" );979 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty polygon stack!" ); 980 980 return; 981 981 } … … 1003 1003 if (a->polygonStippleStackDepth == 0) 1004 1004 { 1005 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty polygon stipple stack!" );1005 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty polygon stipple stack!" ); 1006 1006 return; 1007 1007 } … … 1015 1015 if (a->scissorStackDepth == 0) 1016 1016 { 1017 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty scissor stack!" );1017 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty scissor stack!" ); 1018 1018 return; 1019 1019 } … … 1032 1032 if (a->stencilBufferStackDepth == 0) 1033 1033 { 1034 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty stencil stack!" );1034 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty stencil stack!" ); 1035 1035 return; 1036 1036 } … … 1065 1065 if (a->textureStackDepth == 0) 1066 1066 { 1067 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty texture stack!" );1067 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty texture stack!" ); 1068 1068 return; 1069 1069 } … … 1076 1076 copy_texunit(&g->texture.unit[i], &tState->unit[i]); 1077 1077 /* first, restore the bindings! */ 1078 g->texture.unit[i].currentTexture1D = crStateTextureGet( GL_TEXTURE_1D, tState->unit[i].Saved1D.id);1079 copy_texobj( g->texture.unit[i].currentTexture1D, &tState->unit[i].Saved1D, GL_FALSE);1080 g->texture.unit[i].currentTexture2D = crStateTextureGet( GL_TEXTURE_2D, tState->unit[i].Saved2D.id);1081 copy_texobj( g->texture.unit[i].currentTexture2D, &tState->unit[i].Saved2D, GL_FALSE);1078 g->texture.unit[i].currentTexture1D = crStateTextureGet(pState, GL_TEXTURE_1D, tState->unit[i].Saved1D.id); 1079 copy_texobj(pState, g->texture.unit[i].currentTexture1D, &tState->unit[i].Saved1D, GL_FALSE); 1080 g->texture.unit[i].currentTexture2D = crStateTextureGet(pState, GL_TEXTURE_2D, tState->unit[i].Saved2D.id); 1081 copy_texobj(pState, g->texture.unit[i].currentTexture2D, &tState->unit[i].Saved2D, GL_FALSE); 1082 1082 #ifdef CR_OPENGL_VERSION_1_2 1083 g->texture.unit[i].currentTexture3D = crStateTextureGet( GL_TEXTURE_3D, tState->unit[i].Saved3D.id);1084 copy_texobj( g->texture.unit[i].currentTexture3D, &tState->unit[i].Saved3D, GL_FALSE);1083 g->texture.unit[i].currentTexture3D = crStateTextureGet(pState, GL_TEXTURE_3D, tState->unit[i].Saved3D.id); 1084 copy_texobj(pState, g->texture.unit[i].currentTexture3D, &tState->unit[i].Saved3D, GL_FALSE); 1085 1085 #endif 1086 1086 #ifdef CR_ARB_texture_cube_map 1087 g->texture.unit[i].currentTextureCubeMap = crStateTextureGet( GL_TEXTURE_CUBE_MAP_ARB, tState->unit[i].SavedCubeMap.id);1088 copy_texobj( g->texture.unit[i].currentTextureCubeMap, &tState->unit[i].SavedCubeMap, GL_FALSE);1087 g->texture.unit[i].currentTextureCubeMap = crStateTextureGet(pState, GL_TEXTURE_CUBE_MAP_ARB, tState->unit[i].SavedCubeMap.id); 1088 copy_texobj(pState, g->texture.unit[i].currentTextureCubeMap, &tState->unit[i].SavedCubeMap, GL_FALSE); 1089 1089 #endif 1090 1090 #ifdef CR_NV_texture_rectangle 1091 g->texture.unit[i].currentTextureRect = crStateTextureGet( GL_TEXTURE_CUBE_MAP_ARB, tState->unit[i].SavedRect.id);1092 copy_texobj( g->texture.unit[i].currentTextureRect, &tState->unit[i].SavedRect, GL_FALSE);1091 g->texture.unit[i].currentTextureRect = crStateTextureGet(pState, GL_TEXTURE_CUBE_MAP_ARB, tState->unit[i].SavedRect.id); 1092 copy_texobj(pState, g->texture.unit[i].currentTextureRect, &tState->unit[i].SavedRect, GL_FALSE); 1093 1093 #endif 1094 1094 } … … 1130 1130 if (a->transformStackDepth == 0) 1131 1131 { 1132 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty transform stack!" );1132 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty transform stack!" ); 1133 1133 return; 1134 1134 } 1135 1135 a->transformStackDepth--; 1136 1136 g->transform.matrixMode = a->transformStack[a->transformStackDepth].matrixMode; 1137 crStateMatrixMode( g->transform.matrixMode);1137 crStateMatrixMode(pState, g->transform.matrixMode); 1138 1138 for (i = 0 ; i < g->limits.maxClipPlanes ; i++) 1139 1139 { … … 1154 1154 if (a->viewportStackDepth == 0) 1155 1155 { 1156 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty viewport stack!" );1156 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty viewport stack!" ); 1157 1157 return; 1158 1158 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_buffer.c
r69392 r78375 13 13 { 14 14 CRBufferState *b = &ctx->buffer; 15 CRStateBits *sb = GetCurrentBits( );15 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 16 16 CRBufferBits *bb = &(sb->buffer); 17 17 GLcolorf zero_colorf = {0.0f, 0.0f, 0.0f, 0.0f}; … … 83 83 } 84 84 85 void STATE_APIENTRY crStateAlphaFunc ( GLenum func, GLclampf ref)86 { 87 CRContext *g = GetCurrentContext( );85 void STATE_APIENTRY crStateAlphaFunc (PCRStateTracker pState, GLenum func, GLclampf ref) 86 { 87 CRContext *g = GetCurrentContext(pState); 88 88 CRBufferState *b = &(g->buffer); 89 CRStateBits *sb = GetCurrentBits( );90 CRBufferBits *bb = &(sb->buffer); 91 92 if (g->current.inBeginEnd) 93 { 94 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glAlphaFunc called in begin/end");89 CRStateBits *sb = GetCurrentBits(pState); 90 CRBufferBits *bb = &(sb->buffer); 91 92 if (g->current.inBeginEnd) 93 { 94 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glAlphaFunc called in begin/end"); 95 95 return; 96 96 } … … 110 110 break; 111 111 default: 112 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glAlphaFunc: Invalid func: %d", func);112 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glAlphaFunc: Invalid func: %d", func); 113 113 return; 114 114 } … … 123 123 } 124 124 125 void STATE_APIENTRY crStateDepthFunc ( GLenum func)126 { 127 CRContext *g = GetCurrentContext( );128 CRBufferState *b = &(g->buffer); 129 CRStateBits *sb = GetCurrentBits( );130 CRBufferBits *bb = &(sb->buffer); 131 132 if (g->current.inBeginEnd) 133 { 134 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glDepthFunc called in begin/end");125 void STATE_APIENTRY crStateDepthFunc (PCRStateTracker pState, GLenum func) 126 { 127 CRContext *g = GetCurrentContext(pState); 128 CRBufferState *b = &(g->buffer); 129 CRStateBits *sb = GetCurrentBits(pState); 130 CRBufferBits *bb = &(sb->buffer); 131 132 if (g->current.inBeginEnd) 133 { 134 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glDepthFunc called in begin/end"); 135 135 return; 136 136 } … … 150 150 break; 151 151 default: 152 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glDepthFunc: Invalid func: %d", func);152 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glDepthFunc: Invalid func: %d", func); 153 153 return; 154 154 } … … 160 160 } 161 161 162 void STATE_APIENTRY crStateBlendFunc ( GLenum sfactor, GLenum dfactor)163 { 164 CRContext *g = GetCurrentContext( );165 CRBufferState *b = &(g->buffer); 166 CRStateBits *sb = GetCurrentBits( );167 CRBufferBits *bb = &(sb->buffer); 168 169 if (g->current.inBeginEnd) 170 { 171 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glBlendFunc called in begin/end");162 void STATE_APIENTRY crStateBlendFunc (PCRStateTracker pState, GLenum sfactor, GLenum dfactor) 163 { 164 CRContext *g = GetCurrentContext(pState); 165 CRBufferState *b = &(g->buffer); 166 CRStateBits *sb = GetCurrentBits(pState); 167 CRBufferBits *bb = &(sb->buffer); 168 169 if (g->current.inBeginEnd) 170 { 171 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glBlendFunc called in begin/end"); 172 172 return; 173 173 } … … 197 197 RT_FALL_THRU(); 198 198 default: 199 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid sfactor passed to glBlendFunc: %d", sfactor);199 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid sfactor passed to glBlendFunc: %d", sfactor); 200 200 return; 201 201 } … … 222 222 RT_FALL_THRU(); 223 223 default: 224 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid dfactor passed to glBlendFunc: %d", dfactor);224 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid dfactor passed to glBlendFunc: %d", dfactor); 225 225 return; 226 226 } … … 234 234 } 235 235 236 void STATE_APIENTRY crStateBlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )237 { 238 CRContext *g = GetCurrentContext( );239 CRBufferState *b = &(g->buffer); 240 CRStateBits *sb = GetCurrentBits( );241 CRBufferBits *bb = &(sb->buffer); 242 243 if (g->current.inBeginEnd) 244 { 245 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "BlendColorEXT called inside a Begin/End" );236 void STATE_APIENTRY crStateBlendColorEXT(PCRStateTracker pState, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) 237 { 238 CRContext *g = GetCurrentContext(pState); 239 CRBufferState *b = &(g->buffer); 240 CRStateBits *sb = GetCurrentBits(pState); 241 CRBufferBits *bb = &(sb->buffer); 242 243 if (g->current.inBeginEnd) 244 { 245 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "BlendColorEXT called inside a Begin/End" ); 246 246 return; 247 247 } … … 256 256 257 257 #ifdef CR_EXT_blend_func_separate 258 void STATE_APIENTRY crStateBlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA )259 { 260 CRContext *g = GetCurrentContext( );261 CRBufferState *b = &(g->buffer); 262 CRStateBits *sb = GetCurrentBits( );263 CRBufferBits *bb = &(sb->buffer); 264 265 if (g->current.inBeginEnd) 266 { 267 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "BlendFuncSeparateEXT called inside a Begin/End" );258 void STATE_APIENTRY crStateBlendFuncSeparateEXT(PCRStateTracker pState, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) 259 { 260 CRContext *g = GetCurrentContext(pState); 261 CRBufferState *b = &(g->buffer); 262 CRStateBits *sb = GetCurrentBits(pState); 263 CRBufferBits *bb = &(sb->buffer); 264 265 if (g->current.inBeginEnd) 266 { 267 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "BlendFuncSeparateEXT called inside a Begin/End" ); 268 268 return; 269 269 } … … 293 293 RT_FALL_THRU(); 294 294 default: 295 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid sfactorRGB passed to glBlendFuncSeparateEXT: %d", sfactorRGB);295 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid sfactorRGB passed to glBlendFuncSeparateEXT: %d", sfactorRGB); 296 296 return; 297 297 } … … 319 319 RT_FALL_THRU(); 320 320 default: 321 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid sfactorA passed to glBlendFuncSeparateEXT: %d", sfactorA);321 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid sfactorA passed to glBlendFuncSeparateEXT: %d", sfactorA); 322 322 return; 323 323 } … … 347 347 RT_FALL_THRU(); 348 348 default: 349 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid dfactorRGB passed to glBlendFuncSeparateEXT: %d", dfactorRGB);349 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid dfactorRGB passed to glBlendFuncSeparateEXT: %d", dfactorRGB); 350 350 return; 351 351 } … … 375 375 RT_FALL_THRU(); 376 376 default: 377 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid dfactorA passed to glBlendFuncSeparateEXT: %d", dfactorA);377 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid dfactorA passed to glBlendFuncSeparateEXT: %d", dfactorA); 378 378 return; 379 379 } … … 388 388 #endif 389 389 390 void STATE_APIENTRY crStateBlendEquationEXT( GLenum mode )391 { 392 CRContext *g = GetCurrentContext( );393 CRBufferState *b = &(g->buffer); 394 CRStateBits *sb = GetCurrentBits( );390 void STATE_APIENTRY crStateBlendEquationEXT(PCRStateTracker pState, GLenum mode ) 391 { 392 CRContext *g = GetCurrentContext(pState); 393 CRBufferState *b = &(g->buffer); 394 CRStateBits *sb = GetCurrentBits(pState); 395 395 CRBufferBits *bb = &(sb->buffer); 396 396 397 397 if( g->current.inBeginEnd ) 398 398 { 399 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "BlendEquationEXT called inside a Begin/End" );399 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "BlendEquationEXT called inside a Begin/End" ); 400 400 return; 401 401 } … … 419 419 #endif /* defined(CR_EXT_blend_minmax) || defined(CR_EXT_blend_subtract) || defined(CR_EXT_blend_logic_op) */ 420 420 default: 421 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,421 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 422 422 "BlendEquationEXT: mode called with illegal parameter: 0x%x", (GLenum) mode ); 423 423 return; … … 427 427 } 428 428 429 void STATE_APIENTRY crStateLogicOp ( GLenum opcode)430 { 431 CRContext *g = GetCurrentContext( );432 CRBufferState *b = &(g->buffer); 433 CRStateBits *sb = GetCurrentBits( );434 CRBufferBits *bb = &(sb->buffer); 435 436 if (g->current.inBeginEnd) 437 { 438 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glLogicOp called in begin/end");429 void STATE_APIENTRY crStateLogicOp (PCRStateTracker pState, GLenum opcode) 430 { 431 CRContext *g = GetCurrentContext(pState); 432 CRBufferState *b = &(g->buffer); 433 CRStateBits *sb = GetCurrentBits(pState); 434 CRBufferBits *bb = &(sb->buffer); 435 436 if (g->current.inBeginEnd) 437 { 438 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glLogicOp called in begin/end"); 439 439 return; 440 440 } … … 462 462 break; 463 463 default: 464 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glLogicOp called with bogus opcode: %d", opcode);464 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glLogicOp called with bogus opcode: %d", opcode); 465 465 return; 466 466 } … … 472 472 } 473 473 474 void STATE_APIENTRY crStateDrawBuffer ( GLenum mode)475 { 476 CRContext *g = GetCurrentContext( );477 CRBufferState *b = &(g->buffer); 478 CRStateBits *sb = GetCurrentBits( );479 CRBufferBits *bb = &(sb->buffer); 480 481 if (g->current.inBeginEnd) 482 { 483 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glDrawBuffer called in begin/end");474 void STATE_APIENTRY crStateDrawBuffer (PCRStateTracker pState, GLenum mode) 475 { 476 CRContext *g = GetCurrentContext(pState); 477 CRBufferState *b = &(g->buffer); 478 CRStateBits *sb = GetCurrentBits(pState); 479 CRBufferBits *bb = &(sb->buffer); 480 481 if (g->current.inBeginEnd) 482 { 483 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glDrawBuffer called in begin/end"); 484 484 return; 485 485 } … … 506 506 if (g->framebufferobject.drawFB) 507 507 { 508 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glDrawBuffer invalid mode while fbo is active");508 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glDrawBuffer invalid mode while fbo is active"); 509 509 return; 510 510 } … … 515 515 if (!g->framebufferobject.drawFB) 516 516 { 517 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glDrawBuffer invalid mode while fbo is inactive");517 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glDrawBuffer invalid mode while fbo is inactive"); 518 518 return; 519 519 } … … 521 521 else 522 522 { 523 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glDrawBuffer called with bogus mode: %d", mode);523 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glDrawBuffer called with bogus mode: %d", mode); 524 524 return; 525 525 } … … 538 538 } 539 539 540 void STATE_APIENTRY crStateReadBuffer ( GLenum mode)541 { 542 CRContext *g = GetCurrentContext( );543 CRBufferState *b = &(g->buffer); 544 CRStateBits *sb = GetCurrentBits( );545 CRBufferBits *bb = &(sb->buffer); 546 547 if (g->current.inBeginEnd) 548 { 549 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer called in begin/end");540 void STATE_APIENTRY crStateReadBuffer (PCRStateTracker pState, GLenum mode) 541 { 542 CRContext *g = GetCurrentContext(pState); 543 CRBufferState *b = &(g->buffer); 544 CRStateBits *sb = GetCurrentBits(pState); 545 CRBufferBits *bb = &(sb->buffer); 546 547 if (g->current.inBeginEnd) 548 { 549 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer called in begin/end"); 550 550 return; 551 551 } … … 572 572 if (g->framebufferobject.readFB) 573 573 { 574 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer invalid mode while fbo is active");574 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer invalid mode while fbo is active"); 575 575 return; 576 576 } … … 581 581 if (!g->framebufferobject.readFB) 582 582 { 583 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer invalid mode while fbo is inactive");583 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer invalid mode while fbo is inactive"); 584 584 return; 585 585 } … … 591 591 else 592 592 { 593 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glReadBuffer called with bogus mode: %d", mode);593 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glReadBuffer called with bogus mode: %d", mode); 594 594 return; 595 595 } … … 608 608 } 609 609 610 void STATE_APIENTRY crStateIndexMask ( GLuint mask)611 { 612 CRContext *g = GetCurrentContext( );613 CRBufferState *b = &(g->buffer); 614 CRStateBits *sp = GetCurrentBits( );610 void STATE_APIENTRY crStateIndexMask (PCRStateTracker pState, GLuint mask) 611 { 612 CRContext *g = GetCurrentContext(pState); 613 CRBufferState *b = &(g->buffer); 614 CRStateBits *sp = GetCurrentBits(pState); 615 615 CRBufferBits *bb = &(sp->buffer); 616 616 617 617 if (g->current.inBeginEnd) 618 618 { 619 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer called in begin/end");619 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer called in begin/end"); 620 620 return; 621 621 } … … 628 628 } 629 629 630 void STATE_APIENTRY crStateColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)631 { 632 CRContext *g = GetCurrentContext( );633 CRBufferState *b = &(g->buffer); 634 CRStateBits *sp = GetCurrentBits( );630 void STATE_APIENTRY crStateColorMask (PCRStateTracker pState, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) 631 { 632 CRContext *g = GetCurrentContext(pState); 633 CRBufferState *b = &(g->buffer); 634 CRStateBits *sp = GetCurrentBits(pState); 635 635 CRBufferBits *bb = &(sp->buffer); 636 636 637 637 if (g->current.inBeginEnd) 638 638 { 639 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer called in begin/end");639 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer called in begin/end"); 640 640 return; 641 641 } … … 651 651 } 652 652 653 void STATE_APIENTRY crStateClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)654 { 655 CRContext *g = GetCurrentContext( );656 CRBufferState *b = &(g->buffer); 657 CRStateBits *sp = GetCurrentBits( );653 void STATE_APIENTRY crStateClearColor (PCRStateTracker pState, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) 654 { 655 CRContext *g = GetCurrentContext(pState); 656 CRBufferState *b = &(g->buffer); 657 CRStateBits *sp = GetCurrentBits(pState); 658 658 CRBufferBits *bb = &(sp->buffer); 659 659 660 660 if (g->current.inBeginEnd) 661 661 { 662 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glClearColor called in begin/end");662 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glClearColor called in begin/end"); 663 663 return; 664 664 } … … 683 683 } 684 684 685 void STATE_APIENTRY crStateClearIndex ( GLfloat c)686 { 687 CRContext *g = GetCurrentContext( );688 CRBufferState *b = &(g->buffer); 689 CRStateBits *sp = GetCurrentBits( );685 void STATE_APIENTRY crStateClearIndex (PCRStateTracker pState, GLfloat c) 686 { 687 CRContext *g = GetCurrentContext(pState); 688 CRBufferState *b = &(g->buffer); 689 CRStateBits *sp = GetCurrentBits(pState); 690 690 CRBufferBits *bb = &(sp->buffer); 691 691 692 692 if (g->current.inBeginEnd) 693 693 { 694 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glClearIndex called in begin/end");694 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glClearIndex called in begin/end"); 695 695 return; 696 696 } … … 701 701 } 702 702 703 void STATE_APIENTRY crStateClearDepth ( GLclampd depth)704 { 705 CRContext *g = GetCurrentContext( );706 CRBufferState *b = &(g->buffer); 707 CRStateBits *sp = GetCurrentBits( );703 void STATE_APIENTRY crStateClearDepth (PCRStateTracker pState, GLclampd depth) 704 { 705 CRContext *g = GetCurrentContext(pState); 706 CRBufferState *b = &(g->buffer); 707 CRStateBits *sp = GetCurrentBits(pState); 708 708 CRBufferBits *bb = &(sp->buffer); 709 709 710 710 if (g->current.inBeginEnd) 711 711 { 712 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glClearDepth called in begin/end");712 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glClearDepth called in begin/end"); 713 713 return; 714 714 } … … 724 724 } 725 725 726 void STATE_APIENTRY crStateClearAccum ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)727 { 728 CRContext *g = GetCurrentContext( );729 CRBufferState *b = &(g->buffer); 730 CRStateBits *sp = GetCurrentBits( );726 void STATE_APIENTRY crStateClearAccum (PCRStateTracker pState, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) 727 { 728 CRContext *g = GetCurrentContext(pState); 729 CRBufferState *b = &(g->buffer); 730 CRStateBits *sp = GetCurrentBits(pState); 731 731 CRBufferBits *bb = &(sp->buffer); 732 732 733 733 if (g->current.inBeginEnd) 734 734 { 735 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glClearAccum called in begin/end");735 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glClearAccum called in begin/end"); 736 736 return; 737 737 } … … 756 756 } 757 757 758 void STATE_APIENTRY crStateDepthMask ( GLboolean b)759 { 760 CRContext *g = GetCurrentContext( );758 void STATE_APIENTRY crStateDepthMask (PCRStateTracker pState, GLboolean b) 759 { 760 CRContext *g = GetCurrentContext(pState); 761 761 CRBufferState *bs = &(g->buffer); 762 CRStateBits *sp = GetCurrentBits( );762 CRStateBits *sp = GetCurrentBits(pState); 763 763 CRBufferBits *bb = &(sp->buffer); 764 764 765 765 if (g->current.inBeginEnd) 766 766 { 767 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "DepthMask called in begin/end");767 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "DepthMask called in begin/end"); 768 768 return; 769 769 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c
r78116 r78375 28 28 } 29 29 30 void STATE_APIENTRY crStateGenBuffersARB( GLsizei n, GLuint *buffers)31 { 32 CRContext *g = GetCurrentContext( );30 void STATE_APIENTRY crStateGenBuffersARB(PCRStateTracker pState, GLsizei n, GLuint *buffers) 31 { 32 CRContext *g = GetCurrentContext(pState); 33 33 crStateGenNames(g, g->shared->buffersTable, n, buffers); 34 34 } 35 35 36 void crStateRegBuffers( GLsizei n, GLuint *buffers)37 { 38 CRContext *g = GetCurrentContext( );36 void crStateRegBuffers(PCRStateTracker pState, GLsizei n, GLuint *buffers) 37 { 38 CRContext *g = GetCurrentContext(pState); 39 39 crStateRegNames(g, g->shared->buffersTable, n, buffers); 40 40 } … … 61 61 } 62 62 63 GLboolean crStateIsBufferBound( GLenum target)64 { 65 CRContext *g = GetCurrentContext( );63 GLboolean crStateIsBufferBound(PCRStateTracker pState, GLenum target) 64 { 65 CRContext *g = GetCurrentContext(pState); 66 66 return crStateIsBufferBoundForCtx(g, target); 67 67 } … … 86 86 } 87 87 88 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsBufferARB( GLuint buffer )89 { 90 CRContext *g = GetCurrentContext( );88 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsBufferARB(PCRStateTracker pState, GLuint buffer ) 89 { 90 CRContext *g = GetCurrentContext(pState); 91 91 92 92 FLUSH(); 93 93 94 94 if (g->current.inBeginEnd) { 95 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,95 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 96 96 "glIsBufferARB called in begin/end"); 97 97 return GL_FALSE; … … 103 103 void crStateBufferObjectInit (CRContext *ctx) 104 104 { 105 CRStateBits *sb = GetCurrentBits( );105 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 106 106 CRBufferObjectBits *bb = &sb->bufferobject; 107 107 CRBufferObjectState *b = &ctx->bufferobject; … … 114 114 RESET(bb->packBinding, ctx->bitid); 115 115 #endif 116 117 b->pStateTracker = ctx->pStateTracker; 116 118 117 119 #ifdef IN_GUEST … … 134 136 } 135 137 136 void crStateFreeBufferObject(void *data )138 void crStateFreeBufferObject(void *data, void *pvUser) 137 139 { 138 140 CRBufferObject *pObj = (CRBufferObject *)data; 141 PCRStateTracker pState = (PCRStateTracker)pvUser; 139 142 if (pObj->data) crFree(pObj->data); 140 143 141 144 #ifndef IN_GUEST 142 if ( diff_api.DeleteBuffersARB)143 { 144 diff_api.DeleteBuffersARB(1, &pObj->hwid);145 if (pState->diff_api.DeleteBuffersARB) 146 { 147 pState->diff_api.DeleteBuffersARB(1, &pObj->hwid); 145 148 } 146 149 #endif … … 165 168 } 166 169 167 DECLEXPORT(GLuint) STATE_APIENTRY crStateBufferHWIDtoID( GLuint hwid)168 { 169 CRContext *g = GetCurrentContext( );170 DECLEXPORT(GLuint) STATE_APIENTRY crStateBufferHWIDtoID(PCRStateTracker pState, GLuint hwid) 171 { 172 CRContext *g = GetCurrentContext(pState); 170 173 crCheckIDHWID_t parms; 171 174 … … 177 180 } 178 181 179 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetBufferHWID( GLuint id)180 { 181 CRContext *g = GetCurrentContext( );182 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetBufferHWID(PCRStateTracker pState, GLuint id) 183 { 184 CRContext *g = GetCurrentContext(pState); 182 185 CRBufferObject *pObj = (CRBufferObject *) crHashtableSearch(g->shared->buffersTable, id); 183 186 … … 186 189 187 190 void STATE_APIENTRY 188 crStateBindBufferARB ( GLenum target, GLuint buffer)189 { 190 CRContext *g = GetCurrentContext( );191 crStateBindBufferARB (PCRStateTracker pState, GLenum target, GLuint buffer) 192 { 193 CRContext *g = GetCurrentContext(pState); 191 194 CRBufferObjectState *b = &(g->bufferobject); 192 CRStateBits *sb = GetCurrentBits( );195 CRStateBits *sb = GetCurrentBits(pState); 193 196 CRBufferObjectBits *bb = &(sb->bufferobject); 194 197 CRBufferObject *oldObj, *newObj; 195 198 196 199 if (g->current.inBeginEnd) { 197 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,200 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 198 201 "glBindBufferARB called in begin/end"); 199 202 return; … … 205 208 if (!oldObj) 206 209 { 207 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glBindBufferARB(target)");210 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glBindBufferARB(target)"); 208 211 return; 209 212 } … … 219 222 CRSTATE_CHECKERR(!newObj, GL_OUT_OF_MEMORY, "glBindBuffer"); 220 223 #ifndef IN_GUEST 221 diff_api.GenBuffersARB(1, &newObj->hwid);224 pState->diff_api.GenBuffersARB(1, &newObj->hwid); 222 225 if (!newObj->hwid) 223 226 { … … 268 271 /*we shouldn't reach this point*/ 269 272 CRASSERT(false); 270 crHashtableDelete (g->shared->buffersTable, (unsigned long) oldObj->id, crStateFreeBufferObject);273 crHashtableDeleteEx(g->shared->buffersTable, (unsigned long) oldObj->id, crStateFreeBufferObject, pState); 271 274 } 272 275 … … 279 282 } 280 283 281 static void ctStateBuffersRefsCleanup( CRContext *ctx, CRBufferObject *obj, CRbitvalue *neg_bitid)284 static void ctStateBuffersRefsCleanup(PCRStateTracker pState, CRContext *ctx, CRBufferObject *obj, CRbitvalue *neg_bitid) 282 285 { 283 286 CRBufferObjectState *b = &(ctx->bufferobject); 284 CRStateBits *sb = GetCurrentBits( );287 CRStateBits *sb = GetCurrentBits(pState); 285 288 CRBufferObjectBits *bb = &(sb->bufferobject); 286 289 int j, k; … … 347 350 348 351 void STATE_APIENTRY 349 crStateDeleteBuffersARB( GLsizei n, const GLuint *buffers)350 { 351 CRContext *g = GetCurrentContext( );352 crStateDeleteBuffersARB(PCRStateTracker pState, GLsizei n, const GLuint *buffers) 353 { 354 CRContext *g = GetCurrentContext(pState); 352 355 int i; 353 356 … … 355 358 356 359 if (g->current.inBeginEnd) { 357 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,360 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 358 361 "glDeleteBuffersARB called in Begin/End"); 359 362 return; … … 361 364 362 365 if (n < 0) { 363 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,366 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 364 367 "glDeleteBuffersARB(n < 0)"); 365 368 return; … … 373 376 int j; 374 377 375 ctStateBuffersRefsCleanup( g, obj, g->neg_bitid);378 ctStateBuffersRefsCleanup(pState, g, obj, g->neg_bitid); 376 379 377 380 CR_STATE_SHAREDOBJ_USAGE_FOREACH_USED_IDX(obj, j) … … 381 384 * This is why g_pAvailableContexts[j] could be NULL 382 385 * also g_pAvailableContexts[0] will hold default context, which we should discard */ 383 CRContext *ctx = g_pAvailableContexts[j];386 CRContext *ctx = pState->apAvailableContexts[j]; 384 387 if (j && ctx) 385 388 { 386 ctStateBuffersRefsCleanup( ctx, obj, g->neg_bitid); /* <- yes, use g->neg_bitid, i.e. neg_bitid of the current context to ensure others bits get dirtified,387 * but not the current context ones*/389 ctStateBuffersRefsCleanup(pState, ctx, obj, g->neg_bitid); /* <- yes, use g->neg_bitid, i.e. neg_bitid of the current context to ensure others bits get dirtified, 390 * but not the current context ones*/ 388 391 } 389 392 else … … 391 394 } 392 395 393 crHashtableDelete (g->shared->buffersTable, buffers[i], crStateFreeBufferObject);396 crHashtableDeleteEx(g->shared->buffersTable, buffers[i], crStateFreeBufferObject, pState); 394 397 } 395 398 } … … 398 401 399 402 void STATE_APIENTRY 400 crStateBufferDataARB( GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage)401 { 402 CRContext *g = GetCurrentContext( );403 crStateBufferDataARB(PCRStateTracker pState, GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage) 404 { 405 CRContext *g = GetCurrentContext(pState); 403 406 CRBufferObjectState *b = &g->bufferobject; 404 407 CRBufferObject *obj; 405 CRStateBits *sb = GetCurrentBits( );408 CRStateBits *sb = GetCurrentBits(pState); 406 409 CRBufferObjectBits *bb = &sb->bufferobject; 407 410 … … 409 412 410 413 if (g->current.inBeginEnd) { 411 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,414 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 412 415 "glBufferDataARB called in begin/end"); 413 416 return; … … 415 418 416 419 if (size < 0) { 417 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,420 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 418 421 "glBufferDataARB(size < 0)"); 419 422 return; … … 433 436 break; 434 437 default: 435 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,438 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 436 439 "glBufferDataARB(usage)"); 437 440 return; … … 441 444 if (!obj) 442 445 { 443 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glBufferDataARB(target)");446 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glBufferDataARB(target)"); 444 447 return; 445 448 } 446 449 447 450 if (obj->id == 0) { 448 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glBufferDataARB");451 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glBufferDataARB"); 449 452 return; 450 453 } 451 454 452 455 if (obj->pointer) { 453 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,456 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 454 457 "glBufferDataARB(buffer is mapped)"); 455 458 return; … … 469 472 obj->data = crAlloc(size); 470 473 if (!obj->data) { 471 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glBufferDataARB");474 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glBufferDataARB"); 472 475 return; 473 476 } … … 484 487 485 488 void STATE_APIENTRY 486 crStateBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data)487 { 488 CRContext *g = GetCurrentContext( );489 crStateBufferSubDataARB(PCRStateTracker pState, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data) 490 { 491 CRContext *g = GetCurrentContext(pState); 489 492 CRBufferObjectState *b = &g->bufferobject; 490 493 CRBufferObject *obj; 491 CRStateBits *sb = GetCurrentBits( );494 CRStateBits *sb = GetCurrentBits(pState); 492 495 CRBufferObjectBits *bb = &sb->bufferobject; 493 496 … … 495 498 496 499 if (g->current.inBeginEnd) { 497 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,500 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 498 501 "glBufferSubDataARB called in begin/end"); 499 502 return; … … 503 506 if (!obj) 504 507 { 505 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glBufferSubDataARB(target)");508 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glBufferSubDataARB(target)"); 506 509 return; 507 510 } 508 511 509 512 if (obj->id == 0) { 510 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,513 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 511 514 "glBufferSubDataARB"); 512 515 return; … … 514 517 515 518 if (obj->pointer) { 516 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,519 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 517 520 "glBufferSubDataARB(buffer is mapped)"); 518 521 return; … … 520 523 521 524 if (size < 0 || offset < 0 || (unsigned int)offset + size > obj->size) { 522 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,525 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 523 526 "glBufferSubDataARB(bad offset and/or size)"); 524 527 return; … … 540 543 541 544 void STATE_APIENTRY 542 crStateGetBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data)543 { 544 CRContext *g = GetCurrentContext( );545 crStateGetBufferSubDataARB(PCRStateTracker pState, GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data) 546 { 547 CRContext *g = GetCurrentContext(pState); 545 548 CRBufferObjectState *b = &g->bufferobject; 546 549 CRBufferObject *obj; … … 549 552 550 553 if (g->current.inBeginEnd) { 551 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,554 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 552 555 "glGetBufferSubDataARB called in begin/end"); 553 556 return; … … 557 560 if (!obj) 558 561 { 559 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferSubDataARB(target)");562 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferSubDataARB(target)"); 560 563 return; 561 564 } 562 565 563 566 if (obj->id == 0) { 564 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,567 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 565 568 "glGetBufferSubDataARB"); 566 569 return; … … 568 571 569 572 if (obj->pointer) { 570 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,573 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 571 574 "glGetBufferSubDataARB(buffer is mapped)"); 572 575 return; … … 574 577 575 578 if (size < 0 || offset < 0 || (unsigned int)offset + size > obj->size) { 576 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,579 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 577 580 "glGetBufferSubDataARB(bad offset and/or size)"); 578 581 return; … … 586 589 587 590 void * STATE_APIENTRY 588 crStateMapBufferARB( GLenum target, GLenum access)589 { 590 CRContext *g = GetCurrentContext( );591 crStateMapBufferARB(PCRStateTracker pState, GLenum target, GLenum access) 592 { 593 CRContext *g = GetCurrentContext(pState); 591 594 CRBufferObjectState *b = &g->bufferobject; 592 595 CRBufferObject *obj; … … 595 598 596 599 if (g->current.inBeginEnd) { 597 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,600 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 598 601 "glMapBufferARB called in begin/end"); 599 602 return NULL; … … 603 606 if (!obj) 604 607 { 605 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMapBufferARB(target)");608 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMapBufferARB(target)"); 606 609 return NULL; 607 610 } 608 611 609 612 if (obj->id == 0) { 610 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glMapBufferARB");613 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glMapBufferARB"); 611 614 return GL_FALSE; 612 615 } … … 619 622 break; 620 623 default: 621 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,624 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 622 625 "glMapBufferARB(access)"); 623 626 return NULL; … … 632 635 633 636 GLboolean STATE_APIENTRY 634 crStateUnmapBufferARB( GLenum target)635 { 636 CRContext *g = GetCurrentContext( );637 crStateUnmapBufferARB(PCRStateTracker pState, GLenum target) 638 { 639 CRContext *g = GetCurrentContext(pState); 637 640 CRBufferObjectState *b = &g->bufferobject; 638 641 CRBufferObject *obj; 639 CRStateBits *sb = GetCurrentBits( );642 CRStateBits *sb = GetCurrentBits(pState); 640 643 CRBufferObjectBits *bb = &sb->bufferobject; 641 644 … … 643 646 644 647 if (g->current.inBeginEnd) { 645 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,648 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 646 649 "glUnmapBufferARB called in begin/end"); 647 650 return GL_FALSE; … … 651 654 if (!obj) 652 655 { 653 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glUnmapBufferARB(target)");656 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glUnmapBufferARB(target)"); 654 657 return GL_FALSE; 655 658 } 656 659 657 660 if (obj->id == 0) { 658 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glUnmapBufferARB");661 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glUnmapBufferARB"); 659 662 return GL_FALSE; 660 663 } 661 664 662 665 if (!obj->pointer) { 663 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glUnmapBufferARB");666 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glUnmapBufferARB"); 664 667 return GL_FALSE; 665 668 } … … 680 683 681 684 void STATE_APIENTRY 682 crStateGetBufferParameterivARB( GLenum target, GLenum pname, GLint *params)683 { 684 CRContext *g = GetCurrentContext( );685 crStateGetBufferParameterivARB(PCRStateTracker pState, GLenum target, GLenum pname, GLint *params) 686 { 687 CRContext *g = GetCurrentContext(pState); 685 688 CRBufferObjectState *b = &g->bufferobject; 686 689 CRBufferObject *obj; … … 689 692 690 693 if (g->current.inBeginEnd) { 691 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,694 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 692 695 "glGetBufferParameterivARB called in begin/end"); 693 696 return; … … 697 700 if (!obj) 698 701 { 699 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferParameterivARB(target)");702 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferParameterivARB(target)"); 700 703 return; 701 704 } … … 715 718 break; 716 719 default: 717 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,720 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 718 721 "glGetBufferParameterivARB(pname)"); 719 722 return; … … 723 726 724 727 void STATE_APIENTRY 725 crStateGetBufferPointervARB( GLenum target, GLenum pname, GLvoid **params)726 { 727 CRContext *g = GetCurrentContext( );728 crStateGetBufferPointervARB(PCRStateTracker pState, GLenum target, GLenum pname, GLvoid **params) 729 { 730 CRContext *g = GetCurrentContext(pState); 728 731 CRBufferObjectState *b = &g->bufferobject; 729 732 CRBufferObject *obj; … … 732 735 733 736 if (g->current.inBeginEnd) { 734 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,737 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 735 738 "glGetBufferPointervARB called in begin/end"); 736 739 return; … … 740 743 if (!obj) 741 744 { 742 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferPointervARB(target)");745 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferPointervARB(target)"); 743 746 return; 744 747 } 745 748 746 749 if (pname != GL_BUFFER_MAP_POINTER_ARB) { 747 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");750 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)"); 748 751 return; 749 752 } … … 763 766 */ 764 767 static GLboolean 765 HaveBufferObjectExtension( void)768 HaveBufferObjectExtension(PCRStateTracker pState) 766 769 { 767 770 static GLint haveBufferObjectExt = -1; … … 772 775 * GetString into the diff'ing table in order for this to really work. 773 776 */ 774 if (! diff_api.GetString) {777 if (!pState->diff_api.GetString) { 775 778 haveBufferObjectExt = 0; 776 779 return 0; 777 780 } 778 CRASSERT( diff_api.GetString);779 ext = (const char *) diff_api.GetString(GL_EXTENSIONS);781 CRASSERT(pState->diff_api.GetString); 782 ext = (const char *) pState->diff_api.GetString(GL_EXTENSIONS); 780 783 if (crStrstr(ext, "GL_ARB_vertex_buffer_object") || 781 784 crStrstr(ext, "GL_ARB_pixel_buffer_object")) { … … 793 796 GLboolean bSwitch) 794 797 { 798 PCRStateTracker pState = fromCtx->pStateTracker; 795 799 CRBufferObjectState *from = &(fromCtx->bufferobject); 796 800 const CRBufferObjectState *to = &(toCtx->bufferobject); 797 801 802 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 803 798 804 /* ARRAY_BUFFER */ 799 805 if (CHECKDIRTY(bb->arrayBinding, bitID)) … … 802 808 { 803 809 GLuint bufferID = to->arrayBuffer ? to->arrayBuffer->hwid : 0; 804 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, bufferID);810 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, bufferID); 805 811 if (bSwitch) 806 812 { … … 825 831 { 826 832 /* update whole buffer */ 827 diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, bufObj->size,828 bufObj->data, bufObj->usage);833 pState->diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, bufObj->size, 834 bufObj->data, bufObj->usage); 829 835 } 830 836 else 831 837 { 832 838 /* update sub buffer */ 833 diff_api.BufferSubDataARB(GL_ARRAY_BUFFER_ARB,834 bufObj->dirtyStart, bufObj->dirtyLength,835 (char *) bufObj->data + bufObj->dirtyStart);839 pState->diff_api.BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 840 bufObj->dirtyStart, bufObj->dirtyLength, 841 (char *) bufObj->data + bufObj->dirtyStart); 836 842 } 837 843 if (bSwitch) FILLDIRTY(bufObj->dirty); … … 845 851 { 846 852 GLuint bufferID = to->elementsBuffer ? to->elementsBuffer->hwid : 0; 847 diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufferID);853 pState->diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufferID); 848 854 if (bSwitch) 849 855 { … … 868 874 { 869 875 /* update whole buffer */ 870 diff_api.BufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufObj->size,871 bufObj->data, bufObj->usage);876 pState->diff_api.BufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufObj->size, 877 bufObj->data, bufObj->usage); 872 878 } 873 879 else 874 880 { 875 881 /* update sub buffer */ 876 diff_api.BufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,877 bufObj->dirtyStart, bufObj->dirtyLength,878 (char *) bufObj->data + bufObj->dirtyStart);882 pState->diff_api.BufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 883 bufObj->dirtyStart, bufObj->dirtyLength, 884 (char *) bufObj->data + bufObj->dirtyStart); 879 885 } 880 886 if (bSwitch) FILLDIRTY(bufObj->dirty); … … 889 895 { 890 896 GLuint bufferID = to->packBuffer ? to->packBuffer->hwid : 0; 891 diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, bufferID);897 pState->diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, bufferID); 892 898 if (bSwitch) 893 899 { … … 912 918 { 913 919 /* update whole buffer */ 914 diff_api.BufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, bufObj->size,915 bufObj->data, bufObj->usage);920 pState->diff_api.BufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, bufObj->size, 921 bufObj->data, bufObj->usage); 916 922 } 917 923 else 918 924 { 919 925 /* update sub buffer */ 920 diff_api.BufferSubDataARB(GL_PIXEL_PACK_BUFFER_ARB,921 bufObj->dirtyStart, bufObj->dirtyLength,922 (char *) bufObj->data + bufObj->dirtyStart);926 pState->diff_api.BufferSubDataARB(GL_PIXEL_PACK_BUFFER_ARB, 927 bufObj->dirtyStart, bufObj->dirtyLength, 928 (char *) bufObj->data + bufObj->dirtyStart); 923 929 } 924 930 if (bSwitch) FILLDIRTY(bufObj->dirty); … … 932 938 { 933 939 GLuint bufferID = to->unpackBuffer ? to->unpackBuffer->hwid : 0; 934 diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufferID);940 pState->diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufferID); 935 941 if (bSwitch) 936 942 { … … 955 961 { 956 962 /* update whole buffer */ 957 diff_api.BufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufObj->size,958 bufObj->data, bufObj->usage);963 pState->diff_api.BufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufObj->size, 964 bufObj->data, bufObj->usage); 959 965 } 960 966 else 961 967 { 962 968 /* update sub buffer */ 963 diff_api.BufferSubDataARB(GL_PIXEL_UNPACK_BUFFER_ARB,964 bufObj->dirtyStart, bufObj->dirtyLength,965 (char *) bufObj->data + bufObj->dirtyStart);969 pState->diff_api.BufferSubDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, 970 bufObj->dirtyStart, bufObj->dirtyLength, 971 (char *) bufObj->data + bufObj->dirtyStart); 966 972 } 967 973 if (bSwitch) FILLDIRTY(bufObj->dirty); … … 974 980 CRContext *fromCtx, CRContext *toCtx) 975 981 { 976 /*CRBufferObjectState *from = &(fromCtx->bufferobject); - unused977 const CRBufferObjectState *to = &(toCtx->bufferobject); - unused */978 979 if (!HaveBufferObjectExtension( ))982 PCRStateTracker pState = fromCtx->pStateTracker; 983 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 984 985 if (!HaveBufferObjectExtension(pState)) 980 986 return; 981 987 … … 991 997 if (pBufferObj->id && !pBufferObj->hwid) 992 998 { 993 diff_api.GenBuffersARB(1, &pBufferObj->hwid);999 pState->pStateTracker->diff_api.GenBuffersARB(1, &pBufferObj->hwid); 994 1000 CRASSERT(pBufferObj->hwid); 995 1001 } … … 1004 1010 hurt performance." 1005 1011 */ 1006 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pBufferObj->hwid);1007 diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, pBufferObj->size, pBufferObj->data, pBufferObj->usage);1012 pState->pStateTracker->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pBufferObj->hwid); 1013 pState->pStateTracker->diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, pBufferObj->size, pBufferObj->data, pBufferObj->usage); 1008 1014 1009 1015 if (!pState->retainBufferData) … … 1021 1027 CRContext *fromCtx, CRContext *toCtx) 1022 1028 { 1023 /*const CRBufferObjectState *from = &(fromCtx->bufferobject); - unused */1024 1029 CRBufferObjectState *to = &(toCtx->bufferobject); 1030 PCRStateTracker pState = fromCtx->pStateTracker; 1025 1031 int i; 1026 1032 1027 if (!HaveBufferObjectExtension()) 1033 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 1034 1035 if (!HaveBufferObjectExtension(pState)) 1028 1036 return; 1029 1037 … … 1040 1048 if (cp->buffer && (cp->buffer->id || locked)) 1041 1049 { 1042 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1043 diff_api.VertexPointer(cp->size, cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1050 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1051 pState->diff_api.VertexPointer(cp->size, cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1044 1052 } 1045 1053 … … 1047 1055 if (cp->buffer && (cp->buffer->id || locked)) 1048 1056 { 1049 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1050 diff_api.ColorPointer(cp->size, cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1057 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1058 pState->diff_api.ColorPointer(cp->size, cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1051 1059 } 1052 1060 … … 1054 1062 if (cp->buffer && (cp->buffer->id || locked)) 1055 1063 { 1056 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1057 diff_api.FogCoordPointerEXT(cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1064 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1065 pState->diff_api.FogCoordPointerEXT(cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1058 1066 } 1059 1067 … … 1061 1069 if (cp->buffer && (cp->buffer->id || locked)) 1062 1070 { 1063 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1064 diff_api.SecondaryColorPointerEXT(cp->size, cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1071 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1072 pState->diff_api.SecondaryColorPointerEXT(cp->size, cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1065 1073 } 1066 1074 … … 1068 1076 if (cp->buffer && (cp->buffer->id || locked)) 1069 1077 { 1070 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1071 diff_api.EdgeFlagPointer(cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1078 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1079 pState->diff_api.EdgeFlagPointer(cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1072 1080 } 1073 1081 … … 1075 1083 if (cp->buffer && (cp->buffer->id || locked)) 1076 1084 { 1077 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1078 diff_api.IndexPointer(cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1085 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1086 pState->diff_api.IndexPointer(cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1079 1087 } 1080 1088 … … 1082 1090 if (cp->buffer && (cp->buffer->id || locked)) 1083 1091 { 1084 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1085 diff_api.NormalPointer(cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1092 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1093 pState->diff_api.NormalPointer(cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1086 1094 } 1087 1095 … … 1091 1099 if (cp->buffer && (cp->buffer->id || locked)) 1092 1100 { 1093 if ( diff_api.ActiveTextureARB)1094 diff_api.ActiveTextureARB(i+GL_TEXTURE0_ARB);1095 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1096 diff_api.TexCoordPointer(cp->size, cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1097 } 1098 } 1099 1100 if ( diff_api.ActiveTextureARB)1101 diff_api.ActiveTextureARB(toCtx->client.curClientTextureUnit+GL_TEXTURE0_ARB);1101 if (pState->diff_api.ActiveTextureARB) 1102 pState->diff_api.ActiveTextureARB(i+GL_TEXTURE0_ARB); 1103 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1104 pState->diff_api.TexCoordPointer(cp->size, cp->type, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1105 } 1106 } 1107 1108 if (pState->diff_api.ActiveTextureARB) 1109 pState->diff_api.ActiveTextureARB(toCtx->client.curClientTextureUnit+GL_TEXTURE0_ARB); 1102 1110 1103 1111 #ifdef CR_NV_vertex_program … … 1107 1115 if (cp->buffer && (cp->buffer->id || locked)) 1108 1116 { 1109 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid);1110 diff_api.VertexAttribPointerARB(i, cp->size, cp->type, cp->normalized, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/));1111 } 1112 } 1113 #endif 1114 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, to->arrayBuffer->hwid);1115 diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, to->elementsBuffer->hwid);1117 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->hwid); 1118 pState->diff_api.VertexAttribPointerARB(i, cp->size, cp->type, cp->normalized, cp->stride, cp->p CRVBOX_HOST_ONLY_PARAM(-1 /*fRealPtr*/)); 1119 } 1120 } 1121 #endif 1122 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, to->arrayBuffer->hwid); 1123 pState->diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, to->elementsBuffer->hwid); 1116 1124 #ifdef CR_ARB_pixel_buffer_object 1117 diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, to->packBuffer->hwid);1118 diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, to->unpackBuffer->hwid);1125 pState->diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, to->packBuffer->hwid); 1126 pState->diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, to->unpackBuffer->hwid); 1119 1127 #endif 1120 1128 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_client.c
r78263 r78375 376 376 */ 377 377 378 void STATE_APIENTRY crStatePixelStoref ( GLenum pname, GLfloat param)378 void STATE_APIENTRY crStatePixelStoref (PCRStateTracker pState, GLenum pname, GLfloat param) 379 379 { 380 380 … … 386 386 case GL_UNPACK_SWAP_BYTES: 387 387 case GL_UNPACK_LSB_FIRST: 388 crStatePixelStorei( pname, param == 0.0f ? 0: 1 );388 crStatePixelStorei(pState, pname, param == 0.0f ? 0: 1 ); 389 389 break; 390 390 default: 391 crStatePixelStorei( pname, (GLint) param );392 break; 393 } 394 } 395 396 void STATE_APIENTRY crStatePixelStorei ( GLenum pname, GLint param)397 { 398 CRContext *g = GetCurrentContext( );391 crStatePixelStorei(pState, pname, (GLint) param ); 392 break; 393 } 394 } 395 396 void STATE_APIENTRY crStatePixelStorei (PCRStateTracker pState, GLenum pname, GLint param) 397 { 398 CRContext *g = GetCurrentContext(pState); 399 399 CRClientState *c = &(g->client); 400 CRStateBits *sb = GetCurrentBits( );400 CRStateBits *sb = GetCurrentBits(pState); 401 401 CRClientBits *cb = &(sb->client); 402 402 403 403 if (g->current.inBeginEnd) 404 404 { 405 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "PixelStore{if} called in Begin/End");405 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "PixelStore{if} called in Begin/End"); 406 406 return; 407 407 } … … 421 421 if (param < 0.0f) 422 422 { 423 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Row Length: %f", param);423 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Row Length: %f", param); 424 424 return; 425 425 } … … 431 431 if (param < 0.0f) 432 432 { 433 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Image Height: %f", param);433 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Image Height: %f", param); 434 434 return; 435 435 } … … 441 441 if (param < 0.0f) 442 442 { 443 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Skip Images: %f", param);443 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Skip Images: %f", param); 444 444 return; 445 445 } … … 450 450 if (param < 0.0f) 451 451 { 452 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Skip Pixels: %f", param);452 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Skip Pixels: %f", param); 453 453 return; 454 454 } … … 459 459 if (param < 0.0f) 460 460 { 461 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Row Skip: %f", param);461 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Row Skip: %f", param); 462 462 return; 463 463 } … … 471 471 ((GLint) param) != 8) 472 472 { 473 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid Alignment: %f", param);473 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid Alignment: %f", param); 474 474 return; 475 475 } … … 489 489 if (param < 0.0f) 490 490 { 491 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Row Length: %f", param);491 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Row Length: %f", param); 492 492 return; 493 493 } … … 499 499 if (param < 0.0f) 500 500 { 501 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Image Height: %f", param);501 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Image Height: %f", param); 502 502 return; 503 503 } … … 509 509 if (param < 0.0f) 510 510 { 511 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Skip Images: %f", param);511 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Skip Images: %f", param); 512 512 return; 513 513 } … … 518 518 if (param < 0.0f) 519 519 { 520 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Skip Pixels: %f", param);520 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Skip Pixels: %f", param); 521 521 return; 522 522 } … … 527 527 if (param < 0.0f) 528 528 { 529 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Row Skip: %f", param);529 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative Row Skip: %f", param); 530 530 return; 531 531 } … … 539 539 ((GLint) param) != 8) 540 540 { 541 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid Alignment: %f", param);541 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid Alignment: %f", param); 542 542 return; 543 543 } … … 546 546 break; 547 547 default: 548 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Unknown glPixelStore Pname: %d", pname);548 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Unknown glPixelStore Pname: %d", pname); 549 549 return; 550 550 } … … 553 553 554 554 555 static void setClientState(CRC lientState *c, CRClientBits *cb,556 CRbitvalue *neg_bitid, GLenum array, GLboolean state)557 { 558 CRContext *g = GetCurrentContext();555 static void setClientState(CRContext *g, CRClientState *c, CRClientBits *cb, 556 CRbitvalue *neg_bitid, GLenum array, GLboolean state) 557 { 558 PCRStateTracker pState = g->pStateTracker; 559 559 560 560 switch (array) … … 612 612 } 613 613 else { 614 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid Enum passed to Enable/Disable Client State: SECONDARY_COLOR_ARRAY_EXT - EXT_secondary_color is not enabled." );614 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid Enum passed to Enable/Disable Client State: SECONDARY_COLOR_ARRAY_EXT - EXT_secondary_color is not enabled." ); 615 615 return; 616 616 } … … 618 618 #endif 619 619 default: 620 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid Enum passed to Enable/Disable Client State: 0x%x", array );620 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid Enum passed to Enable/Disable Client State: 0x%x", array ); 621 621 return; 622 622 } … … 625 625 } 626 626 627 void STATE_APIENTRY crStateEnableClientState ( GLenum array)628 { 629 CRContext *g = GetCurrentContext( );627 void STATE_APIENTRY crStateEnableClientState (PCRStateTracker pState, GLenum array) 628 { 629 CRContext *g = GetCurrentContext(pState); 630 630 CRClientState *c = &(g->client); 631 CRStateBits *sb = GetCurrentBits( );631 CRStateBits *sb = GetCurrentBits(pState); 632 632 CRClientBits *cb = &(sb->client); 633 633 634 634 FLUSH(); 635 635 636 setClientState( c, cb, g->neg_bitid, array, GL_TRUE);637 } 638 639 void STATE_APIENTRY crStateDisableClientState ( GLenum array)640 { 641 CRContext *g = GetCurrentContext( );636 setClientState(g, c, cb, g->neg_bitid, array, GL_TRUE); 637 } 638 639 void STATE_APIENTRY crStateDisableClientState (PCRStateTracker pState, GLenum array) 640 { 641 CRContext *g = GetCurrentContext(pState); 642 642 CRClientState *c = &(g->client); 643 CRStateBits *sb = GetCurrentBits( );643 CRStateBits *sb = GetCurrentBits(pState); 644 644 CRClientBits *cb = &(sb->client); 645 645 646 646 FLUSH(); 647 647 648 setClientState( c, cb, g->neg_bitid, array, GL_FALSE);648 setClientState(g, c, cb, g->neg_bitid, array, GL_FALSE); 649 649 } 650 650 651 651 static void 652 crStateClientSetPointer(CRC lientPointer *cp, GLint size, GLenum type, GLboolean normalized, GLsizei stride,652 crStateClientSetPointer(CRContext *g, CRClientPointer *cp, GLint size, GLenum type, GLboolean normalized, GLsizei stride, 653 653 const GLvoid *pointer CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 654 654 { 655 CRContext *g = GetCurrentContext();655 PCRStateTracker pState = g->pStateTracker; 656 656 657 657 #ifdef CR_EXT_compiled_vertex_array … … 701 701 break; 702 702 default: 703 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,703 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 704 704 "Unknown type of vertex array: %d", type ); 705 705 return; … … 729 729 } 730 730 731 void STATE_APIENTRY crStateVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))732 { 733 CRContext *g = GetCurrentContext( );731 void STATE_APIENTRY crStateVertexPointer(PCRStateTracker pState, GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 732 { 733 CRContext *g = GetCurrentContext(pState); 734 734 CRClientState *c = &(g->client); 735 CRStateBits *sb = GetCurrentBits( );735 CRStateBits *sb = GetCurrentBits(pState); 736 736 CRClientBits *cb = &(sb->client); 737 737 … … 740 740 if (size != 2 && size != 3 && size != 4) 741 741 { 742 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexPointer: invalid size: %d", size);742 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexPointer: invalid size: %d", size); 743 743 return; 744 744 } … … 746 746 type != GL_FLOAT && type != GL_DOUBLE) 747 747 { 748 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glVertexPointer: invalid type: 0x%x", type);748 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glVertexPointer: invalid type: 0x%x", type); 749 749 return; 750 750 } 751 751 if (stride < 0) 752 752 { 753 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexPointer: stride was negative: %d", stride);754 return; 755 } 756 757 crStateClientSetPointer( &(c->array.v), size, type, GL_FALSE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));753 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexPointer: stride was negative: %d", stride); 754 return; 755 } 756 757 crStateClientSetPointer(g, &(c->array.v), size, type, GL_FALSE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 758 758 DIRTY(cb->dirty, g->neg_bitid); 759 759 DIRTY(cb->clientPointer, g->neg_bitid); … … 761 761 } 762 762 763 void STATE_APIENTRY crStateColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))764 { 765 CRContext *g = GetCurrentContext( );763 void STATE_APIENTRY crStateColorPointer(PCRStateTracker pState, GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 764 { 765 CRContext *g = GetCurrentContext(pState); 766 766 CRClientState *c = &(g->client); 767 CRStateBits *sb = GetCurrentBits( );767 CRStateBits *sb = GetCurrentBits(pState); 768 768 CRClientBits *cb = &(sb->client); 769 769 … … 772 772 if (size != 3 && size != 4) 773 773 { 774 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glColorPointer: invalid size: %d", size);774 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glColorPointer: invalid size: %d", size); 775 775 return; 776 776 } … … 780 780 type != GL_FLOAT && type != GL_DOUBLE) 781 781 { 782 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glColorPointer: invalid type: 0x%x", type);782 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glColorPointer: invalid type: 0x%x", type); 783 783 return; 784 784 } 785 785 if (stride < 0) 786 786 { 787 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glColorPointer: stride was negative: %d", stride);788 return; 789 } 790 791 crStateClientSetPointer( &(c->array.c), size, type, GL_TRUE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));787 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glColorPointer: stride was negative: %d", stride); 788 return; 789 } 790 791 crStateClientSetPointer(g, &(c->array.c), size, type, GL_TRUE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 792 792 DIRTY(cb->dirty, g->neg_bitid); 793 793 DIRTY(cb->clientPointer, g->neg_bitid); … … 795 795 } 796 796 797 void STATE_APIENTRY crStateSecondaryColorPointerEXT( GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))798 { 799 CRContext *g = GetCurrentContext( );797 void STATE_APIENTRY crStateSecondaryColorPointerEXT(PCRStateTracker pState, GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 798 { 799 CRContext *g = GetCurrentContext(pState); 800 800 CRClientState *c = &(g->client); 801 CRStateBits *sb = GetCurrentBits( );801 CRStateBits *sb = GetCurrentBits(pState); 802 802 CRClientBits *cb = &(sb->client); 803 803 … … 821 821 if ((size != 3) && (size != 4)) 822 822 { 823 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glSecondaryColorPointerEXT: invalid size: %d", size);823 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glSecondaryColorPointerEXT: invalid size: %d", size); 824 824 return; 825 825 } … … 829 829 type != GL_FLOAT && type != GL_DOUBLE) 830 830 { 831 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glSecondaryColorPointerEXT: invalid type: 0x%x", type);831 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glSecondaryColorPointerEXT: invalid type: 0x%x", type); 832 832 return; 833 833 } 834 834 if (stride < 0) 835 835 { 836 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glSecondaryColorPointerEXT: stride was negative: %d", stride);837 return; 838 } 839 840 crStateClientSetPointer( &(c->array.s), size, type, GL_TRUE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));836 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glSecondaryColorPointerEXT: stride was negative: %d", stride); 837 return; 838 } 839 840 crStateClientSetPointer(g, &(c->array.s), size, type, GL_TRUE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 841 841 DIRTY(cb->dirty, g->neg_bitid); 842 842 DIRTY(cb->clientPointer, g->neg_bitid); … … 844 844 } 845 845 846 void STATE_APIENTRY crStateIndexPointer( GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))847 { 848 CRContext *g = GetCurrentContext( );846 void STATE_APIENTRY crStateIndexPointer(PCRStateTracker pState, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 847 { 848 CRContext *g = GetCurrentContext(pState); 849 849 CRClientState *c = &(g->client); 850 CRStateBits *sb = GetCurrentBits( );850 CRStateBits *sb = GetCurrentBits(pState); 851 851 CRClientBits *cb = &(sb->client); 852 852 … … 856 856 type != GL_FLOAT && type != GL_DOUBLE) 857 857 { 858 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glIndexPointer: invalid type: 0x%x", type);858 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glIndexPointer: invalid type: 0x%x", type); 859 859 return; 860 860 } 861 861 if (stride < 0) 862 862 { 863 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glIndexPointer: stride was negative: %d", stride);864 return; 865 } 866 867 crStateClientSetPointer( &(c->array.i), 1, type, GL_TRUE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));863 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glIndexPointer: stride was negative: %d", stride); 864 return; 865 } 866 867 crStateClientSetPointer(g, &(c->array.i), 1, type, GL_TRUE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 868 868 DIRTY(cb->dirty, g->neg_bitid); 869 869 DIRTY(cb->clientPointer, g->neg_bitid); … … 871 871 } 872 872 873 void STATE_APIENTRY crStateNormalPointer( GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))874 { 875 CRContext *g = GetCurrentContext( );873 void STATE_APIENTRY crStateNormalPointer(PCRStateTracker pState, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 874 { 875 CRContext *g = GetCurrentContext(pState); 876 876 CRClientState *c = &(g->client); 877 CRStateBits *sb = GetCurrentBits( );877 CRStateBits *sb = GetCurrentBits(pState); 878 878 CRClientBits *cb = &(sb->client); 879 879 … … 884 884 type != GL_DOUBLE) 885 885 { 886 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glNormalPointer: invalid type: 0x%x", type);886 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glNormalPointer: invalid type: 0x%x", type); 887 887 return; 888 888 } 889 889 if (stride < 0) 890 890 { 891 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glNormalPointer: stride was negative: %d", stride);892 return; 893 } 894 895 crStateClientSetPointer( &(c->array.n), 3, type, GL_TRUE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));891 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glNormalPointer: stride was negative: %d", stride); 892 return; 893 } 894 895 crStateClientSetPointer(g, &(c->array.n), 3, type, GL_TRUE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 896 896 DIRTY(cb->dirty, g->neg_bitid); 897 897 DIRTY(cb->clientPointer, g->neg_bitid); … … 899 899 } 900 900 901 void STATE_APIENTRY crStateTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))902 { 903 CRContext *g = GetCurrentContext( );901 void STATE_APIENTRY crStateTexCoordPointer(PCRStateTracker pState, GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 902 { 903 CRContext *g = GetCurrentContext(pState); 904 904 CRClientState *c = &(g->client); 905 CRStateBits *sb = GetCurrentBits( );905 CRStateBits *sb = GetCurrentBits(pState); 906 906 CRClientBits *cb = &(sb->client); 907 907 … … 910 910 if (size != 1 && size != 2 && size != 3 && size != 4) 911 911 { 912 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glTexCoordPointer: invalid size: %d", size);912 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glTexCoordPointer: invalid size: %d", size); 913 913 return; 914 914 } … … 916 916 type != GL_FLOAT && type != GL_DOUBLE) 917 917 { 918 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexCoordPointer: invalid type: 0x%x", type);918 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexCoordPointer: invalid type: 0x%x", type); 919 919 return; 920 920 } 921 921 if (stride < 0) 922 922 { 923 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glTexCoordPointer: stride was negative: %d", stride);924 return; 925 } 926 927 crStateClientSetPointer( &(c->array.t[c->curClientTextureUnit]), size, type, GL_FALSE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));923 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glTexCoordPointer: stride was negative: %d", stride); 924 return; 925 } 926 927 crStateClientSetPointer(g, &(c->array.t[c->curClientTextureUnit]), size, type, GL_FALSE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 928 928 DIRTY(cb->dirty, g->neg_bitid); 929 929 DIRTY(cb->clientPointer, g->neg_bitid); … … 931 931 } 932 932 933 void STATE_APIENTRY crStateEdgeFlagPointer( GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))934 { 935 CRContext *g = GetCurrentContext( );933 void STATE_APIENTRY crStateEdgeFlagPointer(PCRStateTracker pState, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 934 { 935 CRContext *g = GetCurrentContext(pState); 936 936 CRClientState *c = &(g->client); 937 CRStateBits *sb = GetCurrentBits( );937 CRStateBits *sb = GetCurrentBits(pState); 938 938 CRClientBits *cb = &(sb->client); 939 939 … … 942 942 if (stride < 0) 943 943 { 944 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glTexCoordPointer: stride was negative: %d", stride);945 return; 946 } 947 948 crStateClientSetPointer( &(c->array.e), 1, GL_UNSIGNED_BYTE, GL_FALSE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));944 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glTexCoordPointer: stride was negative: %d", stride); 945 return; 946 } 947 948 crStateClientSetPointer(g, &(c->array.e), 1, GL_UNSIGNED_BYTE, GL_FALSE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 949 949 DIRTY(cb->dirty, g->neg_bitid); 950 950 DIRTY(cb->clientPointer, g->neg_bitid); … … 952 952 } 953 953 954 void STATE_APIENTRY crStateFogCoordPointerEXT( GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))955 { 956 CRContext *g = GetCurrentContext( );954 void STATE_APIENTRY crStateFogCoordPointerEXT(PCRStateTracker pState, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 955 { 956 CRContext *g = GetCurrentContext(pState); 957 957 CRClientState *c = &(g->client); 958 CRStateBits *sb = GetCurrentBits( );958 CRStateBits *sb = GetCurrentBits(pState); 959 959 CRClientBits *cb = &(sb->client); 960 960 … … 966 966 type != GL_FLOAT && type != GL_DOUBLE) 967 967 { 968 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glFogCoordPointerEXT: invalid type: 0x%x", type);968 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glFogCoordPointerEXT: invalid type: 0x%x", type); 969 969 return; 970 970 } 971 971 if (stride < 0) 972 972 { 973 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glFogCoordPointerEXT: stride was negative: %d", stride);974 return; 975 } 976 977 crStateClientSetPointer( &(c->array.f), 1, type, GL_FALSE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));973 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glFogCoordPointerEXT: stride was negative: %d", stride); 974 return; 975 } 976 977 crStateClientSetPointer(g, &(c->array.f), 1, type, GL_FALSE, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 978 978 DIRTY(cb->dirty, g->neg_bitid); 979 979 DIRTY(cb->clientPointer, g->neg_bitid); … … 982 982 983 983 984 void STATE_APIENTRY crStateVertexAttribPointerNV( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))984 void STATE_APIENTRY crStateVertexAttribPointerNV(PCRStateTracker pState, GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 985 985 { 986 986 GLboolean normalized = GL_FALSE; … … 988 988 if (type != GL_UNSIGNED_BYTE && type != GL_SHORT && 989 989 type != GL_FLOAT && type != GL_DOUBLE) { 990 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,990 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 991 991 "glVertexAttribPointerNV: invalid type: 0x%x", type); 992 992 return; 993 993 } 994 crStateVertexAttribPointerARB( index, size, type, normalized, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));995 } 996 997 998 void STATE_APIENTRY crStateVertexAttribPointerARB( GLuint index, GLint size, GLenum type, GLboolean normalized,994 crStateVertexAttribPointerARB(pState, index, size, type, normalized, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 995 } 996 997 998 void STATE_APIENTRY crStateVertexAttribPointerARB(PCRStateTracker pState, GLuint index, GLint size, GLenum type, GLboolean normalized, 999 999 GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 1000 1000 { 1001 CRContext *g = GetCurrentContext( );1001 CRContext *g = GetCurrentContext(pState); 1002 1002 CRClientState *c = &(g->client); 1003 CRStateBits *sb = GetCurrentBits( );1003 CRStateBits *sb = GetCurrentBits(pState); 1004 1004 CRClientBits *cb = &(sb->client); 1005 1005 … … 1008 1008 if (index >= CR_MAX_VERTEX_ATTRIBS) 1009 1009 { 1010 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexAttribPointerARB: invalid index: %d", (int) index);1010 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexAttribPointerARB: invalid index: %d", (int) index); 1011 1011 return; 1012 1012 } 1013 1013 if (size != 1 && size != 2 && size != 3 && size != 4) 1014 1014 { 1015 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexAttribPointerARB: invalid size: %d", size);1015 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexAttribPointerARB: invalid size: %d", size); 1016 1016 return; 1017 1017 } … … 1021 1021 type != GL_FLOAT && type != GL_DOUBLE) 1022 1022 { 1023 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glVertexAttribPointerARB: invalid type: 0x%x", type);1023 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glVertexAttribPointerARB: invalid type: 0x%x", type); 1024 1024 return; 1025 1025 } 1026 1026 if (stride < 0) 1027 1027 { 1028 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexAttribPointerARB: stride was negative: %d", stride);1029 return; 1030 } 1031 1032 crStateClientSetPointer( &(c->array.a[index]), size, type, normalized, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr));1028 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glVertexAttribPointerARB: stride was negative: %d", stride); 1029 return; 1030 } 1031 1032 crStateClientSetPointer(g, &(c->array.a[index]), size, type, normalized, stride, p CRVBOX_HOST_ONLY_PARAM(fRealPtr)); 1033 1033 DIRTY(cb->dirty, g->neg_bitid); 1034 1034 DIRTY(cb->clientPointer, g->neg_bitid); … … 1037 1037 1038 1038 1039 void STATE_APIENTRY crStateGetVertexAttribPointervNV( GLuint index, GLenum pname, GLvoid **pointer)1040 { 1041 CRContext *g = GetCurrentContext( );1039 void STATE_APIENTRY crStateGetVertexAttribPointervNV(PCRStateTracker pState, GLuint index, GLenum pname, GLvoid **pointer) 1040 { 1041 CRContext *g = GetCurrentContext(pState); 1042 1042 1043 1043 if (g->current.inBeginEnd) { 1044 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1044 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1045 1045 "glGetVertexAttribPointervNV called in Begin/End"); 1046 1046 return; … … 1048 1048 1049 1049 if (index >= CR_MAX_VERTEX_ATTRIBS) { 1050 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1050 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1051 1051 "glGetVertexAttribPointervNV(index)"); 1052 1052 return; … … 1054 1054 1055 1055 if (pname != GL_ATTRIB_ARRAY_POINTER_NV) { 1056 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1056 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1057 1057 "glGetVertexAttribPointervNV(pname)"); 1058 1058 return; … … 1063 1063 1064 1064 1065 void STATE_APIENTRY crStateGetVertexAttribPointervARB( GLuint index, GLenum pname, GLvoid **pointer)1066 { 1067 crStateGetVertexAttribPointervNV( index, pname, pointer);1065 void STATE_APIENTRY crStateGetVertexAttribPointervARB(PCRStateTracker pState, GLuint index, GLenum pname, GLvoid **pointer) 1066 { 1067 crStateGetVertexAttribPointervNV(pState, index, pname, pointer); 1068 1068 } 1069 1069 … … 1076 1076 ** lets me use the same glDrawArrays method. 1077 1077 */ 1078 void STATE_APIENTRY crStateInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr))1079 { 1080 CRContext *g = GetCurrentContext( );1078 void STATE_APIENTRY crStateInterleavedArrays(PCRStateTracker pState, GLenum format, GLsizei stride, const GLvoid *p CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 1079 { 1080 CRContext *g = GetCurrentContext(pState); 1081 1081 CRClientState *c = &(g->client); 1082 CRStateBits *sb = GetCurrentBits( );1082 CRStateBits *sb = GetCurrentBits(pState); 1083 1083 CRClientBits *cb = &(sb->client); 1084 1084 CRClientPointer *cp; … … 1091 1091 if (g->current.inBeginEnd) 1092 1092 { 1093 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glInterleavedArrays called in begin/end");1093 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glInterleavedArrays called in begin/end"); 1094 1094 return; 1095 1095 } … … 1099 1099 if (stride < 0) 1100 1100 { 1101 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glInterleavedArrays: stride < 0: %d", stride);1101 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glInterleavedArrays: stride < 0: %d", stride); 1102 1102 return; 1103 1103 } … … 1121 1121 break; 1122 1122 default: 1123 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format);1123 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format); 1124 1124 return; 1125 1125 } … … 1200 1200 break; 1201 1201 default: 1202 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format);1202 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format); 1203 1203 return; 1204 1204 } … … 1250 1250 break; 1251 1251 default: 1252 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format);1252 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format); 1253 1253 return; 1254 1254 } … … 1331 1331 break; 1332 1332 default: 1333 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format);1333 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format); 1334 1334 return; 1335 1335 } … … 1383 1383 break; 1384 1384 default: 1385 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format);1385 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glInterleavedArrays: Unrecognized format: %d", format); 1386 1386 return; 1387 1387 } … … 1394 1394 } 1395 1395 1396 void STATE_APIENTRY crStateGetPointerv( GLenum pname, GLvoid * * params)1397 { 1398 CRContext *g = GetCurrentContext( );1396 void STATE_APIENTRY crStateGetPointerv(PCRStateTracker pState, GLenum pname, GLvoid * * params) 1397 { 1398 CRContext *g = GetCurrentContext(pState); 1399 1399 CRClientState *c = &(g->client); 1400 1400 1401 1401 if (g->current.inBeginEnd) 1402 1402 { 1403 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1403 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1404 1404 "GetPointerv called in begin/end"); 1405 1405 return; … … 1437 1437 } 1438 1438 else { 1439 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid Enum passed to glGetPointerv: SECONDARY_COLOR_ARRAY_EXT - EXT_secondary_color is not enabled." );1439 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid Enum passed to glGetPointerv: SECONDARY_COLOR_ARRAY_EXT - EXT_secondary_color is not enabled." ); 1440 1440 return; 1441 1441 } … … 1447 1447 break; 1448 1448 default: 1449 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1449 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1450 1450 "glGetPointerv: invalid pname: %d", pname); 1451 1451 return; … … 1454 1454 1455 1455 1456 void STATE_APIENTRY crStatePushClientAttrib( GLbitfield mask )1457 { 1458 CRContext *g = GetCurrentContext( );1456 void STATE_APIENTRY crStatePushClientAttrib(PCRStateTracker pState, GLbitfield mask ) 1457 { 1458 CRContext *g = GetCurrentContext(pState); 1459 1459 CRClientState *c = &(g->client); 1460 1460 1461 1461 if (g->current.inBeginEnd) { 1462 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1462 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1463 1463 "glPushClientAttrib called in Begin/End"); 1464 1464 return; … … 1466 1466 1467 1467 if (c->attribStackDepth == CR_MAX_CLIENT_ATTRIB_STACK_DEPTH - 1) { 1468 crStateError( __LINE__, __FILE__, GL_STACK_OVERFLOW,1468 crStateError(pState, __LINE__, __FILE__, GL_STACK_OVERFLOW, 1469 1469 "glPushClientAttrib called with a full stack!" ); 1470 1470 return; … … 1489 1489 1490 1490 1491 void STATE_APIENTRY crStatePopClientAttrib( void)1492 { 1493 CRContext *g = GetCurrentContext( );1491 void STATE_APIENTRY crStatePopClientAttrib(PCRStateTracker pState) 1492 { 1493 CRContext *g = GetCurrentContext(pState); 1494 1494 CRClientState *c = &(g->client); 1495 CRStateBits *sb = GetCurrentBits( );1495 CRStateBits *sb = GetCurrentBits(pState); 1496 1496 CRClientBits *cb = &(sb->client); 1497 1497 CRbitvalue mask; 1498 1498 1499 1499 if (g->current.inBeginEnd) { 1500 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1500 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1501 1501 "glPopClientAttrib called in Begin/End"); 1502 1502 return; … … 1504 1504 1505 1505 if (c->attribStackDepth == 0) { 1506 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW,1506 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, 1507 1507 "glPopClientAttrib called with an empty stack!" ); 1508 1508 return; … … 1551 1551 } 1552 1552 1553 void STATE_APIENTRY crStateLockArraysEXT( GLint first, GLint count)1554 { 1555 CRContext *g = GetCurrentContext( );1553 void STATE_APIENTRY crStateLockArraysEXT(PCRStateTracker pState, GLint first, GLint count) 1554 { 1555 CRContext *g = GetCurrentContext(pState); 1556 1556 CRClientState *c = &(g->client); 1557 1557 int i; … … 1583 1583 } 1584 1584 1585 void STATE_APIENTRY crStateUnlockArraysEXT( void)1586 { 1587 CRContext *g = GetCurrentContext( );1585 void STATE_APIENTRY crStateUnlockArraysEXT(PCRStateTracker pState) 1586 { 1587 CRContext *g = GetCurrentContext(pState); 1588 1588 CRClientState *c = &(g->client); 1589 1589 int i; … … 1606 1606 } 1607 1607 1608 void STATE_APIENTRY crStateVertexArrayRangeNV( GLsizei length, const GLvoid *pointer CRVBOX_HOST_ONLY_PARAM(int fRealPtr))1608 void STATE_APIENTRY crStateVertexArrayRangeNV(PCRStateTracker pState, GLsizei length, const GLvoid *pointer CRVBOX_HOST_ONLY_PARAM(int fRealPtr)) 1609 1609 { 1610 1610 /* XXX todo */ 1611 1611 crWarning("crStateVertexArrayRangeNV not implemented"); 1612 (void)length; (void)pointer CRVBOX_HOST_ONLY_PARAM((void)fRealPtr);1613 } 1614 1615 1616 void STATE_APIENTRY crStateFlushVertexArrayRangeNV( void)1612 RT_NOREF(pState); (void)length; (void)pointer CRVBOX_HOST_ONLY_PARAM((void)fRealPtr); 1613 } 1614 1615 1616 void STATE_APIENTRY crStateFlushVertexArrayRangeNV(PCRStateTracker pState) 1617 1617 { 1618 1618 /* XXX todo */ 1619 1619 crWarning("crStateFlushVertexArrayRangeNV not implemented"); 1620 RT_NOREF(pState); 1620 1621 } 1621 1622 … … 1650 1651 * (via GL_ARB_vertex_buffer_object). 1651 1652 */ 1652 GLboolean crStateUseServerArrays( void)1653 GLboolean crStateUseServerArrays(PCRStateTracker pState) 1653 1654 { 1654 1655 #if defined(CR_ARB_vertex_buffer_object) && !defined(CR_NO_SERVER_ARRAYS) 1655 CRContext *g = GetCurrentContext( );1656 CRContext *g = GetCurrentContext(pState); 1656 1657 CRClientState *c = &(g->client); 1657 1658 int i; … … 1761 1762 */ 1762 1763 GLboolean 1763 crStateUseServerArrayElements( void)1764 crStateUseServerArrayElements(PCRStateTracker pState) 1764 1765 { 1765 1766 #ifdef CR_ARB_vertex_buffer_object 1766 CRContext *g = GetCurrentContext( );1767 CRContext *g = GetCurrentContext(pState); 1767 1768 if (g->bufferobject.elementsBuffer && 1768 1769 g->bufferobject.elementsBuffer->id > 0) … … 1781 1782 CRContext *fromCtx, CRContext *toCtx) 1782 1783 { 1784 PCRStateTracker pState = fromCtx->pStateTracker; 1783 1785 CRClientState *from = &(fromCtx->client); 1784 1786 const CRClientState *to = &(toCtx->client); … … 1788 1790 const GLint idHwInitialBuffer = idHwArrayBuffer; 1789 1791 1792 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 1793 1790 1794 #ifdef DEBUG_misha 1791 1795 { 1792 1796 GLint tstHwBuffer = -1; 1793 diff_api.GetIntegerv(GL_ARRAY_BUFFER_BINDING, &tstHwBuffer);1797 pState->diff_api.GetIntegerv(GL_ARRAY_BUFFER_BINDING, &tstHwBuffer); 1794 1798 CRASSERT(idHwInitialBuffer == tstHwBuffer); 1795 1799 } … … 1808 1812 if (idHwArrayBufferUsed != idHwArrayBuffer) 1809 1813 { 1810 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1814 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1811 1815 idHwArrayBuffer = idHwArrayBufferUsed; 1812 1816 } 1813 diff_api.VertexPointer(to->array.v.size, to->array.v.type, to->array.v.stride, to->array.v.p CRVBOX_HOST_ONLY_PARAM(to->array.v.fRealPtr));1817 pState->diff_api.VertexPointer(to->array.v.size, to->array.v.type, to->array.v.stride, to->array.v.p CRVBOX_HOST_ONLY_PARAM(to->array.v.fRealPtr)); 1814 1818 from->array.v.size = to->array.v.size; 1815 1819 from->array.v.type = to->array.v.type; … … 1829 1833 if (idHwArrayBufferUsed != idHwArrayBuffer) 1830 1834 { 1831 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1835 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1832 1836 idHwArrayBuffer = idHwArrayBufferUsed; 1833 1837 } 1834 diff_api.NormalPointer(to->array.n.type, to->array.n.stride, to->array.n.p CRVBOX_HOST_ONLY_PARAM(to->array.n.fRealPtr));1838 pState->diff_api.NormalPointer(to->array.n.type, to->array.n.stride, to->array.n.p CRVBOX_HOST_ONLY_PARAM(to->array.n.fRealPtr)); 1835 1839 from->array.n.type = to->array.n.type; 1836 1840 from->array.n.stride = to->array.n.stride; … … 1850 1854 if (idHwArrayBufferUsed != idHwArrayBuffer) 1851 1855 { 1852 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1856 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1853 1857 idHwArrayBuffer = idHwArrayBufferUsed; 1854 1858 } 1855 diff_api.ColorPointer(to->array.c.size, to->array.c.type, to->array.c.stride, to->array.c.p CRVBOX_HOST_ONLY_PARAM(to->array.c.fRealPtr));1859 pState->diff_api.ColorPointer(to->array.c.size, to->array.c.type, to->array.c.stride, to->array.c.p CRVBOX_HOST_ONLY_PARAM(to->array.c.fRealPtr)); 1856 1860 from->array.c.size = to->array.c.size; 1857 1861 from->array.c.type = to->array.c.type; … … 1871 1875 if (idHwArrayBufferUsed != idHwArrayBuffer) 1872 1876 { 1873 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1877 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1874 1878 idHwArrayBuffer = idHwArrayBufferUsed; 1875 1879 } 1876 diff_api.IndexPointer(to->array.i.type, to->array.i.stride, to->array.i.p CRVBOX_HOST_ONLY_PARAM(to->array.i.fRealPtr));1880 pState->diff_api.IndexPointer(to->array.i.type, to->array.i.stride, to->array.i.p CRVBOX_HOST_ONLY_PARAM(to->array.i.fRealPtr)); 1877 1881 from->array.i.type = to->array.i.type; 1878 1882 from->array.i.stride = to->array.i.stride; … … 1893 1897 if (idHwArrayBufferUsed != idHwArrayBuffer) 1894 1898 { 1895 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1899 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1896 1900 idHwArrayBuffer = idHwArrayBufferUsed; 1897 1901 } 1898 diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i);1902 pState->diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i); 1899 1903 curClientTextureUnit = i; 1900 diff_api.TexCoordPointer(to->array.t[i].size, to->array.t[i].type, to->array.t[i].stride, to->array.t[i].p CRVBOX_HOST_ONLY_PARAM(to->array.t[i].fRealPtr));1904 pState->diff_api.TexCoordPointer(to->array.t[i].size, to->array.t[i].type, to->array.t[i].stride, to->array.t[i].p CRVBOX_HOST_ONLY_PARAM(to->array.t[i].fRealPtr)); 1901 1905 from->array.t[i].size = to->array.t[i].size; 1902 1906 from->array.t[i].type = to->array.t[i].type; … … 1916 1920 if (idHwArrayBufferUsed != idHwArrayBuffer) 1917 1921 { 1918 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1922 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1919 1923 idHwArrayBuffer = idHwArrayBufferUsed; 1920 1924 } 1921 diff_api.EdgeFlagPointer(to->array.e.stride, to->array.e.p CRVBOX_HOST_ONLY_PARAM(to->array.e.fRealPtr));1925 pState->diff_api.EdgeFlagPointer(to->array.e.stride, to->array.e.p CRVBOX_HOST_ONLY_PARAM(to->array.e.fRealPtr)); 1922 1926 from->array.e.stride = to->array.e.stride; 1923 1927 from->array.e.p = to->array.e.p; … … 1936 1940 if (idHwArrayBufferUsed != idHwArrayBuffer) 1937 1941 { 1938 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1942 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1939 1943 idHwArrayBuffer = idHwArrayBufferUsed; 1940 1944 } 1941 diff_api.SecondaryColorPointerEXT(to->array.s.size, to->array.s.type, to->array.s.stride, to->array.s.p CRVBOX_HOST_ONLY_PARAM(to->array.s.fRealPtr));1945 pState->diff_api.SecondaryColorPointerEXT(to->array.s.size, to->array.s.type, to->array.s.stride, to->array.s.p CRVBOX_HOST_ONLY_PARAM(to->array.s.fRealPtr)); 1942 1946 from->array.s.size = to->array.s.size; 1943 1947 from->array.s.type = to->array.s.type; … … 1957 1961 if (idHwArrayBufferUsed != idHwArrayBuffer) 1958 1962 { 1959 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1963 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1960 1964 idHwArrayBuffer = idHwArrayBufferUsed; 1961 1965 } 1962 diff_api.FogCoordPointerEXT(to->array.f.type, to->array.f.stride, to->array.f.p CRVBOX_HOST_ONLY_PARAM(to->array.f.fRealPtr));1966 pState->diff_api.FogCoordPointerEXT(to->array.f.type, to->array.f.stride, to->array.f.p CRVBOX_HOST_ONLY_PARAM(to->array.f.fRealPtr)); 1963 1967 from->array.f.type = to->array.f.type; 1964 1968 from->array.f.stride = to->array.f.stride; … … 1981 1985 if (idHwArrayBufferUsed != idHwArrayBuffer) 1982 1986 { 1983 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);1987 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 1984 1988 idHwArrayBuffer = idHwArrayBufferUsed; 1985 1989 } 1986 diff_api.VertexAttribPointerARB(i, to->array.a[i].size, to->array.a[i].type, to->array.a[i].normalized,1987 to->array.a[i].stride, to->array.a[i].p CRVBOX_HOST_ONLY_PARAM(to->array.a[i].fRealPtr));1990 pState->diff_api.VertexAttribPointerARB(i, to->array.a[i].size, to->array.a[i].type, to->array.a[i].normalized, 1991 to->array.a[i].stride, to->array.a[i].p CRVBOX_HOST_ONLY_PARAM(to->array.a[i].fRealPtr)); 1988 1992 from->array.a[i].size = to->array.a[i].size; 1989 1993 from->array.a[i].type = to->array.a[i].type; … … 2001 2005 if (idHwArrayBuffer != idHwInitialBuffer) 2002 2006 { 2003 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwInitialBuffer);2007 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwInitialBuffer); 2004 2008 } 2005 2009 … … 2007 2011 /* update vertex array enable/disable flags */ 2008 2012 glAble able[2]; 2009 able[0] = diff_api.DisableClientState;2010 able[1] = diff_api.EnableClientState;2013 able[0] = pState->diff_api.DisableClientState; 2014 able[1] = pState->diff_api.EnableClientState; 2011 2015 if (from->array.v.enabled != to->array.v.enabled) { 2012 2016 able[to->array.v.enabled](GL_VERTEX_ARRAY); … … 2027 2031 for (i = 0; (unsigned int)i < toCtx->limits.maxTextureUnits; i++) { 2028 2032 if (from->array.t[i].enabled != to->array.t[i].enabled) { 2029 diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i);2033 pState->diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i); 2030 2034 curClientTextureUnit = i; 2031 2035 able[to->array.t[i].enabled](GL_TEXTURE_COORD_ARRAY); … … 2048 2052 if (from->array.a[i].enabled != to->array.a[i].enabled) { 2049 2053 if (to->array.a[i].enabled) 2050 diff_api.EnableVertexAttribArrayARB(i);2054 pState->diff_api.EnableVertexAttribArrayARB(i); 2051 2055 else 2052 diff_api.DisableVertexAttribArrayARB(i);2056 pState->diff_api.DisableVertexAttribArrayARB(i); 2053 2057 from->array.a[i].enabled = to->array.a[i].enabled; 2054 2058 } … … 2059 2063 if (to->curClientTextureUnit != curClientTextureUnit) 2060 2064 { 2061 diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + to->curClientTextureUnit);2065 pState->diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + to->curClientTextureUnit); 2062 2066 } 2063 2067 } … … 2068 2072 CRContext *fromCtx, CRContext *toCtx) 2069 2073 { 2074 PCRStateTracker pState = fromCtx->pStateTracker; 2070 2075 const CRClientState *from = &(fromCtx->client); 2071 2076 const CRClientState *to = &(toCtx->client); … … 2075 2080 const GLint idHwInitialBuffer = idHwArrayBuffer; 2076 2081 2082 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 2083 2077 2084 #ifdef DEBUG_misha 2078 2085 { 2079 2086 GLint tstHwBuffer = -1; 2080 diff_api.GetIntegerv(GL_ARRAY_BUFFER_BINDING, &tstHwBuffer);2087 pState->diff_api.GetIntegerv(GL_ARRAY_BUFFER_BINDING, &tstHwBuffer); 2081 2088 CRASSERT(idHwInitialBuffer == tstHwBuffer); 2082 2089 } … … 2094 2101 if (idHwArrayBufferUsed != idHwArrayBuffer) 2095 2102 { 2096 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2103 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2097 2104 idHwArrayBuffer = idHwArrayBufferUsed; 2098 2105 } 2099 diff_api.VertexPointer(to->array.v.size, to->array.v.type, to->array.v.stride, to->array.v.p CRVBOX_HOST_ONLY_PARAM(to->array.v.fRealPtr));2106 pState->diff_api.VertexPointer(to->array.v.size, to->array.v.type, to->array.v.stride, to->array.v.p CRVBOX_HOST_ONLY_PARAM(to->array.v.fRealPtr)); 2100 2107 FILLDIRTY(cb->v); 2101 2108 FILLDIRTY(cb->clientPointer); … … 2113 2120 if (idHwArrayBufferUsed != idHwArrayBuffer) 2114 2121 { 2115 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2122 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2116 2123 idHwArrayBuffer = idHwArrayBufferUsed; 2117 2124 } 2118 diff_api.NormalPointer(to->array.n.type, to->array.n.stride, to->array.n.p CRVBOX_HOST_ONLY_PARAM(to->array.n.fRealPtr));2125 pState->diff_api.NormalPointer(to->array.n.type, to->array.n.stride, to->array.n.p CRVBOX_HOST_ONLY_PARAM(to->array.n.fRealPtr)); 2119 2126 FILLDIRTY(cb->n); 2120 2127 FILLDIRTY(cb->clientPointer); … … 2133 2140 if (idHwArrayBufferUsed != idHwArrayBuffer) 2134 2141 { 2135 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2142 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2136 2143 idHwArrayBuffer = idHwArrayBufferUsed; 2137 2144 } 2138 diff_api.ColorPointer(to->array.c.size, to->array.c.type, to->array.c.stride, to->array.c.p CRVBOX_HOST_ONLY_PARAM(to->array.c.fRealPtr));2145 pState->diff_api.ColorPointer(to->array.c.size, to->array.c.type, to->array.c.stride, to->array.c.p CRVBOX_HOST_ONLY_PARAM(to->array.c.fRealPtr)); 2139 2146 FILLDIRTY(cb->c); 2140 2147 FILLDIRTY(cb->clientPointer); … … 2152 2159 if (idHwArrayBufferUsed != idHwArrayBuffer) 2153 2160 { 2154 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2161 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2155 2162 idHwArrayBuffer = idHwArrayBufferUsed; 2156 2163 } 2157 diff_api.IndexPointer(to->array.i.type, to->array.i.stride, to->array.i.p CRVBOX_HOST_ONLY_PARAM(to->array.i.fRealPtr));2164 pState->diff_api.IndexPointer(to->array.i.type, to->array.i.stride, to->array.i.p CRVBOX_HOST_ONLY_PARAM(to->array.i.fRealPtr)); 2158 2165 FILLDIRTY(cb->i); 2159 2166 FILLDIRTY(cb->dirty); … … 2173 2180 if (idHwArrayBufferUsed != idHwArrayBuffer) 2174 2181 { 2175 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2182 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2176 2183 idHwArrayBuffer = idHwArrayBufferUsed; 2177 2184 } 2178 diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i);2185 pState->diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i); 2179 2186 curClientTextureUnit = i; 2180 diff_api.TexCoordPointer(to->array.t[i].size, to->array.t[i].type, to->array.t[i].stride, to->array.t[i].p CRVBOX_HOST_ONLY_PARAM(to->array.t[i].fRealPtr));2187 pState->diff_api.TexCoordPointer(to->array.t[i].size, to->array.t[i].type, to->array.t[i].stride, to->array.t[i].p CRVBOX_HOST_ONLY_PARAM(to->array.t[i].fRealPtr)); 2181 2188 FILLDIRTY(cb->t[i]); 2182 2189 FILLDIRTY(cb->clientPointer); … … 2194 2201 if (idHwArrayBufferUsed != idHwArrayBuffer) 2195 2202 { 2196 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2203 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2197 2204 idHwArrayBuffer = idHwArrayBufferUsed; 2198 2205 } 2199 diff_api.EdgeFlagPointer(to->array.e.stride, to->array.e.p CRVBOX_HOST_ONLY_PARAM(to->array.e.fRealPtr));2206 pState->diff_api.EdgeFlagPointer(to->array.e.stride, to->array.e.p CRVBOX_HOST_ONLY_PARAM(to->array.e.fRealPtr)); 2200 2207 FILLDIRTY(cb->e); 2201 2208 FILLDIRTY(cb->clientPointer); … … 2214 2221 if (idHwArrayBufferUsed != idHwArrayBuffer) 2215 2222 { 2216 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2223 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2217 2224 idHwArrayBuffer = idHwArrayBufferUsed; 2218 2225 } 2219 diff_api.SecondaryColorPointerEXT(to->array.s.size, to->array.s.type, to->array.s.stride, to->array.s.p CRVBOX_HOST_ONLY_PARAM(to->array.s.fRealPtr));2226 pState->diff_api.SecondaryColorPointerEXT(to->array.s.size, to->array.s.type, to->array.s.stride, to->array.s.p CRVBOX_HOST_ONLY_PARAM(to->array.s.fRealPtr)); 2220 2227 FILLDIRTY(cb->s); 2221 2228 FILLDIRTY(cb->clientPointer); … … 2233 2240 if (idHwArrayBufferUsed != idHwArrayBuffer) 2234 2241 { 2235 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2242 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2236 2243 idHwArrayBuffer = idHwArrayBufferUsed; 2237 2244 } 2238 diff_api.FogCoordPointerEXT(to->array.f.type, to->array.f.stride, to->array.f.p CRVBOX_HOST_ONLY_PARAM(to->array.f.fRealPtr));2245 pState->diff_api.FogCoordPointerEXT(to->array.f.type, to->array.f.stride, to->array.f.p CRVBOX_HOST_ONLY_PARAM(to->array.f.fRealPtr)); 2239 2246 FILLDIRTY(cb->f); 2240 2247 FILLDIRTY(cb->clientPointer); … … 2256 2263 if (idHwArrayBufferUsed != idHwArrayBuffer) 2257 2264 { 2258 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed);2265 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwArrayBufferUsed); 2259 2266 idHwArrayBuffer = idHwArrayBufferUsed; 2260 2267 } 2261 diff_api.VertexAttribPointerARB(i, to->array.a[i].size, to->array.a[i].type, to->array.a[i].normalized,2262 to->array.a[i].stride, to->array.a[i].p CRVBOX_HOST_ONLY_PARAM(to->array.a[i].fRealPtr));2268 pState->diff_api.VertexAttribPointerARB(i, to->array.a[i].size, to->array.a[i].type, to->array.a[i].normalized, 2269 to->array.a[i].stride, to->array.a[i].p CRVBOX_HOST_ONLY_PARAM(to->array.a[i].fRealPtr)); 2263 2270 FILLDIRTY(cb->a[i]); 2264 2271 FILLDIRTY(cb->clientPointer); … … 2273 2280 if (idHwArrayBuffer != idHwInitialBuffer) 2274 2281 { 2275 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwInitialBuffer);2282 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, idHwInitialBuffer); 2276 2283 } 2277 2284 … … 2279 2286 /* update vertex array enable/disable flags */ 2280 2287 glAble able[2]; 2281 able[0] = diff_api.DisableClientState;2282 able[1] = diff_api.EnableClientState;2288 able[0] = pState->diff_api.DisableClientState; 2289 able[1] = pState->diff_api.EnableClientState; 2283 2290 if (from->array.v.enabled != to->array.v.enabled) { 2284 2291 able[to->array.v.enabled](GL_VERTEX_ARRAY); … … 2303 2310 for (i = 0; (unsigned int)i < toCtx->limits.maxTextureUnits; i++) { 2304 2311 if (from->array.t[i].enabled != to->array.t[i].enabled) { 2305 diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i);2312 pState->diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i); 2306 2313 curClientTextureUnit = i; 2307 2314 able[to->array.t[i].enabled](GL_TEXTURE_COORD_ARRAY); … … 2328 2335 if (from->array.a[i].enabled != to->array.a[i].enabled) { 2329 2336 if (to->array.a[i].enabled) 2330 diff_api.EnableVertexAttribArrayARB(i);2337 pState->diff_api.EnableVertexAttribArrayARB(i); 2331 2338 else 2332 diff_api.DisableVertexAttribArrayARB(i);2339 pState->diff_api.DisableVertexAttribArrayARB(i); 2333 2340 FILLDIRTY(cb->enableClientState); 2334 2341 FILLDIRTY(cb->dirty); … … 2340 2347 if (to->curClientTextureUnit != curClientTextureUnit) 2341 2348 { 2342 diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + to->curClientTextureUnit);2349 pState->diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + to->curClientTextureUnit); 2343 2350 } 2344 2351 … … 2347 2354 if (from->unpack.rowLength != to->unpack.rowLength) 2348 2355 { 2349 diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, to->unpack.rowLength);2356 pState->diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, to->unpack.rowLength); 2350 2357 FILLDIRTY(cb->unpack); 2351 2358 FILLDIRTY(cb->dirty); … … 2353 2360 if (from->unpack.skipRows != to->unpack.skipRows) 2354 2361 { 2355 diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, to->unpack.skipRows);2362 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, to->unpack.skipRows); 2356 2363 FILLDIRTY(cb->unpack); 2357 2364 FILLDIRTY(cb->dirty); … … 2359 2366 if (from->unpack.skipPixels != to->unpack.skipPixels) 2360 2367 { 2361 diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, to->unpack.skipPixels);2368 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, to->unpack.skipPixels); 2362 2369 FILLDIRTY(cb->unpack); 2363 2370 FILLDIRTY(cb->dirty); … … 2365 2372 if (from->unpack.alignment != to->unpack.alignment) 2366 2373 { 2367 diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, to->unpack.alignment);2374 pState->diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, to->unpack.alignment); 2368 2375 FILLDIRTY(cb->unpack); 2369 2376 FILLDIRTY(cb->dirty); … … 2371 2378 if (from->unpack.imageHeight != to->unpack.imageHeight) 2372 2379 { 2373 diff_api.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, to->unpack.imageHeight);2380 pState->diff_api.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, to->unpack.imageHeight); 2374 2381 FILLDIRTY(cb->unpack); 2375 2382 FILLDIRTY(cb->dirty); … … 2377 2384 if (from->unpack.skipImages != to->unpack.skipImages) 2378 2385 { 2379 diff_api.PixelStorei(GL_UNPACK_SKIP_IMAGES, to->unpack.skipImages);2386 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_IMAGES, to->unpack.skipImages); 2380 2387 FILLDIRTY(cb->unpack); 2381 2388 FILLDIRTY(cb->dirty); … … 2383 2390 if (from->unpack.swapBytes != to->unpack.swapBytes) 2384 2391 { 2385 diff_api.PixelStorei(GL_UNPACK_SWAP_BYTES, to->unpack.swapBytes);2392 pState->diff_api.PixelStorei(GL_UNPACK_SWAP_BYTES, to->unpack.swapBytes); 2386 2393 FILLDIRTY(cb->unpack); 2387 2394 FILLDIRTY(cb->dirty); … … 2389 2396 if (from->unpack.psLSBFirst != to->unpack.psLSBFirst) 2390 2397 { 2391 diff_api.PixelStorei(GL_UNPACK_LSB_FIRST, to->unpack.psLSBFirst);2398 pState->diff_api.PixelStorei(GL_UNPACK_LSB_FIRST, to->unpack.psLSBFirst); 2392 2399 FILLDIRTY(cb->unpack); 2393 2400 FILLDIRTY(cb->dirty); … … 2400 2407 if (from->pack.rowLength != to->pack.rowLength) 2401 2408 { 2402 diff_api.PixelStorei(GL_PACK_ROW_LENGTH, to->pack.rowLength);2409 pState->diff_api.PixelStorei(GL_PACK_ROW_LENGTH, to->pack.rowLength); 2403 2410 FILLDIRTY(cb->pack); 2404 2411 FILLDIRTY(cb->dirty); … … 2406 2413 if (from->pack.skipRows != to->pack.skipRows) 2407 2414 { 2408 diff_api.PixelStorei(GL_PACK_SKIP_ROWS, to->pack.skipRows);2415 pState->diff_api.PixelStorei(GL_PACK_SKIP_ROWS, to->pack.skipRows); 2409 2416 FILLDIRTY(cb->pack); 2410 2417 FILLDIRTY(cb->dirty); … … 2412 2419 if (from->pack.skipPixels != to->pack.skipPixels) 2413 2420 { 2414 diff_api.PixelStorei(GL_PACK_SKIP_PIXELS, to->pack.skipPixels);2421 pState->diff_api.PixelStorei(GL_PACK_SKIP_PIXELS, to->pack.skipPixels); 2415 2422 FILLDIRTY(cb->pack); 2416 2423 FILLDIRTY(cb->dirty); … … 2418 2425 if (from->pack.alignment != to->pack.alignment) 2419 2426 { 2420 diff_api.PixelStorei(GL_PACK_ALIGNMENT, to->pack.alignment);2427 pState->diff_api.PixelStorei(GL_PACK_ALIGNMENT, to->pack.alignment); 2421 2428 FILLDIRTY(cb->pack); 2422 2429 FILLDIRTY(cb->dirty); … … 2424 2431 if (from->pack.imageHeight != to->pack.imageHeight) 2425 2432 { 2426 diff_api.PixelStorei(GL_PACK_IMAGE_HEIGHT, to->pack.imageHeight);2433 pState->diff_api.PixelStorei(GL_PACK_IMAGE_HEIGHT, to->pack.imageHeight); 2427 2434 FILLDIRTY(cb->pack); 2428 2435 FILLDIRTY(cb->dirty); … … 2430 2437 if (from->pack.skipImages != to->pack.skipImages) 2431 2438 { 2432 diff_api.PixelStorei(GL_PACK_SKIP_IMAGES, to->pack.skipImages);2439 pState->diff_api.PixelStorei(GL_PACK_SKIP_IMAGES, to->pack.skipImages); 2433 2440 FILLDIRTY(cb->pack); 2434 2441 FILLDIRTY(cb->dirty); … … 2436 2443 if (from->pack.swapBytes != to->pack.swapBytes) 2437 2444 { 2438 diff_api.PixelStorei(GL_PACK_SWAP_BYTES, to->pack.swapBytes);2445 pState->diff_api.PixelStorei(GL_PACK_SWAP_BYTES, to->pack.swapBytes); 2439 2446 FILLDIRTY(cb->pack); 2440 2447 FILLDIRTY(cb->dirty); … … 2442 2449 if (from->pack.psLSBFirst != to->pack.psLSBFirst) 2443 2450 { 2444 diff_api.PixelStorei(GL_PACK_LSB_FIRST, to->pack.psLSBFirst);2451 pState->diff_api.PixelStorei(GL_PACK_LSB_FIRST, to->pack.psLSBFirst); 2445 2452 FILLDIRTY(cb->pack); 2446 2453 FILLDIRTY(cb->dirty); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.c
r69392 r78375 19 19 { 20 20 CRCurrentState *c = &ctx->current; 21 CRStateBits *sb = GetCurrentBits( );21 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 22 22 CRCurrentBits *cb = &(sb->current); 23 23 static const GLfloat default_normal[4] = {0.0f, 0.0f, 1.0f, 1.0f}; … … 70 70 } 71 71 72 void STATE_APIENTRY crStateColor3f( GLfloat r, GLfloat g, GLfloat b )73 { 74 crStateColor4f( r, g, b, 1.0F);75 } 76 77 void STATE_APIENTRY crStateColor3fv( const GLfloat *color )78 { 79 crStateColor4f( color[0], color[1], color[2], 1.0F );80 } 81 82 void STATE_APIENTRY crStateColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )83 { 84 CRContext *g = GetCurrentContext( );72 void STATE_APIENTRY crStateColor3f(PCRStateTracker pState, GLfloat r, GLfloat g, GLfloat b ) 73 { 74 crStateColor4f(pState, r, g, b, 1.0F); 75 } 76 77 void STATE_APIENTRY crStateColor3fv(PCRStateTracker pState, const GLfloat *color ) 78 { 79 crStateColor4f(pState, color[0], color[1], color[2], 1.0F ); 80 } 81 82 void STATE_APIENTRY crStateColor4f(PCRStateTracker pState, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) 83 { 84 CRContext *g = GetCurrentContext(pState); 85 85 CRCurrentState *c = &(g->current); 86 CRStateBits *sb = GetCurrentBits( );86 CRStateBits *sb = GetCurrentBits(pState); 87 87 CRCurrentBits *cb = &(sb->current); 88 88 … … 98 98 } 99 99 100 void STATE_APIENTRY crStateColor4fv( const GLfloat *color )101 { 102 crStateColor4f( color[0], color[1], color[2], color[3] );100 void STATE_APIENTRY crStateColor4fv(PCRStateTracker pState, const GLfloat *color ) 101 { 102 crStateColor4f(pState, color[0], color[1], color[2], color[3] ); 103 103 } 104 104 … … 118 118 } 119 119 120 void STATE_APIENTRY crStateBegin( GLenum mode )121 { 122 CRContext *g = GetCurrentContext( );120 void STATE_APIENTRY crStateBegin(PCRStateTracker pState, GLenum mode ) 121 { 122 CRContext *g = GetCurrentContext(pState); 123 123 CRCurrentState *c = &(g->current); 124 124 125 125 if (mode > GL_POLYGON) 126 126 { 127 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Begin called with invalid mode: %d", mode);127 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Begin called with invalid mode: %d", mode); 128 128 return; 129 129 } … … 131 131 if (c->inBeginEnd) 132 132 { 133 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glBegin called inside Begin/End");133 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glBegin called inside Begin/End"); 134 134 return; 135 135 } … … 141 141 } 142 142 143 void STATE_APIENTRY crStateEnd( void)144 { 145 CRContext *g = GetCurrentContext( );143 void STATE_APIENTRY crStateEnd(PCRStateTracker pState) 144 { 145 CRContext *g = GetCurrentContext(pState); 146 146 CRCurrentState *c = &(g->current); 147 147 148 148 if (!c->inBeginEnd) 149 149 { 150 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glEnd called outside Begin/End" );150 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glEnd called outside Begin/End" ); 151 151 return; 152 152 } … … 158 158 CRContext *fromCtx, CRContext *toCtx ) 159 159 { 160 PCRStateTracker pState = fromCtx->pStateTracker; 160 161 const CRCurrentState *from = &(fromCtx->current); 161 162 const CRCurrentState *to = &(toCtx->current); … … 163 164 unsigned int i, j; 164 165 CRbitvalue nbitID[CR_MAX_BITARRAY]; 166 167 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 165 168 166 169 for (j=0;j<CR_MAX_BITARRAY;j++) … … 177 180 if (toX != fromX || toY != fromY || toZ != fromZ) { 178 181 /* Use glWindowPos (which updates raster color) */ 179 diff_api.WindowPos3fvARB(to->rasterAttrib[VERT_ATTRIB_POS]);182 pState->diff_api.WindowPos3fvARB(to->rasterAttrib[VERT_ATTRIB_POS]); 180 183 FILLDIRTY(c->rasterPos); 181 184 FILLDIRTY(c->dirty); … … 195 198 if (CHECKDIRTY(c->colorIndex, bitID)) { 196 199 if (to->colorIndex != from->colorIndex) { 197 diff_api.Indexf(to->colorIndex);200 pState->diff_api.Indexf(to->colorIndex); 198 201 FILLDIRTY(c->colorIndex); 199 202 FILLDIRTY(c->dirty); … … 204 207 if (CHECKDIRTY(c->edgeFlag, bitID)) { 205 208 if (to->edgeFlag != from->edgeFlag) { 206 diff_api.EdgeFlag(to->edgeFlag);209 pState->diff_api.EdgeFlag(to->edgeFlag); 207 210 FILLDIRTY(c->edgeFlag); 208 211 FILLDIRTY(c->dirty); … … 223 226 && CHECKDIRTY(c->vertexAttrib[i], bitID)) { 224 227 if (COMPARE_VECTOR (from->vertexAttrib[i], to->vertexAttribPre[i])) { 225 diff_api.VertexAttrib4fvARB(i, &(to->vertexAttrib[i][0]));228 pState->diff_api.VertexAttrib4fvARB(i, &(to->vertexAttrib[i][0])); 226 229 FILLDIRTY(c->vertexAttrib[i]); 227 230 FILLDIRTY(c->dirty); … … 242 245 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR0], bitID)) { 243 246 if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR0],to->vertexAttrib[VERT_ATTRIB_COLOR0])) { 244 diff_api.Color4fv ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_COLOR0]));247 pState->diff_api.Color4fv ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_COLOR0])); 245 248 FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR0]); 246 249 FILLDIRTY(c->dirty); … … 253 256 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR1], bitID)) { 254 257 if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR1],to->vertexAttrib[VERT_ATTRIB_COLOR1])) { 255 diff_api.SecondaryColor3fvEXT ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_COLOR1]));258 pState->diff_api.SecondaryColor3fvEXT ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_COLOR1])); 256 259 FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR1]); 257 260 FILLDIRTY(c->dirty); … … 265 268 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG], bitID)) { 266 269 if (from->vertexAttrib[VERT_ATTRIB_FOG][0] != to->vertexAttrib[VERT_ATTRIB_FOG][0] ) { 267 diff_api.FogCoordfvEXT ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_FOG][0] ));270 pState->diff_api.FogCoordfvEXT ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_FOG][0] )); 268 271 FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG]); 269 272 FILLDIRTY(c->dirty); … … 275 278 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_NORMAL], bitID)) { 276 279 if (COMPARE_VECTOR (from->vertexAttrib[VERT_ATTRIB_NORMAL], to->vertexAttrib[VERT_ATTRIB_NORMAL])) { 277 diff_api.Normal3fv ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_NORMAL][0]));280 pState->diff_api.Normal3fv ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_NORMAL][0])); 278 281 FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_NORMAL]); 279 282 FILLDIRTY(c->dirty); … … 285 288 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], bitID)) { 286 289 if (COMPARE_TEXCOORD (from->vertexAttrib[VERT_ATTRIB_TEX0 + i], to->vertexAttribPre[VERT_ATTRIB_TEX0 + i])) { 287 diff_api.MultiTexCoord4fvARB (i+GL_TEXTURE0_ARB, (GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_TEX0+ i][0]));290 pState->diff_api.MultiTexCoord4fvARB (i+GL_TEXTURE0_ARB, (GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_TEX0+ i][0])); 288 291 FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_TEX0 + i]); 289 292 FILLDIRTY(c->dirty); … … 301 304 CRContext *fromCtx, CRContext *toCtx ) 302 305 { 306 PCRStateTracker pState = fromCtx->pStateTracker; 303 307 CRCurrentState *from = &(fromCtx->current); 304 308 const CRCurrentState *to = &(toCtx->current); 305 309 unsigned int i, j; 306 310 CRbitvalue nbitID[CR_MAX_BITARRAY]; 311 312 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 307 313 308 314 for (j=0;j<CR_MAX_BITARRAY;j++) … … 320 326 if (toX != fromX || toY != fromY || toZ != fromZ) { 321 327 /* Use glWindowPos (which updates raster color) */ 322 diff_api.WindowPos3fvARB(to->rasterAttrib[VERT_ATTRIB_POS]);328 pState->diff_api.WindowPos3fvARB(to->rasterAttrib[VERT_ATTRIB_POS]); 323 329 from->rasterAttrib[VERT_ATTRIB_POS][0] = toX; 324 330 from->rasterAttrib[VERT_ATTRIB_POS][1] = toY; … … 342 348 if (CHECKDIRTY(c->edgeFlag, bitID)) { 343 349 if (from->edgeFlag != to->edgeFlagPre) { 344 diff_api.EdgeFlag (to->edgeFlagPre);350 pState->diff_api.EdgeFlag (to->edgeFlagPre); 345 351 } 346 352 from->edgeFlag = to->edgeFlag; … … 351 357 if (CHECKDIRTY(c->colorIndex, bitID)) { 352 358 if (from->colorIndex != to->colorIndexPre) { 353 diff_api.Indexf (to->colorIndex);359 pState->diff_api.Indexf (to->colorIndex); 354 360 } 355 361 from->colorIndex = to->colorIndex; … … 370 376 && CHECKDIRTY(c->vertexAttrib[i], bitID)) { 371 377 if (COMPARE_VECTOR (from->vertexAttrib[i], to->vertexAttribPre[i])) { 372 diff_api.VertexAttrib4fvARB(i, &(to->vertexAttribPre[i][0]));378 pState->diff_api.VertexAttrib4fvARB(i, &(to->vertexAttribPre[i][0])); 373 379 } 374 380 COPY_4V(from->vertexAttrib[i] , to->vertexAttrib[i]); … … 386 392 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR0], bitID)) { 387 393 if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR0],to->vertexAttribPre[VERT_ATTRIB_COLOR0])) { 388 diff_api.Color4fv ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_COLOR0]));394 pState->diff_api.Color4fv ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_COLOR0])); 389 395 } 390 396 COPY_4V(from->vertexAttrib[VERT_ATTRIB_COLOR0] , to->vertexAttrib[VERT_ATTRIB_COLOR0]); … … 395 401 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR1], bitID)) { 396 402 if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR1],to->vertexAttribPre[VERT_ATTRIB_COLOR1])) { 397 diff_api.SecondaryColor3fvEXT ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_COLOR1]));403 pState->diff_api.SecondaryColor3fvEXT ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_COLOR1])); 398 404 } 399 405 COPY_4V(from->vertexAttrib[VERT_ATTRIB_COLOR1] , to->vertexAttrib[VERT_ATTRIB_COLOR1]); … … 405 411 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG], bitID)) { 406 412 if (from->vertexAttrib[VERT_ATTRIB_FOG] != to->vertexAttribPre[VERT_ATTRIB_FOG]) { 407 diff_api.FogCoordfvEXT ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_FOG]));413 pState->diff_api.FogCoordfvEXT ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_FOG])); 408 414 } 409 415 COPY_4V(from->vertexAttrib[VERT_ATTRIB_FOG] , to->vertexAttrib[VERT_ATTRIB_FOG]); … … 414 420 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_NORMAL], bitID)) { 415 421 if (COMPARE_VECTOR (from->vertexAttrib[VERT_ATTRIB_NORMAL], to->vertexAttribPre[VERT_ATTRIB_NORMAL])) { 416 diff_api.Normal3fv ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_NORMAL]));422 pState->diff_api.Normal3fv ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_NORMAL])); 417 423 } 418 424 COPY_4V(from->vertexAttrib[VERT_ATTRIB_NORMAL] , to->vertexAttrib[VERT_ATTRIB_NORMAL]); … … 424 430 if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], bitID)) { 425 431 if (COMPARE_TEXCOORD (from->vertexAttrib[VERT_ATTRIB_TEX0 + i], to->vertexAttribPre[VERT_ATTRIB_TEX0 + i])) { 426 diff_api.MultiTexCoord4fvARB (GL_TEXTURE0_ARB + i, (GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_TEX0 + i]));432 pState->diff_api.MultiTexCoord4fvARB (GL_TEXTURE0_ARB + i, (GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_TEX0 + i])); 427 433 } 428 434 COPY_4V(from->vertexAttrib[VERT_ATTRIB_TEX0 + i] , to->vertexAttrib[VERT_ATTRIB_TEX0 + i]); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.py
r69392 r78375 79 79 print(''' 80 80 81 void crStateCurrentRecover( void)81 void crStateCurrentRecover(PCRStateTracker pState) 82 82 { 83 83 const unsigned char *v; 84 84 convert_func convert=NULL; 85 CRContext *g = GetCurrentContext( );85 CRContext *g = GetCurrentContext(pState); 86 86 CRCurrentState *c = &(g->current); 87 CRStateBits *sb = GetCurrentBits( );87 CRStateBits *sb = GetCurrentBits(pState); 88 88 CRCurrentBits *cb = &(sb->current); 89 89 static const GLfloat color_default[4] = {0.0f, 0.0f, 0.0f, 1.0f}; … … 295 295 const unsigned char *v; 296 296 convert_func convert=NULL; 297 CRCurrentState *c = &(g->current);298 CRStateBits *sb = GetCurrentBits();299 CRCurrentBits *cb = &(sb->current);297 CRCurrentState *c; 298 CRStateBits *sb; 299 CRCurrentBits *cb; 300 300 301 301 static const GLfloat vertexAttrib_default[4] = {0.0f, 0.0f, 0.0f, 1.0f}; … … 309 309 if (!g || !current) 310 310 return; 311 312 c = &(g->current); 313 sb = GetCurrentBits(g->pStateTracker); 314 cb = &(sb->current); 311 315 312 316 /* silence warnings */ -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_diff.c
r76474 r78375 14 14 void crStateDiffContext( CRContext *from, CRContext *to ) 15 15 { 16 PCRStateTracker pState = from->pStateTracker; 16 17 CRbitvalue *bitID = from->bitid; 17 CRStateBits *sb = GetCurrentBits(); 18 CRStateBits *sb = GetCurrentBits(pState); 19 20 CRASSERT(from->pStateTracker == to->pStateTracker); 18 21 19 22 /*crDebug( "Diffing two contexts!" ); */ … … 143 146 int crStateAcquireFBImage(CRContext *to, CRFBData *data) 144 147 { 148 PCRStateTracker pState = to->pStateTracker; 145 149 /*CRBufferState *pBuf = &to->buffer; - unused */ 146 150 CRPixelPackState packing = to->client.pack; 147 151 uint32_t i; 148 152 149 diff_api.PixelStorei(GL_PACK_SKIP_ROWS, 0);150 diff_api.PixelStorei(GL_PACK_SKIP_PIXELS, 0);151 diff_api.PixelStorei(GL_PACK_ALIGNMENT, 1);152 diff_api.PixelStorei(GL_PACK_ROW_LENGTH, 0);153 diff_api.PixelStorei(GL_PACK_IMAGE_HEIGHT, 0);154 diff_api.PixelStorei(GL_PACK_SKIP_IMAGES, 0);155 diff_api.PixelStorei(GL_PACK_SWAP_BYTES, 0);156 diff_api.PixelStorei(GL_PACK_LSB_FIRST, 0);153 pState->diff_api.PixelStorei(GL_PACK_SKIP_ROWS, 0); 154 pState->diff_api.PixelStorei(GL_PACK_SKIP_PIXELS, 0); 155 pState->diff_api.PixelStorei(GL_PACK_ALIGNMENT, 1); 156 pState->diff_api.PixelStorei(GL_PACK_ROW_LENGTH, 0); 157 pState->diff_api.PixelStorei(GL_PACK_IMAGE_HEIGHT, 0); 158 pState->diff_api.PixelStorei(GL_PACK_SKIP_IMAGES, 0); 159 pState->diff_api.PixelStorei(GL_PACK_SWAP_BYTES, 0); 160 pState->diff_api.PixelStorei(GL_PACK_LSB_FIRST, 0); 157 161 158 162 if (to->bufferobject.packBuffer->hwid>0) 159 163 { 160 diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);164 pState->diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); 161 165 } 162 166 … … 169 173 if (!to->buffer.depthTest) 170 174 { 171 diff_api.Enable(GL_DEPTH_TEST);175 pState->diff_api.Enable(GL_DEPTH_TEST); 172 176 } 173 177 if (to->pixel.depthScale != 1.0f) 174 178 { 175 diff_api.PixelTransferf (GL_DEPTH_SCALE, 1.0f);179 pState->diff_api.PixelTransferf (GL_DEPTH_SCALE, 1.0f); 176 180 } 177 181 if (to->pixel.depthBias != 0.0f) 178 182 { 179 diff_api.PixelTransferf (GL_DEPTH_BIAS, 0.0f);183 pState->diff_api.PixelTransferf (GL_DEPTH_BIAS, 0.0f); 180 184 } 181 185 } … … 184 188 if (!to->stencil.stencilTest) 185 189 { 186 diff_api.Enable(GL_STENCIL_TEST);190 pState->diff_api.Enable(GL_STENCIL_TEST); 187 191 } 188 192 if (to->pixel.mapStencil) 189 193 { 190 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_FALSE);194 pState->diff_api.PixelTransferi (GL_MAP_STENCIL, GL_FALSE); 191 195 } 192 196 if (to->pixel.indexOffset) 193 197 { 194 diff_api.PixelTransferi (GL_INDEX_OFFSET, 0);198 pState->diff_api.PixelTransferi (GL_INDEX_OFFSET, 0); 195 199 } 196 200 if (to->pixel.indexShift) 197 201 { 198 diff_api.PixelTransferi (GL_INDEX_SHIFT, 0);199 } 200 } 201 202 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, el->idFBO);202 pState->diff_api.PixelTransferi (GL_INDEX_SHIFT, 0); 203 } 204 } 205 206 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, el->idFBO); 203 207 204 208 if (el->enmBuffer) 205 diff_api.ReadBuffer(el->enmBuffer);206 207 diff_api.ReadPixels(el->posX, el->posY, el->width, el->height, el->enmFormat, el->enmType, el->pvData);209 pState->diff_api.ReadBuffer(el->enmBuffer); 210 211 pState->diff_api.ReadPixels(el->posX, el->posY, el->width, el->height, el->enmFormat, el->enmType, el->pvData); 208 212 crDebug("Acquired %d;%d;%d;%d;%d;0x%p fb image", el->enmBuffer, el->width, el->height, el->enmFormat, el->enmType, el->pvData); 209 213 … … 212 216 if (to->pixel.depthScale != 1.0f) 213 217 { 214 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->pixel.depthScale);218 pState->diff_api.PixelTransferf (GL_DEPTH_SCALE, to->pixel.depthScale); 215 219 } 216 220 if (to->pixel.depthBias != 0.0f) 217 221 { 218 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->pixel.depthBias);222 pState->diff_api.PixelTransferf (GL_DEPTH_BIAS, to->pixel.depthBias); 219 223 } 220 224 if (!to->buffer.depthTest) 221 225 { 222 diff_api.Disable(GL_DEPTH_TEST);226 pState->diff_api.Disable(GL_DEPTH_TEST); 223 227 } 224 228 } … … 227 231 if (to->pixel.indexOffset) 228 232 { 229 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->pixel.indexOffset);233 pState->diff_api.PixelTransferi (GL_INDEX_OFFSET, to->pixel.indexOffset); 230 234 } 231 235 if (to->pixel.indexShift) 232 236 { 233 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->pixel.indexShift);237 pState->diff_api.PixelTransferi (GL_INDEX_SHIFT, to->pixel.indexShift); 234 238 } 235 239 if (to->pixel.mapStencil) 236 240 { 237 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_TRUE);241 pState->diff_api.PixelTransferi (GL_MAP_STENCIL, GL_TRUE); 238 242 } 239 243 if (!to->stencil.stencilTest) 240 244 { 241 diff_api.Disable(GL_STENCIL_TEST);245 pState->diff_api.Disable(GL_STENCIL_TEST); 242 246 } 243 247 } … … 246 250 if (to->bufferobject.packBuffer->hwid>0) 247 251 { 248 diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, to->bufferobject.packBuffer->hwid);252 pState->diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, to->bufferobject.packBuffer->hwid); 249 253 } 250 254 if (to->framebufferobject.readFB) 251 255 { 252 256 CRASSERT(to->framebufferobject.readFB->hwid); 253 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, to->framebufferobject.readFB->hwid);254 diff_api.ReadBuffer(to->framebufferobject.readFB->readbuffer);257 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, to->framebufferobject.readFB->hwid); 258 pState->diff_api.ReadBuffer(to->framebufferobject.readFB->readbuffer); 255 259 256 260 } 257 261 else if (data->idOverrrideFBO) 258 262 { 259 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, data->idOverrrideFBO);260 diff_api.ReadBuffer(GL_COLOR_ATTACHMENT0);263 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, data->idOverrrideFBO); 264 pState->diff_api.ReadBuffer(GL_COLOR_ATTACHMENT0); 261 265 } 262 266 else 263 267 { 264 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0);265 diff_api.ReadBuffer(to->buffer.readBuffer);266 } 267 268 diff_api.PixelStorei(GL_PACK_SKIP_ROWS, packing.skipRows);269 diff_api.PixelStorei(GL_PACK_SKIP_PIXELS, packing.skipPixels);270 diff_api.PixelStorei(GL_PACK_ALIGNMENT, packing.alignment);271 diff_api.PixelStorei(GL_PACK_ROW_LENGTH, packing.rowLength);272 diff_api.PixelStorei(GL_PACK_IMAGE_HEIGHT, packing.imageHeight);273 diff_api.PixelStorei(GL_PACK_SKIP_IMAGES, packing.skipImages);274 diff_api.PixelStorei(GL_PACK_SWAP_BYTES, packing.swapBytes);275 diff_api.PixelStorei(GL_PACK_LSB_FIRST, packing.psLSBFirst);268 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0); 269 pState->diff_api.ReadBuffer(to->buffer.readBuffer); 270 } 271 272 pState->diff_api.PixelStorei(GL_PACK_SKIP_ROWS, packing.skipRows); 273 pState->diff_api.PixelStorei(GL_PACK_SKIP_PIXELS, packing.skipPixels); 274 pState->diff_api.PixelStorei(GL_PACK_ALIGNMENT, packing.alignment); 275 pState->diff_api.PixelStorei(GL_PACK_ROW_LENGTH, packing.rowLength); 276 pState->diff_api.PixelStorei(GL_PACK_IMAGE_HEIGHT, packing.imageHeight); 277 pState->diff_api.PixelStorei(GL_PACK_SKIP_IMAGES, packing.skipImages); 278 pState->diff_api.PixelStorei(GL_PACK_SWAP_BYTES, packing.swapBytes); 279 pState->diff_api.PixelStorei(GL_PACK_LSB_FIRST, packing.psLSBFirst); 276 280 return VINF_SUCCESS; 277 281 } … … 279 283 void crStateApplyFBImage(CRContext *to, CRFBData *data) 280 284 { 281 { 282 /*CRBufferState *pBuf = &to->buffer; - unused */ 283 CRPixelPackState unpack = to->client.unpack; 284 uint32_t i; 285 286 diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0); 287 diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 288 diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1); 289 diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 290 diff_api.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); 291 diff_api.PixelStorei(GL_UNPACK_SKIP_IMAGES, 0); 292 diff_api.PixelStorei(GL_UNPACK_SWAP_BYTES, 0); 293 diff_api.PixelStorei(GL_UNPACK_LSB_FIRST, 0); 294 295 if (to->bufferobject.unpackBuffer->hwid>0) 296 { 297 diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); 298 } 299 300 diff_api.Disable(GL_ALPHA_TEST); 301 diff_api.Disable(GL_SCISSOR_TEST); 302 diff_api.Disable(GL_BLEND); 303 diff_api.Disable(GL_COLOR_LOGIC_OP); 304 diff_api.Disable(GL_DEPTH_TEST); 305 diff_api.Disable(GL_STENCIL_TEST); 306 307 for (i = 0; i < data->cElements; ++i) 308 { 309 CRFBDataElement *el = &data->aElements[i]; 285 PCRStateTracker pState = to->pStateTracker; 286 CRPixelPackState unpack = to->client.unpack; 287 uint32_t i; 288 289 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0); 290 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 291 pState->diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1); 292 pState->diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 293 pState->diff_api.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); 294 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_IMAGES, 0); 295 pState->diff_api.PixelStorei(GL_UNPACK_SWAP_BYTES, 0); 296 pState->diff_api.PixelStorei(GL_UNPACK_LSB_FIRST, 0); 297 298 if (to->bufferobject.unpackBuffer->hwid>0) 299 { 300 pState->diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); 301 } 302 303 pState->diff_api.Disable(GL_ALPHA_TEST); 304 pState->diff_api.Disable(GL_SCISSOR_TEST); 305 pState->diff_api.Disable(GL_BLEND); 306 pState->diff_api.Disable(GL_COLOR_LOGIC_OP); 307 pState->diff_api.Disable(GL_DEPTH_TEST); 308 pState->diff_api.Disable(GL_STENCIL_TEST); 309 310 for (i = 0; i < data->cElements; ++i) 311 { 312 CRFBDataElement *el = &data->aElements[i]; 310 313 #if 0 311 char fname[200]; 312 sprintf(fname, "./img_apply_%p_%d_%d.tga", to, i, el->enmFormat); 313 crDumpNamedTGA(fname, el->width, el->height, el->pvData); 314 #endif 315 316 /* Before SSM version SHCROGL_SSM_VERSION_WITH_SEPARATE_DEPTH_STENCIL_BUFFERS 317 * saved state file contined invalid DEPTH/STENCIL data. In order to prevent 318 * crashes and improper guest App behavior, this data should be ignored. */ 319 if ( data->u32Version < SHCROGL_SSM_VERSION_WITH_SEPARATE_DEPTH_STENCIL_BUFFERS 320 && ( el->enmFormat == GL_DEPTH_COMPONENT 321 || el->enmFormat == GL_STENCIL_INDEX 322 || el->enmFormat == GL_DEPTH_STENCIL)) 323 continue; 324 325 if (el->enmFormat == GL_DEPTH_COMPONENT || el->enmFormat == GL_DEPTH_STENCIL) 326 { 327 diff_api.Enable(GL_DEPTH_TEST); 328 if (to->pixel.depthScale != 1.0f) 329 { 330 diff_api.PixelTransferf (GL_DEPTH_SCALE, 1.0f); 331 } 332 if (to->pixel.depthBias != 0.0f) 333 { 334 diff_api.PixelTransferf (GL_DEPTH_BIAS, 0.0f); 335 } 336 } 337 if (el->enmFormat == GL_STENCIL_INDEX || el->enmFormat == GL_DEPTH_STENCIL) 338 { 339 diff_api.Enable(GL_STENCIL_TEST); 340 if (to->pixel.mapStencil) 341 { 342 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_FALSE); 343 } 344 if (to->pixel.indexOffset) 345 { 346 diff_api.PixelTransferi (GL_INDEX_OFFSET, 0); 347 } 348 if (to->pixel.indexShift) 349 { 350 diff_api.PixelTransferi (GL_INDEX_SHIFT, 0); 351 } 352 } 353 354 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, el->idFBO); 355 356 if (el->enmBuffer) 357 diff_api.DrawBuffer(el->enmBuffer); 358 359 diff_api.WindowPos2iARB(el->posX, el->posY); 360 diff_api.DrawPixels(el->width, el->height, el->enmFormat, el->enmType, el->pvData); 361 crDebug("Applied %d;%d;%d;%d;%d;0x%p fb image", el->enmBuffer, el->width, el->height, el->enmFormat, el->enmType, el->pvData); 362 363 if (el->enmFormat == GL_DEPTH_COMPONENT || el->enmFormat == GL_DEPTH_STENCIL) 364 { 365 if (to->pixel.depthScale != 1.0f) 366 { 367 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->pixel.depthScale); 368 } 369 if (to->pixel.depthBias != 0.0f) 370 { 371 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->pixel.depthBias); 372 } 373 diff_api.Disable(GL_DEPTH_TEST); 374 } 375 if (el->enmFormat == GL_STENCIL_INDEX || el->enmFormat == GL_DEPTH_STENCIL) 376 { 377 if (to->pixel.indexOffset) 378 { 379 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->pixel.indexOffset); 380 } 381 if (to->pixel.indexShift) 382 { 383 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->pixel.indexShift); 384 } 385 if (to->pixel.mapStencil) 386 { 387 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_TRUE); 388 } 389 diff_api.Disable(GL_STENCIL_TEST); 390 } 391 } 392 393 diff_api.WindowPos3fvARB(to->current.rasterAttrib[VERT_ATTRIB_POS]); 394 if (to->bufferobject.unpackBuffer->hwid>0) 395 { 396 diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, to->bufferobject.unpackBuffer->hwid); 397 } 398 if (to->framebufferobject.drawFB) 399 { 400 CRASSERT(to->framebufferobject.drawFB->hwid); 401 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, to->framebufferobject.drawFB->hwid); 402 diff_api.DrawBuffer(to->framebufferobject.drawFB->drawbuffer[0]); 403 } 404 else if (data->idOverrrideFBO) 405 { 406 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, data->idOverrrideFBO); 407 diff_api.DrawBuffer(GL_COLOR_ATTACHMENT0); 408 } 409 else 410 { 411 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0); 412 diff_api.DrawBuffer(to->buffer.drawBuffer); 413 } 414 if (to->buffer.alphaTest) 415 { 416 diff_api.Enable(GL_ALPHA_TEST); 417 } 418 if (to->viewport.scissorTest) 419 { 420 diff_api.Enable(GL_SCISSOR_TEST); 421 } 422 if (to->buffer.blend) 423 { 424 diff_api.Enable(GL_BLEND); 425 } 426 if (to->buffer.logicOp) 427 { 428 diff_api.Enable(GL_COLOR_LOGIC_OP); 429 } 430 if (to->buffer.depthTest) 431 { 432 diff_api.Enable(GL_DEPTH_TEST); 433 } 434 if (to->stencil.stencilTest) 435 { 436 diff_api.Enable(GL_STENCIL_TEST); 437 } 438 439 diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, unpack.skipRows); 440 diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, unpack.skipPixels); 441 diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, unpack.alignment); 442 diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, unpack.rowLength); 443 diff_api.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, unpack.imageHeight); 444 diff_api.PixelStorei(GL_UNPACK_SKIP_IMAGES, unpack.skipImages); 445 diff_api.PixelStorei(GL_UNPACK_SWAP_BYTES, unpack.swapBytes); 446 diff_api.PixelStorei(GL_UNPACK_LSB_FIRST, unpack.psLSBFirst); 447 448 diff_api.Finish(); 449 } 314 char fname[200]; 315 sprintf(fname, "./img_apply_%p_%d_%d.tga", to, i, el->enmFormat); 316 crDumpNamedTGA(fname, el->width, el->height, el->pvData); 317 #endif 318 319 /* Before SSM version SHCROGL_SSM_VERSION_WITH_SEPARATE_DEPTH_STENCIL_BUFFERS 320 * saved state file contined invalid DEPTH/STENCIL data. In order to prevent 321 * crashes and improper guest App behavior, this data should be ignored. */ 322 if ( data->u32Version < SHCROGL_SSM_VERSION_WITH_SEPARATE_DEPTH_STENCIL_BUFFERS 323 && ( el->enmFormat == GL_DEPTH_COMPONENT 324 || el->enmFormat == GL_STENCIL_INDEX 325 || el->enmFormat == GL_DEPTH_STENCIL)) 326 continue; 327 328 if (el->enmFormat == GL_DEPTH_COMPONENT || el->enmFormat == GL_DEPTH_STENCIL) 329 { 330 pState->diff_api.Enable(GL_DEPTH_TEST); 331 if (to->pixel.depthScale != 1.0f) 332 { 333 pState->diff_api.PixelTransferf (GL_DEPTH_SCALE, 1.0f); 334 } 335 if (to->pixel.depthBias != 0.0f) 336 { 337 pState->diff_api.PixelTransferf (GL_DEPTH_BIAS, 0.0f); 338 } 339 } 340 if (el->enmFormat == GL_STENCIL_INDEX || el->enmFormat == GL_DEPTH_STENCIL) 341 { 342 pState->diff_api.Enable(GL_STENCIL_TEST); 343 if (to->pixel.mapStencil) 344 { 345 pState->diff_api.PixelTransferi (GL_MAP_STENCIL, GL_FALSE); 346 } 347 if (to->pixel.indexOffset) 348 { 349 pState->diff_api.PixelTransferi (GL_INDEX_OFFSET, 0); 350 } 351 if (to->pixel.indexShift) 352 { 353 pState->diff_api.PixelTransferi (GL_INDEX_SHIFT, 0); 354 } 355 } 356 357 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, el->idFBO); 358 359 if (el->enmBuffer) 360 pState->diff_api.DrawBuffer(el->enmBuffer); 361 362 pState->diff_api.WindowPos2iARB(el->posX, el->posY); 363 pState->diff_api.DrawPixels(el->width, el->height, el->enmFormat, el->enmType, el->pvData); 364 crDebug("Applied %d;%d;%d;%d;%d;0x%p fb image", el->enmBuffer, el->width, el->height, el->enmFormat, el->enmType, el->pvData); 365 366 if (el->enmFormat == GL_DEPTH_COMPONENT || el->enmFormat == GL_DEPTH_STENCIL) 367 { 368 if (to->pixel.depthScale != 1.0f) 369 { 370 pState->diff_api.PixelTransferf (GL_DEPTH_SCALE, to->pixel.depthScale); 371 } 372 if (to->pixel.depthBias != 0.0f) 373 { 374 pState->diff_api.PixelTransferf (GL_DEPTH_BIAS, to->pixel.depthBias); 375 } 376 pState->diff_api.Disable(GL_DEPTH_TEST); 377 } 378 if (el->enmFormat == GL_STENCIL_INDEX || el->enmFormat == GL_DEPTH_STENCIL) 379 { 380 if (to->pixel.indexOffset) 381 { 382 pState->diff_api.PixelTransferi (GL_INDEX_OFFSET, to->pixel.indexOffset); 383 } 384 if (to->pixel.indexShift) 385 { 386 pState->diff_api.PixelTransferi (GL_INDEX_SHIFT, to->pixel.indexShift); 387 } 388 if (to->pixel.mapStencil) 389 { 390 pState->diff_api.PixelTransferi (GL_MAP_STENCIL, GL_TRUE); 391 } 392 pState->diff_api.Disable(GL_STENCIL_TEST); 393 } 394 } 395 396 pState->diff_api.WindowPos3fvARB(to->current.rasterAttrib[VERT_ATTRIB_POS]); 397 if (to->bufferobject.unpackBuffer->hwid>0) 398 { 399 pState->diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, to->bufferobject.unpackBuffer->hwid); 400 } 401 if (to->framebufferobject.drawFB) 402 { 403 CRASSERT(to->framebufferobject.drawFB->hwid); 404 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, to->framebufferobject.drawFB->hwid); 405 pState->diff_api.DrawBuffer(to->framebufferobject.drawFB->drawbuffer[0]); 406 } 407 else if (data->idOverrrideFBO) 408 { 409 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, data->idOverrrideFBO); 410 pState->diff_api.DrawBuffer(GL_COLOR_ATTACHMENT0); 411 } 412 else 413 { 414 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0); 415 pState->diff_api.DrawBuffer(to->buffer.drawBuffer); 416 } 417 if (to->buffer.alphaTest) 418 { 419 pState->diff_api.Enable(GL_ALPHA_TEST); 420 } 421 if (to->viewport.scissorTest) 422 { 423 pState->diff_api.Enable(GL_SCISSOR_TEST); 424 } 425 if (to->buffer.blend) 426 { 427 pState->diff_api.Enable(GL_BLEND); 428 } 429 if (to->buffer.logicOp) 430 { 431 pState->diff_api.Enable(GL_COLOR_LOGIC_OP); 432 } 433 if (to->buffer.depthTest) 434 { 435 pState->diff_api.Enable(GL_DEPTH_TEST); 436 } 437 if (to->stencil.stencilTest) 438 { 439 pState->diff_api.Enable(GL_STENCIL_TEST); 440 } 441 442 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, unpack.skipRows); 443 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, unpack.skipPixels); 444 pState->diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, unpack.alignment); 445 pState->diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, unpack.rowLength); 446 pState->diff_api.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, unpack.imageHeight); 447 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_IMAGES, unpack.skipImages); 448 pState->diff_api.PixelStorei(GL_UNPACK_SWAP_BYTES, unpack.swapBytes); 449 pState->diff_api.PixelStorei(GL_UNPACK_LSB_FIRST, unpack.psLSBFirst); 450 451 pState->diff_api.Finish(); 450 452 } 451 453 452 454 void crStateSwitchContext( CRContext *from, CRContext *to ) 453 455 { 456 PCRStateTracker pState = from->pStateTracker; 454 457 CRbitvalue *bitID = to->bitid; 455 CRStateBits *sb = GetCurrentBits(); 458 CRStateBits *sb = GetCurrentBits(pState); 459 460 CRASSERT(from->pStateTracker == to->pStateTracker); 456 461 457 462 if (CHECKDIRTY(sb->attrib.dirty, bitID)) … … 590 595 { 591 596 GLenum err; 592 while ((err = diff_api.GetError()) != GL_NO_ERROR)597 while ((err = ctx->pStateTracker->diff_api.GetError()) != GL_NO_ERROR) 593 598 { 594 599 if (ctx->error != GL_NO_ERROR) … … 597 602 } 598 603 599 GLenum crStateCleanHWErrorState( void)604 GLenum crStateCleanHWErrorState(PCRStateTracker pState) 600 605 { 601 606 GLenum err; 602 while ((err = diff_api.GetError()) != GL_NO_ERROR)607 while ((err = pState->diff_api.GetError()) != GL_NO_ERROR) 603 608 { 604 609 static int cErrPrints = 0; … … 618 623 void crStateSwitchPrepare(CRContext *toCtx, CRContext *fromCtx, GLuint idDrawFBO, GLuint idReadFBO) 619 624 { 625 PCRStateTracker pState = toCtx->pStateTracker ? toCtx->pStateTracker : fromCtx->pStateTracker; 626 627 CRASSERT(pState); 628 CRASSERT(!toCtx || !fromCtx || toCtx->pStateTracker == fromCtx->pStateTracker); 629 620 630 if (!fromCtx) 621 631 return; 622 632 623 if ( g_bVBoxEnableDiffOnMakeCurrent && toCtx && toCtx != fromCtx)633 if (pState->fVBoxEnableDiffOnMakeCurrent && toCtx && toCtx != fromCtx) 624 634 crStateSyncHWErrorState(fromCtx); 625 635 … … 631 641 void crStateSwitchPostprocess(CRContext *toCtx, CRContext *fromCtx, GLuint idDrawFBO, GLuint idReadFBO) 632 642 { 643 PCRStateTracker pState = toCtx->pStateTracker ? toCtx->pStateTracker : fromCtx->pStateTracker; 644 645 CRASSERT(pState); 646 CRASSERT(!toCtx || !fromCtx || toCtx->pStateTracker == fromCtx->pStateTracker); 647 633 648 if (!toCtx) 634 649 return; … … 638 653 #endif 639 654 640 if ( g_bVBoxEnableDiffOnMakeCurrent && fromCtx && toCtx != fromCtx)641 { 642 CR_STATE_CLEAN_HW_ERR_WARN( "error on make current");643 } 644 } 655 if (pState->fVBoxEnableDiffOnMakeCurrent && fromCtx && toCtx != fromCtx) 656 { 657 CR_STATE_CLEAN_HW_ERR_WARN(pState, "error on make current"); 658 } 659 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_enable.c
r69392 r78375 13 13 GLenum cap, GLboolean val) 14 14 { 15 PCRStateTracker pState = g->pStateTracker; 15 16 unsigned int i; 16 17 i = cap - GL_CLIP_PLANE0; … … 56 57 * for an example of why). */ 57 58 58 crStateCurrentRecover( 59 crStateColorMaterialRecover( 59 crStateCurrentRecover(pState); 60 crStateColorMaterialRecover(pState); 60 61 } 61 62 g->lighting.colorMaterial = val; … … 71 72 } 72 73 else { 73 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(GL_COLOR_SUM_EXT) - No support for secondary color!");74 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(GL_COLOR_SUM_EXT) - No support for secondary color!"); 74 75 return; 75 76 } … … 164 165 } 165 166 else { 166 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(GL_REGISTER_COMBINERS_NV) - No support for NV_register_combiners");167 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(GL_REGISTER_COMBINERS_NV) - No support for NV_register_combiners"); 167 168 return; 168 169 } … … 177 178 } 178 179 else { 179 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(GL_PER_STAGE_CONSTANTS_NV) - No support for NV_register_combiners2");180 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(GL_PER_STAGE_CONSTANTS_NV) - No support for NV_register_combiners2"); 180 181 return; 181 182 } … … 190 191 } 191 192 else { 192 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap);193 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap); 193 194 return; 194 195 } … … 237 238 } 238 239 else { 239 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap);240 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap); 240 241 return; 241 242 } … … 273 274 if (g->texture.curTextureUnit != 0) 274 275 { 275 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "Map stuff was enabled while the current texture unit was not GL_TEXTURE0_ARB!" );276 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "Map stuff was enabled while the current texture unit was not GL_TEXTURE0_ARB!" ); 276 277 return; 277 278 } … … 335 336 } 336 337 else { 337 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap);338 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap); 338 339 return; 339 340 } … … 351 352 } 352 353 else { 353 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap);354 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap); 354 355 return; 355 356 } … … 367 368 } 368 369 else { 369 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap);370 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap); 370 371 return; 371 372 } … … 427 428 } 428 429 else { 429 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap);430 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap); 430 431 return; 431 432 } … … 440 441 } 441 442 else { 442 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap);443 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable(0x%x)", cap); 443 444 return; 444 445 } … … 493 494 #endif 494 495 if (val) 495 crStateEnableClientState( cap);496 crStateEnableClientState(pState, cap); 496 497 else 497 crStateDisableClientState( cap);498 crStateDisableClientState(pState, cap); 498 499 break; 499 500 #ifdef CR_EXT_stencil_two_side … … 505 506 #endif 506 507 default: 507 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable called with bogus cap: 0x%x", cap);508 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEnable/glDisable called with bogus cap: 0x%x", cap); 508 509 return; 509 510 } … … 511 512 512 513 513 void STATE_APIENTRY crStateEnable ( GLenum cap)514 void STATE_APIENTRY crStateEnable (PCRStateTracker pState, GLenum cap) 514 515 { 515 CRContext *g = GetCurrentContext( );516 CRStateBits *sb = GetCurrentBits( );516 CRContext *g = GetCurrentContext(pState); 517 CRStateBits *sb = GetCurrentBits(pState); 517 518 518 519 if (g->current.inBeginEnd) 519 520 { 520 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glEnable called in begin/end");521 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glEnable called in begin/end"); 521 522 return; 522 523 } … … 528 529 529 530 530 void STATE_APIENTRY crStateDisable ( GLenum cap)531 void STATE_APIENTRY crStateDisable (PCRStateTracker pState, GLenum cap) 531 532 { 532 CRContext *g = GetCurrentContext( );533 CRStateBits *sb = GetCurrentBits( );533 CRContext *g = GetCurrentContext(pState); 534 CRStateBits *sb = GetCurrentBits(pState); 534 535 535 536 if (g->current.inBeginEnd) 536 537 { 537 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glDisable called in begin/end");538 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glDisable called in begin/end"); 538 539 return; 539 540 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_error.c
r78190 r78375 5 5 */ 6 6 7 #include "state/cr_statetypes.h" 7 8 #include "state/cr_stateerror.h" 8 #include "state/cr_statetypes.h"9 9 #include "state.h" 10 10 #include "cr_error.h" … … 14 14 #include <iprt/env.h> 15 15 16 void crStateError( int line, const char *file, GLenum error, const char *format, ... )16 void crStateError(PCRStateTracker pState, int line, const char *file, GLenum error, const char *format, ... ) 17 17 { 18 CRContext *g = GetCurrentContext( );18 CRContext *g = GetCurrentContext(pState); 19 19 char errstr[8096]; 20 20 va_list args; … … 70 70 71 71 72 GLenum STATE_APIENTRY crStateGetError( void)72 GLenum STATE_APIENTRY crStateGetError(PCRStateTracker pState) 73 73 { 74 CRContext *g = GetCurrentContext( );74 CRContext *g = GetCurrentContext(pState); 75 75 GLenum e = g->error; 76 76 77 77 if (g->current.inBeginEnd) 78 78 { 79 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,79 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 80 80 "glStateGetError() called between glBegin/glEnd" ); 81 81 return 0; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_evaluators.c
r78105 r78375 41 41 { 42 42 CREvaluatorState *e = &ctx->eval; 43 CRStateBits *sb = GetCurrentBits( );43 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 44 44 CREvaluatorBits *eb = &(sb->eval); 45 45 GLint i; … … 63 63 { 64 64 CREvaluatorState *e = &ctx->eval; 65 CRStateBits *sb = GetCurrentBits( );65 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 66 66 CREvaluatorBits *eb = &(sb->eval); 67 67 GLint i; … … 111 111 { 112 112 CREvaluatorState *e = &ctx->eval; 113 CRStateBits *sb = GetCurrentBits( );113 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 114 114 CREvaluatorBits *eb = &(sb->eval); 115 115 static GLfloat vertex[4] = { 0.0, 0.0, 0.0, 1.0 }; … … 324 324 */ 325 325 static void 326 map1( GLenum target, GLfloat u1, GLfloat u2, GLint ustride,326 map1(PCRStateTracker pState, GLenum target, GLfloat u1, GLfloat u2, GLint ustride, 327 327 GLint uorder, const GLvoid * points, GLenum type) 328 328 { 329 CRContext *g = GetCurrentContext( );329 CRContext *g = GetCurrentContext(pState); 330 330 CREvaluatorState *e = &(g->eval); 331 CRStateBits *sb = GetCurrentBits( );331 CRStateBits *sb = GetCurrentBits(pState); 332 332 CREvaluatorBits *eb = &(sb->eval); 333 333 CRTextureState *t = &(g->texture); … … 337 337 338 338 if (g->current.inBeginEnd) { 339 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,339 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 340 340 "Map1d called in begin/end"); 341 341 return; … … 347 347 348 348 if (u1 == u2) { 349 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap1d(u1==u2)");349 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap1d(u1==u2)"); 350 350 return; 351 351 } 352 352 if (uorder < 1 || uorder > MAX_EVAL_ORDER) { 353 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap1d(bad uorder)");353 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap1d(bad uorder)"); 354 354 return; 355 355 } 356 356 if (!points) { 357 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,357 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 358 358 "glMap1d(null points)"); 359 359 return; … … 372 372 break; 373 373 default: 374 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMap1d(bad target)");374 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMap1d(bad target)"); 375 375 return; 376 376 } … … 381 381 382 382 if (k == 0) { 383 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMap1d(k=0)");383 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMap1d(k=0)"); 384 384 return; 385 385 } 386 386 387 387 if (ustride < k) { 388 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap1d(bad ustride");388 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap1d(bad ustride"); 389 389 return; 390 390 } … … 392 392 if (t->curTextureUnit != 0) { 393 393 /* See OpenGL 1.2.1 spec, section F.2.13 */ 394 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,394 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 395 395 "glMap1d(current texture unit must be zero)"); 396 396 return; … … 418 418 419 419 void STATE_APIENTRY 420 crStateMap1f( GLenum target, GLfloat u1, GLfloat u2,420 crStateMap1f(PCRStateTracker pState, GLenum target, GLfloat u1, GLfloat u2, 421 421 GLint stride, GLint order, const GLfloat * points) 422 422 { 423 map1( target, u1, u2, stride, order, points, GL_FLOAT);423 map1(pState, target, u1, u2, stride, order, points, GL_FLOAT); 424 424 } 425 425 426 426 void STATE_APIENTRY 427 crStateMap1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,427 crStateMap1d(PCRStateTracker pState, GLenum target, GLdouble u1, GLdouble u2, GLint stride, 428 428 GLint order, const GLdouble * points) 429 429 { 430 map1( target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE);430 map1(pState, target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE); 431 431 } 432 432 433 433 static void 434 map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,434 map2(PCRStateTracker pState, GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, 435 435 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, 436 436 const GLvoid * points, GLenum type) 437 437 { 438 CRContext *g = GetCurrentContext( );439 CRStateBits *sb = GetCurrentBits( );438 CRContext *g = GetCurrentContext(pState); 439 CRStateBits *sb = GetCurrentBits(pState); 440 440 CREvaluatorState *e = &(g->eval); 441 441 CREvaluatorBits *eb = &(sb->eval); … … 448 448 449 449 if (g->current.inBeginEnd) { 450 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glMap2d()");450 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glMap2d()"); 451 451 return; 452 452 } … … 455 455 456 456 if (u1 == u2) { 457 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()");457 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()"); 458 458 return; 459 459 } 460 460 461 461 if (v1 == v2) { 462 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()");462 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()"); 463 463 return; 464 464 } 465 465 466 466 if (uorder < 1 || uorder > MAX_EVAL_ORDER) { 467 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()");467 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()"); 468 468 return; 469 469 } 470 470 471 471 if (vorder < 1 || vorder > MAX_EVAL_ORDER) { 472 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()");472 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()"); 473 473 return; 474 474 } … … 486 486 break; 487 487 default: 488 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMap2d()");488 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMap2d()"); 489 489 return; 490 490 } … … 500 500 501 501 if (k == 0) { 502 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMap2d()");502 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMap2d()"); 503 503 return; 504 504 } 505 505 506 506 if (ustride < k) { 507 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()");507 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()"); 508 508 return; 509 509 } 510 510 if (vstride < k) { 511 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()");511 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMap2d()"); 512 512 return; 513 513 } … … 520 520 if (t->curTextureUnit != 0) { 521 521 /* See OpenGL 1.2.1 spec, section F.2.13 */ 522 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glMap2d()");522 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glMap2d()"); 523 523 return; 524 524 } … … 550 550 551 551 void STATE_APIENTRY 552 crStateMap2f( GLenum target, GLfloat u1, GLfloat u2,552 crStateMap2f(PCRStateTracker pState, GLenum target, GLfloat u1, GLfloat u2, 553 553 GLint ustride, GLint uorder, 554 554 GLfloat v1, GLfloat v2, 555 555 GLint vstride, GLint vorder, const GLfloat * points) 556 556 { 557 map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, 558 points, GL_FLOAT); 557 map2(pState, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points, GL_FLOAT); 559 558 } 560 559 561 560 562 561 void STATE_APIENTRY 563 crStateMap2d( GLenum target, GLdouble u1, GLdouble u2,562 crStateMap2d(PCRStateTracker pState, GLenum target, GLdouble u1, GLdouble u2, 564 563 GLint ustride, GLint uorder, 565 564 GLdouble v1, GLdouble v2, 566 565 GLint vstride, GLint vorder, const GLdouble * points) 567 566 { 568 map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder, 569 (GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE); 567 map2(pState, target, (GLfloat) u1, (GLfloat) u2, ustride, uorder, (GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE); 570 568 } 571 569 572 570 void STATE_APIENTRY 573 crStateGetMapdv( GLenum target, GLenum query, GLdouble * v)574 { 575 CRContext *g = GetCurrentContext( );576 CRStateBits *sb = GetCurrentBits( );571 crStateGetMapdv(PCRStateTracker pState, GLenum target, GLenum query, GLdouble * v) 572 { 573 CRContext *g = GetCurrentContext(pState); 574 CRStateBits *sb = GetCurrentBits(pState); 577 575 CREvaluatorState *e = &(g->eval); 578 576 GLint size; … … 581 579 582 580 if (g->current.inBeginEnd) { 583 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,581 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 584 582 "Map1d called in begin/end"); 585 583 return; … … 594 592 595 593 if (i < 0 || i >= GLEVAL_TOT) { 596 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,594 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 597 595 "GetMapdv: invalid target: %d", target); 598 596 return; … … 617 615 break; 618 616 default: 619 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,617 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 620 618 "GetMapdv: invalid target: %d", target); 621 619 return; … … 638 636 break; 639 637 default: 640 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,638 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 641 639 "GetMapdv: invalid target: %d", target); 642 640 return; … … 646 644 647 645 void STATE_APIENTRY 648 crStateGetMapfv( GLenum target, GLenum query, GLfloat * v)649 { 650 CRContext *g = GetCurrentContext( );651 CRStateBits *sb = GetCurrentBits( );646 crStateGetMapfv(PCRStateTracker pState, GLenum target, GLenum query, GLfloat * v) 647 { 648 CRContext *g = GetCurrentContext(pState); 649 CRStateBits *sb = GetCurrentBits(pState); 652 650 CREvaluatorState *e = &(g->eval); 653 651 GLint size; … … 656 654 657 655 if (g->current.inBeginEnd) { 658 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,656 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 659 657 "Map1d called in begin/end"); 660 658 return; … … 667 665 i = target - GL_MAP2_COLOR_4; 668 666 if (i < 0 || i >= GLEVAL_TOT) { 669 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,667 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 670 668 "GetMapfv: invalid target: %d", target); 671 669 return; … … 689 687 break; 690 688 default: 691 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,689 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 692 690 "GetMapfv: invalid target: %d", target); 693 691 return; … … 710 708 break; 711 709 default: 712 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,710 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 713 711 "GetMapfv: invalid target: %d", target); 714 712 return; … … 718 716 719 717 void STATE_APIENTRY 720 crStateGetMapiv( GLenum target, GLenum query, GLint * v)721 { 722 CRContext *g = GetCurrentContext( );723 CRStateBits *sb = GetCurrentBits( );718 crStateGetMapiv(PCRStateTracker pState, GLenum target, GLenum query, GLint * v) 719 { 720 CRContext *g = GetCurrentContext(pState); 721 CRStateBits *sb = GetCurrentBits(pState); 724 722 CREvaluatorState *e = &(g->eval); 725 723 GLint size; … … 728 726 729 727 if (g->current.inBeginEnd) { 730 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,728 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 731 729 "Map1d called in begin/end"); 732 730 return; … … 739 737 i = target - GL_MAP2_COLOR_4; 740 738 if (i < 0 || i >= GLEVAL_TOT) { 741 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,739 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 742 740 "GetMapiv: invalid target: %d", target); 743 741 return; … … 761 759 break; 762 760 default: 763 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,761 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 764 762 "GetMapiv: invalid target: %d", target); 765 763 return; … … 782 780 break; 783 781 default: 784 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,782 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 785 783 "GetMapiv: invalid target: %d", target); 786 784 return; … … 790 788 791 789 void STATE_APIENTRY 792 crStateMapGrid1f( GLint un, GLfloat u1, GLfloat u2)793 { 794 CRContext *g = GetCurrentContext( );795 CRStateBits *sb = GetCurrentBits( );790 crStateMapGrid1f(PCRStateTracker pState, GLint un, GLfloat u1, GLfloat u2) 791 { 792 CRContext *g = GetCurrentContext(pState); 793 CRStateBits *sb = GetCurrentBits(pState); 796 794 CREvaluatorState *e = &(g->eval); 797 795 CREvaluatorBits *eb = &(sb->eval); 798 796 799 797 if (g->current.inBeginEnd) { 800 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,798 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 801 799 "Map1d called in begin/end"); 802 800 return; … … 806 804 807 805 if (un < 1) { 808 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMapGrid1f(bad un)");806 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMapGrid1f(bad un)"); 809 807 return; 810 808 } … … 819 817 820 818 void STATE_APIENTRY 821 crStateMapGrid1d( GLint un, GLdouble u1, GLdouble u2)822 { 823 crStateMapGrid1f( un, (GLfloat) u1, (GLfloat) u2);819 crStateMapGrid1d(PCRStateTracker pState, GLint un, GLdouble u1, GLdouble u2) 820 { 821 crStateMapGrid1f(pState, un, (GLfloat) u1, (GLfloat) u2); 824 822 } 825 823 826 824 827 825 void STATE_APIENTRY 828 crStateMapGrid2f( GLint un, GLfloat u1, GLfloat u2,826 crStateMapGrid2f(PCRStateTracker pState, GLint un, GLfloat u1, GLfloat u2, 829 827 GLint vn, GLfloat v1, GLfloat v2) 830 828 { 831 CRContext *g = GetCurrentContext( );832 CRStateBits *sb = GetCurrentBits( );829 CRContext *g = GetCurrentContext(pState); 830 CRStateBits *sb = GetCurrentBits(pState); 833 831 CREvaluatorState *e = &(g->eval); 834 832 CREvaluatorBits *eb = &(sb->eval); 835 833 836 834 if (g->current.inBeginEnd) { 837 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,835 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 838 836 "Map1d called in begin/end"); 839 837 return; … … 843 841 844 842 if (un < 1) { 845 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMapGrid2f(bad un)");843 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMapGrid2f(bad un)"); 846 844 return; 847 845 } 848 846 if (vn < 1) { 849 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMapGrid2f(bad vn)");847 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMapGrid2f(bad vn)"); 850 848 return; 851 849 } … … 863 861 864 862 void STATE_APIENTRY 865 crStateMapGrid2d( GLint un, GLdouble u1, GLdouble u2,863 crStateMapGrid2d(PCRStateTracker pState, GLint un, GLdouble u1, GLdouble u2, 866 864 GLint vn, GLdouble v1, GLdouble v2) 867 865 { 868 crStateMapGrid2f( un, (GLfloat) u1, (GLfloat) u2,866 crStateMapGrid2f(pState, un, (GLfloat) u1, (GLfloat) u2, 869 867 vn, (GLfloat) v1, (GLfloat) v2); 870 868 } … … 874 872 CRContext *fromCtx, CRContext *toCtx) 875 873 { 874 PCRStateTracker pState = fromCtx->pStateTracker; 876 875 CREvaluatorState *from = &(fromCtx->eval); 877 876 CREvaluatorState *to = &(toCtx->eval); … … 879 878 CRbitvalue nbitID[CR_MAX_BITARRAY]; 880 879 880 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 881 881 882 for (j = 0; j < CR_MAX_BITARRAY; j++) 882 883 nbitID[j] = ~bitID[j]; … … 885 886 if (from->autoNormal != to->autoNormal) { 886 887 glAble able[2]; 887 able[0] = diff_api.Disable;888 able[1] = diff_api.Enable;888 able[0] = pState->diff_api.Disable; 889 able[1] = pState->diff_api.Enable; 889 890 able[to->autoNormal] (GL_AUTO_NORMAL); 890 891 FILLDIRTY(e->enable); … … 902 903 crMemcmp((const void *) from->eval1D[i].coeff, 903 904 (const void *) to->eval1D[i].coeff, size)) { 904 diff_api.Map1f(i + GL_MAP1_COLOR_4, to->eval1D[i].u1,905 to->eval1D[i].u2, gleval_sizes[i], to->eval1D[i].order,906 to->eval1D[i].coeff);905 pState->diff_api.Map1f(i + GL_MAP1_COLOR_4, to->eval1D[i].u1, 906 to->eval1D[i].u2, gleval_sizes[i], to->eval1D[i].order, 907 to->eval1D[i].coeff); 907 908 FILLDIRTY(e->dirty); 908 909 FILLDIRTY(e->eval1D[i]); … … 924 925 crMemcmp((const void *) from->eval2D[i].coeff, 925 926 (const void *) to->eval2D[i].coeff, size)) { 926 diff_api.Map2f(i + GL_MAP2_COLOR_4,927 to->eval2D[i].u1, to->eval2D[i].u2,928 gleval_sizes[i], to->eval2D[i].uorder,929 to->eval2D[i].v1, to->eval2D[i].v2,930 gleval_sizes[i], to->eval2D[i].vorder,931 to->eval2D[i].coeff);927 pState->diff_api.Map2f(i + GL_MAP2_COLOR_4, 928 to->eval2D[i].u1, to->eval2D[i].u2, 929 gleval_sizes[i], to->eval2D[i].uorder, 930 to->eval2D[i].v1, to->eval2D[i].v2, 931 gleval_sizes[i], to->eval2D[i].vorder, 932 to->eval2D[i].coeff); 932 933 FILLDIRTY(e->dirty); 933 934 FILLDIRTY(e->eval2D[i]); … … 940 941 from->u21D != to->u21D || 941 942 from->un1D != to->un1D) { 942 diff_api.MapGrid1d(to->un1D, to->u11D, to->u21D);943 pState->diff_api.MapGrid1d(to->un1D, to->u11D, to->u21D); 943 944 FILLDIRTY(e->dirty); 944 945 FILLDIRTY(e->grid1D); … … 953 954 from->v22D != to->v22D || 954 955 from->vn2D != to->vn2D) { 955 diff_api.MapGrid2d(to->un2D, to->u12D, to->u22D,956 to->vn2D, to->v12D, to->v22D);956 pState->diff_api.MapGrid2d(to->un2D, to->u12D, to->u22D, 957 to->vn2D, to->v12D, to->v22D); 957 958 FILLDIRTY(e->dirty); 958 959 FILLDIRTY(e->grid1D); … … 967 968 CRContext *fromCtx, CRContext *toCtx) 968 969 { 970 PCRStateTracker pState = fromCtx->pStateTracker; 969 971 CREvaluatorState *from = &(fromCtx->eval); 970 972 CREvaluatorState *to = &(toCtx->eval); … … 973 975 CRbitvalue nbitID[CR_MAX_BITARRAY]; 974 976 977 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 978 975 979 for (j = 0; j < CR_MAX_BITARRAY; j++) 976 980 nbitID[j] = ~bitID[j]; 977 981 978 able[0] = diff_api.Disable;979 able[1] = diff_api.Enable;982 able[0] = pState->diff_api.Disable; 983 able[1] = pState->diff_api.Enable; 980 984 981 985 if (CHECKDIRTY(e->enable, bitID)) { … … 1002 1006 crMemcmp((const void *) from->eval1D[i].coeff, 1003 1007 (const void *) to->eval1D[i].coeff, size)) { 1004 diff_api.Map1f(i + GL_MAP1_COLOR_4, to->eval1D[i].u1,1005 to->eval1D[i].u2, gleval_sizes[i], to->eval1D[i].order,1006 to->eval1D[i].coeff);1008 pState->diff_api.Map1f(i + GL_MAP1_COLOR_4, to->eval1D[i].u1, 1009 to->eval1D[i].u2, gleval_sizes[i], to->eval1D[i].order, 1010 to->eval1D[i].coeff); 1007 1011 from->eval1D[i].order = to->eval1D[i].order; 1008 1012 from->eval1D[i].u1 = to->eval1D[i].u1; … … 1034 1038 crMemcmp((const void *) from->eval2D[i].coeff, 1035 1039 (const void *) to->eval2D[i].coeff, size)) { 1036 diff_api.Map2f(i + GL_MAP2_COLOR_4,1037 to->eval2D[i].u1, to->eval2D[i].u2,1038 gleval_sizes[i], to->eval2D[i].uorder,1039 to->eval2D[i].v1, to->eval2D[i].v2,1040 gleval_sizes[i], to->eval2D[i].vorder,1041 to->eval2D[i].coeff);1040 pState->diff_api.Map2f(i + GL_MAP2_COLOR_4, 1041 to->eval2D[i].u1, to->eval2D[i].u2, 1042 gleval_sizes[i], to->eval2D[i].uorder, 1043 to->eval2D[i].v1, to->eval2D[i].v2, 1044 gleval_sizes[i], to->eval2D[i].vorder, 1045 to->eval2D[i].coeff); 1042 1046 from->eval2D[i].uorder = to->eval2D[i].uorder; 1043 1047 from->eval2D[i].vorder = to->eval2D[i].vorder; … … 1056 1060 from->u21D != to->u21D || 1057 1061 from->un1D != to->un1D) { 1058 diff_api.MapGrid1d(to->un1D, to->u11D, to->u21D);1062 pState->diff_api.MapGrid1d(to->un1D, to->u11D, to->u21D); 1059 1063 from->u11D = to->u11D; 1060 1064 from->u21D = to->u21D; … … 1070 1074 from->v22D != to->v22D || 1071 1075 from->vn2D != to->vn2D) { 1072 diff_api.MapGrid2d(to->un2D, to->u12D, to->u22D,1073 to->vn2D, to->v12D, to->v22D);1076 pState->diff_api.MapGrid2d(to->un2D, to->u12D, to->u22D, 1077 to->vn2D, to->v12D, to->v22D); 1074 1078 from->u12D = to->u12D; 1075 1079 from->u22D = to->u22D; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_feedback.c
r69392 r78375 120 120 */ 121 121 static GLuint 122 clip_point(const CRVertex *v) 123 { 124 CRContext *g = GetCurrentContext(); 122 clip_point(CRContext *g, const CRVertex *v) 123 { 125 124 GLuint mask = 0; 126 125 GLuint i; … … 165 164 */ 166 165 static GLboolean 167 clip_line( const CRVertex *v0in, const CRVertex *v1in,166 clip_line(CRContext *g, const CRVertex *v0in, const CRVertex *v1in, 168 167 CRVertex *v0new, CRVertex *v1new) 169 168 { … … 174 173 /* XXX need to do user-clip planes */ 175 174 176 code0 = clip_point( v0in);177 code1 = clip_point( v1in);175 code0 = clip_point(g, v0in); 176 code1 = clip_point(g, v1in); 178 177 if (code0 & code1) 179 178 return GL_FALSE; /* totally clipped */ … … 462 461 */ 463 462 static void 464 feedback_vertex(const CRVertex *v) 465 { 466 CRContext *g = GetCurrentContext(); 463 feedback_vertex(CRContext *g, const CRVertex *v) 464 { 467 465 CRFeedbackState *f = &(g->feedback); 468 466 CRTransformState *t = &(g->transform); … … 514 512 515 513 static void 516 feedback_rasterpos(void) 517 { 518 CRContext *g = GetCurrentContext(); 514 feedback_rasterpos(CRContext *g) 515 { 519 516 CRVertex *tv = g->vBuffer + g->vCount; 520 517 CRVertex v; … … 535 532 COPY_4V(v.attrib[VERT_ATTRIB_TEX0] , tv->attrib[VERT_ATTRIB_TEX0]); 536 533 537 feedback_vertex( &v);534 feedback_vertex(g, &v); 538 535 } 539 536 540 537 541 538 static void 542 feedback_point(const CRVertex *v) 543 { 544 CRContext *g = GetCurrentContext(); 539 feedback_point(CRContext *g, const CRVertex *v) 540 { 545 541 CRFeedbackState *f = &(g->feedback); 546 if (clip_point( v) == 0)542 if (clip_point(g, v) == 0) 547 543 { 548 544 CRVertex c = *v; 549 545 MAP_POINT(c.winPos, c.clipPos, g->viewport); 550 546 FEEDBACK_TOKEN((GLfloat) GL_POINT_TOKEN); 551 feedback_vertex( &c);547 feedback_vertex(g, &c); 552 548 } 553 549 } … … 555 551 556 552 static void 557 feedback_line(const CRVertex *v0, const CRVertex *v1, GLboolean reset) 558 { 559 CRContext *g = GetCurrentContext(); 553 feedback_line(CRContext *g, const CRVertex *v0, const CRVertex *v1, GLboolean reset) 554 { 560 555 CRFeedbackState *f = &(g->feedback); 561 556 CRVertex c0, c1; 562 if (clip_line( v0, v1, &c0, &c1))557 if (clip_line(g, v0, v1, &c0, &c1)) 563 558 { 564 559 MAP_POINT(c0.winPos, c0.clipPos, g->viewport); … … 568 563 else 569 564 FEEDBACK_TOKEN((GLfloat) GL_LINE_TOKEN); 570 feedback_vertex( &c0);571 feedback_vertex( &c1);565 feedback_vertex(g, &c0); 566 feedback_vertex(g, &c1); 572 567 } 573 568 } … … 575 570 576 571 static void 577 feedback_triangle(const CRVertex *v0, const CRVertex *v1, const CRVertex *v2) 578 { 579 CRContext *g = GetCurrentContext(); 572 feedback_triangle(CRContext *g, const CRVertex *v0, const CRVertex *v1, const CRVertex *v2) 573 { 580 574 CRFeedbackState *f = &(g->feedback); 581 575 CRVertex vlist[3], vclipped[8]; … … 590 584 for (i = 0; i < n; i++) { 591 585 MAP_POINT(vclipped[i].winPos, vclipped[i].clipPos, g->viewport); 592 feedback_vertex( vclipped + i);593 } 594 } 595 596 597 void STATE_APIENTRY 598 crStateFeedbackVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w)599 { 600 CRContext *g = GetCurrentContext( );586 feedback_vertex(g, vclipped + i); 587 } 588 } 589 590 591 void STATE_APIENTRY 592 crStateFeedbackVertex4f(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 593 { 594 CRContext *g = GetCurrentContext(pState); 601 595 CRTransformState *t = &(g->transform); 602 596 CRPolygonState *p = &(g->polygon); … … 621 615 case GL_POINTS: 622 616 CRASSERT(g->vCount == 0); 623 feedback_point( v);617 feedback_point(g, v); 624 618 break; 625 619 case GL_LINES: … … 631 625 { 632 626 CRASSERT(g->vCount == 1); 633 feedback_line(g ->vBuffer + 0, g->vBuffer + 1, g->lineReset);627 feedback_line(g, g->vBuffer + 0, g->vBuffer + 1, g->lineReset); 634 628 g->vCount = 0; 635 629 } … … 643 637 { 644 638 CRASSERT(g->vCount == 1); 645 feedback_line(g ->vBuffer + 0, g->vBuffer + 1, g->lineReset);639 feedback_line(g, g->vBuffer + 0, g->vBuffer + 1, g->lineReset); 646 640 g->vBuffer[0] = g->vBuffer[1]; 647 641 g->lineReset = GL_FALSE; … … 657 651 else if (g->vCount == 1) 658 652 { 659 feedback_line(g ->vBuffer + 0, g->vBuffer + 1, g->lineReset);653 feedback_line(g, g->vBuffer + 0, g->vBuffer + 1, g->lineReset); 660 654 g->lineReset = GL_FALSE; 661 655 g->lineLoop = GL_TRUE; … … 667 661 CRASSERT(g->lineReset == GL_FALSE); 668 662 g->lineLoop = GL_FALSE; 669 feedback_line(g ->vBuffer + 1, g->vBuffer + 2, g->lineReset);663 feedback_line(g, g->vBuffer + 1, g->vBuffer + 2, g->lineReset); 670 664 g->vBuffer[1] = g->vBuffer[2]; 671 665 /* leave g->vCount at 2 */ … … 680 674 { 681 675 CRASSERT(g->vCount == 2); 682 feedback_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);676 feedback_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 683 677 g->vCount = 0; 684 678 } … … 691 685 else if (g->vCount == 2) 692 686 { 693 feedback_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);687 feedback_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 694 688 g->vCount = 3; 695 689 } … … 697 691 { 698 692 CRASSERT(g->vCount == 3); 699 feedback_triangle(g ->vBuffer + 1, g->vBuffer + 3, g->vBuffer + 2);693 feedback_triangle(g, g->vBuffer + 1, g->vBuffer + 3, g->vBuffer + 2); 700 694 g->vBuffer[0] = g->vBuffer[2]; 701 695 g->vBuffer[1] = g->vBuffer[3]; … … 711 705 { 712 706 CRASSERT(g->vCount == 2); 713 feedback_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);707 feedback_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 714 708 g->vBuffer[1] = g->vBuffer[2]; 715 709 /* leave g->vCount = 2 */ … … 724 718 { 725 719 CRASSERT(g->vCount == 3); 726 feedback_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);727 feedback_triangle(g ->vBuffer + 0, g->vBuffer + 2, g->vBuffer + 3);720 feedback_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 721 feedback_triangle(g, g->vBuffer + 0, g->vBuffer + 2, g->vBuffer + 3); 728 722 g->vCount = 0; 729 723 } … … 737 731 { 738 732 CRASSERT(g->vCount == 3); 739 feedback_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);740 feedback_triangle(g ->vBuffer + 1, g->vBuffer + 3, g->vBuffer + 2);733 feedback_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 734 feedback_triangle(g, g->vBuffer + 1, g->vBuffer + 3, g->vBuffer + 2); 741 735 g->vBuffer[0] = g->vBuffer[2]; 742 736 g->vBuffer[1] = g->vBuffer[3]; … … 749 743 case GL_POINT: 750 744 CRASSERT(g->vCount == 0); 751 feedback_point( v);745 feedback_point(g, v); 752 746 break; 753 747 case GL_LINE: … … 759 753 else if (g->vCount == 1) 760 754 { 761 feedback_line(g ->vBuffer + 0, g->vBuffer + 1, g->lineReset);755 feedback_line(g, g->vBuffer + 0, g->vBuffer + 1, g->lineReset); 762 756 g->lineReset = GL_FALSE; 763 757 g->lineLoop = GL_TRUE; … … 769 763 CRASSERT(g->lineReset == GL_FALSE); 770 764 g->lineLoop = GL_FALSE; 771 feedback_line(g ->vBuffer + 1, g->vBuffer + 2, g->lineReset);765 feedback_line(g, g->vBuffer + 1, g->vBuffer + 2, g->lineReset); 772 766 g->vBuffer[1] = g->vBuffer[2]; 773 767 /* leave g->vCount at 2 */ … … 783 777 { 784 778 CRASSERT(g->vCount == 2); 785 feedback_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);779 feedback_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 786 780 g->vBuffer[1] = g->vBuffer[2]; 787 781 /* leave g->vCount = 2 */ … … 799 793 800 794 void STATE_APIENTRY 801 crStateFeedbackBegin( GLenum mode)802 { 803 CRContext *g = GetCurrentContext( );804 805 crStateBegin( mode);795 crStateFeedbackBegin(PCRStateTracker pState, GLenum mode) 796 { 797 CRContext *g = GetCurrentContext(pState); 798 799 crStateBegin(pState, mode); 806 800 807 801 g->vCount = 0; … … 812 806 813 807 void STATE_APIENTRY 814 crStateFeedbackEnd( void)815 { 816 CRContext *g = GetCurrentContext( );808 crStateFeedbackEnd(PCRStateTracker pState) 809 { 810 CRContext *g = GetCurrentContext(pState); 817 811 818 812 if ( (g->current.mode == GL_LINE_LOOP || … … 822 816 /* draw the last line segment */ 823 817 if (g->lineLoop) 824 feedback_line(g ->vBuffer + 1, g->vBuffer + 0, GL_FALSE);818 feedback_line(g, g->vBuffer + 1, g->vBuffer + 0, GL_FALSE); 825 819 else 826 feedback_line(g ->vBuffer + 2, g->vBuffer + 0, GL_FALSE);827 } 828 829 crStateEnd( );830 } 831 832 833 void STATE_APIENTRY 834 crStateFeedbackBuffer( GLsizei size, GLenum type, GLfloat * buffer)835 { 836 CRContext *g = GetCurrentContext( );820 feedback_line(g, g->vBuffer + 2, g->vBuffer + 0, GL_FALSE); 821 } 822 823 crStateEnd(pState); 824 } 825 826 827 void STATE_APIENTRY 828 crStateFeedbackBuffer(PCRStateTracker pState, GLsizei size, GLenum type, GLfloat * buffer) 829 { 830 CRContext *g = GetCurrentContext(pState); 837 831 CRFeedbackState *f = &(g->feedback); 838 832 839 833 if (g->current.inBeginEnd) 840 834 { 841 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,835 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 842 836 "FeedbackBuffer called in begin/end"); 843 837 return; … … 846 840 if (g->renderMode == GL_FEEDBACK) 847 841 { 848 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,842 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 849 843 "Invalid Operation GL_FEEDBACK"); 850 844 return; … … 852 846 if (size < 0) 853 847 { 854 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,848 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 855 849 "Invalid Value size < 0"); 856 850 return; … … 858 852 if (!buffer) 859 853 { 860 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,854 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 861 855 "Invalid Value buffer = NULL"); 862 856 f->bufferSize = 0; … … 884 878 break; 885 879 default: 886 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "invalid type");880 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "invalid type"); 887 881 return; 888 882 } … … 896 890 897 891 void STATE_APIENTRY 898 crStatePassThrough( GLfloat token)899 { 900 CRContext *g = GetCurrentContext( );892 crStatePassThrough(PCRStateTracker pState, GLfloat token) 893 { 894 CRContext *g = GetCurrentContext(pState); 901 895 CRFeedbackState *f = &(g->feedback); 902 896 903 897 if (g->current.inBeginEnd) 904 898 { 905 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,899 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 906 900 "PassThrough called in begin/end"); 907 901 return; … … 923 917 */ 924 918 void STATE_APIENTRY 925 crStateFeedbackGetBooleanv( GLenum pname, GLboolean * params)926 { 927 CRContext *g = GetCurrentContext( );919 crStateFeedbackGetBooleanv(PCRStateTracker pState, GLenum pname, GLboolean * params) 920 { 921 CRContext *g = GetCurrentContext(pState); 928 922 929 923 switch (pname) … … 946 940 947 941 void STATE_APIENTRY 948 crStateFeedbackGetDoublev( GLenum pname, GLdouble * params)949 { 950 CRContext *g = GetCurrentContext( );942 crStateFeedbackGetDoublev(PCRStateTracker pState, GLenum pname, GLdouble * params) 943 { 944 CRContext *g = GetCurrentContext(pState); 951 945 952 946 switch (pname) … … 969 963 970 964 void STATE_APIENTRY 971 crStateFeedbackGetFloatv( GLenum pname, GLfloat * params)972 { 973 CRContext *g = GetCurrentContext( );965 crStateFeedbackGetFloatv(PCRStateTracker pState, GLenum pname, GLfloat * params) 966 { 967 CRContext *g = GetCurrentContext(pState); 974 968 975 969 switch (pname) … … 992 986 993 987 void STATE_APIENTRY 994 crStateFeedbackGetIntegerv( GLenum pname, GLint * params)995 { 996 CRContext *g = GetCurrentContext( );988 crStateFeedbackGetIntegerv(PCRStateTracker pState, GLenum pname, GLint * params) 989 { 990 CRContext *g = GetCurrentContext(pState); 997 991 998 992 switch (pname) … … 1015 1009 1016 1010 void STATE_APIENTRY 1017 crStateFeedbackDrawPixels( GLsizei width, GLsizei height, GLenum format,1011 crStateFeedbackDrawPixels(PCRStateTracker pState, GLsizei width, GLsizei height, GLenum format, 1018 1012 GLenum type, const GLvoid * pixels) 1019 1013 { 1020 CRContext *g = GetCurrentContext( );1014 CRContext *g = GetCurrentContext(pState); 1021 1015 CRFeedbackState *f = &(g->feedback); 1022 1016 … … 1029 1023 FEEDBACK_TOKEN((GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN); 1030 1024 1031 feedback_rasterpos( );1032 } 1033 1034 void STATE_APIENTRY 1035 crStateFeedbackCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height,1025 feedback_rasterpos(g); 1026 } 1027 1028 void STATE_APIENTRY 1029 crStateFeedbackCopyPixels(PCRStateTracker pState, GLint x, GLint y, GLsizei width, GLsizei height, 1036 1030 GLenum type) 1037 1031 { 1038 CRContext *g = GetCurrentContext( );1032 CRContext *g = GetCurrentContext(pState); 1039 1033 CRFeedbackState *f = &(g->feedback); 1040 1034 … … 1046 1040 1047 1041 FEEDBACK_TOKEN((GLfloat) (GLint) GL_COPY_PIXEL_TOKEN); 1048 feedback_rasterpos( );1049 } 1050 1051 void STATE_APIENTRY 1052 crStateFeedbackBitmap( GLsizei width, GLsizei height, GLfloat xorig,1042 feedback_rasterpos(g); 1043 } 1044 1045 void STATE_APIENTRY 1046 crStateFeedbackBitmap(PCRStateTracker pState, GLsizei width, GLsizei height, GLfloat xorig, 1053 1047 GLfloat yorig, GLfloat xmove, GLfloat ymove, 1054 1048 const GLubyte * bitmap) 1055 1049 { 1056 CRContext *g = GetCurrentContext( );1050 CRContext *g = GetCurrentContext(pState); 1057 1051 CRFeedbackState *f = &(g->feedback); 1058 1052 … … 1065 1059 FEEDBACK_TOKEN((GLfloat) (GLint) GL_BITMAP_TOKEN); 1066 1060 1067 feedback_rasterpos( );1061 feedback_rasterpos(g); 1068 1062 1069 1063 if (g->current.rasterValid) … … 1076 1070 1077 1071 void STATE_APIENTRY 1078 crStateFeedbackVertex4fv( const GLfloat * v)1079 { 1080 crStateFeedbackVertex4f( v[0], v[1], v[2], v[3]);1081 } 1082 1083 void STATE_APIENTRY 1084 crStateFeedbackVertex4s( GLshort v0, GLshort v1, GLshort v2, GLshort v3)1085 { 1086 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, (GLfloat) v2,1072 crStateFeedbackVertex4fv(PCRStateTracker pState, const GLfloat * v) 1073 { 1074 crStateFeedbackVertex4f(pState, v[0], v[1], v[2], v[3]); 1075 } 1076 1077 void STATE_APIENTRY 1078 crStateFeedbackVertex4s(PCRStateTracker pState, GLshort v0, GLshort v1, GLshort v2, GLshort v3) 1079 { 1080 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1087 1081 (GLfloat) v3); 1088 1082 } 1089 1083 1090 1084 void STATE_APIENTRY 1091 crStateFeedbackVertex4sv( const GLshort * v)1092 { 1093 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2],1085 crStateFeedbackVertex4sv(PCRStateTracker pState, const GLshort * v) 1086 { 1087 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1094 1088 (GLfloat) v[3]); 1095 1089 } 1096 1090 1097 1091 void STATE_APIENTRY 1098 crStateFeedbackVertex4i( GLint v0, GLint v1, GLint v2, GLint v3)1099 { 1100 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, (GLfloat) v2,1092 crStateFeedbackVertex4i(PCRStateTracker pState, GLint v0, GLint v1, GLint v2, GLint v3) 1093 { 1094 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1101 1095 (GLfloat) v3); 1102 1096 } 1103 1097 1104 1098 void STATE_APIENTRY 1105 crStateFeedbackVertex4iv( const GLint * v)1106 { 1107 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2],1099 crStateFeedbackVertex4iv(PCRStateTracker pState, const GLint * v) 1100 { 1101 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1108 1102 (GLfloat) v[3]); 1109 1103 } 1110 1104 1111 1105 void STATE_APIENTRY 1112 crStateFeedbackVertex4d( GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)1113 { 1114 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, (GLfloat) v2,1106 crStateFeedbackVertex4d(PCRStateTracker pState, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3) 1107 { 1108 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1115 1109 (GLfloat) v3); 1116 1110 } 1117 1111 1118 1112 void STATE_APIENTRY 1119 crStateFeedbackVertex4dv( const GLdouble * v)1120 { 1121 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2],1113 crStateFeedbackVertex4dv(PCRStateTracker pState, const GLdouble * v) 1114 { 1115 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1122 1116 (GLfloat) v[3]); 1123 1117 } 1124 1118 1125 1119 void STATE_APIENTRY 1126 crStateFeedbackVertex2i( GLint v0, GLint v1)1127 { 1128 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, 0.0f, 1.0f);1129 } 1130 1131 void STATE_APIENTRY 1132 crStateFeedbackVertex2iv( const GLint * v)1133 { 1134 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f);1135 } 1136 1137 void STATE_APIENTRY 1138 crStateFeedbackVertex2s( GLshort v0, GLshort v1)1139 { 1140 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, 0.0f, 1.0f);1141 } 1142 1143 void STATE_APIENTRY 1144 crStateFeedbackVertex2sv( const GLshort * v)1145 { 1146 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f);1147 } 1148 1149 void STATE_APIENTRY 1150 crStateFeedbackVertex2f( GLfloat v0, GLfloat v1)1151 { 1152 crStateFeedbackVertex4f( v0, v1, 0.0f, 1.0f);1153 } 1154 1155 void STATE_APIENTRY 1156 crStateFeedbackVertex2fv( const GLfloat * v)1157 { 1158 crStateFeedbackVertex4f( v[0], v[1], 0.0f, 1.0f);1159 } 1160 1161 void STATE_APIENTRY 1162 crStateFeedbackVertex2d( GLdouble v0, GLdouble v1)1163 { 1164 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, 0.0f, 1.0f);1165 } 1166 1167 void STATE_APIENTRY 1168 crStateFeedbackVertex2dv( const GLdouble * v)1169 { 1170 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f);1171 } 1172 1173 void STATE_APIENTRY 1174 crStateFeedbackVertex3i( GLint v0, GLint v1, GLint v2)1175 { 1176 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1.0f);1177 } 1178 1179 void STATE_APIENTRY 1180 crStateFeedbackVertex3iv( const GLint * v)1181 { 1182 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0f);1183 } 1184 1185 void STATE_APIENTRY 1186 crStateFeedbackVertex3s( GLshort v0, GLshort v1, GLshort v2)1187 { 1188 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1.0f);1189 } 1190 1191 void STATE_APIENTRY 1192 crStateFeedbackVertex3sv( const GLshort * v)1193 { 1194 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2],1120 crStateFeedbackVertex2i(PCRStateTracker pState, GLint v0, GLint v1) 1121 { 1122 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, 0.0f, 1.0f); 1123 } 1124 1125 void STATE_APIENTRY 1126 crStateFeedbackVertex2iv(PCRStateTracker pState, const GLint * v) 1127 { 1128 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f); 1129 } 1130 1131 void STATE_APIENTRY 1132 crStateFeedbackVertex2s(PCRStateTracker pState, GLshort v0, GLshort v1) 1133 { 1134 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, 0.0f, 1.0f); 1135 } 1136 1137 void STATE_APIENTRY 1138 crStateFeedbackVertex2sv(PCRStateTracker pState, const GLshort * v) 1139 { 1140 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f); 1141 } 1142 1143 void STATE_APIENTRY 1144 crStateFeedbackVertex2f(PCRStateTracker pState, GLfloat v0, GLfloat v1) 1145 { 1146 crStateFeedbackVertex4f(pState, v0, v1, 0.0f, 1.0f); 1147 } 1148 1149 void STATE_APIENTRY 1150 crStateFeedbackVertex2fv(PCRStateTracker pState, const GLfloat * v) 1151 { 1152 crStateFeedbackVertex4f(pState, v[0], v[1], 0.0f, 1.0f); 1153 } 1154 1155 void STATE_APIENTRY 1156 crStateFeedbackVertex2d(PCRStateTracker pState, GLdouble v0, GLdouble v1) 1157 { 1158 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, 0.0f, 1.0f); 1159 } 1160 1161 void STATE_APIENTRY 1162 crStateFeedbackVertex2dv(PCRStateTracker pState, const GLdouble * v) 1163 { 1164 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f); 1165 } 1166 1167 void STATE_APIENTRY 1168 crStateFeedbackVertex3i(PCRStateTracker pState, GLint v0, GLint v1, GLint v2) 1169 { 1170 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1.0f); 1171 } 1172 1173 void STATE_APIENTRY 1174 crStateFeedbackVertex3iv(PCRStateTracker pState, const GLint * v) 1175 { 1176 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0f); 1177 } 1178 1179 void STATE_APIENTRY 1180 crStateFeedbackVertex3s(PCRStateTracker pState, GLshort v0, GLshort v1, GLshort v2) 1181 { 1182 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1.0f); 1183 } 1184 1185 void STATE_APIENTRY 1186 crStateFeedbackVertex3sv(PCRStateTracker pState, const GLshort * v) 1187 { 1188 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1195 1189 1.0f); 1196 1190 } 1197 1191 1198 1192 void STATE_APIENTRY 1199 crStateFeedbackVertex3f( GLfloat v0, GLfloat v1, GLfloat v2)1200 { 1201 crStateFeedbackVertex4f( v0, v1, v2, 1.0f);1202 } 1203 1204 void STATE_APIENTRY 1205 crStateFeedbackVertex3fv( const GLfloat * v)1206 { 1207 crStateFeedbackVertex4f( v[0], v[1], v[2], 1.0f);1208 } 1209 1210 void STATE_APIENTRY 1211 crStateFeedbackVertex3d( GLdouble v0, GLdouble v1, GLdouble v2)1212 { 1213 crStateFeedbackVertex4f( (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1.0f);1214 } 1215 1216 void STATE_APIENTRY 1217 crStateFeedbackVertex3dv( const GLdouble * v)1218 { 1219 crStateFeedbackVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2],1193 crStateFeedbackVertex3f(PCRStateTracker pState, GLfloat v0, GLfloat v1, GLfloat v2) 1194 { 1195 crStateFeedbackVertex4f(pState, v0, v1, v2, 1.0f); 1196 } 1197 1198 void STATE_APIENTRY 1199 crStateFeedbackVertex3fv(PCRStateTracker pState, const GLfloat * v) 1200 { 1201 crStateFeedbackVertex4f(pState, v[0], v[1], v[2], 1.0f); 1202 } 1203 1204 void STATE_APIENTRY 1205 crStateFeedbackVertex3d(PCRStateTracker pState, GLdouble v0, GLdouble v1, GLdouble v2) 1206 { 1207 crStateFeedbackVertex4f(pState, (GLfloat) v0, (GLfloat) v1, (GLfloat) v2, 1.0f); 1208 } 1209 1210 void STATE_APIENTRY 1211 crStateFeedbackVertex3dv(PCRStateTracker pState, const GLdouble * v) 1212 { 1213 crStateFeedbackVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1220 1214 1.0f); 1221 1215 } 1222 1216 1223 1217 void STATE_APIENTRY 1224 crStateFeedbackTexCoord4f( GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 )1225 { 1226 CRContext *g = GetCurrentContext( );1218 crStateFeedbackTexCoord4f(PCRStateTracker pState, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 ) 1219 { 1220 CRContext *g = GetCurrentContext(pState); 1227 1221 CRVertex *v = g->vBuffer + g->vCount; 1228 1222 … … 1235 1229 1236 1230 void STATE_APIENTRY 1237 crStateFeedbackTexCoord4fv( const GLfloat *v )1238 { 1239 crStateFeedbackTexCoord4f( v[0], v[1], v[2], v[3] );1240 } 1241 1242 void STATE_APIENTRY 1243 crStateFeedbackTexCoord4s( GLshort v0, GLshort v1, GLshort v2, GLshort v3 )1244 { 1245 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, (GLfloat)v3 );1246 } 1247 1248 void STATE_APIENTRY 1249 crStateFeedbackTexCoord4sv( const GLshort *v )1250 { 1251 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3] );1252 } 1253 1254 void STATE_APIENTRY 1255 crStateFeedbackTexCoord4i( GLint v0, GLint v1, GLint v2, GLint v3 )1256 { 1257 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, (GLfloat)v3 );1258 } 1259 1260 void STATE_APIENTRY 1261 crStateFeedbackTexCoord4iv( const GLint *v )1262 { 1263 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3] );1264 } 1265 1266 void STATE_APIENTRY 1267 crStateFeedbackTexCoord4d( GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3 )1268 { 1269 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, (GLfloat)v3 );1270 } 1271 1272 void STATE_APIENTRY 1273 crStateFeedbackTexCoord4dv( const GLdouble *v )1274 { 1275 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3] );1276 } 1277 1278 void STATE_APIENTRY 1279 crStateFeedbackTexCoord1i( GLint v0 )1280 { 1281 crStateFeedbackTexCoord4f( (GLfloat)v0, 0.0f, 0.0f, 1.0f );1282 } 1283 1284 void STATE_APIENTRY 1285 crStateFeedbackTexCoord1iv( const GLint *v )1286 { 1287 crStateFeedbackTexCoord4f( (GLfloat)v[0], 0.0f, 0.0f, 1.0f );1288 } 1289 1290 void STATE_APIENTRY 1291 crStateFeedbackTexCoord1s( GLshort v0 )1292 { 1293 crStateFeedbackTexCoord4f( (GLfloat)v0, 0.0f, 0.0f, 1.0f );1294 } 1295 1296 void STATE_APIENTRY 1297 crStateFeedbackTexCoord1sv( const GLshort *v )1298 { 1299 crStateFeedbackTexCoord4f( (GLfloat)v[0], 0.0f, 0.0f, 1.0f );1300 } 1301 1302 void STATE_APIENTRY 1303 crStateFeedbackTexCoord1f( GLfloat v0 )1304 { 1305 crStateFeedbackTexCoord4f( v0, 0.0f, 0.0f, 1.0f );1306 } 1307 1308 void STATE_APIENTRY 1309 crStateFeedbackTexCoord1fv( const GLfloat *v )1310 { 1311 crStateFeedbackTexCoord4f( v[0], 0.0f, 0.0f, 1.0f );1312 } 1313 1314 void STATE_APIENTRY 1315 crStateFeedbackTexCoord1d( GLdouble v0 )1316 { 1317 crStateFeedbackTexCoord4f( (GLfloat)v0, 0.0f, 0.0f, 1.0f );1318 } 1319 1320 void STATE_APIENTRY 1321 crStateFeedbackTexCoord1dv( const GLdouble *v )1322 { 1323 crStateFeedbackTexCoord4f( (GLfloat)v[0], 0.0f, 0.0f, 1.0f );1324 } 1325 1326 void STATE_APIENTRY 1327 crStateFeedbackTexCoord2i( GLint v0, GLint v1 )1328 { 1329 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, 0.0f, 1.0f );1330 } 1331 1332 void STATE_APIENTRY 1333 crStateFeedbackTexCoord2iv( const GLint *v )1334 { 1335 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], 0.0f, 1.0f );1336 } 1337 1338 void STATE_APIENTRY 1339 crStateFeedbackTexCoord2s( GLshort v0, GLshort v1 )1340 { 1341 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, 0.0f, 1.0f );1342 } 1343 1344 void STATE_APIENTRY 1345 crStateFeedbackTexCoord2sv( const GLshort *v )1346 { 1347 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], 0.0f, 1.0f );1348 } 1349 1350 void STATE_APIENTRY 1351 crStateFeedbackTexCoord2f( GLfloat v0, GLfloat v1 )1352 { 1353 crStateFeedbackTexCoord4f( v0, v1, 0.0f, 1.0f );1354 } 1355 1356 void STATE_APIENTRY 1357 crStateFeedbackTexCoord2fv( const GLfloat *v )1358 { 1359 crStateFeedbackTexCoord4f( v[0], v[1], 0.0f, 1.0f );1360 } 1361 1362 void STATE_APIENTRY 1363 crStateFeedbackTexCoord2d( GLdouble v0, GLdouble v1 )1364 { 1365 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, 0.0f, 1.0f );1366 } 1367 1368 void STATE_APIENTRY 1369 crStateFeedbackTexCoord2dv( const GLdouble *v )1370 { 1371 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], 0.0f, 1.0f );1372 } 1373 1374 void STATE_APIENTRY 1375 crStateFeedbackTexCoord3i( GLint v0, GLint v1, GLint v2 )1376 { 1377 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, 1.0f );1378 } 1379 1380 void STATE_APIENTRY 1381 crStateFeedbackTexCoord3iv( const GLint *v )1382 { 1383 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], 0.0f, 1.0f );1384 } 1385 1386 void STATE_APIENTRY 1387 crStateFeedbackTexCoord3s( GLshort v0, GLshort v1, GLshort v2 )1388 { 1389 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, 1.0f );1390 } 1391 1392 void STATE_APIENTRY 1393 crStateFeedbackTexCoord3sv( const GLshort *v )1394 { 1395 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], 1.0f );1396 } 1397 1398 void STATE_APIENTRY 1399 crStateFeedbackTexCoord3f( GLfloat v0, GLfloat v1, GLfloat v2 )1400 { 1401 crStateFeedbackTexCoord4f( v0, v1, v2, 1.0f );1402 } 1403 1404 void STATE_APIENTRY 1405 crStateFeedbackTexCoord3fv( const GLfloat *v )1406 { 1407 crStateFeedbackTexCoord4f( v[0], v[1], v[2], 1.0f );1408 } 1409 1410 void STATE_APIENTRY 1411 crStateFeedbackTexCoord3d( GLdouble v0, GLdouble v1, GLdouble v2 )1412 { 1413 crStateFeedbackTexCoord4f( (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, 1.0f );1414 } 1415 1416 void STATE_APIENTRY 1417 crStateFeedbackTexCoord3dv( const GLdouble *v )1418 { 1419 crStateFeedbackTexCoord4f( (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], 1.0f );1420 } 1421 1422 void STATE_APIENTRY 1423 crStateFeedbackRectf( GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1)1424 { 1425 crStateFeedbackBegin( GL_QUADS);1426 crStateFeedbackVertex2f( x0, y0);1427 crStateFeedbackVertex2f( x0, y1);1428 crStateFeedbackVertex2f( x1, y1);1429 crStateFeedbackVertex2f( x1, y0);1430 crStateFeedbackEnd( );1431 } 1432 1433 void STATE_APIENTRY 1434 crStateFeedbackRecti( GLint x0, GLint y0, GLint x1, GLint y1)1435 { 1436 crStateFeedbackRectf( (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1);1437 } 1438 1439 void STATE_APIENTRY 1440 crStateFeedbackRectd( GLdouble x0, GLdouble y0, GLdouble x1, GLdouble y1)1441 { 1442 crStateFeedbackRectf( (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1);1443 } 1444 1445 void STATE_APIENTRY 1446 crStateFeedbackRects( GLshort x0, GLshort y0, GLshort x1, GLshort y1)1447 { 1448 crStateFeedbackRectf( (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1);1449 } 1450 1451 void STATE_APIENTRY 1452 crStateFeedbackRectiv( const GLint *v0, const GLint *v1)1453 { 1454 crStateFeedbackRectf( (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]);1455 } 1456 1457 void STATE_APIENTRY 1458 crStateFeedbackRectfv( const GLfloat *v0, const GLfloat *v1)1459 { 1460 crStateFeedbackRectf( v0[0], v0[1], v1[0], v1[1]);1461 } 1462 1463 void STATE_APIENTRY 1464 crStateFeedbackRectdv( const GLdouble *v0, const GLdouble *v1)1465 { 1466 crStateFeedbackRectf( (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]);1467 } 1468 1469 void STATE_APIENTRY 1470 crStateFeedbackRectsv( const GLshort *v0, const GLshort *v1)1471 { 1472 crStateFeedbackRectf( (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]);1231 crStateFeedbackTexCoord4fv(PCRStateTracker pState, const GLfloat *v ) 1232 { 1233 crStateFeedbackTexCoord4f(pState, v[0], v[1], v[2], v[3] ); 1234 } 1235 1236 void STATE_APIENTRY 1237 crStateFeedbackTexCoord4s(PCRStateTracker pState, GLshort v0, GLshort v1, GLshort v2, GLshort v3 ) 1238 { 1239 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, (GLfloat)v3 ); 1240 } 1241 1242 void STATE_APIENTRY 1243 crStateFeedbackTexCoord4sv(PCRStateTracker pState, const GLshort *v ) 1244 { 1245 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3] ); 1246 } 1247 1248 void STATE_APIENTRY 1249 crStateFeedbackTexCoord4i(PCRStateTracker pState, GLint v0, GLint v1, GLint v2, GLint v3 ) 1250 { 1251 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, (GLfloat)v3 ); 1252 } 1253 1254 void STATE_APIENTRY 1255 crStateFeedbackTexCoord4iv(PCRStateTracker pState, const GLint *v ) 1256 { 1257 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3] ); 1258 } 1259 1260 void STATE_APIENTRY 1261 crStateFeedbackTexCoord4d(PCRStateTracker pState, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3 ) 1262 { 1263 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, (GLfloat)v3 ); 1264 } 1265 1266 void STATE_APIENTRY 1267 crStateFeedbackTexCoord4dv(PCRStateTracker pState, const GLdouble *v ) 1268 { 1269 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3] ); 1270 } 1271 1272 void STATE_APIENTRY 1273 crStateFeedbackTexCoord1i(PCRStateTracker pState, GLint v0 ) 1274 { 1275 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, 0.0f, 0.0f, 1.0f ); 1276 } 1277 1278 void STATE_APIENTRY 1279 crStateFeedbackTexCoord1iv(PCRStateTracker pState, const GLint *v ) 1280 { 1281 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], 0.0f, 0.0f, 1.0f ); 1282 } 1283 1284 void STATE_APIENTRY 1285 crStateFeedbackTexCoord1s(PCRStateTracker pState, GLshort v0 ) 1286 { 1287 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, 0.0f, 0.0f, 1.0f ); 1288 } 1289 1290 void STATE_APIENTRY 1291 crStateFeedbackTexCoord1sv(PCRStateTracker pState, const GLshort *v ) 1292 { 1293 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], 0.0f, 0.0f, 1.0f ); 1294 } 1295 1296 void STATE_APIENTRY 1297 crStateFeedbackTexCoord1f(PCRStateTracker pState, GLfloat v0 ) 1298 { 1299 crStateFeedbackTexCoord4f(pState, v0, 0.0f, 0.0f, 1.0f ); 1300 } 1301 1302 void STATE_APIENTRY 1303 crStateFeedbackTexCoord1fv(PCRStateTracker pState, const GLfloat *v ) 1304 { 1305 crStateFeedbackTexCoord4f(pState, v[0], 0.0f, 0.0f, 1.0f ); 1306 } 1307 1308 void STATE_APIENTRY 1309 crStateFeedbackTexCoord1d(PCRStateTracker pState, GLdouble v0 ) 1310 { 1311 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, 0.0f, 0.0f, 1.0f ); 1312 } 1313 1314 void STATE_APIENTRY 1315 crStateFeedbackTexCoord1dv(PCRStateTracker pState, const GLdouble *v ) 1316 { 1317 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], 0.0f, 0.0f, 1.0f ); 1318 } 1319 1320 void STATE_APIENTRY 1321 crStateFeedbackTexCoord2i(PCRStateTracker pState, GLint v0, GLint v1 ) 1322 { 1323 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, 0.0f, 1.0f ); 1324 } 1325 1326 void STATE_APIENTRY 1327 crStateFeedbackTexCoord2iv(PCRStateTracker pState, const GLint *v ) 1328 { 1329 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], 0.0f, 1.0f ); 1330 } 1331 1332 void STATE_APIENTRY 1333 crStateFeedbackTexCoord2s(PCRStateTracker pState, GLshort v0, GLshort v1 ) 1334 { 1335 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, 0.0f, 1.0f ); 1336 } 1337 1338 void STATE_APIENTRY 1339 crStateFeedbackTexCoord2sv(PCRStateTracker pState, const GLshort *v ) 1340 { 1341 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], 0.0f, 1.0f ); 1342 } 1343 1344 void STATE_APIENTRY 1345 crStateFeedbackTexCoord2f(PCRStateTracker pState, GLfloat v0, GLfloat v1 ) 1346 { 1347 crStateFeedbackTexCoord4f(pState, v0, v1, 0.0f, 1.0f ); 1348 } 1349 1350 void STATE_APIENTRY 1351 crStateFeedbackTexCoord2fv(PCRStateTracker pState, const GLfloat *v ) 1352 { 1353 crStateFeedbackTexCoord4f(pState, v[0], v[1], 0.0f, 1.0f ); 1354 } 1355 1356 void STATE_APIENTRY 1357 crStateFeedbackTexCoord2d(PCRStateTracker pState, GLdouble v0, GLdouble v1 ) 1358 { 1359 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, 0.0f, 1.0f ); 1360 } 1361 1362 void STATE_APIENTRY 1363 crStateFeedbackTexCoord2dv(PCRStateTracker pState, const GLdouble *v ) 1364 { 1365 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], 0.0f, 1.0f ); 1366 } 1367 1368 void STATE_APIENTRY 1369 crStateFeedbackTexCoord3i(PCRStateTracker pState, GLint v0, GLint v1, GLint v2 ) 1370 { 1371 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, 1.0f ); 1372 } 1373 1374 void STATE_APIENTRY 1375 crStateFeedbackTexCoord3iv(PCRStateTracker pState, const GLint *v ) 1376 { 1377 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], 0.0f, 1.0f ); 1378 } 1379 1380 void STATE_APIENTRY 1381 crStateFeedbackTexCoord3s(PCRStateTracker pState, GLshort v0, GLshort v1, GLshort v2 ) 1382 { 1383 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, 1.0f ); 1384 } 1385 1386 void STATE_APIENTRY 1387 crStateFeedbackTexCoord3sv(PCRStateTracker pState, const GLshort *v ) 1388 { 1389 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], 1.0f ); 1390 } 1391 1392 void STATE_APIENTRY 1393 crStateFeedbackTexCoord3f(PCRStateTracker pState, GLfloat v0, GLfloat v1, GLfloat v2 ) 1394 { 1395 crStateFeedbackTexCoord4f(pState, v0, v1, v2, 1.0f ); 1396 } 1397 1398 void STATE_APIENTRY 1399 crStateFeedbackTexCoord3fv(PCRStateTracker pState, const GLfloat *v ) 1400 { 1401 crStateFeedbackTexCoord4f(pState, v[0], v[1], v[2], 1.0f ); 1402 } 1403 1404 void STATE_APIENTRY 1405 crStateFeedbackTexCoord3d(PCRStateTracker pState, GLdouble v0, GLdouble v1, GLdouble v2 ) 1406 { 1407 crStateFeedbackTexCoord4f(pState, (GLfloat)v0, (GLfloat)v1, (GLfloat)v2, 1.0f ); 1408 } 1409 1410 void STATE_APIENTRY 1411 crStateFeedbackTexCoord3dv(PCRStateTracker pState, const GLdouble *v ) 1412 { 1413 crStateFeedbackTexCoord4f(pState, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], 1.0f ); 1414 } 1415 1416 void STATE_APIENTRY 1417 crStateFeedbackRectf(PCRStateTracker pState, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1) 1418 { 1419 crStateFeedbackBegin(pState, GL_QUADS); 1420 crStateFeedbackVertex2f(pState, x0, y0); 1421 crStateFeedbackVertex2f(pState, x0, y1); 1422 crStateFeedbackVertex2f(pState, x1, y1); 1423 crStateFeedbackVertex2f(pState, x1, y0); 1424 crStateFeedbackEnd(pState); 1425 } 1426 1427 void STATE_APIENTRY 1428 crStateFeedbackRecti(PCRStateTracker pState, GLint x0, GLint y0, GLint x1, GLint y1) 1429 { 1430 crStateFeedbackRectf(pState, (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1); 1431 } 1432 1433 void STATE_APIENTRY 1434 crStateFeedbackRectd(PCRStateTracker pState, GLdouble x0, GLdouble y0, GLdouble x1, GLdouble y1) 1435 { 1436 crStateFeedbackRectf(pState, (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1); 1437 } 1438 1439 void STATE_APIENTRY 1440 crStateFeedbackRects(PCRStateTracker pState, GLshort x0, GLshort y0, GLshort x1, GLshort y1) 1441 { 1442 crStateFeedbackRectf(pState, (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1); 1443 } 1444 1445 void STATE_APIENTRY 1446 crStateFeedbackRectiv(PCRStateTracker pState, const GLint *v0, const GLint *v1) 1447 { 1448 crStateFeedbackRectf(pState, (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]); 1449 } 1450 1451 void STATE_APIENTRY 1452 crStateFeedbackRectfv(PCRStateTracker pState, const GLfloat *v0, const GLfloat *v1) 1453 { 1454 crStateFeedbackRectf(pState, v0[0], v0[1], v1[0], v1[1]); 1455 } 1456 1457 void STATE_APIENTRY 1458 crStateFeedbackRectdv(PCRStateTracker pState, const GLdouble *v0, const GLdouble *v1) 1459 { 1460 crStateFeedbackRectf(pState, (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]); 1461 } 1462 1463 void STATE_APIENTRY 1464 crStateFeedbackRectsv(PCRStateTracker pState, const GLshort *v0, const GLshort *v1) 1465 { 1466 crStateFeedbackRectf(pState, (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]); 1473 1467 } 1474 1468 … … 1479 1473 1480 1474 void STATE_APIENTRY 1481 crStateSelectBuffer( GLsizei size, GLuint * buffer)1482 { 1483 CRContext *g = GetCurrentContext( );1475 crStateSelectBuffer(PCRStateTracker pState, GLsizei size, GLuint * buffer) 1476 { 1477 CRContext *g = GetCurrentContext(pState); 1484 1478 CRSelectionState *se = &(g->selection); 1485 1479 1486 1480 if (g->current.inBeginEnd) 1487 1481 { 1488 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1482 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1489 1483 "SelectBuffer called in begin/end"); 1490 1484 return; … … 1493 1487 if (g->renderMode == GL_SELECT) 1494 1488 { 1495 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1489 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1496 1490 "SelectBuffer called with RenderMode = GL_SELECT"); 1497 1491 return; … … 1545 1539 1546 1540 void STATE_APIENTRY 1547 crStateInitNames( void)1548 { 1549 CRContext *g = GetCurrentContext( );1541 crStateInitNames(PCRStateTracker pState) 1542 { 1543 CRContext *g = GetCurrentContext(pState); 1550 1544 CRSelectionState *se = &(g->selection); 1551 1545 1552 1546 if (g->current.inBeginEnd) 1553 1547 { 1554 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1548 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1555 1549 "InitNames called in begin/end"); 1556 1550 return; … … 1576 1570 1577 1571 void STATE_APIENTRY 1578 crStateLoadName( GLuint name)1579 { 1580 CRContext *g = GetCurrentContext( );1572 crStateLoadName(PCRStateTracker pState, GLuint name) 1573 { 1574 CRContext *g = GetCurrentContext(pState); 1581 1575 CRSelectionState *se = &(g->selection); 1582 1576 1583 1577 if (g->current.inBeginEnd) 1584 1578 { 1585 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1579 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1586 1580 "LoadName called in begin/end"); 1587 1581 return; … … 1596 1590 if (se->nameStackDepth == 0) 1597 1591 { 1598 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1592 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1599 1593 "nameStackDepth = 0"); 1600 1594 return; … … 1619 1613 1620 1614 void STATE_APIENTRY 1621 crStatePushName( GLuint name)1622 { 1623 CRContext *g = GetCurrentContext( );1615 crStatePushName(PCRStateTracker pState, GLuint name) 1616 { 1617 CRContext *g = GetCurrentContext(pState); 1624 1618 CRSelectionState *se = &(g->selection); 1625 1619 1626 1620 if (g->current.inBeginEnd) 1627 1621 { 1628 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1622 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1629 1623 "PushName called in begin/end"); 1630 1624 return; … … 1645 1639 if (se->nameStackDepth >= MAX_NAME_STACK_DEPTH) 1646 1640 { 1647 crStateError( __LINE__, __FILE__, GL_STACK_OVERFLOW,1641 crStateError(pState, __LINE__, __FILE__, GL_STACK_OVERFLOW, 1648 1642 "nameStackDepth overflow"); 1649 1643 } … … 1653 1647 1654 1648 void STATE_APIENTRY 1655 crStatePopName( void)1656 { 1657 CRContext *g = GetCurrentContext( );1649 crStatePopName(PCRStateTracker pState) 1650 { 1651 CRContext *g = GetCurrentContext(pState); 1658 1652 CRSelectionState *se = &(g->selection); 1659 1653 1660 1654 if (g->current.inBeginEnd) 1661 1655 { 1662 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1656 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1663 1657 "PopName called in begin/end"); 1664 1658 return; … … 1679 1673 if (se->nameStackDepth == 0) 1680 1674 { 1681 crStateError( __LINE__, __FILE__, GL_STACK_UNDERFLOW,1675 crStateError(pState, __LINE__, __FILE__, GL_STACK_UNDERFLOW, 1682 1676 "nameStackDepth underflow"); 1683 1677 } … … 1688 1682 1689 1683 static void 1690 update_hitflag(GLfloat z) 1691 { 1692 CRContext *g = GetCurrentContext(); 1684 update_hitflag(CRContext *g, GLfloat z) 1685 { 1693 1686 CRSelectionState *se = &(g->selection); 1694 1687 … … 1704 1697 1705 1698 static void 1706 select_rasterpos(void) 1707 { 1708 CRContext *g = GetCurrentContext(); 1709 1699 select_rasterpos(CRContext *g) 1700 { 1710 1701 if (g->current.rasterValid) 1711 update_hitflag(g ->current.rasterAttrib[VERT_ATTRIB_POS][2]);1702 update_hitflag(g, g->current.rasterAttrib[VERT_ATTRIB_POS][2]); 1712 1703 } 1713 1704 1714 1705 static void 1715 select_point(const CRVertex *v) 1716 { 1717 CRContext *g = GetCurrentContext(); 1718 if (clip_point(v) == 0) 1706 select_point(CRContext *g, const CRVertex *v) 1707 { 1708 if (clip_point(g, v) == 0) 1719 1709 { 1720 1710 CRVertex c = *v; 1721 1711 MAP_POINT(c.winPos, c.clipPos, g->viewport); 1722 update_hitflag( c.winPos.z);1712 update_hitflag(g, c.winPos.z); 1723 1713 } 1724 1714 } … … 1726 1716 1727 1717 static void 1728 select_line(const CRVertex *v0, const CRVertex *v1) 1729 { 1730 CRContext *g = GetCurrentContext(); 1718 select_line(CRContext *g, const CRVertex *v0, const CRVertex *v1) 1719 { 1731 1720 CRVertex c0, c1; 1732 if (clip_line( v0, v1, &c0, &c1))1721 if (clip_line(g, v0, v1, &c0, &c1)) 1733 1722 { 1734 1723 MAP_POINT(c0.winPos, c0.clipPos, g->viewport); 1735 1724 MAP_POINT(c1.winPos, c1.clipPos, g->viewport); 1736 update_hitflag( c0.winPos.z);1737 update_hitflag( c1.winPos.z);1725 update_hitflag(g, c0.winPos.z); 1726 update_hitflag(g, c1.winPos.z); 1738 1727 } 1739 1728 } … … 1741 1730 1742 1731 static void 1743 select_triangle( const CRVertex *v0,1732 select_triangle(CRContext *g, const CRVertex *v0, 1744 1733 const CRVertex *v1, 1745 1734 const CRVertex *v2) 1746 1735 { 1747 CRContext *g = GetCurrentContext();1748 1736 CRVertex vlist[3], vclipped[8]; 1749 1737 GLuint i, n; … … 1755 1743 for (i = 0; i < n; i++) { 1756 1744 MAP_POINT(vclipped[i].winPos, vclipped[i].clipPos, g->viewport); 1757 update_hitflag( vclipped[i].winPos.z);1758 } 1759 } 1760 1761 1762 void STATE_APIENTRY 1763 crStateSelectVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w)1764 { 1765 CRContext *g = GetCurrentContext( );1745 update_hitflag(g, vclipped[i].winPos.z); 1746 } 1747 } 1748 1749 1750 void STATE_APIENTRY 1751 crStateSelectVertex4f(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 1752 { 1753 CRContext *g = GetCurrentContext(pState); 1766 1754 CRTransformState *t = &(g->transform); 1767 1755 CRVertex *v = g->vBuffer + g->vCount; … … 1785 1773 case GL_POINTS: 1786 1774 CRASSERT(g->vCount == 0); 1787 select_point( v);1775 select_point(g, v); 1788 1776 break; 1789 1777 case GL_LINES: … … 1795 1783 { 1796 1784 CRASSERT(g->vCount == 1); 1797 select_line(g ->vBuffer + 0, g->vBuffer + 1);1785 select_line(g, g->vBuffer + 0, g->vBuffer + 1); 1798 1786 g->vCount = 0; 1799 1787 } … … 1807 1795 { 1808 1796 CRASSERT(g->vCount == 1); 1809 select_line(g ->vBuffer + 0, g->vBuffer + 1);1797 select_line(g, g->vBuffer + 0, g->vBuffer + 1); 1810 1798 g->vBuffer[0] = g->vBuffer[1]; 1811 1799 /* leave g->vCount at 1 */ … … 1820 1808 else if (g->vCount == 1) 1821 1809 { 1822 select_line(g ->vBuffer + 0, g->vBuffer + 1);1810 select_line(g, g->vBuffer + 0, g->vBuffer + 1); 1823 1811 g->lineLoop = GL_TRUE; 1824 1812 g->vCount = 2; … … 1828 1816 CRASSERT(g->vCount == 2); 1829 1817 g->lineLoop = GL_FALSE; 1830 select_line(g ->vBuffer + 1, g->vBuffer + 2);1818 select_line(g, g->vBuffer + 1, g->vBuffer + 2); 1831 1819 g->vBuffer[1] = g->vBuffer[2]; 1832 1820 /* leave g->vCount at 2 */ … … 1841 1829 { 1842 1830 CRASSERT(g->vCount == 2); 1843 select_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);1831 select_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 1844 1832 g->vCount = 0; 1845 1833 } … … 1852 1840 else if (g->vCount == 2) 1853 1841 { 1854 select_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);1842 select_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 1855 1843 g->vCount = 3; 1856 1844 } … … 1858 1846 { 1859 1847 CRASSERT(g->vCount == 3); 1860 select_triangle(g ->vBuffer + 1, g->vBuffer + 3, g->vBuffer + 2);1848 select_triangle(g, g->vBuffer + 1, g->vBuffer + 3, g->vBuffer + 2); 1861 1849 g->vBuffer[0] = g->vBuffer[2]; 1862 1850 g->vBuffer[1] = g->vBuffer[3]; … … 1872 1860 { 1873 1861 CRASSERT(g->vCount == 2); 1874 select_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);1862 select_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 1875 1863 g->vBuffer[1] = g->vBuffer[2]; 1876 1864 /* leave g->vCount = 2 */ … … 1885 1873 { 1886 1874 CRASSERT(g->vCount == 3); 1887 select_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);1888 select_triangle(g ->vBuffer + 0, g->vBuffer + 2, g->vBuffer + 3);1875 select_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 1876 select_triangle(g, g->vBuffer + 0, g->vBuffer + 2, g->vBuffer + 3); 1889 1877 g->vCount = 0; 1890 1878 } … … 1898 1886 { 1899 1887 CRASSERT(g->vCount == 3); 1900 select_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);1901 select_triangle(g ->vBuffer + 1, g->vBuffer + 3, g->vBuffer + 2);1888 select_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 1889 select_triangle(g, g->vBuffer + 1, g->vBuffer + 3, g->vBuffer + 2); 1902 1890 g->vBuffer[0] = g->vBuffer[2]; 1903 1891 g->vBuffer[1] = g->vBuffer[3]; … … 1914 1902 { 1915 1903 CRASSERT(g->vCount == 2); 1916 select_triangle(g ->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2);1904 select_triangle(g, g->vBuffer + 0, g->vBuffer + 1, g->vBuffer + 2); 1917 1905 g->vBuffer[1] = g->vBuffer[2]; 1918 1906 /* leave g->vCount = 2 */ … … 1925 1913 1926 1914 void STATE_APIENTRY 1927 crStateSelectRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 1928 { 1929 crStateRasterPos4f( x, y, z, w ); 1930 1931 select_rasterpos(); 1932 } 1933 1934 void STATE_APIENTRY 1935 crStateSelectBegin(GLenum mode) 1936 { 1937 CRContext *g = GetCurrentContext(); 1938 1939 crStateBegin(mode); 1915 crStateSelectRasterPos4f(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 1916 { 1917 CRContext *g = GetCurrentContext(pState); 1918 crStateRasterPos4f(pState, x, y, z, w ); 1919 1920 select_rasterpos(g); 1921 } 1922 1923 void STATE_APIENTRY 1924 crStateSelectBegin(PCRStateTracker pState, GLenum mode) 1925 { 1926 CRContext *g = GetCurrentContext(pState); 1927 1928 crStateBegin(pState, mode); 1940 1929 1941 1930 g->vCount = 0; … … 1946 1935 1947 1936 void STATE_APIENTRY 1948 crStateSelectEnd( void)1949 { 1950 CRContext *g = GetCurrentContext( );1937 crStateSelectEnd(PCRStateTracker pState) 1938 { 1939 CRContext *g = GetCurrentContext(pState); 1951 1940 1952 1941 if (g->current.mode == GL_LINE_LOOP && g->vCount == 2) 1953 1942 { 1954 1943 /* draw the last line segment */ 1955 select_line(g ->vBuffer + 1, g->vBuffer + 0);1956 } 1957 1958 crStateEnd( );1959 } 1960 1961 void STATE_APIENTRY 1962 crStateSelectVertex2d( GLdouble x, GLdouble y)1963 { 1964 crStateSelectVertex4f( (GLfloat) x, (GLfloat) y, 0.0, 1.0);1965 } 1966 1967 void STATE_APIENTRY 1968 crStateSelectVertex2dv( const GLdouble * v)1969 { 1970 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0);1971 } 1972 1973 void STATE_APIENTRY 1974 crStateSelectVertex2f( GLfloat x, GLfloat y)1975 { 1976 crStateSelectVertex4f( x, y, 0.0, 1.0);1977 } 1978 1979 void STATE_APIENTRY 1980 crStateSelectVertex2fv( const GLfloat * v)1981 { 1982 crStateSelectVertex4f( v[0], v[1], 0.0, 1.0);1983 } 1984 1985 void STATE_APIENTRY 1986 crStateSelectVertex2i( GLint x, GLint y)1987 { 1988 crStateSelectVertex4f( (GLfloat) x, (GLfloat) y, 0.0, 1.0);1989 } 1990 1991 void STATE_APIENTRY 1992 crStateSelectVertex2iv( const GLint * v)1993 { 1994 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0);1995 } 1996 1997 void STATE_APIENTRY 1998 crStateSelectVertex2s( GLshort x, GLshort y)1999 { 2000 crStateSelectVertex4f( (GLfloat) x, (GLfloat) y, 0.0, 1.0);2001 } 2002 2003 void STATE_APIENTRY 2004 crStateSelectVertex2sv( const GLshort * v)2005 { 2006 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0);2007 } 2008 2009 void STATE_APIENTRY 2010 crStateSelectVertex3d( GLdouble x, GLdouble y, GLdouble z)2011 { 2012 crStateSelectVertex4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0);2013 } 2014 2015 void STATE_APIENTRY 2016 crStateSelectVertex3dv( const GLdouble * v)2017 { 2018 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0);2019 } 2020 2021 void STATE_APIENTRY 2022 crStateSelectVertex3f( GLfloat x, GLfloat y, GLfloat z)2023 { 2024 crStateSelectVertex4f( x, y, z, 1.0);2025 } 2026 2027 void STATE_APIENTRY 2028 crStateSelectVertex3fv( const GLfloat * v)2029 { 2030 crStateSelectVertex4f( v[0], v[1], v[2], 1.0);2031 } 2032 2033 void STATE_APIENTRY 2034 crStateSelectVertex3i( GLint x, GLint y, GLint z)2035 { 2036 crStateSelectVertex4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0);2037 } 2038 2039 void STATE_APIENTRY 2040 crStateSelectVertex3iv( const GLint * v)2041 { 2042 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0);2043 } 2044 2045 void STATE_APIENTRY 2046 crStateSelectVertex3s( GLshort x, GLshort y, GLshort z)2047 { 2048 crStateSelectVertex4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0);2049 } 2050 2051 void STATE_APIENTRY 2052 crStateSelectVertex3sv( const GLshort * v)2053 { 2054 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0);2055 } 2056 2057 void STATE_APIENTRY 2058 crStateSelectVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w)2059 { 2060 crStateSelectVertex4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);2061 } 2062 2063 void STATE_APIENTRY 2064 crStateSelectVertex4dv( const GLdouble * v)2065 { 2066 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);2067 } 2068 2069 void STATE_APIENTRY 2070 crStateSelectVertex4fv( const GLfloat * v)2071 { 2072 crStateSelectVertex4f( v[0], v[1], v[2], v[3]);2073 } 2074 2075 void STATE_APIENTRY 2076 crStateSelectVertex4i( GLint x, GLint y, GLint z, GLint w)2077 { 2078 crStateSelectVertex4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);2079 } 2080 2081 void STATE_APIENTRY 2082 crStateSelectVertex4iv( const GLint * v)2083 { 2084 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);2085 } 2086 2087 void STATE_APIENTRY 2088 crStateSelectVertex4s( GLshort x, GLshort y, GLshort z, GLshort w)2089 { 2090 crStateSelectVertex4f( x, y, z, w);2091 } 2092 2093 void STATE_APIENTRY 2094 crStateSelectVertex4sv( const GLshort * v)2095 { 2096 crStateSelectVertex4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);2097 } 2098 2099 void STATE_APIENTRY 2100 crStateSelectRasterPos2d( GLdouble x, GLdouble y)2101 { 2102 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, 0.0, 1.0);2103 } 2104 2105 void STATE_APIENTRY 2106 crStateSelectRasterPos2dv( const GLdouble * v)2107 { 2108 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0);2109 } 2110 2111 void STATE_APIENTRY 2112 crStateSelectRasterPos2f( GLfloat x, GLfloat y)2113 { 2114 crStateSelectRasterPos4f( x, y, 0.0, 1.0);2115 } 2116 2117 void STATE_APIENTRY 2118 crStateSelectRasterPos2fv( const GLfloat * v)2119 { 2120 crStateSelectRasterPos4f( v[0], v[1], 0.0, 1.0);2121 } 2122 2123 void STATE_APIENTRY 2124 crStateSelectRasterPos2i( GLint x, GLint y)2125 { 2126 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, 0.0, 1.0);2127 } 2128 2129 void STATE_APIENTRY 2130 crStateSelectRasterPos2iv( const GLint * v)2131 { 2132 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0);2133 } 2134 2135 void STATE_APIENTRY 2136 crStateSelectRasterPos2s( GLshort x, GLshort y)2137 { 2138 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, 0.0, 1.0);2139 } 2140 2141 void STATE_APIENTRY 2142 crStateSelectRasterPos2sv( const GLshort * v)2143 { 2144 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0);2145 } 2146 2147 void STATE_APIENTRY 2148 crStateSelectRasterPos3d( GLdouble x, GLdouble y, GLdouble z)2149 { 2150 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0);2151 } 2152 2153 void STATE_APIENTRY 2154 crStateSelectRasterPos3dv( const GLdouble * v)2155 { 2156 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , 1.0);2157 } 2158 2159 void STATE_APIENTRY 2160 crStateSelectRasterPos3f( GLfloat x, GLfloat y, GLfloat z)2161 { 2162 crStateSelectRasterPos4f( x, y, z, 1.0);2163 } 2164 2165 void STATE_APIENTRY 2166 crStateSelectRasterPos3fv( const GLfloat * v)2167 { 2168 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , 1.0);2169 } 2170 2171 void STATE_APIENTRY 2172 crStateSelectRasterPos3i( GLint x, GLint y, GLint z)2173 { 2174 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0);2175 } 2176 2177 void STATE_APIENTRY 2178 crStateSelectRasterPos3iv( const GLint * v)2179 { 2180 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , 1.0);2181 } 2182 2183 void STATE_APIENTRY 2184 crStateSelectRasterPos3s( GLshort x, GLshort y, GLshort z)2185 { 2186 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0);2187 } 2188 2189 void STATE_APIENTRY 2190 crStateSelectRasterPos3sv( const GLshort * v)2191 { 2192 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , 1.0);2193 } 2194 2195 void STATE_APIENTRY 2196 crStateSelectRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w)2197 { 2198 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);2199 } 2200 2201 void STATE_APIENTRY 2202 crStateSelectRasterPos4dv( const GLdouble * v)2203 { 2204 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , (GLfloat) v[3]);2205 } 2206 2207 void STATE_APIENTRY 2208 crStateSelectRasterPos4fv( const GLfloat * v)2209 { 2210 crStateSelectRasterPos4f( v[0], v[1], v[2], v[3]);2211 } 2212 2213 void STATE_APIENTRY 2214 crStateSelectRasterPos4i( GLint x, GLint y, GLint z, GLint w)2215 { 2216 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);2217 } 2218 2219 void STATE_APIENTRY 2220 crStateSelectRasterPos4iv( const GLint * v)2221 { 2222 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);2223 } 2224 2225 void STATE_APIENTRY 2226 crStateSelectRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w)2227 { 2228 crStateSelectRasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);2229 } 2230 2231 void STATE_APIENTRY 2232 crStateSelectRasterPos4sv( const GLshort * v)2233 { 2234 crStateSelectRasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , (GLfloat) v[3]);2235 } 2236 2237 void STATE_APIENTRY 2238 crStateSelectRectf( GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1)2239 { 2240 crStateSelectBegin( GL_QUADS);2241 crStateSelectVertex2f( x0, y0);2242 crStateSelectVertex2f( x0, y1);2243 crStateSelectVertex2f( x1, y1);2244 crStateSelectVertex2f( x1, y0);2245 crStateSelectEnd( );2246 } 2247 2248 void STATE_APIENTRY 2249 crStateSelectRecti( GLint x0, GLint y0, GLint x1, GLint y1)2250 { 2251 crStateSelectRectf( (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1);2252 } 2253 2254 void STATE_APIENTRY 2255 crStateSelectRectd( GLdouble x0, GLdouble y0, GLdouble x1, GLdouble y1)2256 { 2257 crStateSelectRectf( (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1);2258 } 2259 2260 void STATE_APIENTRY 2261 crStateSelectRects( GLshort x0, GLshort y0, GLshort x1, GLshort y1)2262 { 2263 crStateSelectRectf( (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1);2264 } 2265 2266 void STATE_APIENTRY 2267 crStateSelectRectiv( const GLint *v0, const GLint *v1)2268 { 2269 crStateSelectRectf( (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]);2270 } 2271 2272 void STATE_APIENTRY 2273 crStateSelectRectfv( const GLfloat *v0, const GLfloat *v1)2274 { 2275 crStateSelectRectf( v0[0], v0[1], v1[0], v1[1]);2276 } 2277 2278 void STATE_APIENTRY 2279 crStateSelectRectdv( const GLdouble *v0, const GLdouble *v1)2280 { 2281 crStateSelectRectf( (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]);2282 } 2283 2284 void STATE_APIENTRY 2285 crStateSelectRectsv( const GLshort *v0, const GLshort *v1)2286 { 2287 crStateSelectRectf( (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]);1944 select_line(g, g->vBuffer + 1, g->vBuffer + 0); 1945 } 1946 1947 crStateEnd(pState); 1948 } 1949 1950 void STATE_APIENTRY 1951 crStateSelectVertex2d(PCRStateTracker pState, GLdouble x, GLdouble y) 1952 { 1953 crStateSelectVertex4f(pState, (GLfloat) x, (GLfloat) y, 0.0, 1.0); 1954 } 1955 1956 void STATE_APIENTRY 1957 crStateSelectVertex2dv(PCRStateTracker pState, const GLdouble * v) 1958 { 1959 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0); 1960 } 1961 1962 void STATE_APIENTRY 1963 crStateSelectVertex2f(PCRStateTracker pState, GLfloat x, GLfloat y) 1964 { 1965 crStateSelectVertex4f(pState, x, y, 0.0, 1.0); 1966 } 1967 1968 void STATE_APIENTRY 1969 crStateSelectVertex2fv(PCRStateTracker pState, const GLfloat * v) 1970 { 1971 crStateSelectVertex4f(pState, v[0], v[1], 0.0, 1.0); 1972 } 1973 1974 void STATE_APIENTRY 1975 crStateSelectVertex2i(PCRStateTracker pState, GLint x, GLint y) 1976 { 1977 crStateSelectVertex4f(pState, (GLfloat) x, (GLfloat) y, 0.0, 1.0); 1978 } 1979 1980 void STATE_APIENTRY 1981 crStateSelectVertex2iv(PCRStateTracker pState, const GLint * v) 1982 { 1983 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0); 1984 } 1985 1986 void STATE_APIENTRY 1987 crStateSelectVertex2s(PCRStateTracker pState, GLshort x, GLshort y) 1988 { 1989 crStateSelectVertex4f(pState, (GLfloat) x, (GLfloat) y, 0.0, 1.0); 1990 } 1991 1992 void STATE_APIENTRY 1993 crStateSelectVertex2sv(PCRStateTracker pState, const GLshort * v) 1994 { 1995 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0); 1996 } 1997 1998 void STATE_APIENTRY 1999 crStateSelectVertex3d(PCRStateTracker pState, GLdouble x, GLdouble y, GLdouble z) 2000 { 2001 crStateSelectVertex4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0); 2002 } 2003 2004 void STATE_APIENTRY 2005 crStateSelectVertex3dv(PCRStateTracker pState, const GLdouble * v) 2006 { 2007 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0); 2008 } 2009 2010 void STATE_APIENTRY 2011 crStateSelectVertex3f(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z) 2012 { 2013 crStateSelectVertex4f(pState, x, y, z, 1.0); 2014 } 2015 2016 void STATE_APIENTRY 2017 crStateSelectVertex3fv(PCRStateTracker pState, const GLfloat * v) 2018 { 2019 crStateSelectVertex4f(pState, v[0], v[1], v[2], 1.0); 2020 } 2021 2022 void STATE_APIENTRY 2023 crStateSelectVertex3i(PCRStateTracker pState, GLint x, GLint y, GLint z) 2024 { 2025 crStateSelectVertex4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0); 2026 } 2027 2028 void STATE_APIENTRY 2029 crStateSelectVertex3iv(PCRStateTracker pState, const GLint * v) 2030 { 2031 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0); 2032 } 2033 2034 void STATE_APIENTRY 2035 crStateSelectVertex3s(PCRStateTracker pState, GLshort x, GLshort y, GLshort z) 2036 { 2037 crStateSelectVertex4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0); 2038 } 2039 2040 void STATE_APIENTRY 2041 crStateSelectVertex3sv(PCRStateTracker pState, const GLshort * v) 2042 { 2043 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0); 2044 } 2045 2046 void STATE_APIENTRY 2047 crStateSelectVertex4d(PCRStateTracker pState, GLdouble x, GLdouble y, GLdouble z, GLdouble w) 2048 { 2049 crStateSelectVertex4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 2050 } 2051 2052 void STATE_APIENTRY 2053 crStateSelectVertex4dv(PCRStateTracker pState, const GLdouble * v) 2054 { 2055 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); 2056 } 2057 2058 void STATE_APIENTRY 2059 crStateSelectVertex4fv(PCRStateTracker pState, const GLfloat * v) 2060 { 2061 crStateSelectVertex4f(pState, v[0], v[1], v[2], v[3]); 2062 } 2063 2064 void STATE_APIENTRY 2065 crStateSelectVertex4i(PCRStateTracker pState, GLint x, GLint y, GLint z, GLint w) 2066 { 2067 crStateSelectVertex4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 2068 } 2069 2070 void STATE_APIENTRY 2071 crStateSelectVertex4iv(PCRStateTracker pState, const GLint * v) 2072 { 2073 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); 2074 } 2075 2076 void STATE_APIENTRY 2077 crStateSelectVertex4s(PCRStateTracker pState, GLshort x, GLshort y, GLshort z, GLshort w) 2078 { 2079 crStateSelectVertex4f(pState, x, y, z, w); 2080 } 2081 2082 void STATE_APIENTRY 2083 crStateSelectVertex4sv(PCRStateTracker pState, const GLshort * v) 2084 { 2085 crStateSelectVertex4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); 2086 } 2087 2088 void STATE_APIENTRY 2089 crStateSelectRasterPos2d(PCRStateTracker pState, GLdouble x, GLdouble y) 2090 { 2091 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, 0.0, 1.0); 2092 } 2093 2094 void STATE_APIENTRY 2095 crStateSelectRasterPos2dv(PCRStateTracker pState, const GLdouble * v) 2096 { 2097 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0); 2098 } 2099 2100 void STATE_APIENTRY 2101 crStateSelectRasterPos2f(PCRStateTracker pState, GLfloat x, GLfloat y) 2102 { 2103 crStateSelectRasterPos4f(pState, x, y, 0.0, 1.0); 2104 } 2105 2106 void STATE_APIENTRY 2107 crStateSelectRasterPos2fv(PCRStateTracker pState, const GLfloat * v) 2108 { 2109 crStateSelectRasterPos4f(pState, v[0], v[1], 0.0, 1.0); 2110 } 2111 2112 void STATE_APIENTRY 2113 crStateSelectRasterPos2i(PCRStateTracker pState, GLint x, GLint y) 2114 { 2115 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, 0.0, 1.0); 2116 } 2117 2118 void STATE_APIENTRY 2119 crStateSelectRasterPos2iv(PCRStateTracker pState, const GLint * v) 2120 { 2121 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0); 2122 } 2123 2124 void STATE_APIENTRY 2125 crStateSelectRasterPos2s(PCRStateTracker pState, GLshort x, GLshort y) 2126 { 2127 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, 0.0, 1.0); 2128 } 2129 2130 void STATE_APIENTRY 2131 crStateSelectRasterPos2sv(PCRStateTracker pState, const GLshort * v) 2132 { 2133 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0); 2134 } 2135 2136 void STATE_APIENTRY 2137 crStateSelectRasterPos3d(PCRStateTracker pState, GLdouble x, GLdouble y, GLdouble z) 2138 { 2139 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0); 2140 } 2141 2142 void STATE_APIENTRY 2143 crStateSelectRasterPos3dv(PCRStateTracker pState, const GLdouble * v) 2144 { 2145 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , 1.0); 2146 } 2147 2148 void STATE_APIENTRY 2149 crStateSelectRasterPos3f(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z) 2150 { 2151 crStateSelectRasterPos4f(pState, x, y, z, 1.0); 2152 } 2153 2154 void STATE_APIENTRY 2155 crStateSelectRasterPos3fv(PCRStateTracker pState, const GLfloat * v) 2156 { 2157 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , 1.0); 2158 } 2159 2160 void STATE_APIENTRY 2161 crStateSelectRasterPos3i(PCRStateTracker pState, GLint x, GLint y, GLint z) 2162 { 2163 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0); 2164 } 2165 2166 void STATE_APIENTRY 2167 crStateSelectRasterPos3iv(PCRStateTracker pState, const GLint * v) 2168 { 2169 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , 1.0); 2170 } 2171 2172 void STATE_APIENTRY 2173 crStateSelectRasterPos3s(PCRStateTracker pState, GLshort x, GLshort y, GLshort z) 2174 { 2175 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0); 2176 } 2177 2178 void STATE_APIENTRY 2179 crStateSelectRasterPos3sv(PCRStateTracker pState, const GLshort * v) 2180 { 2181 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , 1.0); 2182 } 2183 2184 void STATE_APIENTRY 2185 crStateSelectRasterPos4d(PCRStateTracker pState, GLdouble x, GLdouble y, GLdouble z, GLdouble w) 2186 { 2187 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 2188 } 2189 2190 void STATE_APIENTRY 2191 crStateSelectRasterPos4dv(PCRStateTracker pState, const GLdouble * v) 2192 { 2193 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , (GLfloat) v[3]); 2194 } 2195 2196 void STATE_APIENTRY 2197 crStateSelectRasterPos4fv(PCRStateTracker pState, const GLfloat * v) 2198 { 2199 crStateSelectRasterPos4f(pState, v[0], v[1], v[2], v[3]); 2200 } 2201 2202 void STATE_APIENTRY 2203 crStateSelectRasterPos4i(PCRStateTracker pState, GLint x, GLint y, GLint z, GLint w) 2204 { 2205 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 2206 } 2207 2208 void STATE_APIENTRY 2209 crStateSelectRasterPos4iv(PCRStateTracker pState, const GLint * v) 2210 { 2211 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); 2212 } 2213 2214 void STATE_APIENTRY 2215 crStateSelectRasterPos4s(PCRStateTracker pState, GLshort x, GLshort y, GLshort z, GLshort w) 2216 { 2217 crStateSelectRasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 2218 } 2219 2220 void STATE_APIENTRY 2221 crStateSelectRasterPos4sv(PCRStateTracker pState, const GLshort * v) 2222 { 2223 crStateSelectRasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] , (GLfloat) v[3]); 2224 } 2225 2226 void STATE_APIENTRY 2227 crStateSelectRectf(PCRStateTracker pState, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1) 2228 { 2229 crStateSelectBegin(pState, GL_QUADS); 2230 crStateSelectVertex2f(pState, x0, y0); 2231 crStateSelectVertex2f(pState, x0, y1); 2232 crStateSelectVertex2f(pState, x1, y1); 2233 crStateSelectVertex2f(pState, x1, y0); 2234 crStateSelectEnd(pState); 2235 } 2236 2237 void STATE_APIENTRY 2238 crStateSelectRecti(PCRStateTracker pState, GLint x0, GLint y0, GLint x1, GLint y1) 2239 { 2240 crStateSelectRectf(pState, (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1); 2241 } 2242 2243 void STATE_APIENTRY 2244 crStateSelectRectd(PCRStateTracker pState, GLdouble x0, GLdouble y0, GLdouble x1, GLdouble y1) 2245 { 2246 crStateSelectRectf(pState, (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1); 2247 } 2248 2249 void STATE_APIENTRY 2250 crStateSelectRects(PCRStateTracker pState, GLshort x0, GLshort y0, GLshort x1, GLshort y1) 2251 { 2252 crStateSelectRectf(pState, (GLfloat) x0, (GLfloat) y0, (GLfloat) x1, (GLfloat) y1); 2253 } 2254 2255 void STATE_APIENTRY 2256 crStateSelectRectiv(PCRStateTracker pState, const GLint *v0, const GLint *v1) 2257 { 2258 crStateSelectRectf(pState, (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]); 2259 } 2260 2261 void STATE_APIENTRY 2262 crStateSelectRectfv(PCRStateTracker pState, const GLfloat *v0, const GLfloat *v1) 2263 { 2264 crStateSelectRectf(pState, v0[0], v0[1], v1[0], v1[1]); 2265 } 2266 2267 void STATE_APIENTRY 2268 crStateSelectRectdv(PCRStateTracker pState, const GLdouble *v0, const GLdouble *v1) 2269 { 2270 crStateSelectRectf(pState, (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]); 2271 } 2272 2273 void STATE_APIENTRY 2274 crStateSelectRectsv(PCRStateTracker pState, const GLshort *v0, const GLshort *v1) 2275 { 2276 crStateSelectRectf(pState, (GLfloat) v0[0], (GLfloat) v0[1], (GLfloat) v1[0], (GLfloat) v1[1]); 2288 2277 } 2289 2278 2290 2279 2291 2280 GLint STATE_APIENTRY 2292 crStateRenderMode( GLenum mode)2293 { 2294 CRContext *g = GetCurrentContext( );2281 crStateRenderMode(PCRStateTracker pState, GLenum mode) 2282 { 2283 CRContext *g = GetCurrentContext(pState); 2295 2284 CRFeedbackState *f = &(g->feedback); 2296 2285 CRSelectionState *se = &(g->selection); … … 2299 2288 if (g->current.inBeginEnd) 2300 2289 { 2301 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2290 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2302 2291 "RenderMode called in begin/end"); 2303 2292 return 0; … … 2343 2332 break; 2344 2333 default: 2345 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "invalid rendermode");2334 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "invalid rendermode"); 2346 2335 return 0; 2347 2336 } … … 2355 2344 { 2356 2345 /* haven't called glSelectBuffer yet */ 2357 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2346 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2358 2347 "buffersize = 0"); 2359 2348 } … … 2363 2352 { 2364 2353 /* haven't called glFeedbackBuffer yet */ 2365 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2354 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2366 2355 "buffersize = 0"); 2367 2356 } 2368 2357 break; 2369 2358 default: 2370 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "invalid rendermode");2359 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "invalid rendermode"); 2371 2360 return 0; 2372 2361 } … … 2379 2368 2380 2369 void STATE_APIENTRY 2381 crStateSelectDrawPixels( GLsizei width, GLsizei height, GLenum format,2370 crStateSelectDrawPixels(PCRStateTracker pState, GLsizei width, GLsizei height, GLenum format, 2382 2371 GLenum type, const GLvoid * pixels) 2383 2372 { 2373 CRContext *g = GetCurrentContext(pState); 2384 2374 (void) width; 2385 2375 (void) height; … … 2387 2377 (void) type; 2388 2378 (void) pixels; 2389 select_rasterpos( );2390 } 2391 2392 void STATE_APIENTRY 2393 crStateSelectCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height,2379 select_rasterpos(g); 2380 } 2381 2382 void STATE_APIENTRY 2383 crStateSelectCopyPixels(PCRStateTracker pState, GLint x, GLint y, GLsizei width, GLsizei height, 2394 2384 GLenum type) 2395 2385 { 2386 CRContext *g = GetCurrentContext(pState); 2396 2387 (void) x; 2397 2388 (void) y; … … 2399 2390 (void) height; 2400 2391 (void) type; 2401 select_rasterpos( );2402 } 2403 2404 void STATE_APIENTRY 2405 crStateSelectBitmap( GLsizei width, GLsizei height, GLfloat xorig,2392 select_rasterpos(g); 2393 } 2394 2395 void STATE_APIENTRY 2396 crStateSelectBitmap(PCRStateTracker pState, GLsizei width, GLsizei height, GLfloat xorig, 2406 2397 GLfloat yorig, GLfloat xmove, GLfloat ymove, 2407 2398 const GLubyte * bitmap) 2408 2399 { 2409 CRContext *g = GetCurrentContext( );2400 CRContext *g = GetCurrentContext(pState); 2410 2401 (void) width; 2411 2402 (void) height; … … 2414 2405 (void) bitmap; 2415 2406 2416 select_rasterpos( );2407 select_rasterpos(g); 2417 2408 if (g->current.rasterValid) 2418 2409 { -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_fence.c
r69392 r78375 11 11 12 12 13 void APIENTRY crStateGenFencesNV( GLsizei n, GLuint *fences)13 void APIENTRY crStateGenFencesNV(PCRStateTracker pState, GLsizei n, GLuint *fences) 14 14 { 15 (void)n; (void)fences;15 RT_NOREF(pState, n, fences); 16 16 } 17 17 18 18 19 void APIENTRY crStateDeleteFencesNV( GLsizei n, const GLuint *fences)19 void APIENTRY crStateDeleteFencesNV(PCRStateTracker pState, GLsizei n, const GLuint *fences) 20 20 { 21 (void)n; (void)fences;21 RT_NOREF(pState, n, fences); 22 22 } 23 23 24 void APIENTRY crStateSetFenceNV( GLuint fence, GLenum condition)24 void APIENTRY crStateSetFenceNV(PCRStateTracker pState, GLuint fence, GLenum condition) 25 25 { 26 (void)fence; (void)condition;26 RT_NOREF(pState, fence, condition); 27 27 } 28 28 29 GLboolean APIENTRY crStateTestFenceNV( GLuint fence)29 GLboolean APIENTRY crStateTestFenceNV(PCRStateTracker pState, GLuint fence) 30 30 { 31 (void)fence;31 RT_NOREF(pState, fence); 32 32 return GL_FALSE; 33 33 } 34 34 35 void APIENTRY crStateFinishFenceNV( GLuint fence)35 void APIENTRY crStateFinishFenceNV(PCRStateTracker pState, GLuint fence) 36 36 { 37 (void)fence;37 RT_NOREF(pState, fence); 38 38 } 39 39 40 GLboolean APIENTRY crStateIsFenceNV( GLuint fence)40 GLboolean APIENTRY crStateIsFenceNV(PCRStateTracker pState, GLuint fence) 41 41 { 42 (void)fence;42 RT_NOREF(pState, fence); 43 43 return GL_FALSE; 44 44 } 45 45 46 void APIENTRY crStateGetFenceivNV( GLuint fence, GLenum pname, GLint *params)46 void APIENTRY crStateGetFenceivNV(PCRStateTracker pState, GLuint fence, GLenum pname, GLint *params) 47 47 { 48 (void)fence; (void)pname; (void)params;48 RT_NOREF(pState, fence, pname, params); 49 49 } 50 50 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_flush.c
r69392 r78375 8 8 #include "cr_spu.h" 9 9 10 SPUDispatchTable diff_api; 11 12 void crStateFlushFunc( CRStateFlushFunc func ) 10 void crStateFlushFunc(PCRStateTracker pState, CRStateFlushFunc func ) 13 11 { 14 CRContext *g = GetCurrentContext( );12 CRContext *g = GetCurrentContext(pState); 15 13 16 14 g->flush_func = func; 17 15 } 18 16 19 void crStateFlushArg( void *arg )17 void crStateFlushArg(PCRStateTracker pState, void *arg ) 20 18 { 21 CRContext *g = GetCurrentContext( );19 CRContext *g = GetCurrentContext(pState); 22 20 23 21 g->flush_arg = arg; 24 22 } 25 23 26 void crStateDiffAPI( SPUDispatchTable *api )24 void crStateDiffAPI(PCRStateTracker pState, SPUDispatchTable *api ) 27 25 { 28 if (! diff_api.AlphaFunc)26 if (!pState->diff_api.AlphaFunc) 29 27 { 30 28 /* Called when starting up Chromium */ 31 crSPUInitDispatchTable( & (diff_api));29 crSPUInitDispatchTable( &pState->diff_api ); 32 30 } 33 crSPUCopyDispatchTable( & (diff_api), api );31 crSPUCopyDispatchTable( &pState->diff_api, api ); 34 32 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_fog.c
r69392 r78375 13 13 { 14 14 CRFogState *f = &ctx->fog; 15 CRStateBits *sb = GetCurrentBits( );15 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 16 16 CRFogBits *fb = &(sb->fog); 17 17 GLcolorf black = {0.0f, 0.0f, 0.0f, 0.0f}; … … 43 43 } 44 44 45 void STATE_APIENTRY crStateFogf( GLenum pname, GLfloat param)45 void STATE_APIENTRY crStateFogf(PCRStateTracker pState, GLenum pname, GLfloat param) 46 46 { 47 crStateFogfv( pname, ¶m );47 crStateFogfv(pState, pname, ¶m ); 48 48 } 49 49 50 void STATE_APIENTRY crStateFogi( GLenum pname, GLint param)50 void STATE_APIENTRY crStateFogi(PCRStateTracker pState, GLenum pname, GLint param) 51 51 { 52 52 GLfloat f_param = (GLfloat) param; 53 crStateFogfv( pname, &f_param );53 crStateFogfv(pState, pname, &f_param ); 54 54 } 55 55 56 void STATE_APIENTRY crStateFogiv( GLenum pname, const GLint *param)56 void STATE_APIENTRY crStateFogiv(PCRStateTracker pState, GLenum pname, const GLint *param) 57 57 { 58 58 GLcolor f_color; … … 66 66 case GL_FOG_INDEX: 67 67 f_param = (GLfloat) (*param); 68 crStateFogfv( pname, &f_param );68 crStateFogfv(pState, pname, &f_param ); 69 69 break; 70 70 case GL_FOG_COLOR: … … 73 73 f_color.b = ((GLfloat) param[2]) / ((GLfloat) CR_MAXINT); 74 74 f_color.a = ((GLfloat) param[3]) / ((GLfloat) CR_MAXINT); 75 crStateFogfv( pname, (GLfloat *) &f_color );75 crStateFogfv(pState, pname, (GLfloat *) &f_color ); 76 76 break; 77 77 #ifdef CR_NV_fog_distance 78 78 case GL_FOG_DISTANCE_MODE_NV: 79 79 f_param = (GLfloat) (*param); 80 crStateFogfv( pname, &f_param );80 crStateFogfv(pState, pname, &f_param ); 81 81 break; 82 82 #endif … … 84 84 case GL_FOG_COORDINATE_SOURCE_EXT: 85 85 f_param = (GLfloat) (*param); 86 crStateFogfv( pname, &f_param );86 crStateFogfv(pState, pname, &f_param ); 87 87 break; 88 88 #endif 89 89 default: 90 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid glFog Param: %d", param);90 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid glFog Param: %d", param); 91 91 return; 92 92 } 93 93 } 94 94 95 void STATE_APIENTRY crStateFogfv( GLenum pname, const GLfloat *param)95 void STATE_APIENTRY crStateFogfv(PCRStateTracker pState, GLenum pname, const GLfloat *param) 96 96 { 97 CRContext *g = GetCurrentContext( );97 CRContext *g = GetCurrentContext(pState); 98 98 CRFogState *f = &(g->fog); 99 CRStateBits *sb = GetCurrentBits( );99 CRStateBits *sb = GetCurrentBits(pState); 100 100 CRFogBits *fb = &(sb->fog); 101 101 102 102 if (g->current.inBeginEnd) 103 103 { 104 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glFogfv called in Begin/End");104 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glFogfv called in Begin/End"); 105 105 return; 106 106 } … … 115 115 if (e != GL_LINEAR && e != GL_EXP && e != GL_EXP2) 116 116 { 117 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid param for glFog: %d", e);117 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid param for glFog: %d", e); 118 118 return; 119 119 } … … 157 157 param[0] != GL_EYE_PLANE_ABSOLUTE_NV ) 158 158 { 159 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,159 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 160 160 "Fogfv: GL_FOG_DISTANCE_MODE_NV called with illegal parameter: 0x%x", (GLenum) param[0]); 161 161 return; … … 166 166 else 167 167 { 168 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid glFog Param: %d", param);168 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid glFog Param: %d", param); 169 169 return; 170 170 } … … 178 178 (GLenum) param[0] != GL_FRAGMENT_DEPTH_EXT) 179 179 { 180 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,180 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 181 181 "Fogfv: GL_FOG_COORDINATE_SOURCE_EXT called with illegal parameter: 0x%x", (GLenum) param[0]); 182 182 return; … … 187 187 else 188 188 { 189 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid glFog Param: 0x%x", (GLint) param[0]);189 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid glFog Param: 0x%x", (GLint) param[0]); 190 190 return; 191 191 } … … 193 193 #endif 194 194 default: 195 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid glFog Param: %d", param);195 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Invalid glFog Param: %d", param); 196 196 return; 197 197 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_framebuffer.c
r76553 r78375 34 34 } 35 35 36 void STATE_APIENTRY crStateGenFramebuffersEXT( GLsizei n, GLuint *buffers)37 { 38 CRContext *g = GetCurrentContext( );36 void STATE_APIENTRY crStateGenFramebuffersEXT(PCRStateTracker pState, GLsizei n, GLuint *buffers) 37 { 38 CRContext *g = GetCurrentContext(pState); 39 39 crStateGenNames(g, g->shared->fbTable, n, buffers); 40 40 } 41 41 42 void STATE_APIENTRY crStateGenRenderbuffersEXT( GLsizei n, GLuint *buffers)43 { 44 CRContext *g = GetCurrentContext( );42 void STATE_APIENTRY crStateGenRenderbuffersEXT(PCRStateTracker pState, GLsizei n, GLuint *buffers) 43 { 44 CRContext *g = GetCurrentContext(pState); 45 45 crStateGenNames(g, g->shared->rbTable, n, buffers); 46 46 } 47 47 48 void crStateRegFramebuffers( GLsizei n, GLuint *buffers)49 { 50 CRContext *g = GetCurrentContext( );48 void crStateRegFramebuffers(PCRStateTracker pState, GLsizei n, GLuint *buffers) 49 { 50 CRContext *g = GetCurrentContext(pState); 51 51 crStateRegNames(g, g->shared->fbTable, n, buffers); 52 52 } 53 53 54 void crStateRegRenderbuffers( GLsizei n, GLuint *buffers)55 { 56 CRContext *g = GetCurrentContext( );54 void crStateRegRenderbuffers(PCRStateTracker pState, GLsizei n, GLuint *buffers) 55 { 56 CRContext *g = GetCurrentContext(pState); 57 57 crStateRegNames(g, g->shared->rbTable, n, buffers); 58 58 } … … 63 63 crStateFramebufferAllocate(CRContext *ctx, GLuint name) 64 64 { 65 PCRStateTracker pState = ctx->pStateTracker; 65 66 CRFramebufferObject *buffer = (CRFramebufferObject*) crCalloc(sizeof(CRFramebufferObject)); 66 67 CRSTATE_CHECKERR_RET(!buffer, GL_OUT_OF_MEMORY, "crStateFramebufferAllocate", NULL); 67 68 buffer->id = name; 68 69 #ifndef IN_GUEST 69 diff_api.GenFramebuffersEXT(1, &buffer->hwid);70 ctx->pStateTracker->diff_api.GenFramebuffersEXT(1, &buffer->hwid); 70 71 if (!buffer->hwid) 71 72 { … … 88 89 crStateRenderbufferAllocate(CRContext *ctx, GLuint name) 89 90 { 91 PCRStateTracker pState = ctx->pStateTracker; 90 92 CRRenderbufferObject *buffer = (CRRenderbufferObject*) crCalloc(sizeof(CRRenderbufferObject)); 91 93 CRSTATE_CHECKERR_RET(!buffer, GL_OUT_OF_MEMORY, "crStateRenderbufferAllocate", NULL); 92 94 buffer->id = name; 93 95 #ifndef IN_GUEST 94 diff_api.GenRenderbuffersEXT(1, &buffer->hwid);96 ctx->pStateTracker->diff_api.GenRenderbuffersEXT(1, &buffer->hwid); 95 97 if (!buffer->hwid) 96 98 { … … 110 112 } 111 113 112 void crStateFreeFBO(void *data) 113 { 114 void crStateFreeFBO(void *data, void *pvUser) 115 { 116 PCRStateTracker pState = (PCRStateTracker)pvUser; 114 117 CRFramebufferObject *pObj = (CRFramebufferObject *)data; 115 118 116 119 #ifndef IN_GUEST 117 if (diff_api.DeleteFramebuffersEXT) 118 { 119 diff_api.DeleteFramebuffersEXT(1, &pObj->hwid); 120 } 120 if (pState->diff_api.DeleteFramebuffersEXT) 121 { 122 pState->diff_api.DeleteFramebuffersEXT(1, &pObj->hwid); 123 } 124 #else 125 RT_NOREF(pState); 121 126 #endif 122 127 … … 124 129 } 125 130 126 void crStateFreeRBO(void *data) 127 { 131 void crStateFreeRBO(void *data, void *pvUser) 132 { 133 PCRStateTracker pState = (PCRStateTracker)pvUser; 128 134 CRRenderbufferObject *pObj = (CRRenderbufferObject *)data; 129 135 130 136 #ifndef IN_GUEST 131 if (diff_api.DeleteRenderbuffersEXT) 132 { 133 diff_api.DeleteRenderbuffersEXT(1, &pObj->hwid); 134 } 137 if (pState->diff_api.DeleteRenderbuffersEXT) 138 { 139 pState->diff_api.DeleteRenderbuffersEXT(1, &pObj->hwid); 140 } 141 #else 142 RT_NOREF(pState); 135 143 #endif 136 144 … … 149 157 150 158 DECLEXPORT(void) STATE_APIENTRY 151 crStateBindRenderbufferEXT( GLenum target, GLuint renderbuffer)152 { 153 CRContext *g = GetCurrentContext( );159 crStateBindRenderbufferEXT(PCRStateTracker pState, GLenum target, GLuint renderbuffer) 160 { 161 CRContext *g = GetCurrentContext(pState); 154 162 CRFramebufferObjectState *fbo = &g->framebufferobject; 155 163 … … 170 178 } 171 179 172 static void crStateCheckFBOAttachments( CRFramebufferObject *pFBO, GLuint rbo, GLenum target)180 static void crStateCheckFBOAttachments(PCRStateTracker pState, CRFramebufferObject *pFBO, GLuint rbo, GLenum target) 173 181 { 174 182 CRFBOAttachmentPoint *ap; … … 183 191 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==rbo) 184 192 { 185 crStateFramebufferRenderbufferEXT( target, u+GL_COLOR_ATTACHMENT0_EXT, 0, 0);193 crStateFramebufferRenderbufferEXT(pState, target, u+GL_COLOR_ATTACHMENT0_EXT, 0, 0); 186 194 #ifdef IN_GUEST 187 195 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; … … 193 201 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==rbo) 194 202 { 195 crStateFramebufferRenderbufferEXT( target, GL_DEPTH_ATTACHMENT_EXT, 0, 0);203 crStateFramebufferRenderbufferEXT(pState, target, GL_DEPTH_ATTACHMENT_EXT, 0, 0); 196 204 #ifdef IN_GUEST 197 205 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; … … 201 209 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==rbo) 202 210 { 203 crStateFramebufferRenderbufferEXT( target, GL_STENCIL_ATTACHMENT_EXT, 0, 0);211 crStateFramebufferRenderbufferEXT(pState, target, GL_STENCIL_ATTACHMENT_EXT, 0, 0); 204 212 #ifdef IN_GUEST 205 213 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; … … 218 226 219 227 /* check the attachments of current framebuffers */ 220 crStateCheckFBOAttachments( fbo->readFB, fboId, GL_READ_FRAMEBUFFER);221 crStateCheckFBOAttachments( fbo->drawFB, fboId, GL_DRAW_FRAMEBUFFER);228 crStateCheckFBOAttachments(g->pStateTracker, fbo->readFB, fboId, GL_READ_FRAMEBUFFER); 229 crStateCheckFBOAttachments(g->pStateTracker, fbo->drawFB, fboId, GL_DRAW_FRAMEBUFFER); 222 230 223 231 CR_STATE_SHAREDOBJ_USAGE_CLEAR(rbo, g); … … 225 233 226 234 DECLEXPORT(void) STATE_APIENTRY 227 crStateDeleteRenderbuffersEXT( GLsizei n, const GLuint *renderbuffers)228 { 229 CRContext *g = GetCurrentContext( );235 crStateDeleteRenderbuffersEXT(PCRStateTracker pState, GLsizei n, const GLuint *renderbuffers) 236 { 237 CRContext *g = GetCurrentContext(pState); 230 238 /*CRFramebufferObjectState *fbo = &g->framebufferobject; - unused */ 231 239 int i; … … 251 259 * This is why g_pAvailableContexts[j] could be NULL 252 260 * also g_pAvailableContexts[0] will hold default context, which we should discard */ 253 CRContext *ctx = g_pAvailableContexts[j];261 CRContext *ctx = pState->apAvailableContexts[j]; 254 262 if (j && ctx) 255 263 { … … 265 273 CR_STATE_SHAREDOBJ_USAGE_CLEAR_IDX(rbo, j); 266 274 } 267 crHashtableDelete (g->shared->rbTable, renderbuffers[i], crStateFreeRBO);275 crHashtableDeleteEx(g->shared->rbTable, renderbuffers[i], crStateFreeRBO, pState); 268 276 } 269 277 } … … 272 280 273 281 DECLEXPORT(void) STATE_APIENTRY 274 crStateRenderbufferStorageEXT( GLenum target, GLenum internalformat, GLsizei width, GLsizei height)275 { 276 CRContext *g = GetCurrentContext( );282 crStateRenderbufferStorageEXT(PCRStateTracker pState, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) 283 { 284 CRContext *g = GetCurrentContext(pState); 277 285 CRFramebufferObjectState *fbo = &g->framebufferobject; 278 286 CRRenderbufferObject *rb = fbo->renderbuffer; … … 288 296 289 297 DECLEXPORT(void) STATE_APIENTRY 290 crStateGetRenderbufferParameterivEXT( GLenum target, GLenum pname, GLint *params)291 { 292 CRContext *g = GetCurrentContext( );298 crStateGetRenderbufferParameterivEXT(PCRStateTracker pState, GLenum target, GLenum pname, GLint *params) 299 { 300 CRContext *g = GetCurrentContext(pState); 293 301 CRFramebufferObjectState *fbo = &g->framebufferobject; 294 302 CRRenderbufferObject *rb = fbo->renderbuffer; … … 371 379 372 380 DECLEXPORT(void) STATE_APIENTRY 373 crStateBindFramebufferEXT( GLenum target, GLuint framebuffer)374 { 375 CRContext *g = GetCurrentContext( );381 crStateBindFramebufferEXT(PCRStateTracker pState, GLenum target, GLuint framebuffer) 382 { 383 CRContext *g = GetCurrentContext(pState); 376 384 CRFramebufferObjectState *fbo = &g->framebufferobject; 377 385 CRFramebufferObject *pFBO=NULL; … … 430 438 431 439 DECLEXPORT(void) STATE_APIENTRY 432 crStateDeleteFramebuffersEXT( GLsizei n, const GLuint *framebuffers)433 { 434 CRContext *g = GetCurrentContext( );440 crStateDeleteFramebuffersEXT(PCRStateTracker pState, GLsizei n, const GLuint *framebuffers) 441 { 442 CRContext *g = GetCurrentContext(pState); 435 443 int i; 436 444 … … 456 464 * This is why g_pAvailableContexts[j] could be NULL 457 465 * also g_pAvailableContexts[0] will hold default context, which we should discard */ 458 CRContext *ctx = g_pAvailableContexts[j];466 CRContext *ctx = pState->apAvailableContexts[j]; 459 467 if (j && ctx) 460 468 { … … 473 481 CR_STATE_SHAREDOBJ_USAGE_CLEAR_IDX(fb, j); 474 482 } 475 crHashtableDelete (g->shared->fbTable, framebuffers[i], crStateFreeFBO);483 crHashtableDeleteEx(g->shared->fbTable, framebuffers[i], crStateFreeFBO, pState); 476 484 } 477 485 } … … 523 531 } 524 532 525 static GLuint crStateFramebufferTextureCheck( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level,533 static GLuint crStateFramebufferTextureCheck(CRContext *g, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, 526 534 CRFBOAttachmentPoint **aap, CRTextureObj **tobj) 527 535 { 528 CRContext *g = GetCurrentContext();536 PCRStateTracker pState = g->pStateTracker; 529 537 CRFramebufferObjectState *fbo = &g->framebufferobject; 530 538 CRFramebufferObject *apFBOs[2]; … … 565 573 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 566 574 maxtexsizelog2 = crLog2Floor(g->limits.maxCubeMapTextureSize); 567 *tobj = crStateTextureGet( GL_TEXTURE_CUBE_MAP_ARB, texture);575 *tobj = crStateTextureGet(pState, GL_TEXTURE_CUBE_MAP_ARB, texture); 568 576 break; 569 577 case GL_TEXTURE_RECTANGLE_ARB: 570 578 maxtexsizelog2 = 0; 571 *tobj = crStateTextureGet( textarget, texture);579 *tobj = crStateTextureGet(pState, textarget, texture); 572 580 break; 573 581 case GL_TEXTURE_3D: 574 582 maxtexsizelog2 = crLog2Floor(g->limits.max3DTextureSize); 575 *tobj = crStateTextureGet( textarget, texture);583 *tobj = crStateTextureGet(pState, textarget, texture); 576 584 break; 577 585 case GL_TEXTURE_2D: 578 586 case GL_TEXTURE_1D: 579 587 maxtexsizelog2 = crLog2Floor(g->limits.maxTextureSize); 580 *tobj = crStateTextureGet( textarget, texture);588 *tobj = crStateTextureGet(pState, textarget, texture); 581 589 break; 582 590 default: … … 611 619 612 620 DECLEXPORT(void) STATE_APIENTRY 613 crStateFramebufferTexture1DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)614 { 615 CRContext *g = GetCurrentContext( );621 crStateFramebufferTexture1DEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 622 { 623 CRContext *g = GetCurrentContext(pState); 616 624 /*CRFramebufferObjectState *fbo = &g->framebufferobject; - unused */ 617 625 CRFBOAttachmentPoint *aap[2]; … … 619 627 CRTextureObj *tobj; 620 628 621 cap = crStateFramebufferTextureCheck( target, attachment, textarget, texture, level, aap, &tobj);629 cap = crStateFramebufferTextureCheck(g, target, attachment, textarget, texture, level, aap, &tobj); 622 630 if (!cap) return; 623 631 … … 645 653 646 654 DECLEXPORT(void) STATE_APIENTRY 647 crStateFramebufferTexture2DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)648 { 649 CRContext *g = GetCurrentContext( );655 crStateFramebufferTexture2DEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 656 { 657 CRContext *g = GetCurrentContext(pState); 650 658 /* CRFramebufferObjectState *fbo = &g->framebufferobject; - unused */ 651 659 CRFBOAttachmentPoint *aap[2]; … … 653 661 CRTextureObj *tobj; 654 662 655 cap = crStateFramebufferTextureCheck( target, attachment, textarget, texture, level, aap, &tobj);663 cap = crStateFramebufferTextureCheck(g, target, attachment, textarget, texture, level, aap, &tobj); 656 664 if (!cap) return; 657 665 … … 683 691 684 692 DECLEXPORT(void) STATE_APIENTRY 685 crStateFramebufferTexture3DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)686 { 687 CRContext *g = GetCurrentContext( );693 crStateFramebufferTexture3DEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) 694 { 695 CRContext *g = GetCurrentContext(pState); 688 696 /* CRFramebufferObjectState *fbo = &g->framebufferobject; - unused */ 689 697 CRFBOAttachmentPoint *aap[2]; … … 691 699 CRTextureObj *tobj; 692 700 693 cap = crStateFramebufferTextureCheck( target, attachment, textarget, texture, level, aap, &tobj);701 cap = crStateFramebufferTextureCheck(g, target, attachment, textarget, texture, level, aap, &tobj); 694 702 if (!cap) return; 695 703 … … 719 727 720 728 DECLEXPORT(void) STATE_APIENTRY 721 crStateFramebufferRenderbufferEXT( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)722 { 723 CRContext *g = GetCurrentContext( );729 crStateFramebufferRenderbufferEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) 730 { 731 CRContext *g = GetCurrentContext(pState); 724 732 CRFramebufferObjectState *fbo = &g->framebufferobject; 725 733 CRFramebufferObject *apFBOs[2]; … … 783 791 784 792 DECLEXPORT(void) STATE_APIENTRY 785 crStateGetFramebufferAttachmentParameterivEXT( GLenum target, GLenum attachment, GLenum pname, GLint *params)786 { 787 CRContext *g = GetCurrentContext( );793 crStateGetFramebufferAttachmentParameterivEXT(PCRStateTracker pState, GLenum target, GLenum attachment, GLenum pname, GLint *params) 794 { 795 CRContext *g = GetCurrentContext(pState); 788 796 CRFramebufferObjectState *fbo = &g->framebufferobject; 789 797 CRFramebufferObject *apFBOs[2]; … … 839 847 } 840 848 841 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsFramebufferEXT( GLuint framebuffer )842 { 843 CRContext *g = GetCurrentContext( );849 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsFramebufferEXT(PCRStateTracker pState, GLuint framebuffer ) 850 { 851 CRContext *g = GetCurrentContext(pState); 844 852 845 853 FLUSH(); 846 854 847 855 if (g->current.inBeginEnd) { 848 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,856 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 849 857 "glIsFramebufferEXT called in begin/end"); 850 858 return GL_FALSE; … … 854 862 } 855 863 856 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsRenderbufferEXT( GLuint renderbuffer )857 { 858 CRContext *g = GetCurrentContext( );864 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsRenderbufferEXT(PCRStateTracker pState, GLuint renderbuffer ) 865 { 866 CRContext *g = GetCurrentContext(pState); 859 867 860 868 … … 862 870 863 871 if (g->current.inBeginEnd) { 864 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,872 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 865 873 "glIsRenderbufferEXT called in begin/end"); 866 874 return GL_FALSE; … … 871 879 872 880 DECLEXPORT(void) STATE_APIENTRY 873 crStateGenerateMipmapEXT(GLenum target) 874 { 881 crStateGenerateMipmapEXT(PCRStateTracker pState, GLenum target) 882 { 883 RT_NOREF(pState); 875 884 (void)target; 876 885 /** @todo */ … … 879 888 static void crStateSyncRenderbuffersCB(unsigned long key, void *data1, void *data2) 880 889 { 890 PCRStateTracker pState = (PCRStateTracker)data2; 881 891 CRRenderbufferObject *pRBO = (CRRenderbufferObject*) data1; 882 (void)key; (void)data2;883 884 diff_api.GenRenderbuffersEXT(1, &pRBO->hwid);892 (void)key; 893 894 pState->diff_api.GenRenderbuffersEXT(1, &pRBO->hwid); 885 895 886 896 if (pRBO->width && pRBO->height) 887 897 { 888 diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, pRBO->hwid);889 diff_api.RenderbufferStorageEXT(GL_RENDERBUFFER_EXT, pRBO->internalformat, pRBO->width, pRBO->height);898 pState->diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, pRBO->hwid); 899 pState->diff_api.RenderbufferStorageEXT(GL_RENDERBUFFER_EXT, pRBO->internalformat, pRBO->width, pRBO->height); 890 900 } 891 901 } … … 893 903 static void crStateSyncAP(CRFBOAttachmentPoint *pAP, GLenum ap, CRContext *ctx) 894 904 { 905 PCRStateTracker pState = ctx->pStateTracker; 895 906 CRRenderbufferObject *pRBO; 896 907 CRTextureObj *tobj; … … 909 920 { 910 921 case GL_TEXTURE_1D: 911 diff_api.FramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, ap, tobj->target, crStateGetTextureObjHWID(tobj), pAP->level);922 pState->diff_api.FramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, ap, tobj->target, crStateGetTextureObjHWID(pState, tobj), pAP->level); 912 923 break; 913 924 case GL_TEXTURE_2D: 914 925 case GL_TEXTURE_RECTANGLE_ARB: 915 diff_api.FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ap, tobj->target, crStateGetTextureObjHWID(tobj), pAP->level);926 pState->diff_api.FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ap, tobj->target, crStateGetTextureObjHWID(pState, tobj), pAP->level); 916 927 break; 917 928 case GL_TEXTURE_CUBE_MAP_ARB: 918 diff_api.FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ap, pAP->face, crStateGetTextureObjHWID(tobj), pAP->level);929 pState->diff_api.FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ap, pAP->face, crStateGetTextureObjHWID(pState, tobj), pAP->level); 919 930 break; 920 931 case GL_TEXTURE_3D: 921 diff_api.FramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, ap, tobj->target, crStateGetTextureObjHWID(tobj), pAP->level, pAP->zoffset);932 pState->diff_api.FramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, ap, tobj->target, crStateGetTextureObjHWID(pState, tobj), pAP->level, pAP->zoffset); 922 933 break; 923 934 default: … … 932 943 case GL_RENDERBUFFER_EXT: 933 944 pRBO = (CRRenderbufferObject*) crHashtableSearch(ctx->shared->rbTable, pAP->name); 934 diff_api.FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, ap, GL_RENDERBUFFER_EXT, pRBO->hwid);945 pState->diff_api.FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, ap, GL_RENDERBUFFER_EXT, pRBO->hwid); 935 946 break; 936 947 case GL_NONE: … … 945 956 CRFramebufferObject *pFBO = (CRFramebufferObject*) data1; 946 957 CRContext *ctx = (CRContext*) data2; 958 PCRStateTracker pState = ctx->pStateTracker; 947 959 GLint i; 948 960 (void)key; 949 961 950 diff_api.GenFramebuffersEXT(1, &pFBO->hwid);951 952 diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, pFBO->hwid);962 pState->diff_api.GenFramebuffersEXT(1, &pFBO->hwid); 963 964 pState->diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, pFBO->hwid); 953 965 954 966 for (i=0; i<CR_MAX_COLOR_ATTACHMENTS; ++i) … … 964 976 crStateFramebufferObjectSwitch(CRContext *from, CRContext *to) 965 977 { 978 PCRStateTracker pState = to->pStateTracker; 979 966 980 if (to->shared->bFBOResyncNeeded) 967 981 { 968 982 to->shared->bFBOResyncNeeded = GL_FALSE; 969 983 970 crHashtableWalk(to->shared->rbTable, crStateSyncRenderbuffersCB, NULL);984 crHashtableWalk(to->shared->rbTable, crStateSyncRenderbuffersCB, pState); 971 985 crHashtableWalk(to->shared->fbTable, crStateSyncFramebuffersCB, to); 972 986 973 987 if (to->framebufferobject.drawFB==to->framebufferobject.readFB) 974 988 { 975 diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, to->framebufferobject.drawFB?989 pState->diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, to->framebufferobject.drawFB? 976 990 to->framebufferobject.drawFB->hwid:0); 977 991 } 978 992 else 979 993 { 980 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, to->framebufferobject.drawFB?994 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, to->framebufferobject.drawFB? 981 995 to->framebufferobject.drawFB->hwid:0); 982 996 983 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, to->framebufferobject.readFB?997 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, to->framebufferobject.readFB? 984 998 to->framebufferobject.readFB->hwid:0); 985 999 } 986 1000 987 diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, to->framebufferobject.renderbuffer?1001 pState->diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, to->framebufferobject.renderbuffer? 988 1002 to->framebufferobject.renderbuffer->hwid:0); 989 1003 } … … 995 1009 if (to->framebufferobject.drawFB==to->framebufferobject.readFB) 996 1010 { 997 diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, to->framebufferobject.drawFB?1011 pState->diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, to->framebufferobject.drawFB? 998 1012 to->framebufferobject.drawFB->hwid:0); 999 1013 } 1000 1014 else 1001 1015 { 1002 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, to->framebufferobject.drawFB?1016 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, to->framebufferobject.drawFB? 1003 1017 to->framebufferobject.drawFB->hwid:0); 1004 1018 1005 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, to->framebufferobject.readFB?1019 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, to->framebufferobject.readFB? 1006 1020 to->framebufferobject.readFB->hwid:0); 1007 1021 } 1008 1022 1009 diff_api.DrawBuffer(to->framebufferobject.drawFB?to->framebufferobject.drawFB->drawbuffer[0]:to->buffer.drawBuffer);1010 diff_api.ReadBuffer(to->framebufferobject.readFB?to->framebufferobject.readFB->readbuffer:to->buffer.readBuffer);1023 pState->diff_api.DrawBuffer(to->framebufferobject.drawFB?to->framebufferobject.drawFB->drawbuffer[0]:to->buffer.drawBuffer); 1024 pState->diff_api.ReadBuffer(to->framebufferobject.readFB?to->framebufferobject.readFB->readbuffer:to->buffer.readBuffer); 1011 1025 } 1012 1026 1013 1027 if (to->framebufferobject.renderbuffer!=from->framebufferobject.renderbuffer) 1014 1028 { 1015 diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, to->framebufferobject.renderbuffer?1029 pState->diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, to->framebufferobject.renderbuffer? 1016 1030 to->framebufferobject.renderbuffer->hwid:0); 1017 1031 } … … 1022 1036 crStateFramebufferObjectDisableHW(CRContext *ctx, GLuint idDrawFBO, GLuint idReadFBO) 1023 1037 { 1038 PCRStateTracker pState = ctx->pStateTracker; 1024 1039 GLenum idDrawBuffer = 0, idReadBuffer = 0; 1025 1040 1026 1041 if (ctx->framebufferobject.drawFB || idDrawFBO) 1027 1042 { 1028 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0);1043 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0); 1029 1044 idDrawBuffer = ctx->buffer.drawBuffer; 1030 1045 } … … 1032 1047 if (ctx->framebufferobject.readFB || idReadFBO) 1033 1048 { 1034 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0);1049 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0); 1035 1050 idReadBuffer = ctx->buffer.readBuffer; 1036 1051 } 1037 1052 1038 1053 if (idDrawBuffer) 1039 diff_api.DrawBuffer(idDrawBuffer);1054 pState->diff_api.DrawBuffer(idDrawBuffer); 1040 1055 if (idReadBuffer) 1041 diff_api.ReadBuffer(idReadBuffer);1056 pState->diff_api.ReadBuffer(idReadBuffer); 1042 1057 1043 1058 if (ctx->framebufferobject.renderbuffer) 1044 diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);1059 pState->diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); 1045 1060 } 1046 1061 … … 1048 1063 crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx, GLuint idDrawFBO, GLuint idReadFBO) 1049 1064 { 1065 PCRStateTracker pState = fromCtx ? fromCtx->pStateTracker : toCtx->pStateTracker; 1050 1066 GLuint idReadBuffer = 0, idDrawBuffer = 0; 1051 1067 if (!fromCtx) … … 1055 1071 && fromCtx->framebufferobject.drawFB == toCtx->framebufferobject.drawFB) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */ 1056 1072 { 1057 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, toCtx->framebufferobject.drawFB->hwid);1073 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, toCtx->framebufferobject.drawFB->hwid); 1058 1074 idDrawBuffer = toCtx->framebufferobject.drawFB->drawbuffer[0]; 1059 1075 } 1060 1076 else if (idDrawFBO && !toCtx->framebufferobject.drawFB) 1061 1077 { 1062 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idDrawFBO);1078 pState->diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idDrawFBO); 1063 1079 idDrawBuffer = GL_COLOR_ATTACHMENT0; 1064 1080 } … … 1067 1083 && fromCtx->framebufferobject.readFB == toCtx->framebufferobject.readFB) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */ 1068 1084 { 1069 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, toCtx->framebufferobject.readFB->hwid);1085 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, toCtx->framebufferobject.readFB->hwid); 1070 1086 idReadBuffer = toCtx->framebufferobject.readFB->readbuffer; 1071 1087 } 1072 1088 else if (idReadFBO && !toCtx->framebufferobject.readFB) 1073 1089 { 1074 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idReadFBO);1090 pState->diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idReadFBO); 1075 1091 idReadBuffer = GL_COLOR_ATTACHMENT0; 1076 1092 } 1077 1093 1078 1094 if (idDrawBuffer) 1079 diff_api.DrawBuffer(idDrawBuffer);1095 pState->diff_api.DrawBuffer(idDrawBuffer); 1080 1096 if (idReadBuffer) 1081 diff_api.ReadBuffer(idReadBuffer);1097 pState->diff_api.ReadBuffer(idReadBuffer); 1082 1098 1083 1099 if (fromCtx->framebufferobject.renderbuffer /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */ 1084 1100 && fromCtx->framebufferobject.renderbuffer==toCtx->framebufferobject.renderbuffer) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */ 1085 1101 { 1086 diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, toCtx->framebufferobject.renderbuffer->hwid);1087 } 1088 } 1089 1090 1091 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetFramebufferHWID( GLuint id)1092 { 1093 CRContext *g = GetCurrentContext( );1102 pState->diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, toCtx->framebufferobject.renderbuffer->hwid); 1103 } 1104 } 1105 1106 1107 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetFramebufferHWID(PCRStateTracker pState, GLuint id) 1108 { 1109 CRContext *g = GetCurrentContext(pState); 1094 1110 CRFramebufferObject *pFBO = (CRFramebufferObject*) crHashtableSearch(g->shared->fbTable, id); 1095 1111 #if 0 /*def DEBUG_misha*/ … … 1099 1115 } 1100 1116 1101 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetRenderbufferHWID( GLuint id)1102 { 1103 CRContext *g = GetCurrentContext( );1117 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetRenderbufferHWID(PCRStateTracker pState, GLuint id) 1118 { 1119 CRContext *g = GetCurrentContext(pState); 1104 1120 CRRenderbufferObject *pRBO = (CRRenderbufferObject*) crHashtableSearch(g->shared->rbTable, id); 1105 1121 … … 1127 1143 } 1128 1144 1129 DECLEXPORT(GLuint) STATE_APIENTRY crStateFBOHWIDtoID( GLuint hwid)1130 { 1131 CRContext *g = GetCurrentContext( );1145 DECLEXPORT(GLuint) STATE_APIENTRY crStateFBOHWIDtoID(PCRStateTracker pState, GLuint hwid) 1146 { 1147 CRContext *g = GetCurrentContext(pState); 1132 1148 crCheckIDHWID_t parms; 1133 1149 … … 1139 1155 } 1140 1156 1141 DECLEXPORT(GLuint) STATE_APIENTRY crStateRBOHWIDtoID( GLuint hwid)1142 { 1143 CRContext *g = GetCurrentContext( );1157 DECLEXPORT(GLuint) STATE_APIENTRY crStateRBOHWIDtoID(PCRStateTracker pState, GLuint hwid) 1158 { 1159 CRContext *g = GetCurrentContext(pState); 1144 1160 crCheckIDHWID_t parms; 1145 1161 … … 1152 1168 1153 1169 #ifdef IN_GUEST 1154 DECLEXPORT(GLenum) STATE_APIENTRY crStateCheckFramebufferStatusEXT( GLenum target)1170 DECLEXPORT(GLenum) STATE_APIENTRY crStateCheckFramebufferStatusEXT(PCRStateTracker pState, GLenum target) 1155 1171 { 1156 1172 GLenum status = GL_FRAMEBUFFER_UNDEFINED; 1157 CRContext *g = GetCurrentContext( );1173 CRContext *g = GetCurrentContext(pState); 1158 1174 CRFramebufferObjectState *fbo = &g->framebufferobject; 1159 1175 CRFramebufferObject *pFBO=NULL; … … 1177 1193 } 1178 1194 1179 DECLEXPORT(GLenum) STATE_APIENTRY crStateSetFramebufferStatus( GLenum target, GLenum status)1180 { 1181 CRContext *g = GetCurrentContext( );1195 DECLEXPORT(GLenum) STATE_APIENTRY crStateSetFramebufferStatus(PCRStateTracker pState, GLenum target, GLenum status) 1196 { 1197 CRContext *g = GetCurrentContext(pState); 1182 1198 CRFramebufferObjectState *fbo = &g->framebufferobject; 1183 1199 CRFramebufferObject *pFBO=NULL; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_funcs.py
r78116 r78375 34 34 #endif 35 35 36 #define STATE_UNUSED(x) ((void)x)""") 36 #define STATE_UNUSED(x) ((void)x) 37 38 /** Forward declaration of the stae tracker. */ 39 typedef struct CRStateTracker *PCRStateTracker;""") 37 40 38 41 … … 41 44 return_type = apiutil.ReturnType(func_name) 42 45 params = apiutil.Parameters(func_name) 43 print('DECLEXPORT(%s) STATE_APIENTRY crState%s(%s);' % (return_type, func_name, apiutil.MakeDeclarationStringForDispatcher(params))) 46 if len(params) == 0: 47 print('DECLEXPORT(%s) STATE_APIENTRY crState%s(PCRStateTracker pState);' % (return_type, func_name)) 48 else: 49 print('DECLEXPORT(%s) STATE_APIENTRY crState%s(PCRStateTracker pState, %s);' % (return_type, func_name, apiutil.MakeDeclarationStringForDispatcher(params))) 44 50 45 51 for func_name in apiutil.AllSpecials( "state_feedback" ): 46 52 return_type = apiutil.ReturnType(func_name) 47 53 params = apiutil.Parameters(func_name) 48 print('DECLEXPORT(%s) STATE_APIENTRY crStateFeedback%s(%s);' % (return_type, func_name, apiutil.MakeDeclarationStringForDispatcher(params))) 54 if len(params) == 0: 55 print('DECLEXPORT(%s) STATE_APIENTRY crStateFeedback%s(PCRStateTracker pState);' % (return_type, func_name)) 56 else: 57 print('DECLEXPORT(%s) STATE_APIENTRY crStateFeedback%s(PCRStateTracker pState, %s);' % (return_type, func_name, apiutil.MakeDeclarationStringForDispatcher(params))) 49 58 50 59 for func_name in apiutil.AllSpecials( "state_select" ): 51 60 return_type = apiutil.ReturnType(func_name) 52 61 params = apiutil.Parameters(func_name) 53 print('DECLEXPORT(%s) STATE_APIENTRY crStateSelect%s(%s);' % (return_type, func_name, apiutil.MakeDeclarationStringForDispatcher(params))) 54 62 if len(params) == 0: 63 print('DECLEXPORT(%s) STATE_APIENTRY crStateSelect%s(PCRStateTracker pState);' % (return_type, func_name)) 64 else: 65 print('DECLEXPORT(%s) STATE_APIENTRY crStateSelect%s(PCRStateTracker pState, %s);' % (return_type, func_name, apiutil.MakeDeclarationStringForDispatcher(params))) 55 66 56 67 print(""" -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_get.py
r69392 r78375 146 146 header = """ 147 147 { 148 CRContext *g = GetCurrentContext( );148 CRContext *g = GetCurrentContext(pState); 149 149 150 150 if (g->current.inBeginEnd) 151 151 { 152 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,152 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 153 153 "glGet called in Begin/End"); 154 154 return; … … 162 162 { 163 163 #if 0 164 crStateError( __LINE__,__FILE__, GL_INVALID_OPERATION,164 crStateError(pState, __LINE__,__FILE__, GL_INVALID_OPERATION, 165 165 "Unimplemented glGet of a 'current' value" ); 166 166 #else 167 crStateCurrentRecover( );/* &g->current, &sb->current, g->bitID );*/167 crStateCurrentRecover(pState);/* &g->current, &sb->current, g->bitID );*/ 168 168 169 169 #endif … … 175 175 for rettype in types: 176 176 print('') 177 print('void STATE_APIENTRY crStateGet%sv( GLenum pname, %s *params )' % ( rettype, ctypes[rettype] ))177 print('void STATE_APIENTRY crStateGet%sv(PCRStateTracker pState, GLenum pname, %s *params )' % ( rettype, ctypes[rettype] )) 178 178 print(header) 179 179 … … 189 189 i += 1 190 190 except: 191 print('\t\t\tcrStateError( __LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");')191 print('\t\t\tcrStateError(pState, __LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");') 192 192 print("\t\t\tbreak;") 193 193 … … 216 216 i += 1 217 217 except: 218 print('\t\t\tcrStateError( __LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");')218 print('\t\t\tcrStateError(pState, __LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");') 219 219 if ext != 'OPENGL_VERSION_1_2': 220 220 print("\t\t\t}") 221 221 print("\t\t\telse {") 222 print('\t\t\t\tcrStateError( __LINE__,__FILE__,GL_INVALID_ENUM, "glGet%sv");' % rettype)222 print('\t\t\t\tcrStateError(pState, __LINE__,__FILE__,GL_INVALID_ENUM, "glGet%sv");' % rettype) 223 223 print("\t\t\t}") 224 224 print("\t\t\tbreak;") … … 227 227 228 228 print('\t\tdefault:') 229 print('\t\t\tcrStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGet: Unknown enum: 0x%x", pname);')229 print('\t\t\tcrStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGet: Unknown enum: 0x%x", pname);') 230 230 print('\t\t\treturn;') 231 231 print('\t}') -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_getstring.c
r69392 r78375 14 14 15 15 16 const GLubyte * STATE_APIENTRY crStateGetString( GLenum name )16 const GLubyte * STATE_APIENTRY crStateGetString(PCRStateTracker pState, GLenum name ) 17 17 { 18 CRContext *g = GetCurrentContext( );18 CRContext *g = GetCurrentContext(pState); 19 19 if (!g) 20 20 return NULL; … … 47 47 #endif 48 48 default: 49 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,49 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 50 50 "calling glGetString() with invalid name" ); 51 51 return NULL; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
r78341 r78375 26 26 #include <stdio.h> /*sprintf*/ 27 27 28 static CRGLSLShader* crStateGetShaderObj(GLuint id) 29 { 30 CRContext *g = GetCurrentContext(); 31 28 /** 29 * Helper for walking the shaders hash table. 30 */ 31 typedef struct CRStateGLSLShaderWalkArgs 32 { 33 CRGLSLProgram *pProgram; 34 PCRStateTracker pState; 35 } CRStateGLSLShaderWalkArgs; 36 typedef CRStateGLSLShaderWalkArgs *PCRStateGLSLShaderWalkArgs; 37 38 static CRGLSLShader* crStateGetShaderObj(CRContext *g, GLuint id) 39 { 32 40 if (!g) 33 41 { … … 38 46 } 39 47 40 static CRGLSLProgram* crStateGetProgramObj(GLuint id) 41 { 42 CRContext *g = GetCurrentContext(); 43 48 static CRGLSLProgram* crStateGetProgramObj(CRContext *g, GLuint id) 49 { 44 50 if (!g) 45 51 { … … 118 124 } 119 125 120 static void crStateShaderDecRefCount(void *data) 121 { 126 static void crStateShaderDecRefCount(void *data, void *pvUser) 127 { 128 CRContext *g = (CRContext *)pvUser; 122 129 CRGLSLShader *pShader = (CRGLSLShader *) data; 123 130 … … 127 134 128 135 if (0==pShader->refCount && pShader->deleted) 129 {130 CRContext *g = GetCurrentContext();131 136 crHashtableDelete(g->glsl.shaders, pShader->id, crStateFreeGLSLShader); 132 }133 137 } 134 138 … … 140 144 (void) key; (void)ctx; 141 145 142 pRealShader = crStateGetShaderObj( pShader->id);146 pRealShader = crStateGetShaderObj(ctx, pShader->id); 143 147 144 148 if (pRealShader) 145 149 { 146 crStateShaderDecRefCount(pRealShader );150 crStateShaderDecRefCount(pRealShader, ctx); 147 151 } 148 152 else … … 152 156 } 153 157 154 static void crStateFreeGLSLProgram(void *data) 155 { 158 static void crStateFreeGLSLProgram(void *data, void *pvUser) 159 { 160 CRContext *pCtx = (CRContext *)pvUser; 156 161 CRGLSLProgram* pProgram = (CRGLSLProgram *) data; 157 162 158 crFreeHashtable (pProgram->currentState.attachedShaders, crStateShaderDecRefCount);163 crFreeHashtableEx(pProgram->currentState.attachedShaders, crStateShaderDecRefCount, pCtx); 159 164 160 165 if (pProgram->activeState.attachedShaders) 161 166 { 162 CRContext *g = GetCurrentContext(); 163 crHashtableWalk(pProgram->activeState.attachedShaders, crStateFakeDecRefCountCB, g); 167 crHashtableWalk(pProgram->activeState.attachedShaders, crStateFakeDecRefCountCB, pCtx); 164 168 crFreeHashtable(pProgram->activeState.attachedShaders, crStateFreeGLSLShader); 165 169 } … … 188 192 DECLEXPORT(void) STATE_APIENTRY crStateGLSLDestroy(CRContext *ctx) 189 193 { 190 CRContext *g = GetCurrentContext( );194 CRContext *g = GetCurrentContext(ctx->pStateTracker); 191 195 192 196 /** @todo hack to allow crStateFreeGLSLProgram to work correctly, … … 196 200 if (g) 197 201 VBoxTlsRefAddRef(g); /* <- ensure the g is not destroyed by the following SetCurrentContext call */ 198 SetCurrentContext(ctx );199 200 crFreeHashtable (ctx->glsl.programs, crStateFreeGLSLProgram);202 SetCurrentContext(ctx->pStateTracker, ctx); 203 204 crFreeHashtableEx(ctx->glsl.programs, crStateFreeGLSLProgram, ctx); 201 205 crFreeHashtable(ctx->glsl.shaders, crStateFreeGLSLShader); 202 206 203 SetCurrentContext( g);207 SetCurrentContext(ctx->pStateTracker, g); 204 208 if (g) 205 209 VBoxTlsRefRelease(g); … … 207 211 } 208 212 209 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetShaderHWID(GLuint id) 210 { 211 CRGLSLShader *pShader = crStateGetShaderObj(id); 213 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetShaderHWID(PCRStateTracker pState, GLuint id) 214 { 215 CRContext *g = GetCurrentContext(pState); 216 CRGLSLShader *pShader = crStateGetShaderObj(g, id); 212 217 #ifdef IN_GUEST 213 218 CRASSERT(!pShader || pShader->hwid == id); … … 216 221 } 217 222 218 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetProgramHWID(GLuint id) 219 { 220 CRGLSLProgram *pProgram = crStateGetProgramObj(id); 223 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetProgramHWID(PCRStateTracker pState, GLuint id) 224 { 225 CRContext *g = GetCurrentContext(pState); 226 CRGLSLProgram *pProgram = crStateGetProgramObj(g, id); 221 227 #ifdef IN_GUEST 222 228 CRASSERT(!pProgram || pProgram->hwid == id); … … 245 251 } 246 252 247 DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLShaderHWIDtoID( GLuint hwid)248 { 249 CRContext *g = GetCurrentContext( );253 DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLShaderHWIDtoID(PCRStateTracker pState, GLuint hwid) 254 { 255 CRContext *g = GetCurrentContext(pState); 250 256 crCheckIDHWID_t parms; 251 257 … … 257 263 } 258 264 259 DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLProgramHWIDtoID( GLuint hwid)260 { 261 CRContext *g = GetCurrentContext( );265 DECLEXPORT(GLuint) STATE_APIENTRY crStateGLSLProgramHWIDtoID(PCRStateTracker pState, GLuint hwid) 266 { 267 CRContext *g = GetCurrentContext(pState); 262 268 crCheckIDHWID_t parms; 263 269 … … 269 275 } 270 276 271 DECLEXPORT(GLuint) STATE_APIENTRY crStateDeleteObjectARB( VBoxGLhandleARB obj )272 { 273 GLuint hwId = crStateGetProgramHWID( obj);277 DECLEXPORT(GLuint) STATE_APIENTRY crStateDeleteObjectARB(PCRStateTracker pState, VBoxGLhandleARB obj ) 278 { 279 GLuint hwId = crStateGetProgramHWID(pState, obj); 274 280 if (hwId) 275 281 { 276 crStateDeleteProgram( obj);282 crStateDeleteProgram(pState, obj); 277 283 } 278 284 else 279 285 { 280 hwId = crStateGetShaderHWID( obj);281 crStateDeleteShader( obj);286 hwId = crStateGetShaderHWID(pState, obj); 287 crStateDeleteShader(pState, obj); 282 288 } 283 289 return hwId; 284 290 } 285 291 286 DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateShader( GLuint hwid, GLenum type)292 DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateShader(PCRStateTracker pState, GLuint hwid, GLenum type) 287 293 { 288 294 CRGLSLShader *pShader; 289 CRContext *g = GetCurrentContext( );295 CRContext *g = GetCurrentContext(pState); 290 296 GLuint stateId = hwid; 291 297 292 298 #ifdef IN_GUEST 293 CRASSERT(!crStateGetShaderObj( stateId));299 CRASSERT(!crStateGetShaderObj(g, stateId)); 294 300 #else 295 301 /* the proogram and shader names must not intersect because DeleteObjectARB must distinguish between them … … 303 309 } 304 310 305 Assert((pShader = crStateGetShaderObj( stateId)) == NULL);311 Assert((pShader = crStateGetShaderObj(g, stateId)) == NULL); 306 312 #endif 307 313 … … 326 332 } 327 333 328 DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateProgram( GLuint hwid)334 DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateProgram(PCRStateTracker pState, GLuint hwid) 329 335 { 330 336 CRGLSLProgram *pProgram; 331 CRContext *g = GetCurrentContext( );337 CRContext *g = GetCurrentContext(pState); 332 338 GLuint stateId = hwid; 333 339 334 340 #ifdef IN_GUEST 335 pProgram = crStateGetProgramObj( stateId);341 pProgram = crStateGetProgramObj(g, stateId); 336 342 if (pProgram) 337 343 { 338 344 crWarning("Program object %d already exists!", stateId); 339 crStateDeleteProgram( stateId);340 CRASSERT(!crStateGetProgramObj( stateId));345 crStateDeleteProgram(pState, stateId); 346 CRASSERT(!crStateGetProgramObj(g, stateId)); 341 347 } 342 348 #else … … 385 391 } 386 392 387 DECLEXPORT(void) STATE_APIENTRY crStateCompileShader(GLuint shader) 388 { 389 CRGLSLShader *pShader = crStateGetShaderObj(shader); 393 DECLEXPORT(void) STATE_APIENTRY crStateCompileShader(PCRStateTracker pState, GLuint shader) 394 { 395 CRContext *g = GetCurrentContext(pState); 396 CRGLSLShader *pShader = crStateGetShaderObj(g, shader); 390 397 if (!pShader) 391 398 { … … 403 410 } 404 411 405 DECLEXPORT(void) STATE_APIENTRY crStateDeleteShader(GLuint shader) 406 { 407 CRGLSLShader *pShader = crStateGetShaderObj(shader); 412 DECLEXPORT(void) STATE_APIENTRY crStateDeleteShader(PCRStateTracker pState, GLuint shader) 413 { 414 CRContext *g = GetCurrentContext(pState); 415 CRGLSLShader *pShader = crStateGetShaderObj(g, shader); 408 416 if (!pShader) 409 417 { … … 416 424 if (0==pShader->refCount) 417 425 { 418 CRContext *g = GetCurrentContext();419 426 crHashtableDelete(g->glsl.shaders, shader, crStateFreeGLSLShader); 420 427 /* since we use programs table for key allocation key allocation, we need to … … 425 432 } 426 433 427 DECLEXPORT(void) STATE_APIENTRY crStateAttachShader(GLuint program, GLuint shader) 428 { 429 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 434 DECLEXPORT(void) STATE_APIENTRY crStateAttachShader(PCRStateTracker pState, GLuint program, GLuint shader) 435 { 436 CRContext *g = GetCurrentContext(pState); 437 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 430 438 CRGLSLShader *pShader; 431 439 … … 442 450 } 443 451 444 pShader = crStateGetShaderObj( shader);452 pShader = crStateGetShaderObj(g, shader); 445 453 446 454 if (!pShader) … … 455 463 } 456 464 457 DECLEXPORT(void) STATE_APIENTRY crStateDetachShader(GLuint program, GLuint shader) 458 { 459 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 465 DECLEXPORT(void) STATE_APIENTRY crStateDetachShader(PCRStateTracker pState, GLuint program, GLuint shader) 466 { 467 CRContext *g = GetCurrentContext(pState); 468 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 460 469 CRGLSLShader *pShader; 461 470 … … 479 488 480 489 if (0==pShader->refCount) 481 {482 CRContext *g = GetCurrentContext();483 490 crHashtableDelete(g->glsl.shaders, shader, crStateFreeGLSLShader); 484 } 485 } 486 487 DECLEXPORT(void) STATE_APIENTRY crStateUseProgram(GLuint program) 488 { 489 CRContext *g = GetCurrentContext(); 491 } 492 493 DECLEXPORT(void) STATE_APIENTRY crStateUseProgram(PCRStateTracker pState, GLuint program) 494 { 495 CRContext *g = GetCurrentContext(pState); 490 496 491 497 if (program>0) 492 498 { 493 CRGLSLProgram *pProgram = crStateGetProgramObj( program);499 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 494 500 495 501 if (!pProgram) … … 507 513 } 508 514 509 DECLEXPORT(void) STATE_APIENTRY crStateDeleteProgram( GLuint program)510 { 511 CRContext *g = GetCurrentContext( );512 CRGLSLProgram *pProgram = crStateGetProgramObj( program);515 DECLEXPORT(void) STATE_APIENTRY crStateDeleteProgram(PCRStateTracker pState, GLuint program) 516 { 517 CRContext *g = GetCurrentContext(pState); 518 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 513 519 514 520 if (!pProgram) … … 523 529 } 524 530 525 crHashtableDelete(g->glsl.programs, program, crStateFreeGLSLProgram); 526 } 527 528 DECLEXPORT(void) STATE_APIENTRY crStateValidateProgram(GLuint program) 529 { 530 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 531 crHashtableDeleteEx(g->glsl.programs, program, crStateFreeGLSLProgram, g); 532 } 533 534 DECLEXPORT(void) STATE_APIENTRY crStateValidateProgram(PCRStateTracker pState, GLuint program) 535 { 536 CRContext *g = GetCurrentContext(pState); 537 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 531 538 532 539 if (!pProgram) … … 542 549 { 543 550 CRGLSLShader *pRealShader = (CRGLSLShader *) data1; 544 CRGLSLProgram *pProgram = (CRGLSLProgram *) data2; 551 PCRStateGLSLShaderWalkArgs pArgs = (PCRStateGLSLShaderWalkArgs)data2; 552 PCRStateTracker pState = pArgs->pState; 545 553 CRGLSLShader *pShader; 546 554 GLint sLen=0; … … 558 566 crMemcpy(pShader, pRealShader, sizeof(*pShader)); 559 567 560 diff_api.GetShaderiv(pShader->hwid, GL_SHADER_SOURCE_LENGTH, &sLen);568 pState->diff_api.GetShaderiv(pShader->hwid, GL_SHADER_SOURCE_LENGTH, &sLen); 561 569 if (sLen>0) 562 570 { 563 571 pShader->source = (GLchar*) crAlloc(sLen); 564 diff_api.GetShaderSource(pShader->hwid, sLen, NULL, pShader->source); 565 } 566 567 crHashtableAdd(pProgram->activeState.attachedShaders, key, pShader); 568 } 569 570 DECLEXPORT(void) STATE_APIENTRY crStateLinkProgram(GLuint program) 571 { 572 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 572 pState->diff_api.GetShaderSource(pShader->hwid, sLen, NULL, pShader->source); 573 } 574 575 crHashtableAdd(pArgs->pProgram->activeState.attachedShaders, key, pShader); 576 } 577 578 DECLEXPORT(void) STATE_APIENTRY crStateLinkProgram(PCRStateTracker pState, GLuint program) 579 { 580 CRContext *g = GetCurrentContext(pState); 581 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 573 582 GLuint i; 583 CRStateGLSLShaderWalkArgs Args; 574 584 575 585 if (!pProgram) … … 584 594 if (pProgram->activeState.attachedShaders) 585 595 { 586 crHashtableWalk(pProgram->activeState.attachedShaders, crStateFakeDecRefCountCB, NULL);596 crHashtableWalk(pProgram->activeState.attachedShaders, crStateFakeDecRefCountCB, g); 587 597 crFreeHashtable(pProgram->activeState.attachedShaders, crStateFreeGLSLShader); 588 598 pProgram->activeState.attachedShaders = NULL; … … 603 613 return; 604 614 } 605 crHashtableWalk(pProgram->currentState.attachedShaders, crStateCopyShaderCB, pProgram); 615 Args.pProgram = pProgram; 616 Args.pState = pState; 617 crHashtableWalk(pProgram->currentState.attachedShaders, crStateCopyShaderCB, &Args); 606 618 607 619 /*that's not a bug, note the memcpy above*/ … … 624 636 } 625 637 626 DECLEXPORT(void) STATE_APIENTRY crStateBindAttribLocation(GLuint program, GLuint index, const char * name) 627 { 628 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 638 DECLEXPORT(void) STATE_APIENTRY crStateBindAttribLocation(PCRStateTracker pState, GLuint program, GLuint index, const char * name) 639 { 640 CRContext *g = GetCurrentContext(pState); 641 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 629 642 GLuint i; 630 643 CRGLSLAttrib *pAttribs; … … 670 683 } 671 684 672 DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformSize( GLenum type)685 DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformSize(PCRStateTracker pState, GLenum type) 673 686 { 674 687 GLint size; 688 689 RT_NOREF(pState); 675 690 676 691 switch (type) … … 760 775 } 761 776 762 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsIntUniform(GLenum type) 763 { 777 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsIntUniform(PCRStateTracker pState, GLenum type) 778 { 779 RT_NOREF(pState); 780 764 781 if (GL_INT==type 765 782 || GL_INT_VEC2==type … … 784 801 } 785 802 786 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramUniformsCached(GLuint program) 787 { 788 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 803 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramUniformsCached(PCRStateTracker pState, GLuint program) 804 { 805 CRContext *g = GetCurrentContext(pState); 806 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 789 807 790 808 if (!pProgram) … … 802 820 } 803 821 804 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramAttribsCached(GLuint program) 805 { 806 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 822 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramAttribsCached(PCRStateTracker pState, GLuint program) 823 { 824 CRContext *g = GetCurrentContext(pState); 825 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 807 826 808 827 if (!pProgram) … … 824 843 #ifdef IN_GUEST 825 844 DECLEXPORT(void) STATE_APIENTRY 826 crStateGLSLProgramCacheUniforms(GLuint program, GLsizei cbData, GLvoid *pData) 827 { 828 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 845 crStateGLSLProgramCacheUniforms(PCRStateTracker pState, GLuint program, GLsizei cbData, GLvoid *pData) 846 { 847 CRContext *g = GetCurrentContext(pState); 848 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 829 849 char *pCurrent = pData; 830 850 GLsizei cbRead, cbName; … … 900 920 901 921 DECLEXPORT(void) STATE_APIENTRY 902 crStateGLSLProgramCacheAttribs(GLuint program, GLsizei cbData, GLvoid *pData) 903 { 904 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 922 crStateGLSLProgramCacheAttribs(PCRStateTracker pState, GLuint program, GLsizei cbData, GLvoid *pData) 923 { 924 CRContext *g = GetCurrentContext(pState); 925 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 905 926 char *pCurrent = pData; 906 927 GLsizei cbRead, cbName; … … 998 1019 999 1020 DECLEXPORT(void) STATE_APIENTRY 1000 crStateGLSLProgramCacheUniforms(GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData) 1001 { 1002 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 1021 crStateGLSLProgramCacheUniforms(PCRStateTracker pState, GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData) 1022 { 1023 CRContext *g = GetCurrentContext(pState); 1024 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 1003 1025 GLint maxUniformLen = 0, activeUniforms=0, fakeUniformsCount, i, j; 1004 1026 char *pCurrent = pData; … … 1015 1037 * "If no active uniform variable exist, 0 is returned." 1016 1038 */ 1017 diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformLen);1039 pState->diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformLen); 1018 1040 if (maxUniformLen > 0) 1019 diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_UNIFORMS, &activeUniforms);1041 pState->diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_UNIFORMS, &activeUniforms); 1020 1042 1021 1043 *cbData = 0; … … 1050 1072 for (i=0; i<activeUniforms; ++i) 1051 1073 { 1052 diff_api.GetActiveUniform(pProgram->hwid, i, maxUniformLen, &cbName, &size, &type, name);1053 location = diff_api.GetUniformLocation(pProgram->hwid, name);1074 pState->diff_api.GetActiveUniform(pProgram->hwid, i, maxUniformLen, &cbName, &size, &type, name); 1075 location = pState->diff_api.GetUniformLocation(pProgram->hwid, name); 1054 1076 1055 1077 if (!crStateGLSLProgramCacheOneUniform(location, cbName, name, &pCurrent, &cbWritten, maxcbData)) … … 1088 1110 cbName = crStrlen(name); 1089 1111 1090 location = diff_api.GetUniformLocation(pProgram->hwid, name);1112 location = pState->diff_api.GetUniformLocation(pProgram->hwid, name); 1091 1113 1092 1114 if (!crStateGLSLProgramCacheOneUniform(location, cbName, name, &pCurrent, &cbWritten, maxcbData)) … … 1134 1156 1135 1157 DECLEXPORT(void) STATE_APIENTRY 1136 crStateGLSLProgramCacheAttribs(GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData) 1137 { 1138 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 1158 crStateGLSLProgramCacheAttribs(PCRStateTracker pState, GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData) 1159 { 1160 CRContext *g = GetCurrentContext(pState); 1161 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 1139 1162 GLint maxAttribLen, activeAttribs=0, fakeAttribsCount, i, j; 1140 1163 char *pCurrent = pData; … … 1147 1170 } 1148 1171 1149 diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttribLen);1150 diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_ATTRIBUTES, &activeAttribs);1172 pState->diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttribLen); 1173 pState->diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_ATTRIBUTES, &activeAttribs); 1151 1174 1152 1175 *cbData = 0; … … 1181 1204 for (i=0; i<activeAttribs; ++i) 1182 1205 { 1183 diff_api.GetActiveAttrib(pProgram->hwid, i, maxAttribLen, &cbName, &size, &type, name);1184 location = diff_api.GetAttribLocation(pProgram->hwid, name);1206 pState->diff_api.GetActiveAttrib(pProgram->hwid, i, maxAttribLen, &cbName, &size, &type, name); 1207 location = pState->diff_api.GetAttribLocation(pProgram->hwid, name); 1185 1208 1186 1209 if (!crStateGLSLProgramCacheOneAttrib(location, cbName, name, &pCurrent, &cbWritten, maxcbData)) … … 1219 1242 cbName = crStrlen(name); 1220 1243 1221 location = diff_api.GetAttribLocation(pProgram->hwid, name);1244 location = pState->diff_api.GetAttribLocation(pProgram->hwid, name); 1222 1245 1223 1246 if (!crStateGLSLProgramCacheOneAttrib(location, cbName, name, &pCurrent, &cbWritten, maxcbData)) … … 1242 1265 #endif 1243 1266 1244 DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformLocation( GLuint program, const char * name)1267 DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformLocation(PCRStateTracker pState, GLuint program, const char * name) 1245 1268 { 1246 1269 #ifdef IN_GUEST 1247 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 1270 CRContext *g = GetCurrentContext(pState); 1271 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 1248 1272 GLint result=-1; 1249 1273 GLuint i; … … 1272 1296 return result; 1273 1297 #else 1274 RT_NOREF(p rogram, name);1298 RT_NOREF(pState, program, name); 1275 1299 crWarning("crStateGetUniformLocation called on host side!!"); 1276 1300 return -1; … … 1278 1302 } 1279 1303 1280 DECLEXPORT(GLint) STATE_APIENTRY crStateGetAttribLocation( GLuint program, const char * name)1304 DECLEXPORT(GLint) STATE_APIENTRY crStateGetAttribLocation(PCRStateTracker pState, GLuint program, const char * name) 1281 1305 { 1282 1306 #ifdef IN_GUEST 1283 CRGLSLProgram *pProgram = crStateGetProgramObj(program); 1307 CRContext *g = GetCurrentContext(pState); 1308 CRGLSLProgram *pProgram = crStateGetProgramObj(g, program); 1284 1309 GLint result=-1; 1285 1310 GLuint i; … … 1308 1333 return result; 1309 1334 #else 1310 RT_NOREF(p rogram, name);1335 RT_NOREF(pState, program, name); 1311 1336 crWarning("crStateGetAttribLocation called on host side!!"); 1312 1337 return -1; … … 1318 1343 CRGLSLShader *pShader = (CRGLSLShader*) data1; 1319 1344 CRContext *ctx = (CRContext *) data2; 1345 PCRStateTracker pState = ctx->pStateTracker; 1320 1346 (void)ctx; (void)key; 1321 1347 1322 pShader->hwid = diff_api.CreateShader(pShader->type);1348 pShader->hwid = pState->diff_api.CreateShader(pShader->type); 1323 1349 } 1324 1350 … … 1338 1364 { 1339 1365 CRGLSLShader *pShader = (CRGLSLShader*) data1; 1366 PCRStateTracker pState = (PCRStateTracker)data2; 1340 1367 (void) key; 1341 (void) data2;1342 1368 1343 1369 if (pShader->source) 1344 1370 { 1345 diff_api.ShaderSource(pShader->hwid, 1, (const char**)&pShader->source, NULL);1371 pState->diff_api.ShaderSource(pShader->hwid, 1, (const char**)&pShader->source, NULL); 1346 1372 if (pShader->compiled) 1347 diff_api.CompileShader(pShader->hwid);1373 pState->diff_api.CompileShader(pShader->hwid); 1348 1374 crFree(pShader->source); 1349 1375 pShader->source = NULL; … … 1351 1377 1352 1378 if (pShader->deleted) 1353 diff_api.DeleteShader(pShader->hwid);1379 pState->diff_api.DeleteShader(pShader->hwid); 1354 1380 } 1355 1381 … … 1357 1383 { 1358 1384 CRGLSLShader *pShader = (CRGLSLShader*) data1; 1359 CRGLSLProgram *pProgram = (CRGLSLProgram *) data2; 1385 PCRStateGLSLShaderWalkArgs pArgs = (PCRStateGLSLShaderWalkArgs)data2; 1386 PCRStateTracker pState = pArgs->pState; 1360 1387 (void) key; 1361 1388 1362 1389 if (pShader->source) 1363 1390 { 1364 diff_api.ShaderSource(pShader->hwid, 1, (const char**)&pShader->source, NULL);1391 pState->diff_api.ShaderSource(pShader->hwid, 1, (const char**)&pShader->source, NULL); 1365 1392 if (pShader->compiled) 1366 diff_api.CompileShader(pShader->hwid);1367 } 1368 1369 diff_api.AttachShader(pProgram->hwid, pShader->hwid);1393 pState->diff_api.CompileShader(pShader->hwid); 1394 } 1395 1396 pState->diff_api.AttachShader(pArgs->pProgram->hwid, pShader->hwid); 1370 1397 } 1371 1398 … … 1373 1400 { 1374 1401 CRGLSLShader *pShader = (CRGLSLShader*) data1; 1375 CRGLSLProgram *pProgram = (CRGLSLProgram *)data2;1402 PCRStateGLSLShaderWalkArgs pArgs = (PCRStateGLSLShaderWalkArgs)data2; 1376 1403 (void) key; 1377 1404 1378 diff_api.DetachShader(pProgram->hwid, pShader->hwid);1405 pArgs->pState->diff_api.DetachShader(pArgs->pProgram->hwid, pShader->hwid); 1379 1406 } 1380 1407 … … 1383 1410 CRGLSLProgram *pProgram = (CRGLSLProgram*) data1; 1384 1411 CRContext *ctx = (CRContext *) data2; 1412 PCRStateTracker pState = ctx->pStateTracker; 1385 1413 GLuint i; 1414 CRStateGLSLShaderWalkArgs Args; 1415 1416 Args.pProgram = pProgram; 1417 Args.pState = pState; 1418 1386 1419 (void)key; 1387 1420 1388 pProgram->hwid = diff_api.CreateProgram();1421 pProgram->hwid = pState->diff_api.CreateProgram(); 1389 1422 1390 1423 if (pProgram->linked) … … 1393 1426 1394 1427 crHashtableWalk(pProgram->activeState.attachedShaders, crStateFixAttachedShaderHWIDsCB, ctx); 1395 crHashtableWalk(pProgram->activeState.attachedShaders, crStateAttachShaderCB, pProgram);1428 crHashtableWalk(pProgram->activeState.attachedShaders, crStateAttachShaderCB, &Args); 1396 1429 1397 1430 for (i=0; i<pProgram->activeState.cAttribs; ++i) 1398 1431 { 1399 diff_api.BindAttribLocation(pProgram->hwid, pProgram->activeState.pAttribs[i].index, pProgram->activeState.pAttribs[i].name);1432 pState->diff_api.BindAttribLocation(pProgram->hwid, pProgram->activeState.pAttribs[i].index, pProgram->activeState.pAttribs[i].name); 1400 1433 } 1401 1434 1402 1435 if (pProgram->validated) 1403 diff_api.ValidateProgram(pProgram->hwid);1404 1405 diff_api.LinkProgram(pProgram->hwid);1406 } 1407 1408 diff_api.UseProgram(pProgram->hwid);1436 pState->diff_api.ValidateProgram(pProgram->hwid); 1437 1438 pState->diff_api.LinkProgram(pProgram->hwid); 1439 } 1440 1441 pState->diff_api.UseProgram(pProgram->hwid); 1409 1442 1410 1443 for (i=0; i<pProgram->cUniforms; ++i) … … 1414 1447 GLint *pIdata = (GLint*)pProgram->pUniforms[i].data; 1415 1448 1416 location = diff_api.GetUniformLocation(pProgram->hwid, pProgram->pUniforms[i].name);1449 location = pState->diff_api.GetUniformLocation(pProgram->hwid, pProgram->pUniforms[i].name); 1417 1450 switch (pProgram->pUniforms[i].type) 1418 1451 { 1419 1452 case GL_FLOAT: 1420 diff_api.Uniform1fv(location, 1, pFdata);1453 pState->diff_api.Uniform1fv(location, 1, pFdata); 1421 1454 break; 1422 1455 case GL_FLOAT_VEC2: 1423 diff_api.Uniform2fv(location, 1, pFdata);1456 pState->diff_api.Uniform2fv(location, 1, pFdata); 1424 1457 break; 1425 1458 case GL_FLOAT_VEC3: 1426 diff_api.Uniform3fv(location, 1, pFdata);1459 pState->diff_api.Uniform3fv(location, 1, pFdata); 1427 1460 break; 1428 1461 case GL_FLOAT_VEC4: 1429 diff_api.Uniform4fv(location, 1, pFdata);1462 pState->diff_api.Uniform4fv(location, 1, pFdata); 1430 1463 break; 1431 1464 case GL_INT: 1432 1465 case GL_BOOL: 1433 diff_api.Uniform1iv(location, 1, pIdata);1466 pState->diff_api.Uniform1iv(location, 1, pIdata); 1434 1467 break; 1435 1468 case GL_INT_VEC2: 1436 1469 case GL_BOOL_VEC2: 1437 diff_api.Uniform2iv(location, 1, pIdata);1470 pState->diff_api.Uniform2iv(location, 1, pIdata); 1438 1471 break; 1439 1472 case GL_INT_VEC3: 1440 1473 case GL_BOOL_VEC3: 1441 diff_api.Uniform3iv(location, 1, pIdata);1474 pState->diff_api.Uniform3iv(location, 1, pIdata); 1442 1475 break; 1443 1476 case GL_INT_VEC4: 1444 1477 case GL_BOOL_VEC4: 1445 diff_api.Uniform4iv(location, 1, pIdata);1478 pState->diff_api.Uniform4iv(location, 1, pIdata); 1446 1479 break; 1447 1480 case GL_FLOAT_MAT2: 1448 diff_api.UniformMatrix2fv(location, 1, GL_FALSE, pFdata);1481 pState->diff_api.UniformMatrix2fv(location, 1, GL_FALSE, pFdata); 1449 1482 break; 1450 1483 case GL_FLOAT_MAT3: 1451 diff_api.UniformMatrix3fv(location, 1, GL_FALSE, pFdata);1484 pState->diff_api.UniformMatrix3fv(location, 1, GL_FALSE, pFdata); 1452 1485 break; 1453 1486 case GL_FLOAT_MAT4: 1454 diff_api.UniformMatrix4fv(location, 1, GL_FALSE, pFdata);1487 pState->diff_api.UniformMatrix4fv(location, 1, GL_FALSE, pFdata); 1455 1488 break; 1456 1489 case GL_SAMPLER_1D: … … 1462 1495 case GL_SAMPLER_2D_RECT_ARB: 1463 1496 case GL_SAMPLER_2D_RECT_SHADOW_ARB: 1464 diff_api.Uniform1iv(location, 1, pIdata);1497 pState->diff_api.Uniform1iv(location, 1, pIdata); 1465 1498 break; 1466 1499 #ifdef CR_OPENGL_VERSION_2_1 1467 1500 case GL_FLOAT_MAT2x3: 1468 diff_api.UniformMatrix2x3fv(location, 1, GL_FALSE, pFdata);1501 pState->diff_api.UniformMatrix2x3fv(location, 1, GL_FALSE, pFdata); 1469 1502 break; 1470 1503 case GL_FLOAT_MAT2x4: 1471 diff_api.UniformMatrix2x4fv(location, 1, GL_FALSE, pFdata);1504 pState->diff_api.UniformMatrix2x4fv(location, 1, GL_FALSE, pFdata); 1472 1505 break; 1473 1506 case GL_FLOAT_MAT3x2: 1474 diff_api.UniformMatrix3x2fv(location, 1, GL_FALSE, pFdata);1507 pState->diff_api.UniformMatrix3x2fv(location, 1, GL_FALSE, pFdata); 1475 1508 break; 1476 1509 case GL_FLOAT_MAT3x4: 1477 diff_api.UniformMatrix3x4fv(location, 1, GL_FALSE, pFdata);1510 pState->diff_api.UniformMatrix3x4fv(location, 1, GL_FALSE, pFdata); 1478 1511 break; 1479 1512 case GL_FLOAT_MAT4x2: 1480 diff_api.UniformMatrix4x2fv(location, 1, GL_FALSE, pFdata);1513 pState->diff_api.UniformMatrix4x2fv(location, 1, GL_FALSE, pFdata); 1481 1514 break; 1482 1515 case GL_FLOAT_MAT4x3: 1483 diff_api.UniformMatrix4x3fv(location, 1, GL_FALSE, pFdata);1516 pState->diff_api.UniformMatrix4x3fv(location, 1, GL_FALSE, pFdata); 1484 1517 break; 1485 1518 #endif … … 1496 1529 1497 1530 crHashtableWalk(pProgram->activeState.attachedShaders, crStateDetachShaderCB, pProgram); 1498 crHashtableWalk(pProgram->currentState.attachedShaders, crStateAttachShaderCB, pProgram);1531 crHashtableWalk(pProgram->currentState.attachedShaders, crStateAttachShaderCB, &Args); 1499 1532 } 1500 1533 1501 1534 DECLEXPORT(void) STATE_APIENTRY crStateGLSLSwitch(CRContext *from, CRContext *to) 1502 1535 { 1536 PCRStateTracker pState = to->pStateTracker; 1503 1537 GLboolean fForceUseProgramSet = GL_FALSE; 1504 1538 if (to->glsl.bResyncNeeded) … … 1513 1547 fForceUseProgramSet = GL_TRUE; 1514 1548 1515 crHashtableWalk(to->glsl.shaders, crStateGLSLSyncShadersCB, NULL);1549 crHashtableWalk(to->glsl.shaders, crStateGLSLSyncShadersCB, pState); 1516 1550 } 1517 1551 1518 1552 if (to->glsl.activeProgram != from->glsl.activeProgram || fForceUseProgramSet) 1519 1553 { 1520 diff_api.UseProgram(to->glsl.activeProgram ? to->glsl.activeProgram->hwid : 0);1521 } 1522 } 1554 pState->diff_api.UseProgram(to->glsl.activeProgram ? to->glsl.activeProgram->hwid : 0); 1555 } 1556 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_hint.c
r69392 r78375 13 13 { 14 14 CRHintState *h = &ctx->hint; 15 CRStateBits *sb = GetCurrentBits( );15 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 16 16 CRHintBits *hb = &(sb->hint); 17 17 … … 41 41 } 42 42 43 void STATE_APIENTRY crStateHint( GLenum target, GLenum mode)43 void STATE_APIENTRY crStateHint(PCRStateTracker pState, GLenum target, GLenum mode) 44 44 { 45 CRContext *g = GetCurrentContext( );45 CRContext *g = GetCurrentContext(pState); 46 46 CRHintState *h = &(g->hint); 47 CRStateBits *sb = GetCurrentBits( );47 CRStateBits *sb = GetCurrentBits(pState); 48 48 CRHintBits *hb = &(sb->hint); 49 49 50 50 if (g->current.inBeginEnd) 51 51 { 52 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,52 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 53 53 "glHint called in Begin/End"); 54 54 return; … … 58 58 59 59 if (mode != GL_FASTEST && mode != GL_NICEST && mode != GL_DONT_CARE) { 60 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,60 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 61 61 "glHint(mode)"); 62 62 return; … … 91 91 } 92 92 else { 93 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,93 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 94 94 "glHint(target)"); 95 95 return; … … 104 104 } 105 105 else { 106 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,106 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 107 107 "glHint(target)"); 108 108 return; … … 117 117 } 118 118 else { 119 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,119 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 120 120 "glHint(target)"); 121 121 return; … … 124 124 #endif 125 125 default: 126 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,126 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 127 127 "glHint(target)"); 128 128 return; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c
r78341 r78375 11 11 12 12 #include <iprt/asm.h> 13 14 static bool __isContextTLSInited = false;15 CRtsd __contextTSD;16 17 CRStateBits *__currentBits = NULL;18 CRContext *g_pAvailableContexts[CR_MAX_CONTEXTS];19 uint32_t g_cContexts = 0;20 21 static CRSharedState *gSharedState=NULL;22 23 static CRContext *defaultContext = NULL;24 25 GLboolean g_bVBoxEnableDiffOnMakeCurrent = GL_TRUE;26 27 13 28 14 /** … … 50 36 */ 51 37 DECLEXPORT(void) 52 crStateDeleteTextureCallback(void *texObj) 53 { 38 crStateDeleteTextureCallback(void *texObj, void *pvUser) 39 { 40 PCRStateTracker pState = (PCRStateTracker)pvUser; 41 54 42 #ifndef IN_GUEST 55 diff_api.DeleteTextures(1, &((CRTextureObj *)texObj)->hwid);43 pState->diff_api.DeleteTextures(1, &((CRTextureObj *)texObj)->hwid); 56 44 #endif 57 45 crStateDeleteTextureObject((CRTextureObj *) texObj); … … 60 48 typedef struct CR_STATE_RELEASEOBJ 61 49 { 62 CRContext *pCtx; 63 CRSharedState *s; 50 PCRStateTracker pState; 51 CRContext *pCtx; 52 CRSharedState *s; 64 53 } CR_STATE_RELEASEOBJ, *PCR_STATE_RELEASEOBJ; 65 54 66 void crStateOnTextureUsageRelease( CRSharedState *pS, CRTextureObj *pObj)55 void crStateOnTextureUsageRelease(PCRStateTracker pState, CRSharedState *pS, CRTextureObj *pObj) 67 56 { 68 57 if (!pObj->pinned) 69 crHashtableDelete (pS->textureTable, pObj->id, crStateDeleteTextureCallback);58 crHashtableDeleteEx(pS->textureTable, pObj->id, crStateDeleteTextureCallback, pState); 70 59 else 71 60 Assert(crHashtableSearch(pS->textureTable, pObj->id)); … … 79 68 return; 80 69 81 crStateOnTextureUsageRelease(p S, pObj);70 crStateOnTextureUsageRelease(pCtx->pStateTracker, pS, pObj); 82 71 } 83 72 … … 89 78 return; 90 79 91 if (! gSharedState)80 if (!pCtx->pStateTracker->pSharedState) 92 81 { 93 82 WARN(("no global shared")); … … 95 84 } 96 85 97 crStateOnTextureUsageRelease( gSharedState, pObj);86 crStateOnTextureUsageRelease(pCtx->pStateTracker, pCtx->pStateTracker->pSharedState, pObj); 98 87 } 99 88 … … 103 92 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx); 104 93 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 105 crHashtableDelete (pS->buffersTable, pObj->id, crStateFreeBufferObject);94 crHashtableDeleteEx(pS->buffersTable, pObj->id, crStateFreeBufferObject, pCtx->pStateTracker); 106 95 } 107 96 … … 111 100 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx); 112 101 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 113 crHashtableDelete (pS->fbTable, pObj->id, crStateFreeFBO);102 crHashtableDeleteEx(pS->fbTable, pObj->id, crStateFreeFBO, pCtx->pStateTracker); 114 103 } 115 104 … … 119 108 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx); 120 109 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 121 crHashtableDelete (pS->rbTable, pObj->id, crStateFreeRBO);110 crHashtableDeleteEx(pS->rbTable, pObj->id, crStateFreeRBO, pCtx->pStateTracker); 122 111 } 123 112 … … 159 148 */ 160 149 #ifndef IN_GUEST 161 DECLEXPORT(void) crStateFreeShared( CRContext *pContext, CRSharedState *s)150 DECLEXPORT(void) crStateFreeShared(PCRStateTracker pState, CRContext *pContext, CRSharedState *s) 162 151 #else 163 static void crStateFreeShared( CRContext *pContext, CRSharedState *s)152 static void crStateFreeShared(PCRStateTracker pState, CRContext *pContext, CRSharedState *s) 164 153 #endif 165 154 { … … 168 157 Assert(refCount >= 0); 169 158 if (refCount <= 0) { 170 if (s==gSharedState) 171 { 172 gSharedState = NULL; 173 } 174 crFreeHashtable(s->textureTable, crStateDeleteTextureCallback); 159 if (s == pState->pSharedState) 160 pState->pSharedState = NULL; 161 crFreeHashtableEx(s->textureTable, crStateDeleteTextureCallback, pState); 175 162 crFreeHashtable(s->dlistTable, crFree); /* call crFree for each entry */ 176 crFreeHashtable (s->buffersTable, crStateFreeBufferObject);177 crFreeHashtable (s->fbTable, crStateFreeFBO);178 crFreeHashtable (s->rbTable, crStateFreeRBO);163 crFreeHashtableEx(s->buffersTable, crStateFreeBufferObject, pState); 164 crFreeHashtableEx(s->fbTable, crStateFreeFBO, pState); 165 crFreeHashtableEx(s->rbTable, crStateFreeRBO, pState); 179 166 crFree(s); 180 167 } … … 183 170 /* evaluate usage bits*/ 184 171 CR_STATE_RELEASEOBJ CbData; 185 CbData.pCtx = pContext; 186 CbData.s = s; 172 CbData.pState = pState; 173 CbData.pCtx = pContext; 174 CbData.s = s; 187 175 crHashtableWalk(s->textureTable, ReleaseTextureCallback, &CbData); 188 176 crHashtableWalk(s->buffersTable, ReleaseBufferObjectCallback , &CbData); … … 194 182 #ifndef IN_GUEST 195 183 196 DECLEXPORT(CRSharedState *) crStateGlobalSharedAcquire( void)197 { 198 if (! gSharedState)184 DECLEXPORT(CRSharedState *) crStateGlobalSharedAcquire(PCRStateTracker pState) 185 { 186 if (!pState->pSharedState) 199 187 { 200 188 crWarning("No Global Shared State!"); 201 189 return NULL; 202 190 } 203 ASMAtomicIncS32(& gSharedState->refCount);204 return gSharedState;205 } 206 207 DECLEXPORT(void) crStateGlobalSharedRelease( void)208 { 209 crStateFreeShared( NULL, gSharedState);191 ASMAtomicIncS32(&pState->pSharedState->refCount); 192 return pState->pSharedState; 193 } 194 195 DECLEXPORT(void) crStateGlobalSharedRelease(PCRStateTracker pState) 196 { 197 crStateFreeShared(pState, NULL, pState->pSharedState); 210 198 } 211 199 212 200 #endif /* IN_GUEST */ 213 201 214 DECLEXPORT(void) STATE_APIENTRY 215 crStateShareContext(GLboolean value) 216 { 217 CRContext *pCtx = GetCurrentContext(); 202 DECLEXPORT(void) STATE_APIENTRY crStateShareContext(PCRStateTracker pState, GLboolean value) 203 { 204 CRContext *pCtx = GetCurrentContext(pState); 218 205 CRASSERT(pCtx && pCtx->shared); 219 206 220 207 if (value) 221 208 { 222 if (pCtx->shared == gSharedState)209 if (pCtx->shared == pState->pSharedState) 223 210 { 224 211 return; … … 227 214 crDebug("Context(%i) shared", pCtx->id); 228 215 229 if (! gSharedState)230 { 231 gSharedState = pCtx->shared;216 if (!pState->pSharedState) 217 { 218 pState->pSharedState = pCtx->shared; 232 219 } 233 220 else 234 221 { 235 crStateFreeShared(p Ctx, pCtx->shared);236 pCtx->shared = gSharedState;237 ASMAtomicIncS32(& gSharedState->refCount);222 crStateFreeShared(pState, pCtx, pCtx->shared); 223 pCtx->shared = pState->pSharedState; 224 ASMAtomicIncS32(&pState->pSharedState->refCount); 238 225 } 239 226 } 240 227 else 241 228 { 242 if (pCtx->shared != gSharedState)229 if (pCtx->shared != pState->pSharedState) 243 230 { 244 231 return; … … 247 234 crDebug("Context(%i) unshared", pCtx->id); 248 235 249 if ( gSharedState->refCount==1)250 { 251 gSharedState = NULL;236 if (pState->pSharedState->refCount==1) 237 { 238 pState->pSharedState = NULL; 252 239 } 253 240 else … … 255 242 pCtx->shared = crStateAllocShared(); 256 243 pCtx->shared->id = pCtx->id; 257 crStateFreeShared(pCtx, gSharedState); 258 } 259 } 260 } 261 262 DECLEXPORT(void) STATE_APIENTRY 263 crStateShareLists(CRContext *pContext1, CRContext *pContext2) 244 crStateFreeShared(pState, pCtx, pState->pSharedState); 245 } 246 } 247 } 248 249 DECLEXPORT(void) STATE_APIENTRY crStateShareLists(CRContext *pContext1, CRContext *pContext2) 264 250 { 265 251 CRASSERT(pContext1->shared); … … 271 257 } 272 258 273 crStateFreeShared(pContext1 , pContext1->shared);259 crStateFreeShared(pContext1->pStateTracker, pContext1, pContext1->shared); 274 260 pContext1->shared = pContext2->shared; 275 261 ASMAtomicIncS32(&pContext2->shared->refCount); 276 262 } 277 263 278 DECLEXPORT(GLboolean) STATE_APIENTRY 279 crStateContextIsShared(CRContext *pCtx) 280 { 281 return pCtx->shared==gSharedState; 282 } 283 284 DECLEXPORT(void) STATE_APIENTRY 285 crStateSetSharedContext(CRContext *pCtx) 286 { 287 if ( gSharedState)288 { 289 crWarning("crStateSetSharedContext: shared is being changed from %p to %p", gSharedState, pCtx->shared);290 } 291 292 gSharedState = pCtx->shared;264 DECLEXPORT(GLboolean) STATE_APIENTRY crStateContextIsShared(CRContext *pCtx) 265 { 266 return pCtx->shared == pCtx->pStateTracker->pSharedState; 267 } 268 269 DECLEXPORT(void) STATE_APIENTRY crStateSetSharedContext(CRContext *pCtx) 270 { 271 PCRStateTracker pState = pCtx->pStateTracker; 272 273 if (pState->pSharedState) 274 { 275 crWarning("crStateSetSharedContext: shared is being changed from %p to %p", pState->pSharedState, pCtx->shared); 276 } 277 278 pState->pSharedState = pCtx->shared; 293 279 } 294 280 … … 304 290 */ 305 291 static CRContext * 306 crStateCreateContextId( int i, const CRLimitsState *limits, GLint visBits, CRContext *shareCtx)292 crStateCreateContextId(PCRStateTracker pState, int i, const CRLimitsState *limits, GLint visBits, CRContext *shareCtx) 307 293 { 308 294 CRContext *ctx; … … 312 298 (void)limits; 313 299 314 if ( g_pAvailableContexts[i] != NULL)300 if (pState->apAvailableContexts[i] != NULL) 315 301 { 316 302 crWarning("trying to create context with used id"); … … 324 310 return NULL; 325 311 } 326 g_pAvailableContexts[i] = ctx;327 ++g_cContexts;328 CRASSERT( g_cContexts < RT_ELEMENTS(g_pAvailableContexts));312 pState->apAvailableContexts[i] = ctx; 313 pState->cContexts++; 314 CRASSERT(pState->cContexts < RT_ELEMENTS(pState->apAvailableContexts)); 329 315 ctx->id = i; 316 ctx->pStateTracker = pState; 330 317 VBoxTlsRefInit(ctx, crStateContextDtor); 331 318 ctx->flush_func = NULL; … … 432 419 crStateFreeContext(CRContext *ctx) 433 420 { 421 PCRStateTracker pState = ctx->pStateTracker; 422 434 423 #ifndef DEBUG_misha 435 CRASSERT( g_pAvailableContexts[ctx->id] == ctx);424 CRASSERT(pState->apAvailableContexts[ctx->id] == ctx); 436 425 #endif 437 if ( g_pAvailableContexts[ctx->id] == ctx)438 { 439 g_pAvailableContexts[ctx->id] = NULL;440 --g_cContexts;441 CRASSERT( g_cContexts < RT_ELEMENTS(g_pAvailableContexts));426 if (pState->apAvailableContexts[ctx->id] == ctx) 427 { 428 pState->apAvailableContexts[ctx->id] = NULL; 429 pState->cContexts--; 430 CRASSERT(pState->cContexts < RT_ELEMENTS(pState->apAvailableContexts)); 442 431 } 443 432 else … … 458 447 crStateTextureDestroy( ctx ); 459 448 crStateTransformDestroy( ctx ); 460 crStateFreeShared( ctx, ctx->shared);449 crStateFreeShared(pState, ctx, ctx->shared); 461 450 crStateFramebufferObjectDestroy(ctx); 462 451 crStateGLSLDestroy(ctx); … … 483 472 * pointer somewhere. 484 473 */ 485 void crStateInit( void)474 void crStateInit(PCRStateTracker pState) 486 475 { 487 476 unsigned int i; 488 477 489 478 /* Purely initialize the context bits */ 490 if (!__currentBits) { 491 __currentBits = (CRStateBits *) crCalloc( sizeof(CRStateBits) ); 492 crStateClientInitBits( &(__currentBits->client) ); 493 crStateLightingInitBits( &(__currentBits->lighting) ); 479 if (!pState->pCurrentBits) { 480 pState->fVBoxEnableDiffOnMakeCurrent = GL_TRUE; 481 pState->pCurrentBits = (CRStateBits *) crCalloc( sizeof(CRStateBits) ); 482 crStateClientInitBits( &(pState->pCurrentBits->client) ); 483 crStateLightingInitBits( &(pState->pCurrentBits->lighting) ); 494 484 } else 495 485 { … … 500 490 501 491 for (i=0;i<CR_MAX_CONTEXTS;i++) 502 g_pAvailableContexts[i] = NULL;503 g_cContexts = 0;504 505 if (! __isContextTLSInited)492 pState->apAvailableContexts[i] = NULL; 493 pState->cContexts = 0; 494 495 if (!pState->fContextTLSInit) 506 496 { 507 497 # ifndef RT_OS_WINDOWS 508 498 /* tls destructor is implemented for all platforms except windows*/ 509 crInitTSDF(& __contextTSD, crStateThreadTlsDtor);499 crInitTSDF(&pState->contextTSD, crStateThreadTlsDtor); 510 500 # else 511 501 /* windows should do cleanup via DllMain THREAD_DETACH notification */ 512 crInitTSD(& __contextTSD);502 crInitTSD(&pState->contextTSD); 513 503 # endif 514 __isContextTLSInited = 1;515 } 516 517 if ( defaultContext) {504 pState->fContextTLSInit = true; 505 } 506 507 if (pState->pDefaultContext) { 518 508 /* Free the default/NULL context. 519 509 * Ensures context bits are reset */ 520 SetCurrentContext( NULL);521 VBoxTlsRefRelease( defaultContext);510 SetCurrentContext(pState, NULL); 511 VBoxTlsRefRelease(pState->pDefaultContext); 522 512 } 523 513 524 514 /* Reset diff_api */ 525 crMemZero(& diff_api, sizeof(SPUDispatchTable));526 527 Assert(! gSharedState);528 gSharedState = NULL;515 crMemZero(&pState->diff_api, sizeof(SPUDispatchTable)); 516 517 Assert(!pState->pSharedState); 518 pState->pSharedState = NULL; 529 519 530 520 /* Allocate the default/NULL context */ 531 CRASSERT( g_pAvailableContexts[0] == NULL);532 defaultContext = crStateCreateContextId(0, NULL, CR_RGB_BIT, NULL);533 CRASSERT( g_pAvailableContexts[0] == defaultContext);534 CRASSERT( g_cContexts == 1);535 SetCurrentContext( defaultContext);536 } 537 538 void crStateDestroy( void)521 CRASSERT(pState->apAvailableContexts[0] == NULL); 522 pState->pDefaultContext = crStateCreateContextId(pState, 0, NULL, CR_RGB_BIT, NULL); 523 CRASSERT(pState->apAvailableContexts[0] == pState->pDefaultContext); 524 CRASSERT(pState->cContexts == 1); 525 SetCurrentContext(pState, pState->pDefaultContext); 526 } 527 528 void crStateDestroy(PCRStateTracker pState) 539 529 { 540 530 int i; 541 if ( __currentBits)542 { 543 crStateClientDestroyBits(&( __currentBits->client));544 crStateLightingDestroyBits(&( __currentBits->lighting));545 crFree( __currentBits);546 __currentBits = NULL;547 } 548 549 SetCurrentContext( NULL);531 if (pState->pCurrentBits) 532 { 533 crStateClientDestroyBits(&(pState->pCurrentBits->client)); 534 crStateLightingDestroyBits(&(pState->pCurrentBits->lighting)); 535 crFree(pState->pCurrentBits); 536 pState->pCurrentBits = NULL; 537 } 538 539 SetCurrentContext(pState, NULL); 550 540 551 541 for (i = CR_MAX_CONTEXTS-1; i >= 0; i--) 552 542 { 553 if ( g_pAvailableContexts[i])554 { 555 if (VBoxTlsRefIsFunctional( g_pAvailableContexts[i]))556 VBoxTlsRefRelease( g_pAvailableContexts[i]);543 if (pState->apAvailableContexts[i]) 544 { 545 if (VBoxTlsRefIsFunctional(pState->apAvailableContexts[i])) 546 VBoxTlsRefRelease(pState->apAvailableContexts[i]); 557 547 } 558 548 } 559 549 560 550 /* default context was stored in g_pAvailableContexts[0], so it was destroyed already */ 561 defaultContext = NULL;562 563 564 crFreeTSD(& __contextTSD);565 __isContextTLSInited = 0;551 pState->pDefaultContext = NULL; 552 553 554 crFreeTSD(&pState->contextTSD); 555 pState->fContextTLSInit = false; 566 556 } 567 557 … … 610 600 611 601 CRContext * 612 crStateCreateContext( const CRLimitsState *limits, GLint visBits, CRContext *share)613 { 614 return crStateCreateContextEx( limits, visBits, share, -1);602 crStateCreateContext(PCRStateTracker pState, const CRLimitsState *limits, GLint visBits, CRContext *share) 603 { 604 return crStateCreateContextEx(pState, limits, visBits, share, -1); 615 605 } 616 606 617 607 CRContext * 618 crStateCreateContextEx( const CRLimitsState *limits, GLint visBits, CRContext *share, GLint presetID)608 crStateCreateContextEx(PCRStateTracker pState, const CRLimitsState *limits, GLint visBits, CRContext *share, GLint presetID) 619 609 { 620 610 /* Must have created the default context via crStateInit() first */ 621 CRASSERT( defaultContext);611 CRASSERT(pState->pDefaultContext); 622 612 623 613 if (presetID>0) 624 614 { 625 if( g_pAvailableContexts[presetID])615 if(pState->apAvailableContexts[presetID]) 626 616 { 627 617 crWarning("requesting to create context with already allocated id"); … … 635 625 for (i = 1 ; i < CR_MAX_CONTEXTS ; i++) 636 626 { 637 if (! g_pAvailableContexts[i])627 if (!pState->apAvailableContexts[i]) 638 628 { 639 629 presetID = i; … … 651 641 } 652 642 653 return crStateCreateContextId(p resetID, limits, visBits, share);654 } 655 656 void crStateDestroyContext( CRContext *ctx )657 { 658 CRContext *current = GetCurrentContext( );643 return crStateCreateContextId(pState, presetID, limits, visBits, share); 644 } 645 646 void crStateDestroyContext(PCRStateTracker pState, CRContext *ctx ) 647 { 648 CRContext *current = GetCurrentContext(pState); 659 649 660 650 if (current == ctx) { 661 651 /* destroying the current context - have to be careful here */ 662 CRASSERT( defaultContext);652 CRASSERT(pState->pDefaultContext); 663 653 /* Check to see if the differencer exists first, 664 654 we may not have one, aka the packspu */ 665 if ( diff_api.AlphaFunc)666 crStateSwitchContext(current, defaultContext);667 668 SetCurrentContext( defaultContext);655 if (pState->diff_api.AlphaFunc) 656 crStateSwitchContext(current, pState->pDefaultContext); 657 658 SetCurrentContext(pState, pState->pDefaultContext); 669 659 /* ensure matrix state is also current */ 670 crStateMatrixMode( defaultContext->transform.matrixMode);660 crStateMatrixMode(pState, pState->pDefaultContext->transform.matrixMode); 671 661 } 672 662 673 663 VBoxTlsRefMarkDestroy(ctx); 674 664 # ifdef IN_GUEST 675 if (VBoxTlsRefCountGet(ctx) > 1 && ctx->shared == gSharedState)665 if (VBoxTlsRefCountGet(ctx) > 1 && ctx->shared == pState->pSharedState) 676 666 { 677 667 /* we always need to free the global shared state to prevent the situation when guest thinks the shared objects are still valid, while host destroys them */ 678 crStateFreeShared( ctx, ctx->shared);668 crStateFreeShared(pState, ctx, ctx->shared); 679 669 ctx->shared = crStateAllocShared(); 680 670 } … … 683 673 } 684 674 685 GLboolean crStateEnableDiffOnMakeCurrent( GLboolean fEnable)686 { 687 GLboolean bOld = g_bVBoxEnableDiffOnMakeCurrent;688 g_bVBoxEnableDiffOnMakeCurrent = fEnable;675 GLboolean crStateEnableDiffOnMakeCurrent(PCRStateTracker pState, GLboolean fEnable) 676 { 677 GLboolean bOld = pState->fVBoxEnableDiffOnMakeCurrent; 678 pState->fVBoxEnableDiffOnMakeCurrent = fEnable; 689 679 return bOld; 690 680 } 691 681 692 void crStateMakeCurrent( CRContext *ctx )693 { 694 CRContext *current = GetCurrentContext( );682 void crStateMakeCurrent(PCRStateTracker pState, CRContext *ctx ) 683 { 684 CRContext *current = GetCurrentContext(pState); 695 685 CRContext *pLocalCtx = ctx; 696 686 697 687 if (pLocalCtx == NULL) 698 pLocalCtx = defaultContext;688 pLocalCtx = pState->pDefaultContext; 699 689 700 690 if (current == pLocalCtx) … … 703 693 CRASSERT(pLocalCtx); 704 694 705 if ( g_bVBoxEnableDiffOnMakeCurrent && current) {695 if (pState->fVBoxEnableDiffOnMakeCurrent && current) { 706 696 /* Check to see if the differencer exists first, 707 697 we may not have one, aka the packspu */ 708 if ( diff_api.AlphaFunc)709 crStateSwitchContext( 710 } 711 712 SetCurrentContext(p LocalCtx);698 if (pState->diff_api.AlphaFunc) 699 crStateSwitchContext(current, pLocalCtx ); 700 } 701 702 SetCurrentContext(pState, pLocalCtx); 713 703 714 704 /* ensure matrix state is also current */ 715 crStateMatrixMode(p LocalCtx->transform.matrixMode);705 crStateMatrixMode(pState, pLocalCtx->transform.matrixMode); 716 706 } 717 707 … … 720 710 * As above, but don't call crStateSwitchContext(). 721 711 */ 722 static void crStateSetCurrentEx( CRContext *ctx, GLboolean fCleanupDefault )723 { 724 CRContext *current = GetCurrentContext( );712 static void crStateSetCurrentEx(PCRStateTracker pState, CRContext *ctx, GLboolean fCleanupDefault ) 713 { 714 CRContext *current = GetCurrentContext(pState); 725 715 CRContext *pLocalCtx = ctx; 726 716 727 717 if (pLocalCtx == NULL && !fCleanupDefault) 728 pLocalCtx = defaultContext;718 pLocalCtx = pState->pDefaultContext; 729 719 730 720 if (current == pLocalCtx) 731 721 return; /* no-op */ 732 722 733 SetCurrentContext(p LocalCtx);723 SetCurrentContext(pState, pLocalCtx); 734 724 if (pLocalCtx) 735 725 { 736 726 /* ensure matrix state is also current */ 737 crStateMatrixMode(p LocalCtx->transform.matrixMode);738 } 739 } 740 741 void crStateSetCurrent( CRContext *ctx )742 { 743 crStateSetCurrentEx( ctx, GL_FALSE );744 } 745 746 void crStateCleanupCurrent( void)747 { 748 crStateSetCurrentEx( NULL, GL_TRUE );749 } 750 751 752 CRContext *crStateGetCurrent( void)753 { 754 return GetCurrentContext( );755 } 756 757 758 void crStateUpdateColorBits( void)727 crStateMatrixMode(pState, pLocalCtx->transform.matrixMode); 728 } 729 } 730 731 void crStateSetCurrent(PCRStateTracker pState, CRContext *ctx ) 732 { 733 crStateSetCurrentEx(pState, ctx, GL_FALSE ); 734 } 735 736 void crStateCleanupCurrent(PCRStateTracker pState) 737 { 738 crStateSetCurrentEx(pState, NULL, GL_TRUE ); 739 } 740 741 742 CRContext *crStateGetCurrent(PCRStateTracker pState) 743 { 744 return GetCurrentContext(pState); 745 } 746 747 748 void crStateUpdateColorBits(PCRStateTracker pState) 759 749 { 760 750 /* This is a hack to force updating the 'current' attribs */ 761 CRStateBits *sb = GetCurrentBits( );751 CRStateBits *sb = GetCurrentBits(pState); 762 752 FILLDIRTY(sb->current.dirty); 763 753 FILLDIRTY(sb->current.vertexAttrib[VERT_ATTRIB_COLOR0]); … … 766 756 767 757 void STATE_APIENTRY 768 crStateChromiumParameteriCR( GLenum target, GLint value )758 crStateChromiumParameteriCR(PCRStateTracker pState, GLenum target, GLint value ) 769 759 { 770 760 /* This no-op function helps smooth code-gen */ 761 RT_NOREF(pState); 771 762 (void)target; (void)value; 772 763 } 773 764 774 765 void STATE_APIENTRY 775 crStateChromiumParameterfCR( GLenum target, GLfloat value )766 crStateChromiumParameterfCR(PCRStateTracker pState, GLenum target, GLfloat value ) 776 767 { 777 768 /* This no-op function helps smooth code-gen */ 769 RT_NOREF(pState); 778 770 (void)target; (void)value; 779 771 } 780 772 781 773 void STATE_APIENTRY 782 crStateChromiumParametervCR( GLenum target, GLenum type, GLsizei count, const GLvoid *values )774 crStateChromiumParametervCR(PCRStateTracker pState, GLenum target, GLenum type, GLsizei count, const GLvoid *values ) 783 775 { 784 776 /* This no-op function helps smooth code-gen */ 777 RT_NOREF(pState); 785 778 (void)target; (void)type; (void)count; (void)values; 786 779 } 787 780 788 781 void STATE_APIENTRY 789 crStateGetChromiumParametervCR( GLenum target, GLuint index, GLenum type, GLsizei count, GLvoid *values )782 crStateGetChromiumParametervCR(PCRStateTracker pState, GLenum target, GLuint index, GLenum type, GLsizei count, GLvoid *values ) 790 783 { 791 784 /* This no-op function helps smooth code-gen */ 785 RT_NOREF(pState); 792 786 (void)target; (void)index; (void)type; (void)count; (void)values; 793 787 } 794 788 795 789 void STATE_APIENTRY 796 crStateReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,797 790 crStateReadPixels(PCRStateTracker pState, GLint x, GLint y, GLsizei width, GLsizei height, 791 GLenum format, GLenum type, GLvoid *pixels ) 798 792 { 799 793 /* This no-op function helps smooth code-gen */ 794 RT_NOREF(pState); 800 795 (void)x; (void)y; (void)width; (void)height; (void)format; (void)type; (void)pixels; 801 796 } 802 797 803 void crStateVBoxDetachThread( void)798 void crStateVBoxDetachThread(PCRStateTracker pState) 804 799 { 805 800 /* release the context ref so that it can be freed */ 806 SetCurrentContext(NULL); 807 } 808 809 810 void crStateVBoxAttachThread(void) 811 { 801 SetCurrentContext(pState, NULL); 802 } 803 804 805 void crStateVBoxAttachThread(PCRStateTracker pState) 806 { 807 RT_NOREF(pState); 812 808 } 813 809 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_isenabled.py
r69392 r78375 44 44 #include "state/cr_statetypes.h" 45 45 46 GLboolean STATE_APIENTRY crStateIsEnabled( GLenum pname )46 GLboolean STATE_APIENTRY crStateIsEnabled(PCRStateTracker pState, GLenum pname ) 47 47 { 48 CRContext *g = GetCurrentContext( );48 CRContext *g = GetCurrentContext(pState); 49 49 50 50 if (g->current.inBeginEnd) 51 51 { 52 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glGet called in Begin/End");52 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glGet called in Begin/End"); 53 53 return 0; 54 54 } … … 70 70 print('#endif /* CR_%s */' % ext) 71 71 print("\tdefault:") 72 print("\t\tcrStateError( __LINE__, __FILE__, GL_INVALID_ENUM, \"glIsEnabled: Unknown enum: %d\", pname);")72 print("\t\tcrStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, \"glIsEnabled: Unknown enum: %d\", pname);") 73 73 print("\t\treturn 0;") 74 74 print("\t}") -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_lighting.c
r69392 r78375 29 29 { 30 30 CRLightingState *l = &ctx->lighting; 31 CRStateBits *sb = GetCurrentBits( );31 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 32 32 CRLightingBits *lb = &(sb->lighting); 33 33 int i; … … 110 110 } 111 111 112 void STATE_APIENTRY crStateShadeModel ( GLenum mode)113 { 114 CRContext *g = GetCurrentContext( );112 void STATE_APIENTRY crStateShadeModel (PCRStateTracker pState, GLenum mode) 113 { 114 CRContext *g = GetCurrentContext(pState); 115 115 CRLightingState *l = &(g->lighting); 116 CRStateBits *sb = GetCurrentBits( );116 CRStateBits *sb = GetCurrentBits(pState); 117 117 CRLightingBits *lb = &(sb->lighting); 118 118 119 119 if (g->current.inBeginEnd) 120 120 { 121 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "ShadeModel called in begin/end");121 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "ShadeModel called in begin/end"); 122 122 return; 123 123 } … … 128 128 mode != GL_FLAT) 129 129 { 130 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "ShadeModel: Bogus mode 0x%x", mode);130 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "ShadeModel: Bogus mode 0x%x", mode); 131 131 return; 132 132 } … … 137 137 } 138 138 139 void STATE_APIENTRY crStateColorMaterial ( GLenum face, GLenum mode)140 { 141 CRContext *g = GetCurrentContext( );139 void STATE_APIENTRY crStateColorMaterial (PCRStateTracker pState, GLenum face, GLenum mode) 140 { 141 CRContext *g = GetCurrentContext(pState); 142 142 CRLightingState *l = &(g->lighting); 143 CRStateBits *sb = GetCurrentBits( );143 CRStateBits *sb = GetCurrentBits(pState); 144 144 CRLightingBits *lb = &(sb->lighting); 145 145 146 146 if (g->current.inBeginEnd) 147 147 { 148 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "ColorMaterial called in begin/end");148 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "ColorMaterial called in begin/end"); 149 149 return; 150 150 } … … 156 156 face != GL_FRONT_AND_BACK) 157 157 { 158 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "ColorMaterial: Bogus face &d", face);158 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "ColorMaterial: Bogus face &d", face); 159 159 return; 160 160 } … … 166 166 mode != GL_AMBIENT_AND_DIFFUSE) 167 167 { 168 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "ColorMaterial: Bogus mode &d", mode);168 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "ColorMaterial: Bogus mode &d", mode); 169 169 return; 170 170 } … … 180 180 } 181 181 182 void STATE_APIENTRY crStateLightModelfv ( GLenum pname, const GLfloat *param)183 { 184 CRContext *g = GetCurrentContext( );182 void STATE_APIENTRY crStateLightModelfv (PCRStateTracker pState, GLenum pname, const GLfloat *param) 183 { 184 CRContext *g = GetCurrentContext(pState); 185 185 CRLightingState *l = &(g->lighting); 186 CRStateBits *sb = GetCurrentBits( );186 CRStateBits *sb = GetCurrentBits(pState); 187 187 CRLightingBits *lb = &(sb->lighting); 188 188 189 189 if (g->current.inBeginEnd) 190 190 { 191 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "LightModelfv called in begin/end");191 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "LightModelfv called in begin/end"); 192 192 return; 193 193 } … … 217 217 else 218 218 { 219 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "LightModel: Invalid param for LIGHT_MODEL_COLOR_CONTROL: 0x%x", param[0]);219 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "LightModel: Invalid param for LIGHT_MODEL_COLOR_CONTROL: 0x%x", param[0]); 220 220 return; 221 221 } … … 232 232 else 233 233 { 234 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "LightModel: Invalid param for LIGHT_MODEL_COLOR_CONTROL: 0x%x", param[0]);234 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "LightModel: Invalid param for LIGHT_MODEL_COLOR_CONTROL: 0x%x", param[0]); 235 235 return; 236 236 } … … 238 238 else 239 239 { 240 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "LightModel( LIGHT_MODEL_COLOR_CONTROL, ...) - EXT_separate_specular_color is unavailable.");240 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "LightModel( LIGHT_MODEL_COLOR_CONTROL, ...) - EXT_separate_specular_color is unavailable."); 241 241 return; 242 242 } … … 245 245 #endif 246 246 default: 247 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "LightModelfv: Invalid pname: 0x%x", pname);247 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "LightModelfv: Invalid pname: 0x%x", pname); 248 248 return; 249 249 } … … 252 252 } 253 253 254 void STATE_APIENTRY crStateLightModeliv ( GLenum pname, const GLint *param)254 void STATE_APIENTRY crStateLightModeliv (PCRStateTracker pState, GLenum pname, const GLint *param) 255 255 { 256 256 GLfloat f_param; 257 257 GLcolor f_color; 258 258 #ifndef CR_OPENGL_VERSION_1_2 259 CRContext *g = GetCurrentContext( );259 CRContext *g = GetCurrentContext(pState); 260 260 #endif 261 261 … … 265 265 case GL_LIGHT_MODEL_TWO_SIDE: 266 266 f_param = (GLfloat) (*param); 267 crStateLightModelfv(p name, &f_param);267 crStateLightModelfv(pState, pname, &f_param); 268 268 break; 269 269 case GL_LIGHT_MODEL_AMBIENT: … … 272 272 f_color.b = ((GLfloat)param[2])/CR_MAXINT; 273 273 f_color.a = ((GLfloat)param[3])/CR_MAXINT; 274 crStateLightModelfv(p name, (GLfloat *) &f_color);274 crStateLightModelfv(pState, pname, (GLfloat *) &f_color); 275 275 break; 276 276 #if defined(CR_OPENGL_VERSION_1_2) 277 277 case GL_LIGHT_MODEL_COLOR_CONTROL: 278 278 f_param = (GLfloat) (*param); 279 crStateLightModelfv(p name, &f_param);279 crStateLightModelfv(pState, pname, &f_param); 280 280 break; 281 281 #else … … 284 284 if (g->extensions.EXT_separate_specular_color) { 285 285 f_param = (GLfloat) (*param); 286 crStateLightModelfv(p name, &f_param);286 crStateLightModelfv(pState, pname, &f_param); 287 287 } else { 288 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "LightModeliv(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, ...) - EXT_separate_specular_color not enabled!");288 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "LightModeliv(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, ...) - EXT_separate_specular_color not enabled!"); 289 289 return; 290 290 } … … 293 293 #endif 294 294 default: 295 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "LightModeliv: Invalid pname: 0x%x", pname);295 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "LightModeliv: Invalid pname: 0x%x", pname); 296 296 return; 297 297 } 298 298 } 299 299 300 void STATE_APIENTRY crStateLightModelf ( GLenum pname, GLfloat param)301 { 302 crStateLightModelfv(p name, ¶m);303 } 304 305 void STATE_APIENTRY crStateLightModeli ( GLenum pname, GLint param)300 void STATE_APIENTRY crStateLightModelf (PCRStateTracker pState, GLenum pname, GLfloat param) 301 { 302 crStateLightModelfv(pState, pname, ¶m); 303 } 304 305 void STATE_APIENTRY crStateLightModeli (PCRStateTracker pState, GLenum pname, GLint param) 306 306 { 307 307 GLfloat f_param = (GLfloat) param; 308 crStateLightModelfv(p name, &f_param);309 } 310 311 void STATE_APIENTRY crStateLightfv ( GLenum light, GLenum pname, const GLfloat *param)312 { 313 CRContext *g = GetCurrentContext( );308 crStateLightModelfv(pState, pname, &f_param); 309 } 310 311 void STATE_APIENTRY crStateLightfv (PCRStateTracker pState, GLenum light, GLenum pname, const GLfloat *param) 312 { 313 CRContext *g = GetCurrentContext(pState); 314 314 CRLightingState *l = &(g->lighting); 315 315 CRTransformState *t = &(g->transform); … … 319 319 CRmatrix inv; 320 320 CRmatrix *mat; 321 CRStateBits *sb = GetCurrentBits( );321 CRStateBits *sb = GetCurrentBits(pState); 322 322 CRLightingBits *lb = &(sb->lighting); 323 323 CRLightBits *ltb; … … 325 325 if (g->current.inBeginEnd) 326 326 { 327 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glLightfv called in begin/end");327 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glLightfv called in begin/end"); 328 328 return; 329 329 } … … 334 334 if (i>=g->limits.maxLights) 335 335 { 336 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glLight: invalid light specified: 0x%x", light);336 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glLight: invalid light specified: 0x%x", light); 337 337 return; 338 338 } … … 405 405 if (*param < 0.0f || *param > 180.0f) 406 406 { 407 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: spot exponent out of range: %f", *param);407 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: spot exponent out of range: %f", *param); 408 408 return; 409 409 } … … 414 414 if ((*param < 0.0f || *param > 90.0f) && *param != 180.0f) 415 415 { 416 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: spot cutoff out of range: %f", *param);416 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: spot cutoff out of range: %f", *param); 417 417 return; 418 418 } … … 423 423 if (*param < 0.0f) 424 424 { 425 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: constant Attenuation negative: %f", *param);425 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: constant Attenuation negative: %f", *param); 426 426 return; 427 427 } … … 432 432 if (*param < 0.0f) 433 433 { 434 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: linear Attenuation negative: %f", *param);434 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: linear Attenuation negative: %f", *param); 435 435 return; 436 436 } … … 441 441 if (*param < 0.0f) 442 442 { 443 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: quadratic Attenuation negative: %f", *param);443 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glLight: quadratic Attenuation negative: %f", *param); 444 444 return; 445 445 } … … 448 448 break; 449 449 default: 450 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glLight: invalid pname: 0x%x", pname);450 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glLight: invalid pname: 0x%x", pname); 451 451 return; 452 452 } … … 455 455 } 456 456 457 void STATE_APIENTRY crStateLightiv ( GLenum light, GLenum pname, const GLint *param)457 void STATE_APIENTRY crStateLightiv (PCRStateTracker pState, GLenum light, GLenum pname, const GLint *param) 458 458 { 459 459 GLfloat f_param; … … 470 470 f_color.b = ((GLfloat)param[2])/CR_MAXINT; 471 471 f_color.a = ((GLfloat)param[3])/CR_MAXINT; 472 crStateLightfv( light, pname, (GLfloat *) &f_color);472 crStateLightfv(pState, light, pname, (GLfloat *) &f_color); 473 473 break; 474 474 case GL_POSITION: … … 478 478 f_vector.z = (GLfloat) param[2]; 479 479 f_vector.w = (GLfloat) param[3]; 480 crStateLightfv( light, pname, (GLfloat *) &f_vector);480 crStateLightfv(pState, light, pname, (GLfloat *) &f_vector); 481 481 break; 482 482 case GL_SPOT_EXPONENT: … … 486 486 case GL_QUADRATIC_ATTENUATION: 487 487 f_param = (GLfloat) (*param); 488 crStateLightfv( light, pname, &f_param);488 crStateLightfv(pState, light, pname, &f_param); 489 489 break; 490 490 default: 491 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glLight: invalid pname: 0x%x", pname);491 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glLight: invalid pname: 0x%x", pname); 492 492 return; 493 493 } 494 494 } 495 495 496 void STATE_APIENTRY crStateLightf ( GLenum light, GLenum pname, GLfloat param)497 { 498 crStateLightfv( light, pname, ¶m);499 } 500 501 void STATE_APIENTRY crStateLighti ( GLenum light, GLenum pname, GLint param)496 void STATE_APIENTRY crStateLightf (PCRStateTracker pState, GLenum light, GLenum pname, GLfloat param) 497 { 498 crStateLightfv(pState, light, pname, ¶m); 499 } 500 501 void STATE_APIENTRY crStateLighti (PCRStateTracker pState, GLenum light, GLenum pname, GLint param) 502 502 { 503 503 GLfloat f_param = (GLfloat) param; 504 crStateLightfv( light, pname, &f_param);505 } 506 507 void STATE_APIENTRY crStateMaterialfv ( GLenum face, GLenum pname, const GLfloat *param)508 { 509 CRContext *g = GetCurrentContext( );504 crStateLightfv(pState, light, pname, &f_param); 505 } 506 507 void STATE_APIENTRY crStateMaterialfv (PCRStateTracker pState, GLenum face, GLenum pname, const GLfloat *param) 508 { 509 CRContext *g = GetCurrentContext(pState); 510 510 CRLightingState *l = &(g->lighting); 511 CRStateBits *sb = GetCurrentBits( );511 CRStateBits *sb = GetCurrentBits(pState); 512 512 CRLightingBits *lb = &(sb->lighting); 513 513 … … 541 541 break; 542 542 default: 543 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face);543 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face); 544 544 return; 545 545 } … … 567 567 break; 568 568 default: 569 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face);569 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face); 570 570 return; 571 571 } … … 593 593 break; 594 594 default: 595 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face);595 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face); 596 596 return; 597 597 } … … 619 619 break; 620 620 default: 621 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face);621 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face); 622 622 return; 623 623 } … … 645 645 break; 646 646 default: 647 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face);647 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face); 648 648 return; 649 649 } … … 652 652 if (*param > 180.0f || *param < 0.0f) 653 653 { 654 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glMaterialfv: param out of range: %f", param);654 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glMaterialfv: param out of range: %f", param); 655 655 return; 656 656 } … … 668 668 break; 669 669 default: 670 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face);670 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face); 671 671 return; 672 672 } … … 691 691 break; 692 692 default: 693 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face);693 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad face: 0x%x", face); 694 694 return; 695 695 } 696 696 break; 697 697 default: 698 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad pname: 0x%x", pname);698 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialfv: bad pname: 0x%x", pname); 699 699 return; 700 700 } … … 703 703 } 704 704 705 void STATE_APIENTRY crStateMaterialiv ( GLenum face, GLenum pname, const GLint *param)705 void STATE_APIENTRY crStateMaterialiv (PCRStateTracker pState, GLenum face, GLenum pname, const GLint *param) 706 706 { 707 707 GLfloat f_param; … … 719 719 f_color.b = ((GLfloat) param[2]) / ((GLfloat) CR_MAXINT); 720 720 f_color.a = ((GLfloat) param[3]) / ((GLfloat) CR_MAXINT); 721 crStateMaterialfv( face, pname, (GLfloat *) &f_color);721 crStateMaterialfv(pState, face, pname, (GLfloat *) &f_color); 722 722 break; 723 723 case GL_SHININESS: 724 724 f_param = (GLfloat) (*param); 725 crStateMaterialfv( face, pname, (GLfloat *) &f_param);725 crStateMaterialfv(pState, face, pname, (GLfloat *) &f_param); 726 726 break; 727 727 case GL_COLOR_INDEXES : 728 728 f_param = (GLfloat) (*param); 729 crStateMaterialfv( face, pname, (GLfloat *) &f_param);729 crStateMaterialfv(pState, face, pname, (GLfloat *) &f_param); 730 730 break; 731 731 default: 732 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialiv: bad pname: 0x%x", pname);732 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glMaterialiv: bad pname: 0x%x", pname); 733 733 return; 734 734 } 735 735 } 736 736 737 void STATE_APIENTRY crStateMaterialf ( GLenum face, GLenum pname, GLfloat param)738 { 739 crStateMaterialfv( face, pname, ¶m);740 } 741 742 void STATE_APIENTRY crStateMateriali ( GLenum face, GLenum pname, GLint param)737 void STATE_APIENTRY crStateMaterialf (PCRStateTracker pState, GLenum face, GLenum pname, GLfloat param) 738 { 739 crStateMaterialfv(pState, face, pname, ¶m); 740 } 741 742 void STATE_APIENTRY crStateMateriali (PCRStateTracker pState, GLenum face, GLenum pname, GLint param) 743 743 { 744 744 GLfloat f_param = (GLfloat) param; 745 crStateMaterialfv( face, pname, &f_param);746 } 747 748 void STATE_APIENTRY crStateGetLightfv ( GLenum light, GLenum pname, GLfloat *param)749 { 750 CRContext *g = GetCurrentContext( );745 crStateMaterialfv(pState, face, pname, &f_param); 746 } 747 748 void STATE_APIENTRY crStateGetLightfv (PCRStateTracker pState, GLenum light, GLenum pname, GLfloat *param) 749 { 750 CRContext *g = GetCurrentContext(pState); 751 751 CRLightingState *l = &(g->lighting); 752 752 CRLight *lt; … … 755 755 if (g->current.inBeginEnd) 756 756 { 757 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,757 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 758 758 "glGetLightfv called in begin/end"); 759 759 return; … … 763 763 if (i>=g->limits.maxLights) 764 764 { 765 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,765 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 766 766 "glGetLight: invalid light specified: 0x%x", light); 767 767 return; … … 823 823 break; 824 824 default: 825 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,825 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 826 826 "glGetLight: invalid pname: 0x%x", pname); 827 827 return; … … 829 829 } 830 830 831 void STATE_APIENTRY crStateGetLightiv ( GLenum light, GLenum pname, GLint *param)832 { 833 CRContext *g = GetCurrentContext( );831 void STATE_APIENTRY crStateGetLightiv (PCRStateTracker pState, GLenum light, GLenum pname, GLint *param) 832 { 833 CRContext *g = GetCurrentContext(pState); 834 834 CRLightingState *l = &(g->lighting); 835 835 CRLight *lt; … … 838 838 if (g->current.inBeginEnd) 839 839 { 840 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,840 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 841 841 "glGetLightiv called in begin/end"); 842 842 return; … … 846 846 if (i>=g->limits.maxLights) 847 847 { 848 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,848 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 849 849 "glGetLight: invalid light specified: 0x%x", light); 850 850 return; … … 906 906 break; 907 907 default: 908 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,908 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 909 909 "glGetLight: invalid pname: 0x%x", pname); 910 910 return; … … 912 912 } 913 913 914 void STATE_APIENTRY crStateGetMaterialfv ( GLenum face, GLenum pname, GLfloat *param)915 { 916 CRContext *g = GetCurrentContext( );914 void STATE_APIENTRY crStateGetMaterialfv (PCRStateTracker pState, GLenum face, GLenum pname, GLfloat *param) 915 { 916 CRContext *g = GetCurrentContext(pState); 917 917 CRLightingState *l = &(g->lighting); 918 918 919 919 if (g->current.inBeginEnd) 920 920 { 921 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,921 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 922 922 "glGetMaterialfv called in begin/end"); 923 923 return; … … 942 942 break; 943 943 default: 944 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,944 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 945 945 "glGetMaterialfv: bad face: 0x%x", face); 946 946 return; … … 963 963 break; 964 964 default: 965 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,965 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 966 966 "glGetMaterialfv: bad face: 0x%x", face); 967 967 return; … … 984 984 break; 985 985 default: 986 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,986 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 987 987 "glGetMaterialfv: bad face: 0x%x", face); 988 988 return; … … 1005 1005 break; 1006 1006 default: 1007 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1007 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1008 1008 "glGetMaterialfv: bad face: 0x%x", face); 1009 1009 return; … … 1020 1020 break; 1021 1021 default: 1022 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1022 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1023 1023 "glGetMaterialfv: bad face: 0x%x", face); 1024 1024 return; … … 1039 1039 break; 1040 1040 default: 1041 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1041 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1042 1042 "glGetMaterialfv: bad face: 0x%x", face); 1043 1043 return; … … 1045 1045 return; 1046 1046 default: 1047 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1047 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1048 1048 "glGetMaterialfv: bad pname: 0x%x", pname); 1049 1049 return; … … 1052 1052 1053 1053 1054 void STATE_APIENTRY crStateGetMaterialiv ( GLenum face, GLenum pname, GLint *param)1055 { 1056 CRContext *g = GetCurrentContext( );1054 void STATE_APIENTRY crStateGetMaterialiv (PCRStateTracker pState, GLenum face, GLenum pname, GLint *param) 1055 { 1056 CRContext *g = GetCurrentContext(pState); 1057 1057 CRLightingState *l = &(g->lighting); 1058 1058 1059 1059 if (g->current.inBeginEnd) 1060 1060 { 1061 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1061 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1062 1062 "glGetMaterialiv called in begin/end"); 1063 1063 return; … … 1082 1082 break; 1083 1083 default: 1084 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1084 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1085 1085 "glGetMaterialiv: bad face: 0x%x", face); 1086 1086 return; … … 1103 1103 break; 1104 1104 default: 1105 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1105 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1106 1106 "glGetMaterialiv: bad face: 0x%x", face); 1107 1107 return; … … 1124 1124 break; 1125 1125 default: 1126 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1126 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1127 1127 "glGetMaterialiv: bad face: 0x%x", face); 1128 1128 return; … … 1145 1145 break; 1146 1146 default: 1147 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1147 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1148 1148 "glGetMaterialiv: bad face: 0x%x", face); 1149 1149 return; … … 1159 1159 break; 1160 1160 default: 1161 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1161 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1162 1162 "glGetMaterialiv: bad face: 0x%x", face); 1163 1163 return; … … 1178 1178 break; 1179 1179 default: 1180 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1180 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1181 1181 "glGetMaterialiv: bad face: 0x%x", face); 1182 1182 return; … … 1184 1184 return; 1185 1185 default: 1186 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1186 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1187 1187 "glGetMaterialiv: bad pname: 0x%x", pname); 1188 1188 return; … … 1190 1190 } 1191 1191 1192 void crStateColorMaterialRecover( void)1193 { 1194 CRContext *g = GetCurrentContext( );1192 void crStateColorMaterialRecover(PCRStateTracker pState) 1193 { 1194 CRContext *g = GetCurrentContext(pState); 1195 1195 CRLightingState *l = &(g->lighting); 1196 1196 CRCurrentState *c = &(g->current); … … 1206 1206 * short time. Without this, kirchner_colormaterial fails. 1207 1207 */ 1208 crStateFlushFunc( NULL);1209 1210 crStateMaterialfv( l->colorMaterialFace, l->colorMaterialMode, &(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]));1211 } 1212 } 1208 crStateFlushFunc(pState, NULL); 1209 1210 crStateMaterialfv(pState, l->colorMaterialFace, l->colorMaterialMode, &(c->vertexAttrib[VERT_ATTRIB_COLOR0][0])); 1211 } 1212 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_lighting.txt
r15532 r78375 9 9 :shadeModel:shadeModel:ShadeModel 10 10 :lightModel:lightModelAmbient|r,g,b,a:LightModelfv,GL_LIGHT_MODEL_AMBIENT 11 :lightModel:lightModelLocalViewer:* diff_api.LightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, to->lightModelLocalViewer==GL_TRUE);12 :lightModel:lightModelTwoSide:* diff_api.LightModeli(GL_LIGHT_MODEL_TWO_SIDE, to->lightModelTwoSide==GL_TRUE);13 :lightModel:lightModelColorControlEXT:* diff_api.LightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, to->lightModelColorControlEXT);11 :lightModel:lightModelLocalViewer:*pState->diff_api.LightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, to->lightModelLocalViewer==GL_TRUE); 12 :lightModel:lightModelTwoSide:*pState->diff_api.LightModeli(GL_LIGHT_MODEL_TWO_SIDE, to->lightModelTwoSide==GL_TRUE); 13 :lightModel:lightModelColorControlEXT:*pState->diff_api.LightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, to->lightModelColorControlEXT); 14 14 %flush 15 15 :material:ambient[0]|r,g,b,a:Materialfv, GL_FRONT, GL_AMBIENT … … 41 41 :attenuation:linearAttenuation:Lightf, GL_LIGHT0+i, GL_LINEAR_ATTENUATION 42 42 :attenuation:quadraticAttenuation:Lightf, GL_LIGHT0+i, GL_QUADRATIC_ATTENUATION 43 :position:* diff_api.MatrixMode(GL_MODELVIEW);44 :position:* diff_api.PushMatrix();45 :position:* diff_api.LoadIdentity();43 :position:*pState->diff_api.MatrixMode(GL_MODELVIEW); 44 :position:*pState->diff_api.PushMatrix(); 45 :position:*pState->diff_api.LoadIdentity(); 46 46 :position:position|x,y,z,w:Lightfv, GL_LIGHT0+i, GL_POSITION 47 :position:* diff_api.PopMatrix();48 :position:* diff_api.MatrixMode(toCtx->transform.matrixMode);49 :spot:* diff_api.MatrixMode(GL_MODELVIEW);50 :spot:* diff_api.PushMatrix();51 :spot:* diff_api.LoadIdentity();47 :position:*pState->diff_api.PopMatrix(); 48 :position:*pState->diff_api.MatrixMode(toCtx->transform.matrixMode); 49 :spot:*pState->diff_api.MatrixMode(GL_MODELVIEW); 50 :spot:*pState->diff_api.PushMatrix(); 51 :spot:*pState->diff_api.LoadIdentity(); 52 52 :spot:spotDirection|x,y,z:Lightfv, GL_LIGHT0+i, GL_SPOT_DIRECTION 53 53 :spot:spotExponent:Lightf, GL_LIGHT0+i, GL_SPOT_EXPONENT 54 54 :spot:spotCutoff:Lightf, GL_LIGHT0+i, GL_SPOT_CUTOFF 55 :spot:* diff_api.PopMatrix();56 :spot:* diff_api.MatrixMode(toCtx->transform.matrixMode);55 :spot:*pState->diff_api.PopMatrix(); 56 :spot:*pState->diff_api.MatrixMode(toCtx->transform.matrixMode); 57 57 %flush 58 58 >CLEARDIRTY(lb->dirty, nbitID); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_line.c
r69392 r78375 13 13 { 14 14 CRLineState *l = &ctx->line; 15 CRStateBits *sb = GetCurrentBits( );15 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 16 16 CRLineBits *lb = &(sb->line); 17 17 … … 35 35 } 36 36 37 void STATE_APIENTRY crStateLineWidth( GLfloat width)37 void STATE_APIENTRY crStateLineWidth(PCRStateTracker pState, GLfloat width) 38 38 { 39 CRContext *g = GetCurrentContext( );39 CRContext *g = GetCurrentContext(pState); 40 40 CRLineState *l = &(g->line); 41 CRStateBits *sb = GetCurrentBits( );41 CRStateBits *sb = GetCurrentBits(pState); 42 42 CRLineBits *lb = &(sb->line); 43 43 44 44 if (g->current.inBeginEnd) 45 45 { 46 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glLineWidth called in begin/end");46 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glLineWidth called in begin/end"); 47 47 return; 48 48 } … … 52 52 if (width <= 0.0f) 53 53 { 54 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glLineWidth called with size <= 0.0: %f", width);54 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glLineWidth called with size <= 0.0: %f", width); 55 55 return; 56 56 } … … 61 61 } 62 62 63 void STATE_APIENTRY crStateLineStipple( GLint factor, GLushort pattern)63 void STATE_APIENTRY crStateLineStipple(PCRStateTracker pState, GLint factor, GLushort pattern) 64 64 { 65 CRContext *g = GetCurrentContext( );65 CRContext *g = GetCurrentContext(pState); 66 66 CRLineState *l = &(g->line); 67 CRStateBits *sb = GetCurrentBits( );67 CRStateBits *sb = GetCurrentBits(pState); 68 68 CRLineBits *lb = &(sb->line); 69 69 70 70 if (g->current.inBeginEnd) 71 71 { 72 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,72 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 73 73 "glLineStipple called in begin/end"); 74 74 return; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_lists.c
r78263 r78375 20 20 { 21 21 CRListsState *l = &ctx->lists; 22 CRStateBits *sb = GetCurrentBits( );22 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 23 23 CRListsBits *lb = &(sb->lists); 24 24 … … 57 57 #endif 58 58 59 #define CRSTATE_SET_ENABLED(state, cap) CRSTATE_SET_CAP(state, diff_api.IsEnabled(cap), "%u")60 61 #define CRSTATE_SET_ENUM(state, cap) {GLenum _e=g->state; diff_api.GetIntegerv(cap, (GLint *)&_e); CRSTATE_SET_CAP(state, _e, "%#x");}62 #define CRSTATE_SET_FLOAT(state, cap) {GLfloat _f=g->state; diff_api.GetFloatv(cap, &_f); CRSTATE_SET_CAP(state, _f, "%f");}63 #define CRSTATE_SET_INT(state, cap) {GLint _i=g->state; diff_api.GetIntegerv(cap, &_i); CRSTATE_SET_CAP(state, _i, "%i");}64 #define CRSTATE_SET_BOOL(state, cap) {GLboolean _b=g->state; diff_api.GetBooleanv(cap, &_b); CRSTATE_SET_CAP(state, _b, "%u");}59 #define CRSTATE_SET_ENABLED(state, cap) CRSTATE_SET_CAP(state, pState->diff_api.IsEnabled(cap), "%u") 60 61 #define CRSTATE_SET_ENUM(state, cap) {GLenum _e=g->state; pState->diff_api.GetIntegerv(cap, (GLint *)&_e); CRSTATE_SET_CAP(state, _e, "%#x");} 62 #define CRSTATE_SET_FLOAT(state, cap) {GLfloat _f=g->state; pState->diff_api.GetFloatv(cap, &_f); CRSTATE_SET_CAP(state, _f, "%f");} 63 #define CRSTATE_SET_INT(state, cap) {GLint _i=g->state; pState->diff_api.GetIntegerv(cap, &_i); CRSTATE_SET_CAP(state, _i, "%i");} 64 #define CRSTATE_SET_BOOL(state, cap) {GLboolean _b=g->state; pState->diff_api.GetBooleanv(cap, &_b); CRSTATE_SET_CAP(state, _b, "%u");} 65 65 66 66 #define CRSTATE_SET_COLORF(state, cap) \ … … 71 71 value[2]=g->state.b; \ 72 72 value[3]=g->state.a; \ 73 diff_api.GetFloatv(cap, &value[0]);\73 pState->diff_api.GetFloatv(cap, &value[0]); \ 74 74 CRSTATE_SET_CAP(state.r, value[0], "%f"); \ 75 75 CRSTATE_SET_CAP(state.g, value[1], "%f"); \ … … 81 81 { \ 82 82 GLint _stex, _hwtex; \ 83 _stex = _hwtex = crStateGetTextureObjHWID( g->state);\84 diff_api.GetIntegerv(cap, &_hwtex);\83 _stex = _hwtex = crStateGetTextureObjHWID(pState, g->state); \ 84 pState->diff_api.GetIntegerv(cap, &_hwtex); \ 85 85 if (_stex!=_hwtex) \ 86 86 { \ 87 87 CR_STATE_SETTEX_MSG(#state, _stex, _hwtex); \ 88 crStateBindTexture( target, crStateTextureHWIDtoID(_hwtex));\88 crStateBindTexture(pState, target, crStateTextureHWIDtoID(pState, _hwtex)); \ 89 89 } \ 90 90 } … … 97 97 value[2]=g->state.b; \ 98 98 value[3]=g->state.a; \ 99 diff_api.func(p1, p2, &value[0]);\99 pState->diff_api.func(p1, p2, &value[0]); \ 100 100 CRSTATE_SET_CAP(state.r, value[0], "%f"); \ 101 101 CRSTATE_SET_CAP(state.g, value[1], "%f"); \ … … 111 111 value[2]=g->state.z; \ 112 112 value[3]=g->state.w; \ 113 diff_api.func(p1, p2, &value[0]);\113 pState->diff_api.func(p1, p2, &value[0]); \ 114 114 CRSTATE_SET_CAP(state.x, value[0], "%f"); \ 115 115 CRSTATE_SET_CAP(state.y, value[1], "%f"); \ … … 119 119 120 120 #define CRSTATE_SET_TEXGEN_4F(state, coord, pname) _CRSTATE_SET_4F_XYZW(state, coord, pname, GetTexGenfv) 121 #define CRSTATE_SET_TEXGEN_I(state, coord, pname) {GLint _i=g->state; diff_api.GetTexGeniv(coord, pname, &_i); CRSTATE_SET_CAP(state, _i, "%i");}122 123 #define CRSTATE_SET_TEXENV_I(state, target, pname) {GLint _i=g->state; diff_api.GetTexEnviv(target, pname, &_i); CRSTATE_SET_CAP(state, _i, "%i");}124 #define CRSTATE_SET_TEXENV_F(state, target, pname) {GLfloat _f=g->state; diff_api.GetTexEnvfv(target, pname, &_f); CRSTATE_SET_CAP(state, _f, "%f");}121 #define CRSTATE_SET_TEXGEN_I(state, coord, pname) {GLint _i=g->state; pState->diff_api.GetTexGeniv(coord, pname, &_i); CRSTATE_SET_CAP(state, _i, "%i");} 122 123 #define CRSTATE_SET_TEXENV_I(state, target, pname) {GLint _i=g->state; pState->diff_api.GetTexEnviv(target, pname, &_i); CRSTATE_SET_CAP(state, _i, "%i");} 124 #define CRSTATE_SET_TEXENV_F(state, target, pname) {GLfloat _f=g->state; pState->diff_api.GetTexEnvfv(target, pname, &_f); CRSTATE_SET_CAP(state, _f, "%f");} 125 125 #define CRSTATE_SET_TEXENV_COLOR(state, target, pname) _CRSTATE_SET_4F_RGBA(state, target, pname, GetTexEnvfv) 126 126 127 127 #define CRSTATE_SET_MATERIAL_COLOR(state, face, pname) _CRSTATE_SET_4F_RGBA(state, face, pname, GetMaterialfv) 128 #define CRSTATE_SET_MATERIAL_F(state, face, pname) {GLfloat _f=g->state; diff_api.GetMaterialfv(face, pname, &_f); CRSTATE_SET_CAP(state, _f, "%f");}128 #define CRSTATE_SET_MATERIAL_F(state, face, pname) {GLfloat _f=g->state; pState->diff_api.GetMaterialfv(face, pname, &_f); CRSTATE_SET_CAP(state, _f, "%f");} 129 129 130 130 #define CRSTATE_SET_LIGHT_COLOR(state, light, pname) _CRSTATE_SET_4F_RGBA(state, light, pname, GetLightfv) 131 #define CRSTATE_SET_LIGHT_F(state, light, pname) {GLfloat _f=g->state; diff_api.GetLightfv(light, pname, &_f); CRSTATE_SET_CAP(state, _f, "%f");}131 #define CRSTATE_SET_LIGHT_F(state, light, pname) {GLfloat _f=g->state; pState->diff_api.GetLightfv(light, pname, &_f); CRSTATE_SET_CAP(state, _f, "%f");} 132 132 #define CRSTATE_SET_LIGHT_4F(state, light, pname) _CRSTATE_SET_4F_XYZW(state, light, pname, GetLightfv) 133 133 #define CRSTATE_SET_LIGHT_3F(state, light, pname) \ … … 137 137 value[1]=g->state.y; \ 138 138 value[2]=g->state.z; \ 139 diff_api.GetLightfv(light, pname, &value[0]);\139 pState->diff_api.GetLightfv(light, pname, &value[0]); \ 140 140 CRSTATE_SET_CAP(state.x, value[0], "%f"); \ 141 141 CRSTATE_SET_CAP(state.y, value[1], "%f"); \ … … 150 150 value[2]=g->state.z; \ 151 151 value[3]=g->state.w; \ 152 diff_api.GetClipPlane(plane, &value[0]);\152 pState->diff_api.GetClipPlane(plane, &value[0]); \ 153 153 CRSTATE_SET_CAP(state.x, value[0], "%G"); \ 154 154 CRSTATE_SET_CAP(state.y, value[1], "%G"); \ … … 162 162 crMatrixGetFloats(&f[0], g->state); \ 163 163 crMemcpy(&sm[0], &f[0], 16*sizeof(GLfloat)); \ 164 diff_api.GetFloatv(cap, &f[0]);\164 pState->diff_api.GetFloatv(cap, &f[0]); \ 165 165 if (crMemcmp(&f[0], &sm[0], 16*sizeof(GLfloat))) \ 166 166 { \ … … 170 170 } 171 171 172 void STATE_APIENTRY crStateQueryHWState( GLuint fbFbo, GLuint bbFbo)172 void STATE_APIENTRY crStateQueryHWState(PCRStateTracker pState, GLuint fbFbo, GLuint bbFbo) 173 173 { 174 CRContext *g = GetCurrentContext( );175 CRStateBits *sb = GetCurrentBits( );174 CRContext *g = GetCurrentContext(pState); 175 CRStateBits *sb = GetCurrentBits(pState); 176 176 CRbitvalue /* *bitID=g->bitid, */ *negbitID=g->neg_bitid; 177 177 178 CRASSERT( g_bVBoxEnableDiffOnMakeCurrent);178 CRASSERT(pState->fVBoxEnableDiffOnMakeCurrent); 179 179 180 180 crStateSyncHWErrorState(g); … … 224 224 { 225 225 GLuint buf = 0; 226 diff_api.GetIntegerv(GL_DRAW_BUFFER, (GLint *)&buf);226 pState->diff_api.GetIntegerv(GL_DRAW_BUFFER, (GLint *)&buf); 227 227 228 228 if (buf == GL_COLOR_ATTACHMENT0_EXT && (bbFbo || fbFbo)) 229 229 { 230 230 GLuint binding = 0; 231 diff_api.GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&binding);231 pState->diff_api.GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&binding); 232 232 if (!binding) 233 233 { … … 257 257 { 258 258 GLuint buf = 0; 259 diff_api.GetIntegerv(GL_READ_BUFFER, (GLint *)&buf);259 pState->diff_api.GetIntegerv(GL_READ_BUFFER, (GLint *)&buf); 260 260 261 261 if (buf == GL_COLOR_ATTACHMENT0_EXT && (bbFbo || fbFbo)) 262 262 { 263 263 GLuint binding = 0; 264 diff_api.GetIntegerv(GL_READ_FRAMEBUFFER_BINDING, (GLint *)&binding);264 pState->diff_api.GetIntegerv(GL_READ_FRAMEBUFFER_BINDING, (GLint *)&binding); 265 265 if (!binding) 266 266 { … … 299 299 value[2]=g->buffer.colorWriteMask.b; 300 300 value[3]=g->buffer.colorWriteMask.a; 301 diff_api.GetBooleanv(GL_COLOR_WRITEMASK, &value[0]);301 pState->diff_api.GetBooleanv(GL_COLOR_WRITEMASK, &value[0]); 302 302 303 303 CRSTATE_SET_CAP(buffer.colorWriteMask.r, value[0], "%u"); … … 397 397 if (activeFace == GL_BACK) 398 398 { 399 diff_api.ActiveStencilFaceEXT(GL_FRONT);399 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 400 400 activeFace = GL_FRONT; 401 401 } … … 409 409 if (activeFace == GL_BACK) 410 410 { 411 diff_api.ActiveStencilFaceEXT(GL_FRONT);411 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 412 412 activeFace = GL_FRONT; 413 413 } … … 420 420 if (activeFace == GL_BACK) 421 421 { 422 diff_api.ActiveStencilFaceEXT(GL_FRONT);422 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 423 423 activeFace = GL_FRONT; 424 424 } … … 440 440 if (activeFace == GL_BACK) 441 441 { 442 diff_api.ActiveStencilFaceEXT(GL_FRONT);442 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 443 443 activeFace = GL_FRONT; 444 444 } … … 452 452 if (activeFace == GL_BACK) 453 453 { 454 diff_api.ActiveStencilFaceEXT(GL_FRONT);454 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 455 455 activeFace = GL_FRONT; 456 456 } … … 463 463 if (activeFace == GL_BACK) 464 464 { 465 diff_api.ActiveStencilFaceEXT(GL_FRONT);465 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 466 466 activeFace = GL_FRONT; 467 467 } … … 496 496 if (i!=activeUnit) 497 497 { 498 diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB);498 pState->diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB); 499 499 activeUnit=i; 500 500 } … … 527 527 if (i!=activeUnit) 528 528 { 529 diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB);529 pState->diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB); 530 530 activeUnit=i; 531 531 } … … 554 554 if (i!=activeUnit) 555 555 { 556 diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB);556 pState->diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB); 557 557 activeUnit=i; 558 558 } … … 568 568 if (i!=activeUnit) 569 569 { 570 diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB);570 pState->diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB); 571 571 activeUnit=i; 572 572 } … … 582 582 if (i!=activeUnit) 583 583 { 584 diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB);584 pState->diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB); 585 585 activeUnit=i; 586 586 } … … 596 596 if (i!=activeUnit) 597 597 { 598 diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB);598 pState->diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB); 599 599 activeUnit=i; 600 600 } … … 622 622 if (activeUnit!=g->texture.curTextureUnit) 623 623 { 624 diff_api.ActiveTextureARB(g->texture.curTextureUnit + GL_TEXTURE0_ARB);624 pState->diff_api.ActiveTextureARB(g->texture.curTextureUnit + GL_TEXTURE0_ARB); 625 625 } 626 626 } … … 754 754 for (i=0; i<g->limits.maxTextureUnits; i++) 755 755 { 756 diff_api.ActiveTextureARB(GL_TEXTURE0_ARB+i);756 pState->diff_api.ActiveTextureARB(GL_TEXTURE0_ARB+i); 757 757 CRSTATE_SET_MATRIX(transform.textureStack[i].top, GL_TEXTURE_MATRIX); 758 758 } 759 diff_api.ActiveTextureARB(g->texture.curTextureUnit + GL_TEXTURE0_ARB);759 pState->diff_api.ActiveTextureARB(g->texture.curTextureUnit + GL_TEXTURE0_ARB); 760 760 } 761 761 … … 785 785 value[2] = g->viewport.scissorW; 786 786 value[3] = g->viewport.scissorH; 787 diff_api.GetIntegerv(GL_SCISSOR_BOX, &value[0]);787 pState->diff_api.GetIntegerv(GL_SCISSOR_BOX, &value[0]); 788 788 CRSTATE_SET_CAP(viewport.scissorX, value[0], "%i"); 789 789 CRSTATE_SET_CAP(viewport.scissorY, value[1], "%i"); … … 799 799 value[2] = g->viewport.viewportW; 800 800 value[3] = g->viewport.viewportH; 801 diff_api.GetIntegerv(GL_VIEWPORT, &value[0]);801 pState->diff_api.GetIntegerv(GL_VIEWPORT, &value[0]); 802 802 CRSTATE_SET_CAP(viewport.viewportX, value[0], "%i"); 803 803 CRSTATE_SET_CAP(viewport.viewportY, value[1], "%i"); … … 811 811 value[0] = g->viewport.nearClip; 812 812 value[1] = g->viewport.farClip; 813 diff_api.GetFloatv(GL_DEPTH_RANGE, &value[0]);813 pState->diff_api.GetFloatv(GL_DEPTH_RANGE, &value[0]); 814 814 CRSTATE_SET_CAP(viewport.nearClip, value[0], "%f"); 815 815 CRSTATE_SET_CAP(viewport.farClip, value[1], "%f"); … … 847 847 uval[0] = g->eval.eval1D[i].u1; 848 848 uval[1] = g->eval.eval1D[i].u2; 849 diff_api.GetMapiv(i + GL_MAP1_COLOR_4, GL_ORDER, &order);850 diff_api.GetMapfv(i + GL_MAP1_COLOR_4, GL_DOMAIN, &uval[0]);849 pState->diff_api.GetMapiv(i + GL_MAP1_COLOR_4, GL_ORDER, &order); 850 pState->diff_api.GetMapfv(i + GL_MAP1_COLOR_4, GL_DOMAIN, &uval[0]); 851 851 if (order>0) 852 852 { … … 857 857 continue; 858 858 } 859 diff_api.GetMapfv(i + GL_MAP1_COLOR_4, GL_COEFF, coeffs);859 pState->diff_api.GetMapfv(i + GL_MAP1_COLOR_4, GL_COEFF, coeffs); 860 860 } 861 861 … … 886 886 uval[2] = g->eval.eval2D[i].v1; 887 887 uval[3] = g->eval.eval2D[i].v2; 888 diff_api.GetMapiv(i + GL_MAP2_COLOR_4, GL_ORDER, &order[0]);889 diff_api.GetMapfv(i + GL_MAP2_COLOR_4, GL_DOMAIN, &uval[0]);888 pState->diff_api.GetMapiv(i + GL_MAP2_COLOR_4, GL_ORDER, &order[0]); 889 pState->diff_api.GetMapfv(i + GL_MAP2_COLOR_4, GL_DOMAIN, &uval[0]); 890 890 if (order[0]>0 && order[1]>0) 891 891 { … … 896 896 continue; 897 897 } 898 diff_api.GetMapfv(i + GL_MAP1_COLOR_4, GL_COEFF, coeffs);898 pState->diff_api.GetMapfv(i + GL_MAP1_COLOR_4, GL_COEFF, coeffs); 899 899 } 900 900 CRSTATE_SET_CAP(eval.eval2D[i].uorder, order[0], "%i"); … … 927 927 value[0] = g->eval.u11D; 928 928 value[1] = g->eval.u21D; 929 diff_api.GetFloatv(GL_MAP1_GRID_DOMAIN, &value[0]);929 pState->diff_api.GetFloatv(GL_MAP1_GRID_DOMAIN, &value[0]); 930 930 CRSTATE_SET_CAP(eval.u11D, value[0], "%f"); 931 931 CRSTATE_SET_CAP(eval.u21D, value[1], "%f"); … … 938 938 iv[0] = g->eval.un2D; 939 939 iv[1] = g->eval.vn2D; 940 diff_api.GetIntegerv(GL_MAP1_GRID_SEGMENTS, &iv[0]);940 pState->diff_api.GetIntegerv(GL_MAP1_GRID_SEGMENTS, &iv[0]); 941 941 CRSTATE_SET_CAP(eval.un2D, iv[0], "%i"); 942 942 CRSTATE_SET_CAP(eval.vn2D, iv[1], "%i"); … … 945 945 value[2] = g->eval.v12D; 946 946 value[3] = g->eval.v22D; 947 diff_api.GetFloatv(GL_MAP2_GRID_DOMAIN, &value[0]);947 pState->diff_api.GetFloatv(GL_MAP2_GRID_DOMAIN, &value[0]); 948 948 CRSTATE_SET_CAP(eval.u12D, value[0], "%f"); 949 949 CRSTATE_SET_CAP(eval.u22D, value[1], "%f"); … … 1122 1122 value[1] = g->point.distanceAttenuation[1]; 1123 1123 value[2] = g->point.distanceAttenuation[2]; 1124 diff_api.GetFloatv(GL_POINT_DISTANCE_ATTENUATION, &value[0]);1124 pState->diff_api.GetFloatv(GL_POINT_DISTANCE_ATTENUATION, &value[0]); 1125 1125 CRSTATE_SET_CAP(point.distanceAttenuation[0], value[0], "%f"); 1126 1126 CRSTATE_SET_CAP(point.distanceAttenuation[1], value[1], "%f"); … … 1143 1143 if (activeUnit!=i) 1144 1144 { 1145 diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB);1145 pState->diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB); 1146 1146 activeUnit=i; 1147 1147 } 1148 diff_api.GetTexEnviv(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, &val);1148 pState->diff_api.GetTexEnviv(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, &val); 1149 1149 CRSTATE_SET_CAP(point.coordReplacement[i], val, "%i"); 1150 1150 } … … 1153 1153 if (activeUnit!=g->texture.curTextureUnit) 1154 1154 { 1155 diff_api.ActiveTextureARB(g->texture.curTextureUnit + GL_TEXTURE0_ARB);1155 pState->diff_api.ActiveTextureARB(g->texture.curTextureUnit + GL_TEXTURE0_ARB); 1156 1156 } 1157 1157 } … … 1184 1184 val[0] = g->polygon.frontMode; 1185 1185 val[1] = g->polygon.backMode; 1186 diff_api.GetIntegerv(GL_POLYGON_MODE, &val[0]);1186 pState->diff_api.GetIntegerv(GL_POLYGON_MODE, &val[0]); 1187 1187 CRSTATE_SET_CAP(polygon.frontMode, val[0], "%#x"); 1188 1188 CRSTATE_SET_CAP(polygon.backMode, val[1], "%#x"); … … 1195 1195 GLint stipple[32]; 1196 1196 crMemcpy(&stipple[0], &g->polygon.stipple[0], sizeof(stipple)); 1197 diff_api.GetPolygonStipple((GLubyte*) &stipple[0]);1197 pState->diff_api.GetPolygonStipple((GLubyte*) &stipple[0]); 1198 1198 if (crMemcmp(&stipple[0], &g->polygon.stipple[0], sizeof(stipple))) 1199 1199 { … … 1208 1208 } 1209 1209 1210 CR_STATE_CLEAN_HW_ERR_WARN( "error on hw sync");1210 CR_STATE_CLEAN_HW_ERR_WARN(pState, "error on hw sync"); 1211 1211 } 1212 1212 1213 void STATE_APIENTRY crStateNewList ( GLuint list, GLenum mode)1213 void STATE_APIENTRY crStateNewList (PCRStateTracker pState, GLuint list, GLenum mode) 1214 1214 { 1215 CRContext *g = GetCurrentContext( );1215 CRContext *g = GetCurrentContext(pState); 1216 1216 CRListsState *l = &(g->lists); 1217 1217 1218 1218 if (g->current.inBeginEnd) 1219 1219 { 1220 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glNewList called in Begin/End");1220 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glNewList called in Begin/End"); 1221 1221 return; 1222 1222 } … … 1224 1224 if (list == 0) 1225 1225 { 1226 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glNewList(list=0)");1226 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glNewList(list=0)"); 1227 1227 return; 1228 1228 } … … 1231 1231 { 1232 1232 /* already building a list */ 1233 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glNewList called inside display list");1233 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glNewList called inside display list"); 1234 1234 return; 1235 1235 } … … 1237 1237 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) 1238 1238 { 1239 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glNewList invalid mode");1239 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glNewList invalid mode"); 1240 1240 return; 1241 1241 } … … 1256 1256 } 1257 1257 1258 void STATE_APIENTRY crStateEndList ( void)1258 void STATE_APIENTRY crStateEndList (PCRStateTracker pState) 1259 1259 { 1260 CRContext *g = GetCurrentContext( );1260 CRContext *g = GetCurrentContext(pState); 1261 1261 CRListsState *l = &(g->lists); 1262 1262 1263 1263 if (g->current.inBeginEnd) 1264 1264 { 1265 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glEndList called in Begin/End");1265 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glEndList called in Begin/End"); 1266 1266 return; 1267 1267 } … … 1269 1269 if (!l->currentIndex) 1270 1270 { 1271 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glEndList called outside display list");1271 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glEndList called outside display list"); 1272 1272 return; 1273 1273 } … … 1277 1277 } 1278 1278 1279 GLuint STATE_APIENTRY crStateGenLists( GLsizei range)1279 GLuint STATE_APIENTRY crStateGenLists(PCRStateTracker pState, GLsizei range) 1280 1280 { 1281 CRContext *g = GetCurrentContext( );1281 CRContext *g = GetCurrentContext(pState); 1282 1282 GLuint start; 1283 1283 1284 1284 if (g->current.inBeginEnd) 1285 1285 { 1286 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glGenLists called in Begin/End");1286 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glGenLists called in Begin/End"); 1287 1287 return 0; 1288 1288 } … … 1290 1290 if (range < 0) 1291 1291 { 1292 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative range passed to glGenLists: %d", range);1292 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative range passed to glGenLists: %d", range); 1293 1293 return 0; 1294 1294 } … … 1300 1300 } 1301 1301 1302 void STATE_APIENTRY crStateDeleteLists ( GLuint list, GLsizei range)1302 void STATE_APIENTRY crStateDeleteLists (PCRStateTracker pState, GLuint list, GLsizei range) 1303 1303 { 1304 CRContext *g = GetCurrentContext( );1304 CRContext *g = GetCurrentContext(pState); 1305 1305 1306 1306 if (g->current.inBeginEnd) 1307 1307 { 1308 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glDeleteLists called in Begin/End");1308 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glDeleteLists called in Begin/End"); 1309 1309 return; 1310 1310 } … … 1312 1312 if (range < 0) 1313 1313 { 1314 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Negative range passed to glDeleteLists: %d", range);1314 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Negative range passed to glDeleteLists: %d", range); 1315 1315 return; 1316 1316 } … … 1319 1319 } 1320 1320 1321 GLboolean STATE_APIENTRY crStateIsList( GLuint list)1321 GLboolean STATE_APIENTRY crStateIsList(PCRStateTracker pState, GLuint list) 1322 1322 { 1323 CRContext *g = GetCurrentContext( );1323 CRContext *g = GetCurrentContext(pState); 1324 1324 1325 1325 if (g->current.inBeginEnd) 1326 1326 { 1327 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1327 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1328 1328 "GenLists called in Begin/End"); 1329 1329 return GL_FALSE; … … 1336 1336 } 1337 1337 1338 void STATE_APIENTRY crStateListBase ( GLuint base)1338 void STATE_APIENTRY crStateListBase (PCRStateTracker pState, GLuint base) 1339 1339 { 1340 CRContext *g = GetCurrentContext( );1340 CRContext *g = GetCurrentContext(pState); 1341 1341 CRListsState *l = &(g->lists); 1342 CRStateBits *sb = GetCurrentBits( );1342 CRStateBits *sb = GetCurrentBits(pState); 1343 1343 CRListsBits *lb = &(sb->lists); 1344 1344 1345 1345 if (g->current.inBeginEnd) 1346 1346 { 1347 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1347 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1348 1348 "ListBase called in Begin/End"); 1349 1349 return; … … 1361 1361 CRContext *fromCtx, CRContext *toCtx ) 1362 1362 { 1363 PCRStateTracker pState = fromCtx->pStateTracker; 1363 1364 CRListsState *from = &(fromCtx->lists); 1364 1365 CRListsState *to = &(toCtx->lists); … … 1366 1367 CRbitvalue nbitID[CR_MAX_BITARRAY]; 1367 1368 1369 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 1370 1368 1371 for (j=0;j<CR_MAX_BITARRAY;j++) 1369 1372 nbitID[j] = ~bitID[j]; … … 1372 1375 { 1373 1376 if (from->base != to->base) { 1374 diff_api.ListBase(to->base);1377 pState->diff_api.ListBase(to->base); 1375 1378 from->base = to->base; 1376 1379 } … … 1386 1389 CRContext *fromCtx, CRContext *toCtx ) 1387 1390 { 1391 PCRStateTracker pState = fromCtx->pStateTracker; 1388 1392 CRListsState *from = &(fromCtx->lists); 1389 1393 CRListsState *to = &(toCtx->lists); … … 1391 1395 CRbitvalue nbitID[CR_MAX_BITARRAY]; 1392 1396 1397 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 1398 1393 1399 for (j=0;j<CR_MAX_BITARRAY;j++) 1394 1400 nbitID[j] = ~bitID[j]; … … 1397 1403 { 1398 1404 if (from->base != to->base) { 1399 diff_api.ListBase(to->base);1405 pState->diff_api.ListBase(to->base); 1400 1406 FILLDIRTY(b->base); 1401 1407 FILLDIRTY(b->dirty); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_multisample.c
r69392 r78375 13 13 { 14 14 CRMultisampleState *m = &ctx->multisample; 15 CRStateBits *sb = GetCurrentBits( );15 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 16 16 CRMultisampleBits *mb = &(sb->multisample); 17 17 … … 29 29 } 30 30 31 void STATE_APIENTRY crStateSampleCoverageARB( GLclampf value, GLboolean invert)31 void STATE_APIENTRY crStateSampleCoverageARB(PCRStateTracker pState, GLclampf value, GLboolean invert) 32 32 { 33 CRContext *g = GetCurrentContext( );33 CRContext *g = GetCurrentContext(pState); 34 34 CRMultisampleState *m = &(g->multisample); 35 CRStateBits *sb = GetCurrentBits( );35 CRStateBits *sb = GetCurrentBits(pState); 36 36 CRMultisampleBits *mb = &(sb->multisample); 37 37 38 38 if (g->current.inBeginEnd) 39 39 { 40 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glStateSampleCoverageARB called in begin/end");40 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glStateSampleCoverageARB called in begin/end"); 41 41 return; 42 42 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_occlude.c
r78190 r78375 44 44 45 45 void STATE_APIENTRY 46 crStateDeleteQueriesARB( GLsizei n, const GLuint *ids)47 { 48 CRContext *g = GetCurrentContext( );46 crStateDeleteQueriesARB(PCRStateTracker pState, GLsizei n, const GLuint *ids) 47 { 48 CRContext *g = GetCurrentContext(pState); 49 49 CROcclusionState *o = &(g->occlusion); 50 50 /*CRStateBits *sb = GetCurrentBits();*/ … … 55 55 56 56 if (g->current.inBeginEnd) { 57 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,57 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 58 58 "glDeleteQueriesARB called in Begin/End"); 59 59 return; … … 73 73 74 74 void STATE_APIENTRY 75 crStateGenQueriesARB( GLsizei n, GLuint * queries)76 { 77 CRContext *g = GetCurrentContext( );75 crStateGenQueriesARB(PCRStateTracker pState, GLsizei n, GLuint * queries) 76 { 77 CRContext *g = GetCurrentContext(pState); 78 78 CROcclusionState *o = &(g->occlusion); 79 79 GLint start; … … 82 82 83 83 if (g->current.inBeginEnd) { 84 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,84 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 85 85 "glGenQueriesARB called in Begin/End"); 86 86 return; … … 88 88 89 89 if (n < 0) { 90 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,90 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 91 91 "glGenQueriesARB(n < 0)"); 92 92 return; … … 100 100 } 101 101 else { 102 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glGenQueriesARB");102 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glGenQueriesARB"); 103 103 } 104 104 } … … 106 106 107 107 GLboolean STATE_APIENTRY 108 crStateIsQueryARB( GLuint id)109 { 110 CRContext *g = GetCurrentContext( );111 CROcclusionState *o = &(g->occlusion); 112 113 FLUSH(); 114 115 if (g->current.inBeginEnd) { 116 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,108 crStateIsQueryARB(PCRStateTracker pState, GLuint id) 109 { 110 CRContext *g = GetCurrentContext(pState); 111 CROcclusionState *o = &(g->occlusion); 112 113 FLUSH(); 114 115 if (g->current.inBeginEnd) { 116 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 117 117 "glIsQueryARB called in begin/end"); 118 118 return GL_FALSE; … … 127 127 128 128 void STATE_APIENTRY 129 crStateGetQueryivARB( GLenum target, GLenum pname, GLint *params)130 { 131 CRContext *g = GetCurrentContext( );129 crStateGetQueryivARB(PCRStateTracker pState, GLenum target, GLenum pname, GLint *params) 130 { 131 CRContext *g = GetCurrentContext(pState); 132 132 CROcclusionState *o = &(g->occlusion); 133 133 (void)target; … … 136 136 137 137 if (g->current.inBeginEnd) { 138 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,138 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 139 139 "glGetGetQueryivARB called in begin/end"); 140 140 return; … … 149 149 break; 150 150 default: 151 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,151 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 152 152 "glGetGetQueryivARB(pname)"); 153 153 return; … … 157 157 158 158 void STATE_APIENTRY 159 crStateGetQueryObjectivARB( GLuint id, GLenum pname, GLint *params)160 { 161 CRContext *g = GetCurrentContext( );159 crStateGetQueryObjectivARB(PCRStateTracker pState, GLuint id, GLenum pname, GLint *params) 160 { 161 CRContext *g = GetCurrentContext(pState); 162 162 CROcclusionState *o = &(g->occlusion); 163 163 CROcclusionObject *q; … … 166 166 167 167 if (g->current.inBeginEnd) { 168 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,168 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 169 169 "glGetGetQueryObjectivARB called in begin/end"); 170 170 return; … … 173 173 q = (CROcclusionObject *) crHashtableSearch(o->objects, id); 174 174 if (!q || q->active) { 175 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,175 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 176 176 "glGetQueryObjectivARB"); 177 177 return; … … 186 186 break; 187 187 default: 188 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,188 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 189 189 "glGetQueryObjectivARB(pname)"); 190 190 return; … … 194 194 195 195 void STATE_APIENTRY 196 crStateGetQueryObjectuivARB( GLuint id, GLenum pname, GLuint *params)197 { 198 CRContext *g = GetCurrentContext( );196 crStateGetQueryObjectuivARB(PCRStateTracker pState, GLuint id, GLenum pname, GLuint *params) 197 { 198 CRContext *g = GetCurrentContext(pState); 199 199 CROcclusionState *o = &(g->occlusion); 200 200 CROcclusionObject *q; … … 203 203 204 204 if (g->current.inBeginEnd) { 205 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,205 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 206 206 "glGetGetQueryObjectuivARB called in begin/end"); 207 207 return; … … 210 210 q = (CROcclusionObject *) crHashtableSearch(o->objects, id); 211 211 if (!q || q->active) { 212 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,212 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 213 213 "glGetQueryObjectuivARB"); 214 214 return; … … 224 224 break; 225 225 default: 226 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,226 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 227 227 "glGetQueryObjectuivARB(pname)"); 228 228 return; … … 232 232 233 233 void STATE_APIENTRY 234 crStateBeginQueryARB( GLenum target, GLuint id)235 { 236 CRContext *g = GetCurrentContext( );234 crStateBeginQueryARB(PCRStateTracker pState, GLenum target, GLuint id) 235 { 236 CRContext *g = GetCurrentContext(pState); 237 237 CROcclusionState *o = &(g->occlusion); 238 238 CROcclusionObject *q; … … 241 241 242 242 if (g->current.inBeginEnd) { 243 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,243 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 244 244 "glGetGetQueryObjectuivARB called in begin/end"); 245 245 return; … … 247 247 248 248 if (target != GL_SAMPLES_PASSED_ARB) { 249 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,249 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 250 250 "glBeginQueryARB(target)"); 251 251 return; … … 253 253 254 254 if (o->currentQueryObject) { 255 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,255 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 256 256 "glBeginQueryARB(target)"); 257 257 return; … … 260 260 q = (CROcclusionObject *) crHashtableSearch(o->objects, id); 261 261 if (q && q->active) { 262 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glBeginQueryARB");262 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glBeginQueryARB"); 263 263 return; 264 264 } … … 266 266 q = NewQueryObject(target, id); 267 267 if (!q) { 268 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glBeginQueryARB");268 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glBeginQueryARB"); 269 269 return; 270 270 } … … 281 281 282 282 void STATE_APIENTRY 283 crStateEndQueryARB( GLenum target)284 { 285 CRContext *g = GetCurrentContext( );283 crStateEndQueryARB(PCRStateTracker pState, GLenum target) 284 { 285 CRContext *g = GetCurrentContext(pState); 286 286 CROcclusionState *o = &(g->occlusion); 287 287 CROcclusionObject *q; … … 290 290 291 291 if (g->current.inBeginEnd) { 292 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,292 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 293 293 "glGetGetQueryObjectuivARB called in begin/end"); 294 294 return; … … 296 296 297 297 if (target != GL_SAMPLES_PASSED_ARB) { 298 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glEndQueryARB(target)");298 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glEndQueryARB(target)"); 299 299 return; 300 300 } … … 302 302 q = (CROcclusionObject *) crHashtableSearch(o->objects, o->currentQueryObject); 303 303 if (!q || !q->active) { 304 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,304 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 305 305 "glEndQueryARB with glBeginQueryARB"); 306 306 return; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_pixel.c
r74890 r78375 14 14 { 15 15 CRPixelState *p = &ctx->pixel; 16 CRStateBits *sb = GetCurrentBits( );16 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 17 17 CRPixelBits *pb = &(sb->pixel); 18 18 GLcolorf zero_color = {0.0f, 0.0f, 0.0f, 0.0f}; … … 58 58 } 59 59 60 void STATE_APIENTRY crStatePixelTransferi ( GLenum pname, GLint param)61 { 62 crStatePixelTransferf( pname, (GLfloat) param );63 } 64 65 void STATE_APIENTRY crStatePixelTransferf ( GLenum pname, GLfloat param)66 { 67 CRContext *g = GetCurrentContext( );60 void STATE_APIENTRY crStatePixelTransferi (PCRStateTracker pState, GLenum pname, GLint param) 61 { 62 crStatePixelTransferf(pState, pname, (GLfloat) param ); 63 } 64 65 void STATE_APIENTRY crStatePixelTransferf (PCRStateTracker pState, GLenum pname, GLfloat param) 66 { 67 CRContext *g = GetCurrentContext(pState); 68 68 CRPixelState *p = &(g->pixel); 69 CRStateBits *sb = GetCurrentBits( );69 CRStateBits *sb = GetCurrentBits(pState); 70 70 CRPixelBits *pb = &(sb->pixel); 71 71 72 72 if (g->current.inBeginEnd) 73 73 { 74 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "PixelTransfer{if} called in Begin/End");74 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "PixelTransfer{if} called in Begin/End"); 75 75 return; 76 76 } … … 123 123 break; 124 124 default: 125 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Unknown glPixelTransfer pname: %d", pname );125 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "Unknown glPixelTransfer pname: %d", pname ); 126 126 return; 127 127 } … … 130 130 } 131 131 132 void STATE_APIENTRY crStatePixelZoom ( GLfloat xfactor, GLfloat yfactor)133 { 134 CRContext *g = GetCurrentContext( );132 void STATE_APIENTRY crStatePixelZoom (PCRStateTracker pState, GLfloat xfactor, GLfloat yfactor) 133 { 134 CRContext *g = GetCurrentContext(pState); 135 135 CRPixelState *p = &(g->pixel); 136 CRStateBits *sb = GetCurrentBits( );136 CRStateBits *sb = GetCurrentBits(pState); 137 137 CRPixelBits *pb = &(sb->pixel); 138 138 139 139 if (g->current.inBeginEnd) 140 140 { 141 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "PixelZoom called in Begin/End");141 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "PixelZoom called in Begin/End"); 142 142 return; 143 143 } … … 152 152 153 153 154 void STATE_APIENTRY crStateBitmap( GLsizei width, GLsizei height,154 void STATE_APIENTRY crStateBitmap(PCRStateTracker pState, GLsizei width, GLsizei height, 155 155 GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, 156 156 const GLubyte *bitmap) 157 157 { 158 CRContext *g = GetCurrentContext( );158 CRContext *g = GetCurrentContext(pState); 159 159 CRCurrentState *c = &(g->current); 160 CRStateBits *sb = GetCurrentBits( );160 CRStateBits *sb = GetCurrentBits(pState); 161 161 CRCurrentBits *cb = &(sb->current); 162 162 … … 170 170 if (g->current.inBeginEnd) 171 171 { 172 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,172 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 173 173 "Bitmap called in begin/end"); 174 174 return; … … 177 177 if (width < 0 || height < 0) 178 178 { 179 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,179 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 180 180 "Bitmap called with neg dims: %dx%d", width, height); 181 181 return; … … 201 201 #define CLAMP(x, min, max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))) 202 202 203 void STATE_APIENTRY crStatePixelMapfv ( GLenum map, GLint mapsize, const GLfloat * values)204 { 205 CRContext *g = GetCurrentContext( );203 void STATE_APIENTRY crStatePixelMapfv (PCRStateTracker pState, GLenum map, GLint mapsize, const GLfloat * values) 204 { 205 CRContext *g = GetCurrentContext(pState); 206 206 CRPixelState *p = &(g->pixel); 207 CRStateBits *sb = GetCurrentBits( );207 CRStateBits *sb = GetCurrentBits(pState); 208 208 CRPixelBits *pb = &(sb->pixel); 209 209 GLint i; 210 GLboolean unpackbuffer = crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB);210 GLboolean unpackbuffer = crStateIsBufferBound(pState, GL_PIXEL_UNPACK_BUFFER_ARB); 211 211 212 212 if (g->current.inBeginEnd) { 213 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "PixelMap called in Begin/End");213 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "PixelMap called in Begin/End"); 214 214 return; 215 215 } … … 218 218 219 219 if (mapsize < 0 || mapsize > CR_MAX_PIXEL_MAP_TABLE) { 220 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "PixelMap(mapsize)");220 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "PixelMap(mapsize)"); 221 221 return; 222 222 } … … 302 302 break; 303 303 default: 304 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "PixelMap(map)");304 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "PixelMap(map)"); 305 305 return; 306 306 } … … 310 310 } 311 311 312 void STATE_APIENTRY crStatePixelMapuiv ( GLenum map, GLint mapsize, const GLuint * values)312 void STATE_APIENTRY crStatePixelMapuiv (PCRStateTracker pState, GLenum map, GLint mapsize, const GLuint * values) 313 313 { 314 314 if (mapsize < 0 || mapsize > CR_MAX_PIXEL_MAP_TABLE) … … 318 318 } 319 319 320 if (!crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))320 if (!crStateIsBufferBound(pState, GL_PIXEL_UNPACK_BUFFER_ARB)) 321 321 { 322 322 GLfloat fvalues[CR_MAX_PIXEL_MAP_TABLE]; … … 333 333 } 334 334 } 335 crStatePixelMapfv( map, mapsize, fvalues);335 crStatePixelMapfv(pState, map, mapsize, fvalues); 336 336 } 337 337 else 338 338 { 339 crStatePixelMapfv( map, mapsize, (const GLfloat*) values);339 crStatePixelMapfv(pState, map, mapsize, (const GLfloat*) values); 340 340 } 341 341 } 342 342 343 void STATE_APIENTRY crStatePixelMapusv ( GLenum map, GLint mapsize, const GLushort * values)343 void STATE_APIENTRY crStatePixelMapusv (PCRStateTracker pState, GLenum map, GLint mapsize, const GLushort * values) 344 344 { 345 345 if (mapsize < 0 || mapsize > CR_MAX_PIXEL_MAP_TABLE) … … 349 349 } 350 350 351 if (!crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))351 if (!crStateIsBufferBound(pState, GL_PIXEL_UNPACK_BUFFER_ARB)) 352 352 { 353 353 GLfloat fvalues[CR_MAX_PIXEL_MAP_TABLE]; … … 364 364 } 365 365 } 366 crStatePixelMapfv( map, mapsize, fvalues);366 crStatePixelMapfv(pState, map, mapsize, fvalues); 367 367 } 368 368 else 369 369 { 370 crStatePixelMapfv( map, mapsize, (const GLfloat*) values);370 crStatePixelMapfv(pState, map, mapsize, (const GLfloat*) values); 371 371 } 372 372 } 373 373 374 374 375 void STATE_APIENTRY crStateGetPixelMapfv ( GLenum map, GLfloat * values)376 { 377 CRContext *g = GetCurrentContext( );375 void STATE_APIENTRY crStateGetPixelMapfv (PCRStateTracker pState, GLenum map, GLfloat * values) 376 { 377 CRContext *g = GetCurrentContext(pState); 378 378 CRPixelState *p = &(g->pixel); 379 379 GLint i; 380 380 381 381 if (g->current.inBeginEnd) { 382 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,382 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 383 383 "GetPixelMapfv called in Begin/End"); 384 384 return; … … 421 421 break; 422 422 default: 423 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMap(map)");423 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMap(map)"); 424 424 return; 425 425 } 426 426 } 427 427 428 void STATE_APIENTRY crStateGetPixelMapuiv ( GLenum map, GLuint * values)429 { 430 CRContext *g = GetCurrentContext( );428 void STATE_APIENTRY crStateGetPixelMapuiv (PCRStateTracker pState, GLenum map, GLuint * values) 429 { 430 CRContext *g = GetCurrentContext(pState); 431 431 const GLfloat maxUint = 4294967295.0F; 432 432 CRPixelState *p = &(g->pixel); … … 434 434 435 435 if (g->current.inBeginEnd) { 436 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,436 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 437 437 "GetPixelMapuiv called in Begin/End"); 438 438 return; … … 491 491 break; 492 492 default: 493 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMapuiv(map)");493 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMapuiv(map)"); 494 494 return; 495 495 } 496 496 } 497 497 498 void STATE_APIENTRY crStateGetPixelMapusv ( GLenum map, GLushort * values)499 { 500 CRContext *g = GetCurrentContext( );498 void STATE_APIENTRY crStateGetPixelMapusv (PCRStateTracker pState, GLenum map, GLushort * values) 499 { 500 CRContext *g = GetCurrentContext(pState); 501 501 const GLfloat maxUshort = 65535.0F; 502 502 CRPixelState *p = &(g->pixel); … … 504 504 505 505 if (g->current.inBeginEnd) { 506 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,506 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 507 507 "GetPixelMapusv called in Begin/End"); 508 508 return; … … 561 561 break; 562 562 default: 563 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMapusv(map)");563 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMapusv(map)"); 564 564 return; 565 565 } … … 569 569 CRContext *fromCtx, CRContext *toCtx) 570 570 { 571 PCRStateTracker pState = fromCtx->pStateTracker; 571 572 CRPixelState *from = &(fromCtx->pixel); 572 573 CRPixelState *to = &(toCtx->pixel); 573 574 int j, i; 574 575 CRbitvalue nbitID[CR_MAX_BITARRAY]; 576 577 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 578 575 579 for (j=0;j<CR_MAX_BITARRAY;j++) 576 580 nbitID[j] = ~bitID[j]; … … 580 584 if (from->mapColor != to->mapColor) 581 585 { 582 diff_api.PixelTransferi (GL_MAP_COLOR, to->mapColor);586 pState->diff_api.PixelTransferi (GL_MAP_COLOR, to->mapColor); 583 587 from->mapColor = to->mapColor; 584 588 } 585 589 if (from->mapStencil != to->mapStencil) 586 590 { 587 diff_api.PixelTransferi (GL_MAP_STENCIL, to->mapStencil);591 pState->diff_api.PixelTransferi (GL_MAP_STENCIL, to->mapStencil); 588 592 from->mapStencil = to->mapStencil; 589 593 } 590 594 if (from->indexOffset != to->indexOffset) 591 595 { 592 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->indexOffset);596 pState->diff_api.PixelTransferi (GL_INDEX_OFFSET, to->indexOffset); 593 597 from->indexOffset = to->indexOffset; 594 598 } 595 599 if (from->indexShift != to->indexShift) 596 600 { 597 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->indexShift);601 pState->diff_api.PixelTransferi (GL_INDEX_SHIFT, to->indexShift); 598 602 from->indexShift = to->indexShift; 599 603 } 600 604 if (from->scale.r != to->scale.r) 601 605 { 602 diff_api.PixelTransferf (GL_RED_SCALE, to->scale.r);606 pState->diff_api.PixelTransferf (GL_RED_SCALE, to->scale.r); 603 607 from->scale.r = to->scale.r; 604 608 } 605 609 if (from->scale.g != to->scale.g) 606 610 { 607 diff_api.PixelTransferf (GL_GREEN_SCALE, to->scale.g);611 pState->diff_api.PixelTransferf (GL_GREEN_SCALE, to->scale.g); 608 612 from->scale.g = to->scale.g; 609 613 } 610 614 if (from->scale.b != to->scale.b) 611 615 { 612 diff_api.PixelTransferf (GL_BLUE_SCALE, to->scale.b);616 pState->diff_api.PixelTransferf (GL_BLUE_SCALE, to->scale.b); 613 617 from->scale.b = to->scale.b; 614 618 } 615 619 if (from->scale.a != to->scale.a) 616 620 { 617 diff_api.PixelTransferf (GL_ALPHA_SCALE, to->scale.a);621 pState->diff_api.PixelTransferf (GL_ALPHA_SCALE, to->scale.a); 618 622 from->scale.a = to->scale.a; 619 623 } 620 624 if (from->bias.r != to->bias.r) 621 625 { 622 diff_api.PixelTransferf (GL_RED_BIAS, to->bias.r);626 pState->diff_api.PixelTransferf (GL_RED_BIAS, to->bias.r); 623 627 from->bias.r = to->bias.r; 624 628 } 625 629 if (from->bias.g != to->bias.g) 626 630 { 627 diff_api.PixelTransferf (GL_GREEN_BIAS, to->bias.g);631 pState->diff_api.PixelTransferf (GL_GREEN_BIAS, to->bias.g); 628 632 from->bias.g = to->bias.g; 629 633 } 630 634 if (from->bias.b != to->bias.b) 631 635 { 632 diff_api.PixelTransferf (GL_BLUE_BIAS, to->bias.b);636 pState->diff_api.PixelTransferf (GL_BLUE_BIAS, to->bias.b); 633 637 from->bias.b = to->bias.b; 634 638 } 635 639 if (from->bias.a != to->bias.a) 636 640 { 637 diff_api.PixelTransferf (GL_ALPHA_BIAS, to->bias.a);641 pState->diff_api.PixelTransferf (GL_ALPHA_BIAS, to->bias.a); 638 642 from->bias.a = to->bias.a; 639 643 } 640 644 if (from->depthScale != to->depthScale) 641 645 { 642 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->depthScale);646 pState->diff_api.PixelTransferf (GL_DEPTH_SCALE, to->depthScale); 643 647 from->depthScale = to->depthScale; 644 648 } 645 649 if (from->depthBias != to->depthBias) 646 650 { 647 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->depthBias);651 pState->diff_api.PixelTransferf (GL_DEPTH_BIAS, to->depthBias); 648 652 from->depthBias = to->depthBias; 649 653 } … … 655 659 from->yZoom != to->yZoom) 656 660 { 657 diff_api.PixelZoom (to->xZoom, 658 to->yZoom); 661 pState->diff_api.PixelZoom (to->xZoom, to->yZoom); 659 662 from->xZoom = to->xZoom; 660 663 from->yZoom = to->yZoom; … … 665 668 { 666 669 if (crMemcmp(to->mapStoS, from->mapStoS, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 667 diff_api.PixelMapfv(GL_PIXEL_MAP_S_TO_S,to->mapStoSsize,(GLfloat*)to->mapStoS);670 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_S_TO_S,to->mapStoSsize,(GLfloat*)to->mapStoS); 668 671 if (crMemcmp(to->mapItoI, from->mapItoI, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 669 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_I,to->mapItoIsize,(GLfloat*)to->mapItoI);672 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_I,to->mapItoIsize,(GLfloat*)to->mapItoI); 670 673 if (crMemcmp(to->mapItoR, from->mapItoR, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 671 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_R,to->mapItoRsize,(GLfloat*)to->mapItoR);674 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_R,to->mapItoRsize,(GLfloat*)to->mapItoR); 672 675 if (crMemcmp(to->mapItoG, from->mapItoG, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 673 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_G,to->mapItoGsize,(GLfloat*)to->mapItoG);676 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_G,to->mapItoGsize,(GLfloat*)to->mapItoG); 674 677 if (crMemcmp(to->mapItoB, from->mapItoB, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 675 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_B,to->mapItoBsize,(GLfloat*)to->mapItoB);678 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_B,to->mapItoBsize,(GLfloat*)to->mapItoB); 676 679 if (crMemcmp(to->mapItoA, from->mapItoA, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 677 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_A,to->mapItoAsize,(GLfloat*)to->mapItoA);680 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_A,to->mapItoAsize,(GLfloat*)to->mapItoA); 678 681 if (crMemcmp(to->mapRtoR, from->mapRtoR, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 679 diff_api.PixelMapfv(GL_PIXEL_MAP_R_TO_R,to->mapRtoRsize,(GLfloat*)to->mapRtoR);682 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_R_TO_R,to->mapRtoRsize,(GLfloat*)to->mapRtoR); 680 683 if (crMemcmp(to->mapGtoG, from->mapGtoG, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 681 diff_api.PixelMapfv(GL_PIXEL_MAP_G_TO_G,to->mapGtoGsize,(GLfloat*)to->mapGtoG);684 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_G_TO_G,to->mapGtoGsize,(GLfloat*)to->mapGtoG); 682 685 if (crMemcmp(to->mapBtoB, from->mapBtoB, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 683 diff_api.PixelMapfv(GL_PIXEL_MAP_B_TO_B,to->mapBtoBsize,(GLfloat*)to->mapBtoB);686 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_B_TO_B,to->mapBtoBsize,(GLfloat*)to->mapBtoB); 684 687 if (crMemcmp(to->mapAtoA, from->mapAtoA, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 685 diff_api.PixelMapfv(GL_PIXEL_MAP_A_TO_A,to->mapAtoAsize,(GLfloat*)to->mapAtoA);688 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_A_TO_A,to->mapAtoAsize,(GLfloat*)to->mapAtoA); 686 689 CLEARDIRTY(b->maps, nbitID); 687 690 } … … 692 695 CRContext *fromCtx, CRContext *toCtx) 693 696 { 697 PCRStateTracker pState = fromCtx->pStateTracker; 694 698 CRPixelState *from = &(fromCtx->pixel); 695 699 CRPixelState *to = &(toCtx->pixel); 696 700 int j, i; 697 701 CRbitvalue nbitID[CR_MAX_BITARRAY]; 702 703 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 704 698 705 for (j=0;j<CR_MAX_BITARRAY;j++) 699 706 nbitID[j] = ~bitID[j]; … … 703 710 if (from->mapColor != to->mapColor) 704 711 { 705 diff_api.PixelTransferi (GL_MAP_COLOR, to->mapColor);712 pState->diff_api.PixelTransferi (GL_MAP_COLOR, to->mapColor); 706 713 FILLDIRTY(b->transfer); 707 714 FILLDIRTY(b->dirty); … … 709 716 if (from->mapStencil != to->mapStencil) 710 717 { 711 diff_api.PixelTransferi (GL_MAP_STENCIL, to->mapStencil);718 pState->diff_api.PixelTransferi (GL_MAP_STENCIL, to->mapStencil); 712 719 FILLDIRTY(b->transfer); 713 720 FILLDIRTY(b->dirty); … … 715 722 if (from->indexOffset != to->indexOffset) 716 723 { 717 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->indexOffset);724 pState->diff_api.PixelTransferi (GL_INDEX_OFFSET, to->indexOffset); 718 725 FILLDIRTY(b->transfer); 719 726 FILLDIRTY(b->dirty); … … 721 728 if (from->indexShift != to->indexShift) 722 729 { 723 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->indexShift);730 pState->diff_api.PixelTransferi (GL_INDEX_SHIFT, to->indexShift); 724 731 FILLDIRTY(b->transfer); 725 732 FILLDIRTY(b->dirty); … … 727 734 if (from->scale.r != to->scale.r) 728 735 { 729 diff_api.PixelTransferf (GL_RED_SCALE, to->scale.r);736 pState->diff_api.PixelTransferf (GL_RED_SCALE, to->scale.r); 730 737 FILLDIRTY(b->transfer); 731 738 FILLDIRTY(b->dirty); … … 733 740 if (from->scale.g != to->scale.g) 734 741 { 735 diff_api.PixelTransferf (GL_GREEN_SCALE, to->scale.g);742 pState->diff_api.PixelTransferf (GL_GREEN_SCALE, to->scale.g); 736 743 FILLDIRTY(b->transfer); 737 744 FILLDIRTY(b->dirty); … … 739 746 if (from->scale.b != to->scale.b) 740 747 { 741 diff_api.PixelTransferf (GL_BLUE_SCALE, to->scale.b);748 pState->diff_api.PixelTransferf (GL_BLUE_SCALE, to->scale.b); 742 749 FILLDIRTY(b->transfer); 743 750 FILLDIRTY(b->dirty); … … 745 752 if (from->scale.a != to->scale.a) 746 753 { 747 diff_api.PixelTransferf (GL_ALPHA_SCALE, to->scale.a);754 pState->diff_api.PixelTransferf (GL_ALPHA_SCALE, to->scale.a); 748 755 FILLDIRTY(b->transfer); 749 756 FILLDIRTY(b->dirty); … … 751 758 if (from->bias.r != to->bias.r) 752 759 { 753 diff_api.PixelTransferf (GL_RED_BIAS, to->bias.r);760 pState->diff_api.PixelTransferf (GL_RED_BIAS, to->bias.r); 754 761 FILLDIRTY(b->transfer); 755 762 FILLDIRTY(b->dirty); … … 757 764 if (from->bias.g != to->bias.g) 758 765 { 759 diff_api.PixelTransferf (GL_GREEN_BIAS, to->bias.g);766 pState->diff_api.PixelTransferf (GL_GREEN_BIAS, to->bias.g); 760 767 FILLDIRTY(b->transfer); 761 768 FILLDIRTY(b->dirty); … … 763 770 if (from->bias.b != to->bias.b) 764 771 { 765 diff_api.PixelTransferf (GL_BLUE_BIAS, to->bias.b);772 pState->diff_api.PixelTransferf (GL_BLUE_BIAS, to->bias.b); 766 773 FILLDIRTY(b->transfer); 767 774 FILLDIRTY(b->dirty); … … 769 776 if (from->bias.a != to->bias.a) 770 777 { 771 diff_api.PixelTransferf (GL_ALPHA_BIAS, to->bias.a);778 pState->diff_api.PixelTransferf (GL_ALPHA_BIAS, to->bias.a); 772 779 FILLDIRTY(b->transfer); 773 780 FILLDIRTY(b->dirty); … … 775 782 if (from->depthScale != to->depthScale) 776 783 { 777 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->depthScale);784 pState->diff_api.PixelTransferf (GL_DEPTH_SCALE, to->depthScale); 778 785 FILLDIRTY(b->transfer); 779 786 FILLDIRTY(b->dirty); … … 781 788 if (from->depthBias != to->depthBias) 782 789 { 783 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->depthBias);790 pState->diff_api.PixelTransferf (GL_DEPTH_BIAS, to->depthBias); 784 791 FILLDIRTY(b->transfer); 785 792 FILLDIRTY(b->dirty); … … 792 799 from->yZoom != to->yZoom) 793 800 { 794 diff_api.PixelZoom (to->xZoom, 795 to->yZoom); 801 pState->diff_api.PixelZoom (to->xZoom, to->yZoom); 796 802 FILLDIRTY(b->zoom); 797 803 FILLDIRTY(b->dirty); … … 802 808 { 803 809 if (crMemcmp(to->mapStoS, from->mapStoS, CR_MAX_PIXEL_MAP_TABLE)) { 804 diff_api.PixelMapfv(GL_PIXEL_MAP_S_TO_S,to->mapStoSsize,(GLfloat*)to->mapStoS);810 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_S_TO_S,to->mapStoSsize,(GLfloat*)to->mapStoS); 805 811 FILLDIRTY(b->maps); 806 812 FILLDIRTY(b->dirty); 807 813 } 808 814 if (crMemcmp(to->mapItoI, from->mapItoI, CR_MAX_PIXEL_MAP_TABLE)) { 809 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_I,to->mapItoIsize,(GLfloat*)to->mapItoI);815 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_I,to->mapItoIsize,(GLfloat*)to->mapItoI); 810 816 FILLDIRTY(b->maps); 811 817 FILLDIRTY(b->dirty); 812 818 } 813 819 if (crMemcmp(to->mapItoR, from->mapItoR, CR_MAX_PIXEL_MAP_TABLE)) { 814 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_R,to->mapItoRsize,(GLfloat*)to->mapItoR);820 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_R,to->mapItoRsize,(GLfloat*)to->mapItoR); 815 821 FILLDIRTY(b->maps); 816 822 FILLDIRTY(b->dirty); 817 823 } 818 824 if (crMemcmp(to->mapItoG, from->mapItoG, CR_MAX_PIXEL_MAP_TABLE)) { 819 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_G,to->mapItoGsize,(GLfloat*)to->mapItoG);825 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_G,to->mapItoGsize,(GLfloat*)to->mapItoG); 820 826 FILLDIRTY(b->maps); 821 827 FILLDIRTY(b->dirty); 822 828 } 823 829 if (crMemcmp(to->mapItoB, from->mapItoB, CR_MAX_PIXEL_MAP_TABLE)) { 824 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_B,to->mapItoBsize,(GLfloat*)to->mapItoB);830 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_B,to->mapItoBsize,(GLfloat*)to->mapItoB); 825 831 FILLDIRTY(b->maps); 826 832 FILLDIRTY(b->dirty); 827 833 } 828 834 if (crMemcmp(to->mapItoA, from->mapItoA, CR_MAX_PIXEL_MAP_TABLE)) { 829 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_A,to->mapItoAsize,(GLfloat*)to->mapItoA);835 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_A,to->mapItoAsize,(GLfloat*)to->mapItoA); 830 836 FILLDIRTY(b->maps); 831 837 FILLDIRTY(b->dirty); 832 838 } 833 839 if (crMemcmp(to->mapRtoR, from->mapRtoR, CR_MAX_PIXEL_MAP_TABLE)) { 834 diff_api.PixelMapfv(GL_PIXEL_MAP_R_TO_R,to->mapRtoRsize,(GLfloat*)to->mapRtoR);840 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_R_TO_R,to->mapRtoRsize,(GLfloat*)to->mapRtoR); 835 841 FILLDIRTY(b->maps); 836 842 FILLDIRTY(b->dirty); 837 843 } 838 844 if (crMemcmp(to->mapGtoG, from->mapGtoG, CR_MAX_PIXEL_MAP_TABLE)) { 839 diff_api.PixelMapfv(GL_PIXEL_MAP_G_TO_G,to->mapGtoGsize,(GLfloat*)to->mapGtoG);845 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_G_TO_G,to->mapGtoGsize,(GLfloat*)to->mapGtoG); 840 846 FILLDIRTY(b->maps); 841 847 FILLDIRTY(b->dirty); 842 848 } 843 849 if (crMemcmp(to->mapBtoB, from->mapBtoB, CR_MAX_PIXEL_MAP_TABLE)) { 844 diff_api.PixelMapfv(GL_PIXEL_MAP_B_TO_B,to->mapBtoBsize,(GLfloat*)to->mapBtoB);850 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_B_TO_B,to->mapBtoBsize,(GLfloat*)to->mapBtoB); 845 851 FILLDIRTY(b->maps); 846 852 FILLDIRTY(b->dirty); 847 853 } 848 854 if (crMemcmp(to->mapAtoA, from->mapAtoA, CR_MAX_PIXEL_MAP_TABLE)) { 849 diff_api.PixelMapfv(GL_PIXEL_MAP_A_TO_A,to->mapAtoAsize,(GLfloat*)to->mapAtoA);855 pState->diff_api.PixelMapfv(GL_PIXEL_MAP_A_TO_A,to->mapAtoAsize,(GLfloat*)to->mapAtoA); 850 856 FILLDIRTY(b->maps); 851 857 FILLDIRTY(b->dirty); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_point.c
r69392 r78375 12 12 { 13 13 CRPointState *p = &ctx->point; 14 CRStateBits *sb = GetCurrentBits( );14 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 15 15 CRPointBits *pb = &(sb->point); 16 16 int i; … … 56 56 } 57 57 58 void STATE_APIENTRY crStatePointSize( GLfloat size)59 { 60 CRContext *g = GetCurrentContext( );58 void STATE_APIENTRY crStatePointSize(PCRStateTracker pState, GLfloat size) 59 { 60 CRContext *g = GetCurrentContext(pState); 61 61 CRPointState *p = &(g->point); 62 CRStateBits *sb = GetCurrentBits( );62 CRStateBits *sb = GetCurrentBits(pState); 63 63 CRPointBits *pb = &(sb->point); 64 64 65 65 if (g->current.inBeginEnd) 66 66 { 67 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glPointSize called in begin/end");67 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glPointSize called in begin/end"); 68 68 return; 69 69 } … … 73 73 if (size <= 0.0f) 74 74 { 75 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glPointSize called with size <= 0.0: %f", size);75 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glPointSize called with size <= 0.0: %f", size); 76 76 return; 77 77 } … … 82 82 } 83 83 84 void STATE_APIENTRY crStatePointParameterfARB( GLenum pname, GLfloat param)85 { 86 CRContext *g = GetCurrentContext( );84 void STATE_APIENTRY crStatePointParameterfARB(PCRStateTracker pState, GLenum pname, GLfloat param) 85 { 86 CRContext *g = GetCurrentContext(pState); 87 87 88 88 if (g->current.inBeginEnd) 89 89 { 90 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glPointParameterfARB called in begin/end");90 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glPointParameterfARB called in begin/end"); 91 91 return; 92 92 } … … 94 94 FLUSH(); 95 95 96 crStatePointParameterfvARB(p name, ¶m);97 } 98 99 void STATE_APIENTRY crStatePointParameterfvARB( GLenum pname, const GLfloat *params)100 { 101 CRContext *g = GetCurrentContext( );96 crStatePointParameterfvARB(pState, pname, ¶m); 97 } 98 99 void STATE_APIENTRY crStatePointParameterfvARB(PCRStateTracker pState, GLenum pname, const GLfloat *params) 100 { 101 CRContext *g = GetCurrentContext(pState); 102 102 CRPointState *p = &(g->point); 103 CRStateBits *sb = GetCurrentBits( );103 CRStateBits *sb = GetCurrentBits(pState); 104 104 CRPointBits *pb = &(sb->point); 105 105 106 106 if (g->current.inBeginEnd) 107 107 { 108 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glPointParameterfvARB called in begin/end");108 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glPointParameterfvARB called in begin/end"); 109 109 return; 110 110 } … … 122 122 else 123 123 { 124 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname);124 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname); 125 125 return; 126 126 } … … 129 129 if (g->extensions.ARB_point_parameters) { 130 130 if (params[0] < 0.0F) { 131 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]);131 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]); 132 132 return; 133 133 } … … 137 137 else 138 138 { 139 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname);139 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname); 140 140 return; 141 141 } … … 144 144 if (g->extensions.ARB_point_parameters) { 145 145 if (params[0] < 0.0F) { 146 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]);146 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]); 147 147 return; 148 148 } … … 152 152 else 153 153 { 154 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname);154 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname); 155 155 return; 156 156 } … … 159 159 if (g->extensions.ARB_point_parameters) { 160 160 if (params[0] < 0.0F) { 161 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]);161 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid value: %f", params[0]); 162 162 return; 163 163 } … … 167 167 else 168 168 { 169 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname);169 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname); 170 170 return; 171 171 } … … 175 175 GLenum enmVal = (GLenum)params[0]; 176 176 if (enmVal != GL_LOWER_LEFT && enmVal != GL_UPPER_LEFT) { 177 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid GL_POINT_SPRITE_COORD_ORIGIN value: %f", params[0]);177 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glPointParameterfvARB invalid GL_POINT_SPRITE_COORD_ORIGIN value: %f", params[0]); 178 178 return; 179 179 } … … 183 183 } 184 184 default: 185 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname);185 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glPointParameterfvARB invalid enum: %f", pname); 186 186 return; 187 187 } … … 190 190 } 191 191 192 void STATE_APIENTRY crStatePointParameteri( GLenum pname, GLint param)192 void STATE_APIENTRY crStatePointParameteri(PCRStateTracker pState, GLenum pname, GLint param) 193 193 { 194 194 GLfloat f_param = (GLfloat) param; 195 crStatePointParameterfvARB( pname, &f_param );196 } 197 198 void STATE_APIENTRY crStatePointParameteriv( GLenum pname, const GLint *params)195 crStatePointParameterfvARB(pState, pname, &f_param ); 196 } 197 198 void STATE_APIENTRY crStatePointParameteriv(PCRStateTracker pState, GLenum pname, const GLint *params) 199 199 { 200 200 GLfloat f_param = (GLfloat) (*params); 201 crStatePointParameterfvARB( pname, &f_param );201 crStatePointParameterfvARB(pState, pname, &f_param ); 202 202 } 203 203 … … 205 205 CRContext *fromCtx, CRContext *toCtx) 206 206 { 207 PCRStateTracker pState = fromCtx->pStateTracker; 207 208 CRPointState *from = &(fromCtx->point); 208 209 CRPointState *to = &(toCtx->point); 209 210 unsigned int j, i; 210 211 CRbitvalue nbitID[CR_MAX_BITARRAY]; 211 Assert(0); 212 Assert(0); /** @todo Is this never called? */ 213 214 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 215 212 216 for (j=0;j<CR_MAX_BITARRAY;j++) 213 217 nbitID[j] = ~bitID[j]; … … 216 220 { 217 221 glAble able[2]; 218 able[0] = diff_api.Disable;219 able[1] = diff_api.Enable;222 able[0] = pState->diff_api.Disable; 223 able[1] = pState->diff_api.Enable; 220 224 if (from->pointSmooth != to->pointSmooth) 221 225 { … … 229 233 if (from->pointSize != to->pointSize) 230 234 { 231 diff_api.PointSize (to->pointSize);235 pState->diff_api.PointSize (to->pointSize); 232 236 from->pointSize = to->pointSize; 233 237 } … … 238 242 if (from->minSize != to->minSize) 239 243 { 240 diff_api.PointParameterfARB (GL_POINT_SIZE_MIN_ARB, to->minSize);244 pState->diff_api.PointParameterfARB (GL_POINT_SIZE_MIN_ARB, to->minSize); 241 245 from->minSize = to->minSize; 242 246 } … … 247 251 if (from->maxSize != to->maxSize) 248 252 { 249 diff_api.PointParameterfARB (GL_POINT_SIZE_MAX_ARB, to->maxSize);253 pState->diff_api.PointParameterfARB (GL_POINT_SIZE_MAX_ARB, to->maxSize); 250 254 from->maxSize = to->maxSize; 251 255 } … … 256 260 if (from->fadeThresholdSize != to->fadeThresholdSize) 257 261 { 258 diff_api.PointParameterfARB (GL_POINT_FADE_THRESHOLD_SIZE_ARB, to->fadeThresholdSize);262 pState->diff_api.PointParameterfARB (GL_POINT_FADE_THRESHOLD_SIZE_ARB, to->fadeThresholdSize); 259 263 from->fadeThresholdSize = to->fadeThresholdSize; 260 264 } … … 265 269 if (from->spriteCoordOrigin != to->spriteCoordOrigin) 266 270 { 267 diff_api.PointParameterfARB (GL_POINT_SPRITE_COORD_ORIGIN, to->spriteCoordOrigin);271 pState->diff_api.PointParameterfARB (GL_POINT_SPRITE_COORD_ORIGIN, to->spriteCoordOrigin); 268 272 from->spriteCoordOrigin = to->spriteCoordOrigin; 269 273 } … … 273 277 { 274 278 if (from->distanceAttenuation[0] != to->distanceAttenuation[0] || from->distanceAttenuation[1] != to->distanceAttenuation[1] || from->distanceAttenuation[2] != to->distanceAttenuation[2]) { 275 diff_api.PointParameterfvARB (GL_POINT_DISTANCE_ATTENUATION_ARB, to->distanceAttenuation);279 pState->diff_api.PointParameterfvARB (GL_POINT_DISTANCE_ATTENUATION_ARB, to->distanceAttenuation); 276 280 from->distanceAttenuation[0] = to->distanceAttenuation[0]; 277 281 from->distanceAttenuation[1] = to->distanceAttenuation[1]; … … 283 287 { 284 288 glAble able[2]; 285 able[0] = diff_api.Disable;286 able[1] = diff_api.Enable;289 able[0] = pState->diff_api.Disable; 290 able[1] = pState->diff_api.Enable; 287 291 if (from->pointSprite != to->pointSprite) 288 292 { … … 299 303 GLint replacement = to->coordReplacement[i]; 300 304 if (activeUnit != i) { 301 diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB );305 pState->diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB ); 302 306 activeUnit = i; 303 307 } 304 diff_api.TexEnviv(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, &replacement);308 pState->diff_api.TexEnviv(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, &replacement); 305 309 from->coordReplacement[i] = to->coordReplacement[i]; 306 310 CLEARDIRTY(b->coordReplacement[i], nbitID); … … 308 312 } 309 313 if (activeUnit != toCtx->texture.curTextureUnit) 310 diff_api.ActiveTextureARB(GL_TEXTURE0 + toCtx->texture.curTextureUnit);314 pState->diff_api.ActiveTextureARB(GL_TEXTURE0 + toCtx->texture.curTextureUnit); 311 315 } 312 316 CLEARDIRTY(b->dirty, nbitID); … … 316 320 CRContext *fromCtx, CRContext *toCtx) 317 321 { 322 PCRStateTracker pState = fromCtx->pStateTracker; 318 323 CRPointState *from = &(fromCtx->point); 319 324 CRPointState *to = &(toCtx->point); … … 321 326 GLboolean fEnabled; 322 327 CRbitvalue nbitID[CR_MAX_BITARRAY]; 328 329 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 330 323 331 for (j=0;j<CR_MAX_BITARRAY;j++) 324 332 nbitID[j] = ~bitID[j]; … … 327 335 { 328 336 glAble able[2]; 329 able[0] = diff_api.Disable;330 able[1] = diff_api.Enable;337 able[0] = pState->diff_api.Disable; 338 able[1] = pState->diff_api.Enable; 331 339 if (from->pointSmooth != to->pointSmooth) 332 340 { … … 341 349 if (from->pointSize != to->pointSize) 342 350 { 343 diff_api.PointSize (to->pointSize);351 pState->diff_api.PointSize (to->pointSize); 344 352 FILLDIRTY(b->size); 345 353 FILLDIRTY(b->dirty); … … 351 359 if (from->minSize != to->minSize) 352 360 { 353 diff_api.PointParameterfARB (GL_POINT_SIZE_MIN_ARB, to->minSize);361 pState->diff_api.PointParameterfARB (GL_POINT_SIZE_MIN_ARB, to->minSize); 354 362 FILLDIRTY(b->minSize); 355 363 FILLDIRTY(b->dirty); … … 361 369 if (from->maxSize != to->maxSize) 362 370 { 363 diff_api.PointParameterfARB (GL_POINT_SIZE_MAX_ARB, to->maxSize);371 pState->diff_api.PointParameterfARB (GL_POINT_SIZE_MAX_ARB, to->maxSize); 364 372 FILLDIRTY(b->maxSize); 365 373 FILLDIRTY(b->dirty); … … 371 379 if (from->fadeThresholdSize != to->fadeThresholdSize) 372 380 { 373 diff_api.PointParameterfARB (GL_POINT_FADE_THRESHOLD_SIZE_ARB, to->fadeThresholdSize);381 pState->diff_api.PointParameterfARB (GL_POINT_FADE_THRESHOLD_SIZE_ARB, to->fadeThresholdSize); 374 382 FILLDIRTY(b->fadeThresholdSize); 375 383 FILLDIRTY(b->dirty); … … 381 389 if (from->spriteCoordOrigin != to->spriteCoordOrigin) 382 390 { 383 diff_api.PointParameterfARB (GL_POINT_SPRITE_COORD_ORIGIN, to->spriteCoordOrigin);391 pState->diff_api.PointParameterfARB (GL_POINT_SPRITE_COORD_ORIGIN, to->spriteCoordOrigin); 384 392 FILLDIRTY(b->spriteCoordOrigin); 385 393 FILLDIRTY(b->dirty); … … 390 398 { 391 399 if (from->distanceAttenuation[0] != to->distanceAttenuation[0] || from->distanceAttenuation[1] != to->distanceAttenuation[1] || from->distanceAttenuation[2] != to->distanceAttenuation[2]) { 392 diff_api.PointParameterfvARB (GL_POINT_DISTANCE_ATTENUATION_ARB, to->distanceAttenuation);400 pState->diff_api.PointParameterfvARB (GL_POINT_DISTANCE_ATTENUATION_ARB, to->distanceAttenuation); 393 401 FILLDIRTY(b->distanceAttenuation); 394 402 FILLDIRTY(b->dirty); … … 404 412 if (!fEnabled) 405 413 { 406 diff_api.Enable(GL_POINT_SPRITE_ARB);414 pState->diff_api.Enable(GL_POINT_SPRITE_ARB); 407 415 fEnabled = GL_TRUE; 408 416 } … … 422 430 } 423 431 if (activeUnit != toCtx->texture.curTextureUnit) 424 diff_api.ActiveTextureARB(GL_TEXTURE0 + toCtx->texture.curTextureUnit);432 pState->diff_api.ActiveTextureARB(GL_TEXTURE0 + toCtx->texture.curTextureUnit); 425 433 } 426 434 if (CHECKDIRTY(b->enableSprite, bitID)) 427 435 { 428 436 glAble able[2]; 429 able[0] = diff_api.Disable;430 able[1] = diff_api.Enable;437 able[0] = pState->diff_api.Disable; 438 able[1] = pState->diff_api.Enable; 431 439 if (fEnabled != to->pointSprite) 432 440 { … … 440 448 { 441 449 glAble able[2]; 442 able[0] = diff_api.Disable;443 able[1] = diff_api.Enable;450 able[0] = pState->diff_api.Disable; 451 able[1] = pState->diff_api.Enable; 444 452 able[to->pointSprite](GL_POINT_SPRITE_ARB); 445 453 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_polygon.c
r69392 r78375 14 14 { 15 15 CRPolygonState *p = &ctx->polygon; 16 CRStateBits *sb = GetCurrentBits( );16 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 17 17 CRPolygonBits *pb = &(sb->polygon); 18 18 int i; … … 43 43 } 44 44 45 void STATE_APIENTRY crStateCullFace( GLenum mode)46 { 47 CRContext *g = GetCurrentContext( );48 CRPolygonState *p = &(g->polygon); 49 CRStateBits *sb = GetCurrentBits( );50 CRPolygonBits *pb = &(sb->polygon); 51 52 if (g->current.inBeginEnd) 53 { 54 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,45 void STATE_APIENTRY crStateCullFace(PCRStateTracker pState, GLenum mode) 46 { 47 CRContext *g = GetCurrentContext(pState); 48 CRPolygonState *p = &(g->polygon); 49 CRStateBits *sb = GetCurrentBits(pState); 50 CRPolygonBits *pb = &(sb->polygon); 51 52 if (g->current.inBeginEnd) 53 { 54 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 55 55 "glCullFace called in begin/end"); 56 56 return; … … 61 61 if (mode != GL_FRONT && mode != GL_BACK && mode != GL_FRONT_AND_BACK) 62 62 { 63 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,63 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 64 64 "glCullFace called with bogus mode: 0x%x", mode); 65 65 return; … … 71 71 } 72 72 73 void STATE_APIENTRY crStateFrontFace ( GLenum mode)74 { 75 CRContext *g = GetCurrentContext( );76 CRPolygonState *p = &(g->polygon); 77 CRStateBits *sb = GetCurrentBits( );78 CRPolygonBits *pb = &(sb->polygon); 79 80 if (g->current.inBeginEnd) 81 { 82 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,73 void STATE_APIENTRY crStateFrontFace (PCRStateTracker pState, GLenum mode) 74 { 75 CRContext *g = GetCurrentContext(pState); 76 CRPolygonState *p = &(g->polygon); 77 CRStateBits *sb = GetCurrentBits(pState); 78 CRPolygonBits *pb = &(sb->polygon); 79 80 if (g->current.inBeginEnd) 81 { 82 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 83 83 "glFrontFace called in begin/end"); 84 84 return; … … 89 89 if (mode != GL_CW && mode != GL_CCW) 90 90 { 91 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,91 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 92 92 "glFrontFace called with bogus mode: 0x%x", mode); 93 93 return; … … 99 99 } 100 100 101 void STATE_APIENTRY crStatePolygonMode ( GLenum face, GLenum mode)102 { 103 CRContext *g = GetCurrentContext( );104 CRPolygonState *p = &(g->polygon); 105 CRStateBits *sb = GetCurrentBits( );106 CRPolygonBits *pb = &(sb->polygon); 107 108 if (g->current.inBeginEnd) 109 { 110 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,101 void STATE_APIENTRY crStatePolygonMode (PCRStateTracker pState, GLenum face, GLenum mode) 102 { 103 CRContext *g = GetCurrentContext(pState); 104 CRPolygonState *p = &(g->polygon); 105 CRStateBits *sb = GetCurrentBits(pState); 106 CRPolygonBits *pb = &(sb->polygon); 107 108 if (g->current.inBeginEnd) 109 { 110 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 111 111 "glPolygonMode called in begin/end"); 112 112 return; … … 117 117 if (mode != GL_POINT && mode != GL_LINE && mode != GL_FILL) 118 118 { 119 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,119 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 120 120 "glPolygonMode called with bogus mode: 0x%x", mode); 121 121 return; … … 133 133 break; 134 134 default: 135 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,135 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 136 136 "glPolygonMode called with bogus face: 0x%x", face); 137 137 return; … … 141 141 } 142 142 143 void STATE_APIENTRY crStatePolygonOffset ( GLfloat factor, GLfloat units)144 { 145 CRContext *g = GetCurrentContext( );146 CRPolygonState *p = &(g->polygon); 147 CRStateBits *sb = GetCurrentBits( );148 CRPolygonBits *pb = &(sb->polygon); 149 150 if (g->current.inBeginEnd) 151 { 152 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,143 void STATE_APIENTRY crStatePolygonOffset (PCRStateTracker pState, GLfloat factor, GLfloat units) 144 { 145 CRContext *g = GetCurrentContext(pState); 146 CRPolygonState *p = &(g->polygon); 147 CRStateBits *sb = GetCurrentBits(pState); 148 CRPolygonBits *pb = &(sb->polygon); 149 150 if (g->current.inBeginEnd) 151 { 152 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 153 153 "glPolygonOffset called in begin/end"); 154 154 return; … … 164 164 } 165 165 166 void STATE_APIENTRY crStatePolygonStipple ( const GLubyte *p)167 { 168 CRContext *g = GetCurrentContext( );166 void STATE_APIENTRY crStatePolygonStipple (PCRStateTracker pState, const GLubyte *p) 167 { 168 CRContext *g = GetCurrentContext(pState); 169 169 CRPolygonState *poly = &(g->polygon); 170 CRStateBits *sb = GetCurrentBits( );171 CRPolygonBits *pb = &(sb->polygon); 172 173 if (g->current.inBeginEnd) 174 { 175 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,170 CRStateBits *sb = GetCurrentBits(pState); 171 CRPolygonBits *pb = &(sb->polygon); 172 173 if (g->current.inBeginEnd) 174 { 175 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 176 176 "glPolygonStipple called in begin/end"); 177 177 return; … … 180 180 FLUSH(); 181 181 182 if (!p && !crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))182 if (!p && !crStateIsBufferBound(pState, GL_PIXEL_UNPACK_BUFFER_ARB)) 183 183 { 184 184 crDebug("Void pointer passed to PolygonStipple"); … … 187 187 188 188 /** @todo track mask if buffer is bound?*/ 189 if (!crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))189 if (!crStateIsBufferBound(pState, GL_PIXEL_UNPACK_BUFFER_ARB)) 190 190 { 191 191 crMemcpy((char*)poly->stipple, (char*)p, 128); … … 196 196 } 197 197 198 void STATE_APIENTRY crStateGetPolygonStipple( GLubyte *b )199 { 200 CRContext *g = GetCurrentContext( );198 void STATE_APIENTRY crStateGetPolygonStipple(PCRStateTracker pState, GLubyte *b ) 199 { 200 CRContext *g = GetCurrentContext(pState); 201 201 CRPolygonState *poly = &(g->polygon); 202 202 203 203 if (g->current.inBeginEnd) 204 204 { 205 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,205 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 206 206 "glGetPolygonStipple called in begin/end"); 207 207 return; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_polygon.txt
r63199 r78375 14 14 :mode:backMode:PolygonMode,GL_BACK 15 15 :mode:frontMode:PolygonMode,GL_FRONT 16 -:stipple:stipple:* diff_api.PolygonStipple ((GLubyte *) to->stipple);16 -:stipple:stipple:*pState->diff_api.PolygonStipple ((GLubyte *) to->stipple); 17 17 +:stipple:*int iStripple; 18 +:stipple:* diff_api.PolygonStipple ((GLubyte *) to->stipple);18 +:stipple:*pState->diff_api.PolygonStipple ((GLubyte *) to->stipple); 19 19 +:stipple:*for (iStripple=0; iStripple<32; iStripple++) 20 20 +:stipple:*{ -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_program.c
r71903 r78375 132 132 */ 133 133 static CRProgram * 134 BindProgram( GLenum target, GLuint id,134 BindProgram(PCRStateTracker pState, GLenum target, GLuint id, 135 135 GLenum vertexTarget, GLenum fragmentTarget) 136 136 { 137 CRContext *g = GetCurrentContext( );138 CRProgramState *p = &(g->program); 139 CRStateBits *sb = GetCurrentBits( );137 CRContext *g = GetCurrentContext(pState); 138 CRProgramState *p = &(g->program); 139 CRStateBits *sb = GetCurrentBits(pState); 140 140 CRProgramBits *pb = &(sb->program); 141 141 CRProgram *prog; 142 142 143 143 if (g->current.inBeginEnd) { 144 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,144 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 145 145 "glBindProgram called in Begin/End"); 146 146 return NULL; … … 155 155 } 156 156 else { 157 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,157 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 158 158 "glBindProgram(bad target)"); 159 159 return NULL; … … 165 165 166 166 if (!prog) { 167 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glBindProgram");167 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glBindProgram"); 168 168 return NULL; 169 169 } 170 170 else if (prog->target != target) { 171 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,171 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 172 172 "glBindProgram target mismatch"); 173 173 return NULL; … … 190 190 191 191 192 void STATE_APIENTRY crStateBindProgramNV( GLenum target, GLuint id)193 { 194 CRProgram *prog = BindProgram( target, id, GL_VERTEX_PROGRAM_NV,192 void STATE_APIENTRY crStateBindProgramNV(PCRStateTracker pState, GLenum target, GLuint id) 193 { 194 CRProgram *prog = BindProgram(pState, target, id, GL_VERTEX_PROGRAM_NV, 195 195 GL_FRAGMENT_PROGRAM_NV); 196 196 if (prog) { … … 200 200 201 201 202 void STATE_APIENTRY crStateBindProgramARB( GLenum target, GLuint id)203 { 204 CRProgram *prog = BindProgram( target, id, GL_VERTEX_PROGRAM_ARB,202 void STATE_APIENTRY crStateBindProgramARB(PCRStateTracker pState, GLenum target, GLuint id) 203 { 204 CRProgram *prog = BindProgram(pState, target, id, GL_VERTEX_PROGRAM_ARB, 205 205 GL_FRAGMENT_PROGRAM_ARB); 206 206 if (prog) { … … 210 210 211 211 212 void STATE_APIENTRY crStateDeleteProgramsARB( GLsizei n, const GLuint *ids)213 { 214 CRContext *g = GetCurrentContext( );215 CRProgramState *p = &(g->program); 216 CRStateBits *sb = GetCurrentBits( );212 void STATE_APIENTRY crStateDeleteProgramsARB(PCRStateTracker pState, GLsizei n, const GLuint *ids) 213 { 214 CRContext *g = GetCurrentContext(pState); 215 CRProgramState *p = &(g->program); 216 CRStateBits *sb = GetCurrentBits(pState); 217 217 CRProgramBits *pb = &(sb->program); 218 218 GLint i; 219 219 220 220 if (g->current.inBeginEnd) { 221 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,221 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 222 222 "glDeleteProgramsNV called in Begin/End"); 223 223 return; … … 226 226 if (n < 0) 227 227 { 228 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glDeleteProgramsNV(n)");228 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glDeleteProgramsNV(n)"); 229 229 return; 230 230 } … … 253 253 254 254 255 void STATE_APIENTRY crStateExecuteProgramNV( GLenum target, GLuint id, const GLfloat *params)255 void STATE_APIENTRY crStateExecuteProgramNV(PCRStateTracker pState, GLenum target, GLuint id, const GLfloat *params) 256 256 { 257 257 /* Hmmm, this is really hard to do if we don't actually execute 258 258 * the program in a software simulation. 259 259 */ 260 RT_NOREF(pState); 260 261 (void)params; 261 262 (void)target; … … 264 265 265 266 266 void STATE_APIENTRY crStateGenProgramsNV( GLsizei n, GLuint *ids)267 { 268 CRContext *g = GetCurrentContext( );267 void STATE_APIENTRY crStateGenProgramsNV(PCRStateTracker pState, GLsizei n, GLuint *ids) 268 { 269 CRContext *g = GetCurrentContext(pState); 269 270 CRProgramState *p = &(g->program); 270 271 … … 272 273 } 273 274 274 void STATE_APIENTRY crStateGenProgramsARB( GLsizei n, GLuint *ids)275 { 276 crStateGenProgramsNV( n, ids);277 } 278 279 280 GLboolean STATE_APIENTRY crStateIsProgramARB( GLuint id)281 { 282 CRContext *g = GetCurrentContext( );275 void STATE_APIENTRY crStateGenProgramsARB(PCRStateTracker pState, GLsizei n, GLuint *ids) 276 { 277 crStateGenProgramsNV(pState, n, ids); 278 } 279 280 281 GLboolean STATE_APIENTRY crStateIsProgramARB(PCRStateTracker pState, GLuint id) 282 { 283 CRContext *g = GetCurrentContext(pState); 283 284 CRProgramState *p = &(g->program); 284 285 CRProgram *prog; 285 286 286 287 if (g->current.inBeginEnd) { 287 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,288 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 288 289 "glIsProgram called in Begin/End"); 289 290 return GL_FALSE; … … 291 292 292 293 if (id == 0) { 293 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,294 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 294 295 "glIsProgram(id==0)"); 295 296 return GL_FALSE; … … 304 305 305 306 306 GLboolean STATE_APIENTRY crStateAreProgramsResidentNV( GLsizei n, const GLuint *ids, GLboolean *residences)307 { 308 CRContext *g = GetCurrentContext( );307 GLboolean STATE_APIENTRY crStateAreProgramsResidentNV(PCRStateTracker pState, GLsizei n, const GLuint *ids, GLboolean *residences) 308 { 309 CRContext *g = GetCurrentContext(pState); 309 310 CRProgramState *p = &(g->program); 310 311 int i; … … 312 313 313 314 if (n < 0) { 314 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,315 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 315 316 "glAreProgramsResidentNV(n)"); 316 317 return GL_FALSE; … … 321 322 322 323 if (ids[i] == 0) { 323 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,324 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 324 325 "glAreProgramsResidentNV(id)"); 325 326 return GL_FALSE; … … 328 329 prog = (CRProgram *) crHashtableSearch(p->programHash, ids[i]); 329 330 if (!prog) { 330 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,331 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 331 332 "glAreProgramsResidentNV(id)"); 332 333 return GL_FALSE; … … 351 352 352 353 353 void STATE_APIENTRY crStateRequestResidentProgramsNV( GLsizei n, const GLuint *ids)354 { 355 CRContext *g = GetCurrentContext( );354 void STATE_APIENTRY crStateRequestResidentProgramsNV(PCRStateTracker pState, GLsizei n, const GLuint *ids) 355 { 356 CRContext *g = GetCurrentContext(pState); 356 357 CRProgramState *p = &(g->program); 357 358 GLint i; 358 359 359 360 if (g->current.inBeginEnd) { 360 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,361 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 361 362 "glRequestResidentProgramsNV called in Begin/End"); 362 363 return; … … 364 365 365 366 if (n < 0) { 366 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,367 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 367 368 "glRequestResidentProgramsNV(n<0)"); 368 369 return; … … 377 378 378 379 379 void STATE_APIENTRY crStateLoadProgramNV( GLenum target, GLuint id, GLsizei len,380 void STATE_APIENTRY crStateLoadProgramNV(PCRStateTracker pState, GLenum target, GLuint id, GLsizei len, 380 381 const GLubyte *program) 381 382 { 382 CRContext *g = GetCurrentContext( );383 CRProgramState *p = &(g->program); 384 CRStateBits *sb = GetCurrentBits( );383 CRContext *g = GetCurrentContext(pState); 384 CRProgramState *p = &(g->program); 385 CRStateBits *sb = GetCurrentBits(pState); 385 386 CRProgramBits *pb = &(sb->program); 386 387 CRProgram *prog; … … 388 389 389 390 if (g->current.inBeginEnd) { 390 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,391 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 391 392 "glLoadProgramNV called in Begin/End"); 392 393 return; … … 394 395 395 396 if (id == 0) { 396 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,397 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 397 398 "glLoadProgramNV(id==0)"); 398 399 return; … … 402 403 403 404 if (!prog) { 404 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glLoadProgramNV");405 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glLoadProgramNV"); 405 406 return; 406 407 } 407 408 else if (prog && prog->target != target) { 408 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,409 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 409 410 "glLoadProgramNV(target)"); 410 411 return; … … 413 414 progCopy = crAlloc(len); 414 415 if (!progCopy) { 415 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glLoadProgramNV");416 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glLoadProgramNV"); 416 417 return; 417 418 } … … 422 423 && crStrncmp((const char *) program,"!!VP2.0", 7) != 0 423 424 && crStrncmp((const char *) program,"!!VSP1.0", 8) != 0) { 424 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glLoadProgramNV");425 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glLoadProgramNV"); 425 426 crDebug("program = (%s)\n",program); 426 427 return; … … 439 440 440 441 441 void STATE_APIENTRY crStateProgramStringARB( GLenum target, GLenum format,442 void STATE_APIENTRY crStateProgramStringARB(PCRStateTracker pState, GLenum target, GLenum format, 442 443 GLsizei len, const GLvoid *string) 443 444 { 444 CRContext *g = GetCurrentContext( );445 CRProgramState *p = &(g->program); 446 CRStateBits *sb = GetCurrentBits( );445 CRContext *g = GetCurrentContext(pState); 446 CRProgramState *p = &(g->program); 447 CRStateBits *sb = GetCurrentBits(pState); 447 448 CRProgramBits *pb = &(sb->program); 448 449 CRProgram *prog; … … 450 451 451 452 if (g->current.inBeginEnd) { 452 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,453 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 453 454 "glProgramStringARB called in Begin/End"); 454 455 return; … … 456 457 457 458 if (format != GL_PROGRAM_FORMAT_ASCII_ARB) { 458 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,459 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 459 460 "glProgramStringARB(format)"); 460 461 return; … … 470 471 } 471 472 else { 472 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,473 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 473 474 "glProgramStringARB(target)"); 474 475 return; … … 480 481 progCopy = crAlloc(len); 481 482 if (!progCopy) { 482 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glProgramStringARB");483 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glProgramStringARB"); 483 484 return; 484 485 } 485 486 if (crStrncmp(string,"!!ARBvp1.0", 10) != 0 486 487 && crStrncmp(string,"!!ARBfp1.0", 10) != 0) { 487 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glProgramStringARB");488 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glProgramStringARB"); 488 489 return; 489 490 } … … 502 503 503 504 504 void STATE_APIENTRY crStateGetProgramivNV( GLuint id, GLenum pname, GLint *params)505 { 506 CRContext *g = GetCurrentContext( );505 void STATE_APIENTRY crStateGetProgramivNV(PCRStateTracker pState, GLuint id, GLenum pname, GLint *params) 506 { 507 CRContext *g = GetCurrentContext(pState); 507 508 CRProgramState *p = &(g->program); 508 509 CRProgram *prog; 509 510 510 511 if (g->current.inBeginEnd) { 511 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,512 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 512 513 "glGetProgramivNV called in Begin/End"); 513 514 return; … … 515 516 516 517 if (id == 0) { 517 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,518 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 518 519 "glGetProgramivNV(bad id)"); 519 520 return; … … 522 523 prog = (CRProgram *) crHashtableSearch(p->programHash, id); 523 524 if (!prog) { 524 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,525 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 525 526 "glGetProgramivNV(bad id)"); 526 527 return; … … 538 539 return; 539 540 default: 540 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,541 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 541 542 "glGetProgramivNV(pname)"); 542 543 return; … … 545 546 546 547 547 void STATE_APIENTRY crStateGetProgramStringNV( GLuint id, GLenum pname, GLubyte *program)548 { 549 CRContext *g = GetCurrentContext( );548 void STATE_APIENTRY crStateGetProgramStringNV(PCRStateTracker pState, GLuint id, GLenum pname, GLubyte *program) 549 { 550 CRContext *g = GetCurrentContext(pState); 550 551 CRProgramState *p = &(g->program); 551 552 CRProgram *prog; 552 553 553 554 if (pname != GL_PROGRAM_STRING_NV) { 554 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,555 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 555 556 "glGetProgramStringNV(pname)"); 556 557 return; … … 558 559 559 560 if (g->current.inBeginEnd) { 560 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,561 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 561 562 "glGetProgramStringNV called in Begin/End"); 562 563 return; … … 564 565 565 566 if (id == 0) { 566 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,567 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 567 568 "glGetProgramStringNV(bad id)"); 568 569 return; … … 571 572 prog = (CRProgram *) crHashtableSearch(p->programHash, id); 572 573 if (!prog) { 573 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,574 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 574 575 "glGetProgramStringNV(bad id)"); 575 576 return; … … 580 581 581 582 582 void STATE_APIENTRY crStateGetProgramStringARB( GLenum target, GLenum pname, GLvoid *string)583 { 584 CRContext *g = GetCurrentContext( );583 void STATE_APIENTRY crStateGetProgramStringARB(PCRStateTracker pState, GLenum target, GLenum pname, GLvoid *string) 584 { 585 CRContext *g = GetCurrentContext(pState); 585 586 CRProgramState *p = &(g->program); 586 587 CRProgram *prog; … … 593 594 } 594 595 else { 595 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,596 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 596 597 "glGetProgramStringNV(target)"); 597 598 return; … … 599 600 600 601 if (pname != GL_PROGRAM_STRING_NV) { 601 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,602 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 602 603 "glGetProgramStringNV(pname)"); 603 604 return; … … 605 606 606 607 if (g->current.inBeginEnd) { 607 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,608 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 608 609 "glGetProgramStringNV called in Begin/End"); 609 610 return; … … 614 615 615 616 616 void STATE_APIENTRY crStateProgramParameter4dNV( GLenum target, GLuint index,617 GLdouble x, GLdouble y, GLdouble z, GLdouble w)618 { 619 crStateProgramParameter4fNV( target, index, (GLfloat) x, (GLfloat) y,617 void STATE_APIENTRY crStateProgramParameter4dNV(PCRStateTracker pState, GLenum target, GLuint index, 618 GLdouble x, GLdouble y, GLdouble z, GLdouble w) 619 { 620 crStateProgramParameter4fNV(pState, target, index, (GLfloat) x, (GLfloat) y, 620 621 (GLfloat) z, (GLfloat) w); 621 622 } 622 623 623 624 624 void STATE_APIENTRY crStateProgramParameter4dvNV(GLenum target, GLuint index, 625 const GLdouble *params) 626 { 627 crStateProgramParameter4fNV(target, index, 628 (GLfloat) params[0], (GLfloat) params[1], 629 (GLfloat) params[2], (GLfloat) params[3]); 630 } 631 632 633 void STATE_APIENTRY crStateProgramParameter4fNV(GLenum target, GLuint index, 634 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 635 { 636 CRContext *g = GetCurrentContext(); 637 CRProgramState *p = &(g->program); 638 CRStateBits *sb = GetCurrentBits(); 625 void STATE_APIENTRY crStateProgramParameter4dvNV(PCRStateTracker pState, GLenum target, GLuint index, 626 const GLdouble *params) 627 { 628 crStateProgramParameter4fNV(pState, target, index, (GLfloat) params[0], (GLfloat) params[1], 629 (GLfloat) params[2], (GLfloat) params[3]); 630 } 631 632 633 void STATE_APIENTRY crStateProgramParameter4fNV(PCRStateTracker pState, GLenum target, GLuint index, 634 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 635 { 636 CRContext *g = GetCurrentContext(pState); 637 CRProgramState *p = &(g->program); 638 CRStateBits *sb = GetCurrentBits(pState); 639 639 CRProgramBits *pb = &(sb->program); 640 640 641 641 if (g->current.inBeginEnd) { 642 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,642 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 643 643 "glProgramParameterNV called in Begin/End"); 644 644 return; … … 656 656 } 657 657 else { 658 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,658 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 659 659 "glProgramParameterNV(index=%d)", index); 660 660 return; … … 662 662 } 663 663 else { 664 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,664 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 665 665 "glProgramParameterNV(target)"); 666 666 return; … … 669 669 670 670 671 void STATE_APIENTRY crStateProgramParameter4fvNV(GLenum target, GLuint index, 672 const GLfloat *params) 673 { 674 crStateProgramParameter4fNV(target, index, 675 params[0], params[1], params[2], params[3]); 676 } 677 678 679 void STATE_APIENTRY crStateProgramParameters4dvNV(GLenum target, GLuint index, 680 GLuint num, const GLdouble *params) 681 { 682 CRContext *g = GetCurrentContext(); 683 CRProgramState *p = &(g->program); 684 CRStateBits *sb = GetCurrentBits(); 671 void STATE_APIENTRY crStateProgramParameter4fvNV(PCRStateTracker pState, GLenum target, GLuint index, 672 const GLfloat *params) 673 { 674 crStateProgramParameter4fNV(pState, target, index, params[0], params[1], params[2], params[3]); 675 } 676 677 678 void STATE_APIENTRY crStateProgramParameters4dvNV(PCRStateTracker pState, GLenum target, GLuint index, 679 GLuint num, const GLdouble *params) 680 { 681 CRContext *g = GetCurrentContext(pState); 682 CRProgramState *p = &(g->program); 683 CRStateBits *sb = GetCurrentBits(pState); 685 684 CRProgramBits *pb = &(sb->program); 686 685 687 686 if (g->current.inBeginEnd) { 688 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,687 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 689 688 "glProgramParameters4dvNV called in Begin/End"); 690 689 return; … … 693 692 if (target == GL_VERTEX_PROGRAM_NV) { 694 693 if (index >= UINT32_MAX - num) { 695 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,694 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 696 695 "glProgramParameters4dvNV(index+num) integer overflow"); 697 696 return; … … 710 709 } 711 710 else { 712 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,711 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 713 712 "glProgramParameters4dvNV(index+num)"); 714 713 return; … … 716 715 } 717 716 else { 718 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,717 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 719 718 "glProgramParameterNV(target)"); 720 719 return; … … 723 722 724 723 725 void STATE_APIENTRY crStateProgramParameters4fvNV( GLenum target, GLuint index,726 GLuint num, const GLfloat *params)727 { 728 CRContext *g = GetCurrentContext( );729 CRProgramState *p = &(g->program); 730 CRStateBits *sb = GetCurrentBits( );724 void STATE_APIENTRY crStateProgramParameters4fvNV(PCRStateTracker pState, GLenum target, GLuint index, 725 GLuint num, const GLfloat *params) 726 { 727 CRContext *g = GetCurrentContext(pState); 728 CRProgramState *p = &(g->program); 729 CRStateBits *sb = GetCurrentBits(pState); 731 730 CRProgramBits *pb = &(sb->program); 732 731 733 732 if (g->current.inBeginEnd) { 734 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,733 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 735 734 "glProgramParameters4dvNV called in Begin/End"); 736 735 return; … … 739 738 if (target == GL_VERTEX_PROGRAM_NV) { 740 739 if (index >= UINT32_MAX - num) { 741 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,740 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 742 741 "glProgramParameters4dvNV(index+num) integer overflow"); 743 742 return; … … 756 755 } 757 756 else { 758 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,757 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 759 758 "glProgramParameters4dvNV(index+num)"); 760 759 return; … … 762 761 } 763 762 else { 764 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,763 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 765 764 "glProgramParameterNV(target)"); 766 765 return; … … 769 768 770 769 771 void STATE_APIENTRY crStateGetProgramParameterfvNV( GLenum target, GLuint index,772 773 { 774 CRContext *g = GetCurrentContext( );775 CRProgramState *p = &(g->program); 776 777 if (g->current.inBeginEnd) { 778 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,770 void STATE_APIENTRY crStateGetProgramParameterfvNV(PCRStateTracker pState, GLenum target, GLuint index, 771 GLenum pname, GLfloat *params) 772 { 773 CRContext *g = GetCurrentContext(pState); 774 CRProgramState *p = &(g->program); 775 776 if (g->current.inBeginEnd) { 777 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 779 778 "glGetProgramParameterfvNV called in Begin/End"); 780 779 return; … … 790 789 } 791 790 else { 792 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,791 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 793 792 "glGetProgramParameterfvNV(index)"); 794 793 return; … … 796 795 } 797 796 else { 798 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,797 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 799 798 "glGetProgramParameterfvNV(pname)"); 800 799 return; … … 802 801 } 803 802 else { 804 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,803 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 805 804 "glGetProgramParameterfvNV(target)"); 806 805 return; … … 809 808 810 809 811 void STATE_APIENTRY crStateGetProgramParameterdvNV( GLenum target, GLuint index,812 GLenum pname, GLdouble *params)813 { 814 CRContext *g = GetCurrentContext( );815 CRProgramState *p = &(g->program); 816 817 if (g->current.inBeginEnd) { 818 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,810 void STATE_APIENTRY crStateGetProgramParameterdvNV(PCRStateTracker pState, GLenum target, GLuint index, 811 GLenum pname, GLdouble *params) 812 { 813 CRContext *g = GetCurrentContext(pState); 814 CRProgramState *p = &(g->program); 815 816 if (g->current.inBeginEnd) { 817 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 819 818 "glGetProgramParameterdvNV called in Begin/End"); 820 819 return; … … 830 829 } 831 830 else { 832 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,831 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 833 832 "glGetProgramParameterdvNV(index)"); 834 833 return; … … 836 835 } 837 836 else { 838 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,837 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 839 838 "glGetProgramParameterdvNV(pname)"); 840 839 return; … … 842 841 } 843 842 else { 844 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,843 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 845 844 "glGetProgramParameterdvNV(target)"); 846 845 return; … … 849 848 850 849 851 void STATE_APIENTRY crStateTrackMatrixNV( GLenum target, GLuint address,852 GLenum matrix, GLenum transform)853 { 854 CRContext *g = GetCurrentContext( );855 CRProgramState *p = &(g->program); 856 CRStateBits *sb = GetCurrentBits( );850 void STATE_APIENTRY crStateTrackMatrixNV(PCRStateTracker pState, GLenum target, GLuint address, 851 GLenum matrix, GLenum transform) 852 { 853 CRContext *g = GetCurrentContext(pState); 854 CRProgramState *p = &(g->program); 855 CRStateBits *sb = GetCurrentBits(pState); 857 856 CRProgramBits *pb = &(sb->program); 858 857 859 858 if (g->current.inBeginEnd) { 860 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,859 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 861 860 "glGetTrackMatrixivNV called in Begin/End"); 862 861 return; … … 865 864 if (target == GL_VERTEX_PROGRAM_NV) { 866 865 if (address & 0x3 || address >= g->limits.maxVertexProgramEnvParams) { 867 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,866 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 868 867 "glTrackMatrixNV(address)"); 869 868 return; … … 896 895 break; 897 896 default: 898 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,897 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 899 898 "glTrackMatrixNV(matrix = %x)",matrix); 900 899 return; … … 909 908 break; 910 909 default: 911 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,910 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 912 911 "glTrackMatrixNV(transform = %x)",transform); 913 912 return; … … 920 919 } 921 920 else { 922 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,921 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 923 922 "glTrackMatrixNV(target = %x)",target); 924 923 } … … 926 925 927 926 928 void STATE_APIENTRY crStateGetTrackMatrixivNV( GLenum target, GLuint address,929 930 { 931 CRContext *g = GetCurrentContext( );932 CRProgramState *p = &(g->program); 933 934 if (g->current.inBeginEnd) { 935 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,927 void STATE_APIENTRY crStateGetTrackMatrixivNV(PCRStateTracker pState, GLenum target, GLuint address, 928 GLenum pname, GLint *params) 929 { 930 CRContext *g = GetCurrentContext(pState); 931 CRProgramState *p = &(g->program); 932 933 if (g->current.inBeginEnd) { 934 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 936 935 "glGetTrackMatrixivNV called in Begin/End"); 937 936 return; … … 940 939 if (target == GL_VERTEX_PROGRAM_NV) { 941 940 if ((address & 0x3) || address >= g->limits.maxVertexProgramEnvParams) { 942 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,941 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 943 942 "glGetTrackMatrixivNV(address)"); 944 943 return; … … 951 950 } 952 951 else { 953 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,952 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 954 953 "glGetTrackMatrixivNV(pname)"); 955 954 return; … … 957 956 } 958 957 else { 959 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,958 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 960 959 "glGetTrackMatrixivNV(target)"); 961 960 return; … … 964 963 965 964 966 void STATE_APIENTRY crStateGetVertexAttribdvNV( GLuint index, GLenum pname, GLdouble *params)965 void STATE_APIENTRY crStateGetVertexAttribdvNV(PCRStateTracker pState, GLuint index, GLenum pname, GLdouble *params) 967 966 { 968 967 /* init vars to prevent compiler warnings/errors */ 969 968 GLfloat floatParams[4] = { 0.0, 0.0, 0.0, 0.0 }; 970 crStateGetVertexAttribfvNV( index, pname, floatParams);969 crStateGetVertexAttribfvNV(pState, index, pname, floatParams); 971 970 params[0] = floatParams[0]; 972 971 if (pname == GL_CURRENT_ATTRIB_NV) { … … 978 977 979 978 980 void STATE_APIENTRY crStateGetVertexAttribfvNV( GLuint index, GLenum pname, GLfloat *params)981 { 982 CRContext *g = GetCurrentContext( );983 984 if (g->current.inBeginEnd) { 985 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,979 void STATE_APIENTRY crStateGetVertexAttribfvNV(PCRStateTracker pState, GLuint index, GLenum pname, GLfloat *params) 980 { 981 CRContext *g = GetCurrentContext(pState); 982 983 if (g->current.inBeginEnd) { 984 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 986 985 "glGetVertexAttribfvNV called in Begin/End"); 987 986 return; … … 989 988 990 989 if (index >= CR_MAX_VERTEX_ATTRIBS) { 991 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,990 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 992 991 "glGetVertexAttribfvNV(index)"); 993 992 return; … … 1005 1004 break; 1006 1005 case GL_CURRENT_ATTRIB_NV: 1007 crStateCurrentRecover( );1006 crStateCurrentRecover(pState); 1008 1007 COPY_4V(params , g->current.vertexAttrib[index]); 1009 1008 break; 1010 1009 default: 1011 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetVertexAttribfvNV");1012 return; 1013 } 1014 } 1015 1016 1017 void STATE_APIENTRY crStateGetVertexAttribivNV( GLuint index, GLenum pname, GLint *params)1010 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetVertexAttribfvNV"); 1011 return; 1012 } 1013 } 1014 1015 1016 void STATE_APIENTRY crStateGetVertexAttribivNV(PCRStateTracker pState, GLuint index, GLenum pname, GLint *params) 1018 1017 { 1019 1018 /* init vars to prevent compiler warnings/errors */ 1020 1019 GLfloat floatParams[4] = { 0.0, 0.0, 0.0, 0.0 }; 1021 crStateGetVertexAttribfvNV( index, pname, floatParams);1020 crStateGetVertexAttribfvNV(pState, index, pname, floatParams); 1022 1021 params[0] = (GLint) floatParams[0]; 1023 1022 if (pname == GL_CURRENT_ATTRIB_NV) { … … 1030 1029 1031 1030 1032 void STATE_APIENTRY crStateGetVertexAttribfvARB( GLuint index, GLenum pname, GLfloat *params)1033 { 1034 CRContext *g = GetCurrentContext( );1035 1036 if (g->current.inBeginEnd) { 1037 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1031 void STATE_APIENTRY crStateGetVertexAttribfvARB(PCRStateTracker pState, GLuint index, GLenum pname, GLfloat *params) 1032 { 1033 CRContext *g = GetCurrentContext(pState); 1034 1035 if (g->current.inBeginEnd) { 1036 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1038 1037 "glGetVertexAttribfvARB called in Begin/End"); 1039 1038 return; … … 1041 1040 1042 1041 if (index >= CR_MAX_VERTEX_ATTRIBS) { 1043 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1042 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1044 1043 "glGetVertexAttribfvARB(index)"); 1045 1044 return; … … 1063 1062 break; 1064 1063 case GL_CURRENT_VERTEX_ATTRIB_ARB: 1065 crStateCurrentRecover( );1064 crStateCurrentRecover(pState); 1066 1065 COPY_4V(params , g->current.vertexAttrib[index]); 1067 1066 break; 1068 1067 default: 1069 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetVertexAttribfvARB");1070 return; 1071 } 1072 } 1073 1074 1075 void STATE_APIENTRY crStateGetVertexAttribivARB( GLuint index, GLenum pname, GLint *params)1068 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetVertexAttribfvARB"); 1069 return; 1070 } 1071 } 1072 1073 1074 void STATE_APIENTRY crStateGetVertexAttribivARB(PCRStateTracker pState, GLuint index, GLenum pname, GLint *params) 1076 1075 { 1077 1076 /* init vars to prevent compiler warnings/errors */ 1078 1077 GLfloat floatParams[4] = { 0.0, 0.0, 0.0, 0.0 }; 1079 crStateGetVertexAttribfvARB( index, pname, floatParams);1078 crStateGetVertexAttribfvARB(pState, index, pname, floatParams); 1080 1079 params[0] = (GLint) floatParams[0]; 1081 1080 if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { … … 1087 1086 1088 1087 1089 void STATE_APIENTRY crStateGetVertexAttribdvARB( GLuint index, GLenum pname, GLdouble *params)1088 void STATE_APIENTRY crStateGetVertexAttribdvARB(PCRStateTracker pState, GLuint index, GLenum pname, GLdouble *params) 1090 1089 { 1091 1090 /* init vars to prevent compiler warnings/errors */ 1092 1091 GLfloat floatParams[4] = { 0.0, 0.0, 0.0, 0.0 }; 1093 crStateGetVertexAttribfvARB( index, pname, floatParams);1092 crStateGetVertexAttribfvARB(pState, index, pname, floatParams); 1094 1093 params[0] = floatParams[0]; 1095 1094 if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { … … 1107 1106 */ 1108 1107 1109 void STATE_APIENTRY crStateProgramNamedParameter4fNV( GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)1110 { 1111 CRContext *g = GetCurrentContext( );1108 void STATE_APIENTRY crStateProgramNamedParameter4fNV(PCRStateTracker pState, GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 1109 { 1110 CRContext *g = GetCurrentContext(pState); 1112 1111 CRProgramState *p = &(g->program); 1113 1112 CRProgram *prog; 1114 CRStateBits *sb = GetCurrentBits( );1113 CRStateBits *sb = GetCurrentBits(pState); 1115 1114 CRProgramBits *pb = &(sb->program); 1116 1115 1117 1116 if (g->current.inBeginEnd) { 1118 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1117 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1119 1118 "glProgramNamedParameterfNV called in Begin/End"); 1120 1119 return; … … 1123 1122 prog = (CRProgram *) crHashtableSearch(p->programHash, id); 1124 1123 if (!prog) { 1125 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1124 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1126 1125 "glProgramNamedParameterNV(bad id %d)", id); 1127 1126 return; … … 1129 1128 1130 1129 if (prog->target != GL_FRAGMENT_PROGRAM_NV) { 1131 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1130 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1132 1131 "glProgramNamedParameterNV(target)"); 1133 1132 return; … … 1140 1139 1141 1140 1142 void STATE_APIENTRY crStateProgramNamedParameter4dNV( GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w)1143 { 1144 crStateProgramNamedParameter4fNV( id, len, name, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);1145 } 1146 1147 1148 void STATE_APIENTRY crStateProgramNamedParameter4fvNV( GLuint id, GLsizei len, const GLubyte *name, const GLfloat v[])1149 { 1150 crStateProgramNamedParameter4fNV( id, len, name, v[0], v[1], v[2], v[3]);1151 } 1152 1153 1154 void STATE_APIENTRY crStateProgramNamedParameter4dvNV( GLuint id, GLsizei len, const GLubyte *name, const GLdouble v[])1155 { 1156 crStateProgramNamedParameter4fNV( id, len, name, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);1157 } 1158 1159 1160 void STATE_APIENTRY crStateGetProgramNamedParameterfvNV( GLuint id, GLsizei len, const GLubyte *name, GLfloat *params)1161 { 1162 CRContext *g = GetCurrentContext( );1141 void STATE_APIENTRY crStateProgramNamedParameter4dNV(PCRStateTracker pState, GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) 1142 { 1143 crStateProgramNamedParameter4fNV(pState, id, len, name, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 1144 } 1145 1146 1147 void STATE_APIENTRY crStateProgramNamedParameter4fvNV(PCRStateTracker pState, GLuint id, GLsizei len, const GLubyte *name, const GLfloat v[]) 1148 { 1149 crStateProgramNamedParameter4fNV(pState, id, len, name, v[0], v[1], v[2], v[3]); 1150 } 1151 1152 1153 void STATE_APIENTRY crStateProgramNamedParameter4dvNV(PCRStateTracker pState, GLuint id, GLsizei len, const GLubyte *name, const GLdouble v[]) 1154 { 1155 crStateProgramNamedParameter4fNV(pState, id, len, name, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); 1156 } 1157 1158 1159 void STATE_APIENTRY crStateGetProgramNamedParameterfvNV(PCRStateTracker pState, GLuint id, GLsizei len, const GLubyte *name, GLfloat *params) 1160 { 1161 CRContext *g = GetCurrentContext(pState); 1163 1162 CRProgramState *p = &(g->program); 1164 1163 const CRProgram *prog; … … 1166 1165 1167 1166 if (g->current.inBeginEnd) { 1168 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1167 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1169 1168 "glGetProgramNamedParameterfNV called in Begin/End"); 1170 1169 return; … … 1173 1172 prog = (const CRProgram *) crHashtableSearch(p->programHash, id); 1174 1173 if (!prog) { 1175 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1174 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1176 1175 "glGetProgramNamedParameterNV(bad id)"); 1177 1176 return; … … 1179 1178 1180 1179 if (prog->target != GL_FRAGMENT_PROGRAM_NV) { 1181 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1180 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1182 1181 "glGetProgramNamedParameterNV(target)"); 1183 1182 return; … … 1186 1185 value = GetProgramSymbol(prog, (const char *)name, len); 1187 1186 if (!value) { 1188 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1187 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1189 1188 "glGetProgramNamedParameterNV(name)"); 1190 1189 return; … … 1198 1197 1199 1198 1200 void STATE_APIENTRY crStateGetProgramNamedParameterdvNV( GLuint id, GLsizei len, const GLubyte *name, GLdouble *params)1199 void STATE_APIENTRY crStateGetProgramNamedParameterdvNV(PCRStateTracker pState, GLuint id, GLsizei len, const GLubyte *name, GLdouble *params) 1201 1200 { 1202 1201 GLfloat floatParams[4]; 1203 crStateGetProgramNamedParameterfvNV( id, len, name, floatParams);1202 crStateGetProgramNamedParameterfvNV(pState, id, len, name, floatParams); 1204 1203 params[0] = floatParams[0]; 1205 1204 params[1] = floatParams[1]; … … 1209 1208 1210 1209 1211 void STATE_APIENTRY crStateProgramLocalParameter4dARB( GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)1212 { 1213 crStateProgramLocalParameter4fARB( target, index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);1214 } 1215 1216 1217 void STATE_APIENTRY crStateProgramLocalParameter4dvARB( GLenum target, GLuint index, const GLdouble *params)1218 { 1219 crStateProgramLocalParameter4fARB( target, index, (GLfloat) params[0], (GLfloat) params[1],1210 void STATE_APIENTRY crStateProgramLocalParameter4dARB(PCRStateTracker pState, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) 1211 { 1212 crStateProgramLocalParameter4fARB(pState, target, index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 1213 } 1214 1215 1216 void STATE_APIENTRY crStateProgramLocalParameter4dvARB(PCRStateTracker pState, GLenum target, GLuint index, const GLdouble *params) 1217 { 1218 crStateProgramLocalParameter4fARB(pState, target, index, (GLfloat) params[0], (GLfloat) params[1], 1220 1219 (GLfloat) params[2], (GLfloat) params[3]); 1221 1220 } 1222 1221 1223 1222 1224 void STATE_APIENTRY crStateProgramLocalParameter4fARB( GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)1225 { 1226 CRContext *g = GetCurrentContext( );1223 void STATE_APIENTRY crStateProgramLocalParameter4fARB(PCRStateTracker pState, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 1224 { 1225 CRContext *g = GetCurrentContext(pState); 1227 1226 CRProgramState *p = &(g->program); 1228 1227 CRProgram *prog; 1229 CRStateBits *sb = GetCurrentBits( );1228 CRStateBits *sb = GetCurrentBits(pState); 1230 1229 CRProgramBits *pb = &(sb->program); 1231 1230 1232 1231 if (g->current.inBeginEnd) { 1233 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1232 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1234 1233 "glProgramLocalParameterARB called in Begin/End"); 1235 1234 return; … … 1238 1237 if (target == GL_FRAGMENT_PROGRAM_ARB || target == GL_FRAGMENT_PROGRAM_NV) { 1239 1238 if (index >= CR_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMS) { 1240 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1239 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1241 1240 "glProgramLocalParameterARB(index)"); 1242 1241 return; … … 1246 1245 else if (target == GL_VERTEX_PROGRAM_ARB) { 1247 1246 if (index >= CR_MAX_VERTEX_PROGRAM_LOCAL_PARAMS) { 1248 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1247 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1249 1248 "glProgramLocalParameterARB(index)"); 1250 1249 return; … … 1253 1252 } 1254 1253 else { 1255 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1254 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1256 1255 "glProgramLocalParameterARB(target)"); 1257 1256 return; … … 1270 1269 1271 1270 1272 void STATE_APIENTRY crStateProgramLocalParameter4fvARB( GLenum target, GLuint index, const GLfloat *params)1273 { 1274 crStateProgramLocalParameter4fARB( target, index, params[0], params[1], params[2], params[3]);1275 } 1276 1277 1278 void STATE_APIENTRY crStateGetProgramLocalParameterfvARB( GLenum target, GLuint index, GLfloat *params)1279 { 1280 CRContext *g = GetCurrentContext( );1271 void STATE_APIENTRY crStateProgramLocalParameter4fvARB(PCRStateTracker pState, GLenum target, GLuint index, const GLfloat *params) 1272 { 1273 crStateProgramLocalParameter4fARB(pState, target, index, params[0], params[1], params[2], params[3]); 1274 } 1275 1276 1277 void STATE_APIENTRY crStateGetProgramLocalParameterfvARB(PCRStateTracker pState, GLenum target, GLuint index, GLfloat *params) 1278 { 1279 CRContext *g = GetCurrentContext(pState); 1281 1280 CRProgramState *p = &(g->program); 1282 1281 const CRProgram *prog = NULL; 1283 1282 1284 1283 if (g->current.inBeginEnd) { 1285 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1284 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1286 1285 "glGetProgramLocalParameterARB called in Begin/End"); 1287 1286 return; … … 1291 1290 prog = p->currentFragmentProgram; 1292 1291 if (index >= g->limits.maxFragmentProgramLocalParams) { 1293 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1292 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1294 1293 "glGetProgramLocalParameterARB(index)"); 1295 1294 return; … … 1303 1302 prog = p->currentVertexProgram; 1304 1303 if (index >= g->limits.maxVertexProgramLocalParams) { 1305 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1304 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1306 1305 "glGetProgramLocalParameterARB(index)"); 1307 1306 return; … … 1309 1308 } 1310 1309 else { 1311 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1310 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1312 1311 "glGetProgramLocalParameterARB(target)"); 1313 1312 return; 1314 1313 } 1315 1314 if (!prog) { 1316 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1315 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1317 1316 "glGetProgramLocalParameterARB(no program)"); 1318 1317 return; … … 1320 1319 1321 1320 if (!prog) { 1322 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1321 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1323 1322 "glGetProgramLocalParameterARB(no program)"); 1324 1323 return; … … 1334 1333 1335 1334 1336 void STATE_APIENTRY crStateGetProgramLocalParameterdvARB( GLenum target, GLuint index, GLdouble *params)1335 void STATE_APIENTRY crStateGetProgramLocalParameterdvARB(PCRStateTracker pState, GLenum target, GLuint index, GLdouble *params) 1337 1336 { 1338 1337 GLfloat floatParams[4]; 1339 crStateGetProgramLocalParameterfvARB( target, index, floatParams);1338 crStateGetProgramLocalParameterfvARB(pState, target, index, floatParams); 1340 1339 params[0] = floatParams[0]; 1341 1340 params[1] = floatParams[1]; … … 1346 1345 1347 1346 1348 void STATE_APIENTRY crStateGetProgramivARB( GLenum target, GLenum pname, GLint *params)1347 void STATE_APIENTRY crStateGetProgramivARB(PCRStateTracker pState, GLenum target, GLenum pname, GLint *params) 1349 1348 { 1350 1349 CRProgram *prog; 1351 CRContext *g = GetCurrentContext( );1352 CRProgramState *p = &(g->program); 1353 1354 if (g->current.inBeginEnd) { 1355 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1350 CRContext *g = GetCurrentContext(pState); 1351 CRProgramState *p = &(g->program); 1352 1353 if (g->current.inBeginEnd) { 1354 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1356 1355 "glGetProgramivARB called in Begin/End"); 1357 1356 return; … … 1365 1364 } 1366 1365 else { 1367 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1366 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1368 1367 "glGetProgramivARB(target)"); 1369 1368 return; … … 1502 1501 case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: 1503 1502 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1504 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1503 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1505 1504 "crStateGetProgramivARB(target or pname)"); 1506 1505 return; … … 1510 1509 case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: 1511 1510 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1512 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1511 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1513 1512 "crStateGetProgramivARB(target or pname)"); 1514 1513 return; … … 1518 1517 case GL_PROGRAM_TEX_INDIRECTIONS_ARB: 1519 1518 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1520 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1519 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1521 1520 "crStateGetProgramivARB(target or pname)"); 1522 1521 return; … … 1527 1526 /* XXX same as GL_PROGRAM_ALU_INSTRUCTIONS_ARB? */ 1528 1527 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1529 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1528 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1530 1529 "crStateGetProgramivARB(target or pname)"); 1531 1530 return; … … 1536 1535 /* XXX same as GL_PROGRAM_ALU_INSTRUCTIONS_ARB? */ 1537 1536 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1538 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1537 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1539 1538 "crStateGetProgramivARB(target or pname)"); 1540 1539 return; … … 1544 1543 case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: 1545 1544 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1546 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1545 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1547 1546 "crStateGetProgramivARB(target or pname)"); 1548 1547 return; … … 1553 1552 case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: 1554 1553 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1555 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1554 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1556 1555 "crStateGetProgramivARB(target or pname)"); 1557 1556 return; … … 1562 1561 case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: 1563 1562 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1564 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1563 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1565 1564 "crStateGetProgramivARB(target or pname)"); 1566 1565 return; … … 1571 1570 case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: 1572 1571 if (target != GL_FRAGMENT_PROGRAM_ARB || !g->extensions.ARB_fragment_program) { 1573 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1572 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1574 1573 "crStateGetProgramivARB(target or pname)"); 1575 1574 return; … … 1578 1577 break; 1579 1578 default: 1580 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1579 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1581 1580 "crStateGetProgramivARB(pname)"); 1582 1581 return; … … 1586 1585 1587 1586 /* XXX maybe move these two functions into state_client.c? */ 1588 void STATE_APIENTRY crStateDisableVertexAttribArrayARB( GLuint index)1589 { 1590 CRContext *g = GetCurrentContext( );1587 void STATE_APIENTRY crStateDisableVertexAttribArrayARB(PCRStateTracker pState, GLuint index) 1588 { 1589 CRContext *g = GetCurrentContext(pState); 1591 1590 CRClientState *c = &(g->client); 1592 CRStateBits *sb = GetCurrentBits( );1591 CRStateBits *sb = GetCurrentBits(pState); 1593 1592 CRClientBits *cb = &(sb->client); 1594 1593 1595 1594 if (index >= g->limits.maxVertexProgramAttribs) { 1596 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1595 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1597 1596 "glDisableVertexAttribArrayARB(index)"); 1598 1597 return; … … 1604 1603 1605 1604 1606 void STATE_APIENTRY crStateEnableVertexAttribArrayARB( GLuint index)1607 { 1608 CRContext *g = GetCurrentContext( );1605 void STATE_APIENTRY crStateEnableVertexAttribArrayARB(PCRStateTracker pState, GLuint index) 1606 { 1607 CRContext *g = GetCurrentContext(pState); 1609 1608 CRClientState *c = &(g->client); 1610 CRStateBits *sb = GetCurrentBits( );1609 CRStateBits *sb = GetCurrentBits(pState); 1611 1610 CRClientBits *cb = &(sb->client); 1612 1611 1613 1612 if (index >= g->limits.maxVertexProgramAttribs) { 1614 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1613 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1615 1614 "glEnableVertexAttribArrayARB(index)"); 1616 1615 return; … … 1622 1621 1623 1622 1624 void STATE_APIENTRY crStateGetProgramEnvParameterdvARB( GLenum target, GLuint index, GLdouble *params)1623 void STATE_APIENTRY crStateGetProgramEnvParameterdvARB(PCRStateTracker pState, GLenum target, GLuint index, GLdouble *params) 1625 1624 { 1626 1625 GLfloat fparams[4]; 1627 crStateGetProgramEnvParameterfvARB( target, index, fparams);1626 crStateGetProgramEnvParameterfvARB(pState, target, index, fparams); 1628 1627 params[0] = fparams[0]; 1629 1628 params[1] = fparams[1]; … … 1632 1631 } 1633 1632 1634 void STATE_APIENTRY crStateGetProgramEnvParameterfvARB( GLenum target, GLuint index, GLfloat *params)1635 { 1636 CRContext *g = GetCurrentContext( );1637 CRProgramState *p = &(g->program); 1638 1639 if (g->current.inBeginEnd) { 1640 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1633 void STATE_APIENTRY crStateGetProgramEnvParameterfvARB(PCRStateTracker pState, GLenum target, GLuint index, GLfloat *params) 1634 { 1635 CRContext *g = GetCurrentContext(pState); 1636 CRProgramState *p = &(g->program); 1637 1638 if (g->current.inBeginEnd) { 1639 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1641 1640 "glGetProgramEnvParameterARB called in Begin/End"); 1642 1641 return; … … 1645 1644 if (target == GL_FRAGMENT_PROGRAM_ARB || target == GL_FRAGMENT_PROGRAM_NV) { 1646 1645 if (index >= g->limits.maxFragmentProgramEnvParams) { 1647 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1646 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1648 1647 "glGetProgramEnvParameterARB(index)"); 1649 1648 return; … … 1660 1659 ) { 1661 1660 if (index >= g->limits.maxVertexProgramEnvParams) { 1662 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1661 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1663 1662 "glGetProgramEnvParameterARB(index)"); 1664 1663 return; … … 1670 1669 } 1671 1670 else { 1672 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1671 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1673 1672 "glGetProgramEnvParameterARB(target)"); 1674 1673 return; … … 1677 1676 1678 1677 1679 void STATE_APIENTRY crStateProgramEnvParameter4dARB( GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)1680 { 1681 crStateProgramEnvParameter4fARB( target, index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);1682 } 1683 1684 void STATE_APIENTRY crStateProgramEnvParameter4dvARB( GLenum target, GLuint index, const GLdouble *params)1685 { 1686 crStateProgramEnvParameter4fARB( target, index, (GLfloat) params[0], (GLfloat) params[1], (GLfloat) params[2], (GLfloat) params[3]);1687 } 1688 1689 void STATE_APIENTRY crStateProgramEnvParameter4fARB( GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)1690 { 1691 CRContext *g = GetCurrentContext( );1692 CRProgramState *p = &(g->program); 1693 CRStateBits *sb = GetCurrentBits( );1678 void STATE_APIENTRY crStateProgramEnvParameter4dARB(PCRStateTracker pState, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) 1679 { 1680 crStateProgramEnvParameter4fARB(pState, target, index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 1681 } 1682 1683 void STATE_APIENTRY crStateProgramEnvParameter4dvARB(PCRStateTracker pState, GLenum target, GLuint index, const GLdouble *params) 1684 { 1685 crStateProgramEnvParameter4fARB(pState, target, index, (GLfloat) params[0], (GLfloat) params[1], (GLfloat) params[2], (GLfloat) params[3]); 1686 } 1687 1688 void STATE_APIENTRY crStateProgramEnvParameter4fARB(PCRStateTracker pState, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 1689 { 1690 CRContext *g = GetCurrentContext(pState); 1691 CRProgramState *p = &(g->program); 1692 CRStateBits *sb = GetCurrentBits(pState); 1694 1693 CRProgramBits *pb = &(sb->program); 1695 1694 1696 1695 if (g->current.inBeginEnd) { 1697 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1696 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1698 1697 "glProgramEnvParameterARB called in Begin/End"); 1699 1698 return; … … 1702 1701 if (target == GL_FRAGMENT_PROGRAM_ARB || target == GL_FRAGMENT_PROGRAM_NV) { 1703 1702 if (index >= g->limits.maxFragmentProgramEnvParams) { 1704 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1703 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1705 1704 "glProgramEnvParameterARB(index)"); 1706 1705 return; … … 1719 1718 ) { 1720 1719 if (index >= g->limits.maxVertexProgramEnvParams) { 1721 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1720 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1722 1721 "glProgramEnvParameterARB(index)"); 1723 1722 return; … … 1731 1730 } 1732 1731 else { 1733 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1732 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1734 1733 "glProgramEnvParameterARB(target)"); 1735 1734 return; … … 1739 1738 } 1740 1739 1741 void STATE_APIENTRY crStateProgramEnvParameter4fvARB( GLenum target, GLuint index, const GLfloat *params)1742 { 1743 crStateProgramEnvParameter4fARB( target, index, params[0], params[1], params[2], params[3]);1740 void STATE_APIENTRY crStateProgramEnvParameter4fvARB(PCRStateTracker pState, GLenum target, GLuint index, const GLfloat *params) 1741 { 1742 crStateProgramEnvParameter4fARB(pState, target, index, params[0], params[1], params[2], params[3]); 1744 1743 } 1745 1744 … … 1751 1750 { 1752 1751 CRProgramState *p = &(ctx->program); 1753 CRStateBits *sb = GetCurrentBits( );1752 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 1754 1753 CRProgramBits *pb = &(sb->program); 1755 1754 GLuint i; … … 1819 1818 CRContext *fromCtx, CRContext *toCtx) 1820 1819 { 1820 PCRStateTracker pState = fromCtx->pStateTracker; 1821 1821 CRProgramState *from = &(fromCtx->program); 1822 1822 CRProgramState *to = &(toCtx->program); … … 1824 1824 CRbitvalue nbitID[CR_MAX_BITARRAY]; 1825 1825 1826 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 1827 1826 1828 CRASSERT(from->currentVertexProgram); 1827 1829 CRASSERT(to->currentVertexProgram); … … 1837 1839 CRProgram *toProg = to->currentVertexProgram; 1838 1840 1839 able[0] = diff_api.Disable;1840 able[1] = diff_api.Enable;1841 able[0] = pState->diff_api.Disable; 1842 able[1] = pState->diff_api.Enable; 1841 1843 if (from->vpEnabled != to->vpEnabled) { 1842 1844 if (toProg->isARBprogram) … … 1860 1862 if (CHECKDIRTY(b->fpEnable, bitID)) { 1861 1863 glAble able[2]; 1862 able[0] = diff_api.Disable;1863 able[1] = diff_api.Enable;1864 able[0] = pState->diff_api.Disable; 1865 able[1] = pState->diff_api.Enable; 1864 1866 if (from->fpEnabled != to->fpEnabled) { 1865 1867 able[to->fpEnabled](GL_FRAGMENT_PROGRAM_NV); … … 1879 1881 if (from->TrackMatrix[i] != to->TrackMatrix[i] || 1880 1882 from->TrackMatrixTransform[i] != to->TrackMatrixTransform[i]) { 1881 diff_api.TrackMatrixNV(GL_VERTEX_PROGRAM_NV, i * 4,1883 pState->diff_api.TrackMatrixNV(GL_VERTEX_PROGRAM_NV, i * 4, 1882 1884 to->TrackMatrix[i], 1883 1885 to->TrackMatrixTransform[i]); … … 1898 1900 if (fromProg->id != toProg->id) { 1899 1901 if (toProg->isARBprogram) 1900 diff_api.BindProgramARB(GL_VERTEX_PROGRAM_ARB, toProg->id);1902 pState->diff_api.BindProgramARB(GL_VERTEX_PROGRAM_ARB, toProg->id); 1901 1903 else 1902 diff_api.BindProgramNV(GL_VERTEX_PROGRAM_NV, toProg->id);1904 pState->diff_api.BindProgramNV(GL_VERTEX_PROGRAM_NV, toProg->id); 1903 1905 from->currentVertexProgram = toProg; 1904 1906 } … … 1910 1912 if (CHECKDIRTY(toProg->dirtyProgram, bitID)) { 1911 1913 if (toProg->isARBprogram) { 1912 diff_api.ProgramStringARB( GL_VERTEX_PROGRAM_ARB, toProg->format, toProg->length, toProg->string );1914 pState->diff_api.ProgramStringARB( GL_VERTEX_PROGRAM_ARB, toProg->format, toProg->length, toProg->string ); 1913 1915 } 1914 1916 else { 1915 diff_api.LoadProgramNV( GL_VERTEX_PROGRAM_NV, toProg->id, toProg->length, toProg->string );1917 pState->diff_api.LoadProgramNV( GL_VERTEX_PROGRAM_NV, toProg->id, toProg->length, toProg->string ); 1916 1918 } 1917 1919 CLEARDIRTY(toProg->dirtyProgram, nbitID); … … 1923 1925 if (CHECKDIRTY(b->vertexEnvParameter[i], bitID)) { 1924 1926 if (toProg->isARBprogram) 1925 diff_api.ProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i,1927 pState->diff_api.ProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, 1926 1928 to->vertexParameters[i]); 1927 1929 else 1928 diff_api.ProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV, i,1930 pState->diff_api.ProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV, i, 1929 1931 to->vertexParameters[i]); 1930 1932 if (fromProg) { … … 1943 1945 if (CHECKDIRTY(toProg->dirtyParam[i], bitID)) { 1944 1946 if (toProg->isARBprogram) 1945 diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, toProg->parameters[i]);1947 pState->diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, toProg->parameters[i]); 1946 1948 else 1947 diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_NV, i, toProg->parameters[i]);1949 pState->diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_NV, i, toProg->parameters[i]); 1948 1950 CLEARDIRTY(toProg->dirtyParam[i], nbitID); 1949 1951 } … … 1963 1965 if (CHECKDIRTY(b->fpBinding, bitID)) { 1964 1966 if (fromProg->id != toProg->id) { 1965 diff_api.BindProgramNV(GL_FRAGMENT_PROGRAM_NV, toProg->id);1967 pState->diff_api.BindProgramNV(GL_FRAGMENT_PROGRAM_NV, toProg->id); 1966 1968 from->currentFragmentProgram = toProg; 1967 1969 } … … 1972 1974 /* fragment program text */ 1973 1975 if (CHECKDIRTY(toProg->dirtyProgram, bitID)) { 1974 diff_api.LoadProgramNV( GL_FRAGMENT_PROGRAM_NV, toProg->id,1976 pState->diff_api.LoadProgramNV( GL_FRAGMENT_PROGRAM_NV, toProg->id, 1975 1977 toProg->length, toProg->string ); 1976 1978 CLEARDIRTY(toProg->dirtyProgram, nbitID); … … 1981 1983 for (i = 0; i < toCtx->limits.maxFragmentProgramEnvParams; i++) { 1982 1984 if (CHECKDIRTY(b->fragmentEnvParameter[i], bitID)) { 1983 diff_api.ProgramParameter4fvNV(GL_FRAGMENT_PROGRAM_NV, i,1985 pState->diff_api.ProgramParameter4fvNV(GL_FRAGMENT_PROGRAM_NV, i, 1984 1986 to->fragmentParameters[i]); 1985 1987 if (fromProg) { … … 1999 2001 if (CHECKDIRTY(symbol->dirty, bitID)) { 2000 2002 GLint len = crStrlen(symbol->name); 2001 diff_api.ProgramNamedParameter4fvNV(toProg->id, len,2003 pState->diff_api.ProgramNamedParameter4fvNV(toProg->id, len, 2002 2004 (const GLubyte *) symbol->name, 2003 2005 symbol->value); … … 2017 2019 for (i = 0; i < CR_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMS; i++) { 2018 2020 if (CHECKDIRTY(toProg->dirtyParam[i], bitID)) { 2019 diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_NV, i,2021 pState->diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_NV, i, 2020 2022 toProg->parameters[i]); 2021 2023 if (fromProg) { … … 2035 2037 if (CHECKDIRTY(b->fpBinding, bitID)) { 2036 2038 if (fromProg->id != toProg->id) { 2037 diff_api.BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, toProg->id);2039 pState->diff_api.BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, toProg->id); 2038 2040 from->currentFragmentProgram = toProg; 2039 2041 } … … 2044 2046 /* fragment program text */ 2045 2047 if (CHECKDIRTY(toProg->dirtyProgram, bitID)) { 2046 diff_api.ProgramStringARB( GL_FRAGMENT_PROGRAM_ARB, toProg->format,2048 pState->diff_api.ProgramStringARB( GL_FRAGMENT_PROGRAM_ARB, toProg->format, 2047 2049 toProg->length, toProg->string ); 2048 2050 CLEARDIRTY(toProg->dirtyProgram, nbitID); … … 2053 2055 for (i = 0; i < toCtx->limits.maxFragmentProgramEnvParams; i++) { 2054 2056 if (CHECKDIRTY(b->fragmentEnvParameter[i], bitID)) { 2055 diff_api.ProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i,2057 pState->diff_api.ProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, 2056 2058 to->fragmentParameters[i]); 2057 2059 if (fromProg) { … … 2069 2071 for (i = 0; i < CR_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMS; i++) { 2070 2072 if (CHECKDIRTY(toProg->dirtyParam[i], bitID)) { 2071 diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i,2073 pState->diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, 2072 2074 toProg->parameters[i]); 2073 2075 if (fromProg) { … … 2090 2092 CRContext *fromCtx, CRContext *toCtx) 2091 2093 { 2094 PCRStateTracker pState = fromCtx->pStateTracker; 2092 2095 CRProgramState *from = &(fromCtx->program); 2093 2096 CRProgramState *to = &(toCtx->program); … … 2096 2099 GLenum whichVert = fromCtx->extensions.ARB_vertex_program && toCtx->extensions.ARB_vertex_program ? GL_VERTEX_PROGRAM_ARB : GL_VERTEX_PROGRAM_NV; 2097 2100 2101 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 2098 2102 2099 2103 for (j=0;j<CR_MAX_BITARRAY;j++) … … 2103 2107 if (CHECKDIRTY(b->vpEnable, bitID)) { 2104 2108 glAble able[2]; 2105 able[0] = diff_api.Disable;2106 able[1] = diff_api.Enable;2109 able[0] = pState->diff_api.Disable; 2110 able[1] = pState->diff_api.Enable; 2107 2111 if (from->vpEnabled != to->vpEnabled) { 2108 2112 able[to->vpEnabled](whichVert); … … 2120 2124 if (CHECKDIRTY(b->fpEnable, bitID)) { 2121 2125 glAble able[2]; 2122 able[0] = diff_api.Disable;2123 able[1] = diff_api.Enable;2126 able[0] = pState->diff_api.Disable; 2127 able[1] = pState->diff_api.Enable; 2124 2128 if (from->fpEnabled != to->fpEnabled) { 2125 2129 able[to->fpEnabled](GL_FRAGMENT_PROGRAM_NV); … … 2136 2140 if (CHECKDIRTY(b->trackMatrix[i], bitID)) { 2137 2141 if (from->TrackMatrix[i] != to->TrackMatrix[i]) { 2138 diff_api.TrackMatrixNV(GL_VERTEX_PROGRAM_NV, i * 4,2142 pState->diff_api.TrackMatrixNV(GL_VERTEX_PROGRAM_NV, i * 4, 2139 2143 to->TrackMatrix[i], 2140 2144 to->TrackMatrixTransform[i]); … … 2152 2156 if (fromProg->id != toProg->id) { 2153 2157 if (toProg->isARBprogram) 2154 diff_api.BindProgramARB(GL_VERTEX_PROGRAM_ARB, toProg->id);2158 pState->diff_api.BindProgramARB(GL_VERTEX_PROGRAM_ARB, toProg->id); 2155 2159 else 2156 diff_api.BindProgramNV(GL_VERTEX_PROGRAM_NV, toProg->id);2160 pState->diff_api.BindProgramNV(GL_VERTEX_PROGRAM_NV, toProg->id); 2157 2161 } 2158 2162 DIRTY(b->vpBinding, nbitID); … … 2163 2167 if (CHECKDIRTY(toProg->dirtyProgram, bitID)) { 2164 2168 if (toProg->isARBprogram) 2165 diff_api.ProgramStringARB(GL_VERTEX_PROGRAM_ARB, toProg->format, toProg->length, toProg->string);2169 pState->diff_api.ProgramStringARB(GL_VERTEX_PROGRAM_ARB, toProg->format, toProg->length, toProg->string); 2166 2170 else 2167 diff_api.LoadProgramNV(GL_VERTEX_PROGRAM_NV, toProg->id, toProg->length, toProg->string);2171 pState->diff_api.LoadProgramNV(GL_VERTEX_PROGRAM_NV, toProg->id, toProg->length, toProg->string); 2168 2172 2169 2173 DIRTY(toProg->dirtyProgram, nbitID); … … 2175 2179 if (CHECKDIRTY(b->vertexEnvParameter[i], bitID)) { 2176 2180 if (toProg->isARBprogram) 2177 diff_api.ProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, to->vertexParameters[i]);2181 pState->diff_api.ProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, to->vertexParameters[i]); 2178 2182 else 2179 diff_api.ProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV, i, to->vertexParameters[i]);2183 pState->diff_api.ProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV, i, to->vertexParameters[i]); 2180 2184 2181 2185 DIRTY(b->vertexEnvParameter[i], nbitID); … … 2192 2196 2193 2197 if (toProg->isARBprogram) 2194 diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, toProg->parameters[i]);2198 pState->diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, toProg->parameters[i]); 2195 2199 else 2196 diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_NV, i, toProg->parameters[i]);2200 pState->diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_NV, i, toProg->parameters[i]); 2197 2201 } 2198 2202 } … … 2211 2215 if (CHECKDIRTY(b->fpBinding, bitID)) { 2212 2216 if (fromProg->id != toProg->id) { 2213 diff_api.BindProgramNV(GL_FRAGMENT_PROGRAM_NV, toProg->id);2217 pState->diff_api.BindProgramNV(GL_FRAGMENT_PROGRAM_NV, toProg->id); 2214 2218 } 2215 2219 DIRTY(b->fpBinding, nbitID); … … 2219 2223 /* fragment program text */ 2220 2224 if (CHECKDIRTY(toProg->dirtyProgram, bitID)) { 2221 diff_api.LoadProgramNV(GL_FRAGMENT_PROGRAM_NV, toProg->id, toProg->length, toProg->string);2225 pState->diff_api.LoadProgramNV(GL_FRAGMENT_PROGRAM_NV, toProg->id, toProg->length, toProg->string); 2222 2226 DIRTY(toProg->dirtyProgram, nbitID); 2223 2227 } … … 2227 2231 for (i = 0; i < toCtx->limits.maxFragmentProgramEnvParams; i++) { 2228 2232 if (CHECKDIRTY(b->fragmentEnvParameter[i], bitID)) { 2229 diff_api.ProgramParameter4fvNV(GL_FRAGMENT_PROGRAM_NV, i,2233 pState->diff_api.ProgramParameter4fvNV(GL_FRAGMENT_PROGRAM_NV, i, 2230 2234 to->fragmentParameters[i]); 2231 2235 DIRTY(b->fragmentEnvParameter[i], nbitID); … … 2241 2245 if (CHECKDIRTY(symbol->dirty, bitID)) { 2242 2246 GLint len = crStrlen(symbol->name); 2243 diff_api.ProgramNamedParameter4fvNV(toProg->id, len,2247 pState->diff_api.ProgramNamedParameter4fvNV(toProg->id, len, 2244 2248 (const GLubyte *) symbol->name, 2245 2249 symbol->value); … … 2255 2259 if (CHECKDIRTY(toProg->dirtyParam[i], bitID)) { 2256 2260 if (toProg->isARBprogram) 2257 diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, toProg->parameters[i]);2261 pState->diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, toProg->parameters[i]); 2258 2262 else 2259 diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_NV, i, toProg->parameters[i]);2263 pState->diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_NV, i, toProg->parameters[i]); 2260 2264 } 2261 2265 } … … 2270 2274 if (CHECKDIRTY(b->fpBinding, bitID)) { 2271 2275 if (fromProg->id != toProg->id) { 2272 diff_api.BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, toProg->id);2276 pState->diff_api.BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, toProg->id); 2273 2277 } 2274 2278 DIRTY(b->fpBinding, nbitID); … … 2278 2282 /* fragment program text */ 2279 2283 if (CHECKDIRTY(toProg->dirtyProgram, bitID)) { 2280 diff_api.ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, toProg->format, toProg->length, toProg->string);2284 pState->diff_api.ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, toProg->format, toProg->length, toProg->string); 2281 2285 DIRTY(toProg->dirtyProgram, nbitID); 2282 2286 } … … 2286 2290 for (i = 0; i < toCtx->limits.maxFragmentProgramEnvParams; i++) { 2287 2291 if (CHECKDIRTY(b->fragmentEnvParameter[i], bitID)) { 2288 diff_api.ProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, to->fragmentParameters[i]);2292 pState->diff_api.ProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, to->fragmentParameters[i]); 2289 2293 DIRTY(b->fragmentEnvParameter[i], nbitID); 2290 2294 } … … 2297 2301 for (i = 0; i < CR_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMS; i++) { 2298 2302 if (CHECKDIRTY(toProg->dirtyParam[i], bitID)) { 2299 diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, toProg->parameters[i]);2303 pState->diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, toProg->parameters[i]); 2300 2304 DIRTY(toProg->dirtyParam[i], nbitID); 2301 2305 } … … 2322 2326 { 2323 2327 CRContext *pContext = (CRContext *) pCtx; 2328 PCRStateTracker pState = pContext->pStateTracker; 2324 2329 CRProgram *pProgram = (CRProgram *) pProg; 2325 2330 uint32_t i; … … 2328 2333 if (pProgram->isARBprogram) 2329 2334 { 2330 diff_api.BindProgramARB(pProgram->target, pProgram->id);2331 diff_api.ProgramStringARB(pProgram->target, pProgram->format, pProgram->length, pProgram->string);2335 pState->diff_api.BindProgramARB(pProgram->target, pProgram->id); 2336 pState->diff_api.ProgramStringARB(pProgram->target, pProgram->format, pProgram->length, pProgram->string); 2332 2337 2333 2338 if (GL_VERTEX_PROGRAM_ARB == pProgram->target) … … 2336 2341 for (i = 0; i < pContext->limits.maxVertexProgramEnvParams; i++) 2337 2342 { 2338 diff_api.ProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, pContext->program.vertexParameters[i]);2343 pState->diff_api.ProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, pContext->program.vertexParameters[i]); 2339 2344 } 2340 2345 /* vertex program local parameters */ 2341 2346 for (i = 0; i < pContext->limits.maxVertexProgramLocalParams; i++) 2342 2347 { 2343 diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, pProgram->parameters[i]);2348 pState->diff_api.ProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, pProgram->parameters[i]); 2344 2349 } 2345 2350 } … … 2349 2354 for (i = 0; i < pContext->limits.maxFragmentProgramEnvParams; i++) 2350 2355 { 2351 diff_api.ProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, pContext->program.fragmentParameters[i]);2356 pState->diff_api.ProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, pContext->program.fragmentParameters[i]); 2352 2357 } 2353 2358 /* vertex program local parameters */ 2354 2359 for (i = 0; i < CR_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMS; i++) 2355 2360 { 2356 diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, pProgram->parameters[i]);2361 pState->diff_api.ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, pProgram->parameters[i]); 2357 2362 } 2358 2363 } … … 2364 2369 else 2365 2370 { 2366 diff_api.BindProgramNV(pProgram->target, pProgram->id);2371 pState->diff_api.BindProgramNV(pProgram->target, pProgram->id); 2367 2372 } 2368 2373 } … … 2370 2375 void crStateDiffAllPrograms(CRContext *g, CRbitvalue *bitID, GLboolean bForceUpdate) 2371 2376 { 2377 PCRStateTracker pState = g->pStateTracker; 2372 2378 CRProgram *pOrigVP, *pOrigFP; 2373 2379 … … 2382 2388 /* restore original bindings */ 2383 2389 if (pOrigVP->isARBprogram) 2384 diff_api.BindProgramARB(pOrigVP->target, pOrigVP->id);2390 pState->diff_api.BindProgramARB(pOrigVP->target, pOrigVP->id); 2385 2391 else 2386 diff_api.BindProgramNV(pOrigVP->target, pOrigVP->id);2392 pState->diff_api.BindProgramNV(pOrigVP->target, pOrigVP->id); 2387 2393 2388 2394 if (pOrigFP->isARBprogram) 2389 diff_api.BindProgramARB(pOrigFP->target, pOrigFP->id);2395 pState->diff_api.BindProgramARB(pOrigFP->target, pOrigFP->id); 2390 2396 else 2391 diff_api.BindProgramNV(pOrigFP->target, pOrigFP->id);2392 } 2397 pState->diff_api.BindProgramNV(pOrigFP->target, pOrigFP->id); 2398 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_rasterpos.c
r69392 r78375 17 17 */ 18 18 void 19 crStateRasterPosUpdate( GLfloat x, GLfloat y, GLfloat z, GLfloat w)20 { 21 CRContext *g = GetCurrentContext( );19 crStateRasterPosUpdate(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 20 { 21 CRContext *g = GetCurrentContext(pState); 22 22 CRCurrentState *c = &(g->current); 23 23 CRTransformState *t = &(g->transform); … … 28 28 if (g->current.inBeginEnd) 29 29 { 30 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "RasterPos called in Begin/End");30 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "RasterPos called in Begin/End"); 31 31 return; 32 32 } … … 35 35 36 36 /* update current color, texcoord, etc from the CurrentStatePointers */ 37 crStateCurrentRecover( );37 crStateCurrentRecover(pState); 38 38 39 39 p.x = x; … … 82 82 83 83 /* As above, but set dirty flags */ 84 static void RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w)85 { 86 CRContext *g = GetCurrentContext( );87 CRStateBits *sb = GetCurrentBits( );84 static void RasterPos4f(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 85 { 86 CRContext *g = GetCurrentContext(pState); 87 CRStateBits *sb = GetCurrentBits(pState); 88 88 CRCurrentBits *cb = &(sb->current); 89 89 90 crStateRasterPosUpdate( x, y, z, w);90 crStateRasterPosUpdate(pState, x, y, z, w); 91 91 92 92 DIRTY(cb->dirty, g->neg_bitid); … … 94 94 } 95 95 96 void STATE_APIENTRY crStateRasterPos2d( GLdouble x, GLdouble y)97 { 98 RasterPos4f( (GLfloat) x, (GLfloat) y, 0.0f, 1.0f);99 } 100 101 void STATE_APIENTRY crStateRasterPos2f( GLfloat x, GLfloat y)102 { 103 RasterPos4f( x, y, 0.0f, 1.0f);104 } 105 106 void STATE_APIENTRY crStateRasterPos2i( GLint x, GLint y)107 { 108 RasterPos4f( (GLfloat) x, (GLfloat) y, 0.0f, 1.0f);109 } 110 111 void STATE_APIENTRY crStateRasterPos2s( GLshort x, GLshort y)112 { 113 RasterPos4f( (GLfloat) x, (GLfloat) y, 0.0f, 1.0f);114 } 115 116 void STATE_APIENTRY crStateRasterPos3d( GLdouble x, GLdouble y, GLdouble z)117 { 118 RasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0f);119 } 120 121 void STATE_APIENTRY crStateRasterPos3f( GLfloat x, GLfloat y, GLfloat z)122 { 123 RasterPos4f( x, y, z, 1.0f);124 } 125 126 void STATE_APIENTRY crStateRasterPos3i( GLint x, GLint y, GLint z)127 { 128 RasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0f);129 } 130 131 void STATE_APIENTRY crStateRasterPos3s( GLshort x, GLshort y, GLshort z)132 { 133 RasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0f);134 } 135 136 void STATE_APIENTRY crStateRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w)137 { 138 RasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);139 } 140 141 void STATE_APIENTRY crStateRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w)142 { 143 RasterPos4f( x, y, z, w);144 } 145 146 void STATE_APIENTRY crStateRasterPos4i( GLint x, GLint y, GLint z, GLint w)147 { 148 RasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);149 } 150 151 void STATE_APIENTRY crStateRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w)152 { 153 RasterPos4f( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);154 } 155 156 void STATE_APIENTRY crStateRasterPos2dv( const GLdouble *v)157 { 158 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f);159 } 160 161 void STATE_APIENTRY crStateRasterPos2fv( const GLfloat *v)162 { 163 RasterPos4f( v[0], v[1], 0.0f, 1.0f);164 } 165 166 void STATE_APIENTRY crStateRasterPos2iv( const GLint *v)167 { 168 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f);169 } 170 171 void STATE_APIENTRY crStateRasterPos2sv( const GLshort *v)172 { 173 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f);174 } 175 176 void STATE_APIENTRY crStateRasterPos3dv( const GLdouble *v)177 { 178 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0f);179 } 180 181 void STATE_APIENTRY crStateRasterPos3fv( const GLfloat *v)182 { 183 RasterPos4f( v[0], v[1], v[2], 1.0f);184 } 185 186 void STATE_APIENTRY crStateRasterPos3iv( const GLint *v)187 { 188 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0f);189 } 190 191 void STATE_APIENTRY crStateRasterPos3sv( const GLshort *v)192 { 193 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0f);194 } 195 196 void STATE_APIENTRY crStateRasterPos4dv( const GLdouble *v)197 { 198 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);199 } 200 201 void STATE_APIENTRY crStateRasterPos4fv( const GLfloat *v)202 { 203 RasterPos4f( v[0], v[1], v[2], v[3]);204 } 205 206 void STATE_APIENTRY crStateRasterPos4iv( const GLint *v)207 { 208 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);209 } 210 211 void STATE_APIENTRY crStateRasterPos4sv( const GLshort *v)212 { 213 RasterPos4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]);96 void STATE_APIENTRY crStateRasterPos2d(PCRStateTracker pState, GLdouble x, GLdouble y) 97 { 98 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, 0.0f, 1.0f); 99 } 100 101 void STATE_APIENTRY crStateRasterPos2f(PCRStateTracker pState, GLfloat x, GLfloat y) 102 { 103 RasterPos4f(pState, x, y, 0.0f, 1.0f); 104 } 105 106 void STATE_APIENTRY crStateRasterPos2i(PCRStateTracker pState, GLint x, GLint y) 107 { 108 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, 0.0f, 1.0f); 109 } 110 111 void STATE_APIENTRY crStateRasterPos2s(PCRStateTracker pState, GLshort x, GLshort y) 112 { 113 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, 0.0f, 1.0f); 114 } 115 116 void STATE_APIENTRY crStateRasterPos3d(PCRStateTracker pState, GLdouble x, GLdouble y, GLdouble z) 117 { 118 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0f); 119 } 120 121 void STATE_APIENTRY crStateRasterPos3f(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z) 122 { 123 RasterPos4f(pState, x, y, z, 1.0f); 124 } 125 126 void STATE_APIENTRY crStateRasterPos3i(PCRStateTracker pState, GLint x, GLint y, GLint z) 127 { 128 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0f); 129 } 130 131 void STATE_APIENTRY crStateRasterPos3s(PCRStateTracker pState, GLshort x, GLshort y, GLshort z) 132 { 133 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0f); 134 } 135 136 void STATE_APIENTRY crStateRasterPos4d(PCRStateTracker pState, GLdouble x, GLdouble y, GLdouble z, GLdouble w) 137 { 138 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 139 } 140 141 void STATE_APIENTRY crStateRasterPos4f(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 142 { 143 RasterPos4f(pState, x, y, z, w); 144 } 145 146 void STATE_APIENTRY crStateRasterPos4i(PCRStateTracker pState, GLint x, GLint y, GLint z, GLint w) 147 { 148 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 149 } 150 151 void STATE_APIENTRY crStateRasterPos4s(PCRStateTracker pState, GLshort x, GLshort y, GLshort z, GLshort w) 152 { 153 RasterPos4f(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 154 } 155 156 void STATE_APIENTRY crStateRasterPos2dv(PCRStateTracker pState, const GLdouble *v) 157 { 158 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f); 159 } 160 161 void STATE_APIENTRY crStateRasterPos2fv(PCRStateTracker pState, const GLfloat *v) 162 { 163 RasterPos4f(pState, v[0], v[1], 0.0f, 1.0f); 164 } 165 166 void STATE_APIENTRY crStateRasterPos2iv(PCRStateTracker pState, const GLint *v) 167 { 168 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f); 169 } 170 171 void STATE_APIENTRY crStateRasterPos2sv(PCRStateTracker pState, const GLshort *v) 172 { 173 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0f, 1.0f); 174 } 175 176 void STATE_APIENTRY crStateRasterPos3dv(PCRStateTracker pState, const GLdouble *v) 177 { 178 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0f); 179 } 180 181 void STATE_APIENTRY crStateRasterPos3fv(PCRStateTracker pState, const GLfloat *v) 182 { 183 RasterPos4f(pState, v[0], v[1], v[2], 1.0f); 184 } 185 186 void STATE_APIENTRY crStateRasterPos3iv(PCRStateTracker pState, const GLint *v) 187 { 188 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0f); 189 } 190 191 void STATE_APIENTRY crStateRasterPos3sv(PCRStateTracker pState, const GLshort *v) 192 { 193 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0f); 194 } 195 196 void STATE_APIENTRY crStateRasterPos4dv(PCRStateTracker pState, const GLdouble *v) 197 { 198 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); 199 } 200 201 void STATE_APIENTRY crStateRasterPos4fv(PCRStateTracker pState, const GLfloat *v) 202 { 203 RasterPos4f(pState, v[0], v[1], v[2], v[3]); 204 } 205 206 void STATE_APIENTRY crStateRasterPos4iv(PCRStateTracker pState, const GLint *v) 207 { 208 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); 209 } 210 211 void STATE_APIENTRY crStateRasterPos4sv(PCRStateTracker pState, const GLshort *v) 212 { 213 RasterPos4f(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); 214 214 } 215 215 … … 219 219 220 220 static void 221 crStateWindowPosUpdate( GLfloat x, GLfloat y, GLfloat z)222 { 223 CRContext *g = GetCurrentContext( );221 crStateWindowPosUpdate(PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z) 222 { 223 CRContext *g = GetCurrentContext(pState); 224 224 CRCurrentState *c = &(g->current); 225 CRStateBits *sb = GetCurrentBits( );225 CRStateBits *sb = GetCurrentBits(pState); 226 226 CRCurrentBits *cb = &(sb->current); 227 227 int i; … … 229 229 if (g->current.inBeginEnd) 230 230 { 231 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "WindowPos called in Begin/End");231 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "WindowPos called in Begin/End"); 232 232 return; 233 233 } … … 246 246 247 247 248 void STATE_APIENTRY crStateWindowPos2dARB ( GLdouble x, GLdouble y)249 { 250 crStateWindowPosUpdate( (GLfloat) x, (GLfloat) y, 0.0);251 } 252 253 void STATE_APIENTRY crStateWindowPos2dvARB ( const GLdouble *v)254 { 255 crStateWindowPosUpdate( (GLfloat) v[0], (GLfloat) v[1], 0.0);256 } 257 258 void STATE_APIENTRY crStateWindowPos2fARB ( GLfloat x, GLfloat y)259 { 260 crStateWindowPosUpdate( x, y, 0.0);261 } 262 263 void STATE_APIENTRY crStateWindowPos2fvARB ( const GLfloat *v)264 { 265 crStateWindowPosUpdate( v[0], v[1], 0.0);266 } 267 268 void STATE_APIENTRY crStateWindowPos2iARB ( GLint x, GLint y)269 { 270 crStateWindowPosUpdate( (GLfloat) x, (GLfloat) y, 0.0);271 } 272 273 void STATE_APIENTRY crStateWindowPos2ivARB ( const GLint *v)274 { 275 crStateWindowPosUpdate( (GLfloat) v[0], (GLfloat) v[1], 0.0);276 } 277 278 void STATE_APIENTRY crStateWindowPos2sARB ( GLshort x, GLshort y)279 { 280 crStateWindowPosUpdate( (GLfloat) x, (GLfloat) y, 0.0);281 } 282 283 void STATE_APIENTRY crStateWindowPos2svARB ( const GLshort *v)284 { 285 crStateWindowPosUpdate( (GLfloat) v[0], (GLfloat) v[1], 0.0);286 } 287 288 void STATE_APIENTRY crStateWindowPos3dARB ( GLdouble x, GLdouble y, GLdouble z)289 { 290 crStateWindowPosUpdate( (GLfloat) x, (GLfloat) y, (GLfloat) z);291 } 292 293 void STATE_APIENTRY crStateWindowPos3dvARB ( const GLdouble *v)294 { 295 crStateWindowPosUpdate( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]);296 } 297 298 void STATE_APIENTRY crStateWindowPos3fARB ( GLfloat x, GLfloat y, GLfloat z)299 { 300 crStateWindowPosUpdate( x, y, z);301 } 302 303 void STATE_APIENTRY crStateWindowPos3fvARB ( const GLfloat *v)304 { 305 crStateWindowPosUpdate( v[0], v[1], v[2]);306 } 307 308 void STATE_APIENTRY crStateWindowPos3iARB ( GLint x, GLint y, GLint z)309 { 310 crStateWindowPosUpdate( (GLfloat) x, (GLfloat) y, (GLfloat) z);311 } 312 313 void STATE_APIENTRY crStateWindowPos3ivARB ( const GLint *v)314 { 315 crStateWindowPosUpdate( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]);316 } 317 318 void STATE_APIENTRY crStateWindowPos3sARB ( GLshort x, GLshort y, GLshort z)319 { 320 crStateWindowPosUpdate( (GLfloat) x, (GLfloat) y, (GLfloat) z);321 } 322 323 void STATE_APIENTRY crStateWindowPos3svARB ( const GLshort *v)324 { 325 crStateWindowPosUpdate( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]);326 } 327 248 void STATE_APIENTRY crStateWindowPos2dARB (PCRStateTracker pState, GLdouble x, GLdouble y) 249 { 250 crStateWindowPosUpdate(pState, (GLfloat) x, (GLfloat) y, 0.0); 251 } 252 253 void STATE_APIENTRY crStateWindowPos2dvARB (PCRStateTracker pState, const GLdouble *v) 254 { 255 crStateWindowPosUpdate(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0); 256 } 257 258 void STATE_APIENTRY crStateWindowPos2fARB (PCRStateTracker pState, GLfloat x, GLfloat y) 259 { 260 crStateWindowPosUpdate(pState, x, y, 0.0); 261 } 262 263 void STATE_APIENTRY crStateWindowPos2fvARB (PCRStateTracker pState, const GLfloat *v) 264 { 265 crStateWindowPosUpdate(pState, v[0], v[1], 0.0); 266 } 267 268 void STATE_APIENTRY crStateWindowPos2iARB (PCRStateTracker pState, GLint x, GLint y) 269 { 270 crStateWindowPosUpdate(pState, (GLfloat) x, (GLfloat) y, 0.0); 271 } 272 273 void STATE_APIENTRY crStateWindowPos2ivARB (PCRStateTracker pState, const GLint *v) 274 { 275 crStateWindowPosUpdate(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0); 276 } 277 278 void STATE_APIENTRY crStateWindowPos2sARB (PCRStateTracker pState, GLshort x, GLshort y) 279 { 280 crStateWindowPosUpdate(pState, (GLfloat) x, (GLfloat) y, 0.0); 281 } 282 283 void STATE_APIENTRY crStateWindowPos2svARB (PCRStateTracker pState, const GLshort *v) 284 { 285 crStateWindowPosUpdate(pState, (GLfloat) v[0], (GLfloat) v[1], 0.0); 286 } 287 288 void STATE_APIENTRY crStateWindowPos3dARB (PCRStateTracker pState, GLdouble x, GLdouble y, GLdouble z) 289 { 290 crStateWindowPosUpdate(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z); 291 } 292 293 void STATE_APIENTRY crStateWindowPos3dvARB (PCRStateTracker pState, const GLdouble *v) 294 { 295 crStateWindowPosUpdate(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); 296 } 297 298 void STATE_APIENTRY crStateWindowPos3fARB (PCRStateTracker pState, GLfloat x, GLfloat y, GLfloat z) 299 { 300 crStateWindowPosUpdate(pState, x, y, z); 301 } 302 303 void STATE_APIENTRY crStateWindowPos3fvARB (PCRStateTracker pState, const GLfloat *v) 304 { 305 crStateWindowPosUpdate(pState, v[0], v[1], v[2]); 306 } 307 308 void STATE_APIENTRY crStateWindowPos3iARB (PCRStateTracker pState, GLint x, GLint y, GLint z) 309 { 310 crStateWindowPosUpdate(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z); 311 } 312 313 void STATE_APIENTRY crStateWindowPos3ivARB (PCRStateTracker pState, const GLint *v) 314 { 315 crStateWindowPosUpdate(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); 316 } 317 318 void STATE_APIENTRY crStateWindowPos3sARB (PCRStateTracker pState, GLshort x, GLshort y, GLshort z) 319 { 320 crStateWindowPosUpdate(pState, (GLfloat) x, (GLfloat) y, (GLfloat) z); 321 } 322 323 void STATE_APIENTRY crStateWindowPos3svARB (PCRStateTracker pState, const GLshort *v) 324 { 325 crStateWindowPosUpdate(pState, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); 326 } 327 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_regcombiner.c
r69392 r78375 15 15 { 16 16 CRRegCombinerState *reg = &ctx->regcombiner; 17 CRStateBits *sb = GetCurrentBits( );17 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 18 18 CRRegCombinerBits *rb = &(sb->regcombiner); 19 19 #ifndef CR_NV_register_combiners … … 117 117 } 118 118 119 void STATE_APIENTRY crStateCombinerParameterfvNV( GLenum pname, const GLfloat *params )120 { 121 CRContext *g = GetCurrentContext( );119 void STATE_APIENTRY crStateCombinerParameterfvNV(PCRStateTracker pState, GLenum pname, const GLfloat *params ) 120 { 121 CRContext *g = GetCurrentContext(pState); 122 122 CRRegCombinerState *r = &(g->regcombiner); 123 CRStateBits *sb = GetCurrentBits( );123 CRStateBits *sb = GetCurrentBits(pState); 124 124 CRRegCombinerBits *rb = &(sb->regcombiner); 125 125 … … 143 143 if( *params < 1 || *params > g->limits.maxGeneralCombiners ) 144 144 { 145 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "CombinerParameter passed invalid NUM_GENERAL_COMBINERS param: %d", (GLint)*params );145 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "CombinerParameter passed invalid NUM_GENERAL_COMBINERS param: %d", (GLint)*params ); 146 146 return; 147 147 } … … 154 154 break; 155 155 default: 156 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerParameter passed bogus pname: 0x%x", pname );156 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerParameter passed bogus pname: 0x%x", pname ); 157 157 return; 158 158 } … … 161 161 } 162 162 163 void STATE_APIENTRY crStateCombinerParameterivNV( GLenum pname, const GLint *params )163 void STATE_APIENTRY crStateCombinerParameterivNV(PCRStateTracker pState, GLenum pname, const GLint *params ) 164 164 { 165 165 GLfloat fparams[4]; … … 178 178 *fparams = (GLfloat) *params; 179 179 } 180 crStateCombinerParameterfvNV( pname, fparams );181 } 182 183 void STATE_APIENTRY crStateCombinerParameterfNV( GLenum pname, GLfloat param )180 crStateCombinerParameterfvNV(pState, pname, fparams ); 181 } 182 183 void STATE_APIENTRY crStateCombinerParameterfNV(PCRStateTracker pState, GLenum pname, GLfloat param ) 184 184 { 185 185 GLfloat fparam[1]; … … 187 187 if( pname == GL_CONSTANT_COLOR0_NV || pname == GL_CONSTANT_COLOR1_NV ) 188 188 { 189 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid pname (CONSTANT_COLOR%d) passed to CombinerParameterfNV: 0x%x", (GLint)param-GL_CONSTANT_COLOR0_NV, pname );190 return; 191 } 192 crStateCombinerParameterfvNV( pname, fparam );193 } 194 195 void STATE_APIENTRY crStateCombinerParameteriNV( GLenum pname, GLint param )189 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid pname (CONSTANT_COLOR%d) passed to CombinerParameterfNV: 0x%x", (GLint)param-GL_CONSTANT_COLOR0_NV, pname ); 190 return; 191 } 192 crStateCombinerParameterfvNV(pState, pname, fparam ); 193 } 194 195 void STATE_APIENTRY crStateCombinerParameteriNV(PCRStateTracker pState, GLenum pname, GLint param ) 196 196 { 197 197 GLfloat fparam[1]; … … 199 199 if( pname == GL_CONSTANT_COLOR0_NV || pname == GL_CONSTANT_COLOR1_NV ) 200 200 { 201 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid pname (CONSTANT_COLOR%d) passed to CombinerParameteriNV: 0x%x", param-GL_CONSTANT_COLOR0_NV, pname );202 return; 203 } 204 crStateCombinerParameterfvNV( pname, fparam );205 } 206 207 void STATE_APIENTRY crStateCombinerInputNV( GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage )208 { 209 CRContext *g = GetCurrentContext( );201 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid pname (CONSTANT_COLOR%d) passed to CombinerParameteriNV: 0x%x", param-GL_CONSTANT_COLOR0_NV, pname ); 202 return; 203 } 204 crStateCombinerParameterfvNV(pState, pname, fparam ); 205 } 206 207 void STATE_APIENTRY crStateCombinerInputNV(PCRStateTracker pState, GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage ) 208 { 209 CRContext *g = GetCurrentContext(pState); 210 210 CRRegCombinerState *r = &(g->regcombiner); 211 CRStateBits *sb = GetCurrentBits( );211 CRStateBits *sb = GetCurrentBits(pState); 212 212 CRRegCombinerBits *rb = &(sb->regcombiner); 213 213 214 214 if( stage < GL_COMBINER0_NV || stage >= GL_COMBINER0_NV + g->limits.maxGeneralCombiners ) 215 215 { 216 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus stage: 0x%x", stage );216 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus stage: 0x%x", stage ); 217 217 return; 218 218 } 219 219 if( input != GL_ZERO && input != GL_CONSTANT_COLOR0_NV && input != GL_CONSTANT_COLOR1_NV && input != GL_FOG && input != GL_PRIMARY_COLOR_NV && input != GL_SECONDARY_COLOR_NV && input != GL_SPARE0_NV && input != GL_SPARE1_NV && ( input < GL_TEXTURE0_ARB || input >= GL_TEXTURE0_ARB + g->limits.maxTextureUnits )) 220 220 { 221 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus input: 0x%x", input );221 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus input: 0x%x", input ); 222 222 return; 223 223 } 224 224 if( mapping != GL_UNSIGNED_IDENTITY_NV && mapping != GL_UNSIGNED_INVERT_NV && mapping != GL_EXPAND_NORMAL_NV && mapping != GL_EXPAND_NEGATE_NV && mapping != GL_HALF_BIAS_NORMAL_NV && mapping != GL_HALF_BIAS_NEGATE_NV && mapping != GL_SIGNED_IDENTITY_NV && mapping != GL_SIGNED_NEGATE_NV ) 225 225 { 226 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus mapping: 0x%x", mapping );226 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus mapping: 0x%x", mapping ); 227 227 return; 228 228 } 229 229 if( componentUsage != GL_RGB && componentUsage != GL_ALPHA && componentUsage != GL_BLUE ) 230 230 { 231 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus componentUsage: 0x%x", componentUsage );231 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus componentUsage: 0x%x", componentUsage ); 232 232 return; 233 233 } … … 235 235 if(( componentUsage == GL_RGB && portion == GL_ALPHA )||( componentUsage == GL_BLUE && portion == GL_RGB )) 236 236 { 237 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "Incompatible portion and componentUsage passed to CombinerInputNV: portion = 0x%x, componentUsage = 0x%x", portion, componentUsage );237 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "Incompatible portion and componentUsage passed to CombinerInputNV: portion = 0x%x, componentUsage = 0x%x", portion, componentUsage ); 238 238 return; 239 239 } 240 240 if( componentUsage == GL_ALPHA && input == GL_FOG ) 241 241 { 242 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerInputNV can not have input of GL_FOG if componentUsage is GL_ALPHA" );242 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerInputNV can not have input of GL_FOG if componentUsage is GL_ALPHA" ); 243 243 return; 244 244 } … … 270 270 break; 271 271 default: 272 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus variable: 0x%x", variable );272 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus variable: 0x%x", variable ); 273 273 return; 274 274 } … … 299 299 break; 300 300 default: 301 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus variable: 0x%x", variable );301 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus variable: 0x%x", variable ); 302 302 return; 303 303 } … … 305 305 else 306 306 { 307 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus portion: 0x%x", portion );307 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerInputNV passed bogus portion: 0x%x", portion ); 308 308 return; 309 309 } … … 313 313 } 314 314 315 void STATE_APIENTRY crStateCombinerOutputNV( GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum )316 { 317 CRContext *g = GetCurrentContext( );315 void STATE_APIENTRY crStateCombinerOutputNV(PCRStateTracker pState, GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum ) 316 { 317 CRContext *g = GetCurrentContext(pState); 318 318 CRRegCombinerState *r = &(g->regcombiner); 319 CRStateBits *sb = GetCurrentBits( );319 CRStateBits *sb = GetCurrentBits(pState); 320 320 CRRegCombinerBits *rb = &(sb->regcombiner); 321 321 … … 330 330 if( stage < GL_COMBINER0_NV || stage >= GL_COMBINER0_NV + g->limits.maxGeneralCombiners ) 331 331 { 332 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus stage: 0x%x", stage );332 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus stage: 0x%x", stage ); 333 333 return; 334 334 } 335 335 if( abOutput != GL_DISCARD_NV && abOutput != GL_PRIMARY_COLOR_NV && abOutput != GL_SECONDARY_COLOR_NV && abOutput != GL_SPARE0_NV && abOutput != GL_SPARE1_NV && ( abOutput < GL_TEXTURE0_ARB || abOutput >= g->limits.maxTextureUnits + GL_TEXTURE0_ARB )) 336 336 { 337 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus abOutput: 0x%x", abOutput );337 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus abOutput: 0x%x", abOutput ); 338 338 return; 339 339 } 340 340 if( cdOutput != GL_DISCARD_NV && cdOutput != GL_PRIMARY_COLOR_NV && cdOutput != GL_SECONDARY_COLOR_NV && cdOutput != GL_SPARE0_NV && cdOutput != GL_SPARE1_NV && ( cdOutput < GL_TEXTURE0_ARB || cdOutput >= g->limits.maxTextureUnits + GL_TEXTURE0_ARB )) 341 341 { 342 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus cdOutput: 0x%x", cdOutput );342 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus cdOutput: 0x%x", cdOutput ); 343 343 return; 344 344 } 345 345 if( sumOutput != GL_DISCARD_NV && sumOutput != GL_PRIMARY_COLOR_NV && sumOutput != GL_SECONDARY_COLOR_NV && sumOutput != GL_SPARE0_NV && sumOutput != GL_SPARE1_NV && sumOutput != GL_TEXTURE0_ARB && sumOutput != GL_TEXTURE1_ARB ) 346 346 { 347 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus sumOutput: 0x%x", sumOutput );347 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus sumOutput: 0x%x", sumOutput ); 348 348 return; 349 349 } 350 350 if( scale != GL_NONE && scale != GL_SCALE_BY_TWO_NV && scale != GL_SCALE_BY_FOUR_NV && scale != GL_SCALE_BY_ONE_HALF_NV ) 351 351 { 352 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV passed bogus scale: 0x%x", scale );352 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV passed bogus scale: 0x%x", scale ); 353 353 return; 354 354 } 355 355 if( bias != GL_NONE && bias != GL_BIAS_BY_NEGATIVE_ONE_HALF_NV ) 356 356 { 357 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV passed bogus bias: 0x%x", bias );357 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV passed bogus bias: 0x%x", bias ); 358 358 return; 359 359 } … … 361 361 if( bias == GL_BIAS_BY_NEGATIVE_ONE_HALF_NV && ( scale == GL_SCALE_BY_ONE_HALF_NV || scale == GL_SCALE_BY_FOUR_NV )) 362 362 { 363 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV can't accept bias of -1/2 if scale is by 1/2 or 4" );363 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV can't accept bias of -1/2 if scale is by 1/2 or 4" ); 364 364 return; 365 365 } 366 366 if(( abOutput == cdOutput && abOutput != GL_DISCARD_NV )||( abOutput == sumOutput && abOutput != GL_DISCARD_NV )||( cdOutput == sumOutput && cdOutput != GL_DISCARD_NV )) 367 367 { 368 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV register output names must be unique unless discarded: abOutput = 0x%x, cdOutput = 0x%x, sumOutput = 0x%x", abOutput, cdOutput, sumOutput );368 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV register output names must be unique unless discarded: abOutput = 0x%x, cdOutput = 0x%x, sumOutput = 0x%x", abOutput, cdOutput, sumOutput ); 369 369 return; 370 370 } … … 373 373 if( portion == GL_ALPHA ) 374 374 { 375 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "CombinerOutputNV can not do Dot Products when portion = GL_ALPHA" );375 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "CombinerOutputNV can not do Dot Products when portion = GL_ALPHA" ); 376 376 return; 377 377 } 378 378 if( sumOutput != GL_DISCARD_NV ) 379 379 { 380 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV can not do Dot Products when sumOutput is not discarded" );380 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "CombinerOutputNV can not do Dot Products when sumOutput is not discarded" ); 381 381 return; 382 382 } … … 408 408 else 409 409 { 410 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus portion: 0x%x", portion );410 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus portion: 0x%x", portion ); 411 411 return; 412 412 } … … 416 416 } 417 417 418 void STATE_APIENTRY crStateFinalCombinerInputNV( GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage )419 { 420 CRContext *g = GetCurrentContext( );418 void STATE_APIENTRY crStateFinalCombinerInputNV(PCRStateTracker pState, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage ) 419 { 420 CRContext *g = GetCurrentContext(pState); 421 421 CRRegCombinerState *r = &(g->regcombiner); 422 CRStateBits *sb = GetCurrentBits( );422 CRStateBits *sb = GetCurrentBits(pState); 423 423 CRRegCombinerBits *rb = &(sb->regcombiner); 424 424 425 425 if( input != GL_ZERO && input != GL_CONSTANT_COLOR0_NV && input != GL_CONSTANT_COLOR1_NV && input != GL_FOG && input != GL_PRIMARY_COLOR_NV && input != GL_SECONDARY_COLOR_NV && input != GL_SPARE0_NV && input != GL_SPARE1_NV && ( input < GL_TEXTURE0_ARB || input >= GL_TEXTURE0_ARB + g->limits.maxTextureUnits ) && input != GL_E_TIMES_F_NV && input != GL_SPARE0_PLUS_SECONDARY_COLOR_NV ) 426 426 { 427 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "FinalCombinerInputNV passed bogus input: 0x%x", input );427 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "FinalCombinerInputNV passed bogus input: 0x%x", input ); 428 428 return; 429 429 } 430 430 if( mapping != GL_UNSIGNED_IDENTITY_NV && mapping != GL_UNSIGNED_INVERT_NV && mapping != GL_EXPAND_NORMAL_NV && mapping != GL_EXPAND_NEGATE_NV && mapping != GL_HALF_BIAS_NORMAL_NV && mapping != GL_HALF_BIAS_NEGATE_NV && mapping != GL_SIGNED_IDENTITY_NV && mapping != GL_SIGNED_NEGATE_NV ) 431 431 { 432 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "FinalCombinerInputNV passed bogus mapping: 0x%x", mapping );432 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "FinalCombinerInputNV passed bogus mapping: 0x%x", mapping ); 433 433 return; 434 434 } 435 435 if( componentUsage != GL_RGB && componentUsage != GL_ALPHA && componentUsage != GL_BLUE ) 436 436 { 437 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "FinalCombinerInputNV passed bogus componentUsage: 0x%x", componentUsage );437 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "FinalCombinerInputNV passed bogus componentUsage: 0x%x", componentUsage ); 438 438 return; 439 439 } … … 441 441 if( componentUsage == GL_ALPHA && ( input == GL_E_TIMES_F_NV || input == GL_SPARE0_PLUS_SECONDARY_COLOR_NV )) 442 442 { 443 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "FinalCombinerInputNV does not allow componentUsage of ALPHA when input is E_TIMES_F or SPARE0_PLUS_SECONDARY_COLOR" );443 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "FinalCombinerInputNV does not allow componentUsage of ALPHA when input is E_TIMES_F or SPARE0_PLUS_SECONDARY_COLOR" ); 444 444 return; 445 445 } … … 480 480 if( componentUsage != GL_ALPHA ) 481 481 { 482 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "FinalCombinerInputNV can not have variable G when componentUsage is RGB or BLUE" );482 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "FinalCombinerInputNV can not have variable G when componentUsage is RGB or BLUE" ); 483 483 return; 484 484 } … … 488 488 break; 489 489 default: 490 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus variable: 0x%x", variable );490 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerOutputNV passed bogus variable: 0x%x", variable ); 491 491 return; 492 492 } … … 498 498 499 499 /* XXX Unfinished RegCombiner State functions */ 500 void STATE_APIENTRY crStateGetCombinerOutputParameterfvNV( GLenum stage, GLenum portion, GLenum pname, GLfloat *params ) 501 { 500 void STATE_APIENTRY crStateGetCombinerOutputParameterfvNV(PCRStateTracker pState, GLenum stage, GLenum portion, GLenum pname, GLfloat *params ) 501 { 502 RT_NOREF(pState); 502 503 (void) stage; 503 504 (void) portion; … … 506 507 } 507 508 508 void STATE_APIENTRY crStateGetCombinerOutputParameterivNV( GLenum stage, GLenum portion, GLenum pname, GLint *params ) 509 { 509 void STATE_APIENTRY crStateGetCombinerOutputParameterivNV(PCRStateTracker pState, GLenum stage, GLenum portion, GLenum pname, GLint *params ) 510 { 511 RT_NOREF(pState); 510 512 (void) stage; 511 513 (void) portion; … … 514 516 } 515 517 516 void STATE_APIENTRY crStateGetFinalCombinerInputParameterfvNV( GLenum variable, GLenum pname, GLfloat *params ) 517 { 518 void STATE_APIENTRY crStateGetFinalCombinerInputParameterfvNV(PCRStateTracker pState, GLenum variable, GLenum pname, GLfloat *params ) 519 { 520 RT_NOREF(pState); 518 521 (void) variable; 519 522 (void) pname; … … 521 524 } 522 525 523 void STATE_APIENTRY crStateGetFinalCombinerInputParameterivNV( GLenum variable, GLenum pname, GLint *params ) 524 { 526 void STATE_APIENTRY crStateGetFinalCombinerInputParameterivNV(PCRStateTracker pState, GLenum variable, GLenum pname, GLint *params ) 527 { 528 RT_NOREF(pState); 525 529 (void) variable; 526 530 (void) pname; … … 529 533 530 534 531 void STATE_APIENTRY crStateGetCombinerInputParameterivNV( GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params )532 { 533 CRContext *g = GetCurrentContext( );535 void STATE_APIENTRY crStateGetCombinerInputParameterivNV(PCRStateTracker pState, GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params ) 536 { 537 CRContext *g = GetCurrentContext(pState); 534 538 CRRegCombinerState *r = &(g->regcombiner); 535 539 int i = stage - GL_COMBINER0_NV; … … 538 542 if (g->current.inBeginEnd) 539 543 { 540 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,544 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 541 545 "glGetCombinerParameterivNV called in begin/end"); 542 546 return; … … 544 548 545 549 if (i < 0 || i >= CR_MAX_GENERAL_COMBINERS) { 546 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,550 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 547 551 "GetCombinerInputParameterivNV(stage=0x%x)", stage); 548 552 return; … … 572 576 break; 573 577 default: 574 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,578 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 575 579 "glGetCombinerInputParameterivNV(variable=0x%x)", variable); 576 580 return; … … 600 604 break; 601 605 default: 602 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,606 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 603 607 "glGetCombinerInputParameterivNV(variable=0x%x)", variable); 604 608 return; … … 606 610 } 607 611 else { 608 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,612 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 609 613 "glGetCombinerInputParameterivNV(portion=0x%x)", portion); 610 614 } … … 620 624 return; 621 625 default: 622 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,626 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 623 627 "glGetCombinerInputParameterivNV(pname=0x%x)", pname); 624 628 return; … … 627 631 628 632 629 void STATE_APIENTRY crStateGetCombinerInputParameterfvNV( GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params )633 void STATE_APIENTRY crStateGetCombinerInputParameterfvNV(PCRStateTracker pState, GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params ) 630 634 { 631 635 GLint iparams; 632 crStateGetCombinerInputParameterivNV( stage, portion, variable, pname, &iparams);636 crStateGetCombinerInputParameterivNV(pState, stage, portion, variable, pname, &iparams); 633 637 *params = (GLfloat) iparams; 634 638 } 635 639 636 640 637 void STATE_APIENTRY crStateCombinerStageParameterfvNV( GLenum stage, GLenum pname, const GLfloat *params )638 { 639 CRContext *g = GetCurrentContext( );641 void STATE_APIENTRY crStateCombinerStageParameterfvNV(PCRStateTracker pState, GLenum stage, GLenum pname, const GLfloat *params ) 642 { 643 CRContext *g = GetCurrentContext(pState); 640 644 CRRegCombinerState *r = &(g->regcombiner); 641 CRStateBits *sb = GetCurrentBits( );645 CRStateBits *sb = GetCurrentBits(pState); 642 646 CRRegCombinerBits *rb = &(sb->regcombiner); 643 647 … … 645 649 if( stage >= g->limits.maxGeneralCombiners ) 646 650 { 647 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerStageParameterfvNV passed bogus stage: 0x%x", stage+GL_COMBINER0_NV );651 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerStageParameterfvNV passed bogus stage: 0x%x", stage+GL_COMBINER0_NV ); 648 652 return; 649 653 } … … 666 670 break; 667 671 default: 668 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerStageParameter passed bogus pname: 0x%x", pname );672 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "CombinerStageParameter passed bogus pname: 0x%x", pname ); 669 673 return; 670 674 } … … 673 677 } 674 678 675 void STATE_APIENTRY crStateGetCombinerStageParameterfvNV( GLenum stage, GLenum pname, GLfloat *params )676 { 677 CRContext *g = GetCurrentContext( );679 void STATE_APIENTRY crStateGetCombinerStageParameterfvNV(PCRStateTracker pState, GLenum stage, GLenum pname, GLfloat *params ) 680 { 681 CRContext *g = GetCurrentContext(pState); 678 682 CRRegCombinerState *r = &(g->regcombiner); 679 683 … … 681 685 if( stage >= g->limits.maxGeneralCombiners ) 682 686 { 683 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "GetCombinerStageParameterfvNV passed bogus stage: 0x%x", stage+GL_COMBINER0_NV );687 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "GetCombinerStageParameterfvNV passed bogus stage: 0x%x", stage+GL_COMBINER0_NV ); 684 688 return; 685 689 } … … 699 703 break; 700 704 default: 701 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "GetCombinerStageParameter passed bogus pname: 0x%x", pname );705 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "GetCombinerStageParameter passed bogus pname: 0x%x", pname ); 702 706 return; 703 707 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_regcombiner.txt
r15532 r78375 14 14 :regCombinerStageColor0[i]:stageConstantColor0[i]|r,g,b,a:CombinerStageParameterfvNV, GL_COMBINER0_NV+i, GL_CONSTANT_COLOR0_NV 15 15 :regCombinerStageColor1[i]:stageConstantColor1[i]|r,g,b,a:CombinerStageParameterfvNV, GL_COMBINER0_NV+i, GL_CONSTANT_COLOR1_NV 16 :regCombinerInput[i]:rgb[i].a,rgb[i].aMapping,rgb[i].aPortion:* diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_RGB, GL_VARIABLE_A_NV, to->rgb[i].a, to->rgb[i].aMapping, to->rgb[i].aPortion );17 :regCombinerInput[i]:rgb[i].b,rgb[i].bMapping,rgb[i].bPortion:* diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_RGB, GL_VARIABLE_B_NV, to->rgb[i].b, to->rgb[i].bMapping, to->rgb[i].bPortion );18 :regCombinerInput[i]:rgb[i].c,rgb[i].cMapping,rgb[i].cPortion:* diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_RGB, GL_VARIABLE_C_NV, to->rgb[i].c, to->rgb[i].cMapping, to->rgb[i].cPortion );19 :regCombinerInput[i]:rgb[i].d,rgb[i].dMapping,rgb[i].dPortion:* diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_RGB, GL_VARIABLE_D_NV, to->rgb[i].d, to->rgb[i].dMapping, to->rgb[i].dPortion );20 :regCombinerInput[i]:alpha[i].a,alpha[i].aMapping,alpha[i].aPortion:* diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_ALPHA, GL_VARIABLE_A_NV, to->alpha[i].a, to->alpha[i].aMapping, to->alpha[i].aPortion );21 :regCombinerInput[i]:alpha[i].b,alpha[i].bMapping,alpha[i].bPortion:* diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_ALPHA, GL_VARIABLE_B_NV, to->alpha[i].b, to->alpha[i].bMapping, to->alpha[i].bPortion );22 :regCombinerInput[i]:alpha[i].c,alpha[i].cMapping,alpha[i].cPortion:* diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_ALPHA, GL_VARIABLE_C_NV, to->alpha[i].c, to->alpha[i].cMapping, to->alpha[i].cPortion );23 :regCombinerInput[i]:alpha[i].d,alpha[i].dMapping,alpha[i].dPortion:* diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_ALPHA, GL_VARIABLE_D_NV, to->alpha[i].d, to->alpha[i].dMapping, to->alpha[i].dPortion );24 :regCombinerOutput[i]:rgb[i]|abOutput,cdOutput,sumOutput,scale,bias,abDotProduct,cdDotProduct,muxSum:* diff_api.CombinerOutputNV( GL_COMBINER0_NV+i, GL_RGB, to->rgb[i].abOutput, to->rgb[i].cdOutput, to->rgb[i].sumOutput, to->rgb[i].scale, to->rgb[i].bias, to->rgb[i].abDotProduct, to->rgb[i].cdDotProduct, to->rgb[i].muxSum );25 :regCombinerOutput[i]:alpha[i]|abOutput,cdOutput,sumOutput,scale,bias,abDotProduct,cdDotProduct,muxSum:* diff_api.CombinerOutputNV( GL_COMBINER0_NV+i, GL_ALPHA, to->alpha[i].abOutput, to->alpha[i].cdOutput, to->alpha[i].sumOutput, to->alpha[i].scale, to->alpha[i].bias, to->alpha[i].abDotProduct, to->alpha[i].cdDotProduct, to->alpha[i].muxSum );16 :regCombinerInput[i]:rgb[i].a,rgb[i].aMapping,rgb[i].aPortion:*pState->diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_RGB, GL_VARIABLE_A_NV, to->rgb[i].a, to->rgb[i].aMapping, to->rgb[i].aPortion ); 17 :regCombinerInput[i]:rgb[i].b,rgb[i].bMapping,rgb[i].bPortion:*pState->diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_RGB, GL_VARIABLE_B_NV, to->rgb[i].b, to->rgb[i].bMapping, to->rgb[i].bPortion ); 18 :regCombinerInput[i]:rgb[i].c,rgb[i].cMapping,rgb[i].cPortion:*pState->diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_RGB, GL_VARIABLE_C_NV, to->rgb[i].c, to->rgb[i].cMapping, to->rgb[i].cPortion ); 19 :regCombinerInput[i]:rgb[i].d,rgb[i].dMapping,rgb[i].dPortion:*pState->diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_RGB, GL_VARIABLE_D_NV, to->rgb[i].d, to->rgb[i].dMapping, to->rgb[i].dPortion ); 20 :regCombinerInput[i]:alpha[i].a,alpha[i].aMapping,alpha[i].aPortion:*pState->diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_ALPHA, GL_VARIABLE_A_NV, to->alpha[i].a, to->alpha[i].aMapping, to->alpha[i].aPortion ); 21 :regCombinerInput[i]:alpha[i].b,alpha[i].bMapping,alpha[i].bPortion:*pState->diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_ALPHA, GL_VARIABLE_B_NV, to->alpha[i].b, to->alpha[i].bMapping, to->alpha[i].bPortion ); 22 :regCombinerInput[i]:alpha[i].c,alpha[i].cMapping,alpha[i].cPortion:*pState->diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_ALPHA, GL_VARIABLE_C_NV, to->alpha[i].c, to->alpha[i].cMapping, to->alpha[i].cPortion ); 23 :regCombinerInput[i]:alpha[i].d,alpha[i].dMapping,alpha[i].dPortion:*pState->diff_api.CombinerInputNV( GL_COMBINER0_NV+i, GL_ALPHA, GL_VARIABLE_D_NV, to->alpha[i].d, to->alpha[i].dMapping, to->alpha[i].dPortion ); 24 :regCombinerOutput[i]:rgb[i]|abOutput,cdOutput,sumOutput,scale,bias,abDotProduct,cdDotProduct,muxSum:*pState->diff_api.CombinerOutputNV( GL_COMBINER0_NV+i, GL_RGB, to->rgb[i].abOutput, to->rgb[i].cdOutput, to->rgb[i].sumOutput, to->rgb[i].scale, to->rgb[i].bias, to->rgb[i].abDotProduct, to->rgb[i].cdDotProduct, to->rgb[i].muxSum ); 25 :regCombinerOutput[i]:alpha[i]|abOutput,cdOutput,sumOutput,scale,bias,abDotProduct,cdDotProduct,muxSum:*pState->diff_api.CombinerOutputNV( GL_COMBINER0_NV+i, GL_ALPHA, to->alpha[i].abOutput, to->alpha[i].cdOutput, to->alpha[i].sumOutput, to->alpha[i].scale, to->alpha[i].bias, to->alpha[i].abDotProduct, to->alpha[i].cdDotProduct, to->alpha[i].muxSum ); 26 26 %flush 27 27 >} 28 :regCombinerFinalInput:a,aMapping,aPortion:* diff_api.FinalCombinerInputNV( GL_VARIABLE_A_NV, to->a, to->aMapping, to->aPortion );29 :regCombinerFinalInput:b,bMapping,bPortion:* diff_api.FinalCombinerInputNV( GL_VARIABLE_B_NV, to->b, to->bMapping, to->bPortion );30 :regCombinerFinalInput:c,cMapping,cPortion:* diff_api.FinalCombinerInputNV( GL_VARIABLE_C_NV, to->c, to->cMapping, to->cPortion );31 :regCombinerFinalInput:d,dMapping,dPortion:* diff_api.FinalCombinerInputNV( GL_VARIABLE_D_NV, to->d, to->dMapping, to->dPortion );32 :regCombinerFinalInput:e,eMapping,ePortion:* diff_api.FinalCombinerInputNV( GL_VARIABLE_E_NV, to->e, to->eMapping, to->ePortion );33 :regCombinerFinalInput:f,fMapping,fPortion:* diff_api.FinalCombinerInputNV( GL_VARIABLE_F_NV, to->f, to->fMapping, to->fPortion );34 :regCombinerFinalInput:g,gMapping,gPortion:* diff_api.FinalCombinerInputNV( GL_VARIABLE_G_NV, to->g, to->gMapping, to->gPortion );28 :regCombinerFinalInput:a,aMapping,aPortion:*pState->diff_api.FinalCombinerInputNV( GL_VARIABLE_A_NV, to->a, to->aMapping, to->aPortion ); 29 :regCombinerFinalInput:b,bMapping,bPortion:*pState->diff_api.FinalCombinerInputNV( GL_VARIABLE_B_NV, to->b, to->bMapping, to->bPortion ); 30 :regCombinerFinalInput:c,cMapping,cPortion:*pState->diff_api.FinalCombinerInputNV( GL_VARIABLE_C_NV, to->c, to->cMapping, to->cPortion ); 31 :regCombinerFinalInput:d,dMapping,dPortion:*pState->diff_api.FinalCombinerInputNV( GL_VARIABLE_D_NV, to->d, to->dMapping, to->dPortion ); 32 :regCombinerFinalInput:e,eMapping,ePortion:*pState->diff_api.FinalCombinerInputNV( GL_VARIABLE_E_NV, to->e, to->eMapping, to->ePortion ); 33 :regCombinerFinalInput:f,fMapping,fPortion:*pState->diff_api.FinalCombinerInputNV( GL_VARIABLE_F_NV, to->f, to->fMapping, to->fPortion ); 34 :regCombinerFinalInput:g,gMapping,gPortion:*pState->diff_api.FinalCombinerInputNV( GL_VARIABLE_G_NV, to->g, to->gMapping, to->gPortion ); 35 35 %flush 36 36 %target=to -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c
r78263 r78375 51 51 */ 52 52 53 /** 54 * Helper for walking the hash tables. 55 */ 56 typedef struct CRStateSnapshotWalkArgs 57 { 58 PSSMHANDLE pSSM; 59 PCRStateTracker pState; 60 } CRStateSnapshotWalkArgs; 61 typedef CRStateSnapshotWalkArgs *PCRStateSnapshotWalkArgs; 62 53 63 static int32_t crStateAllocAndSSMR3GetMem(PSSMHANDLE pSSM, void **pBuffer, size_t cbBuffer) 54 64 { … … 396 406 } 397 407 398 static int32_t crStateSaveTextureObjData( CRTextureObj *pTexture, PSSMHANDLE pSSM)408 static int32_t crStateSaveTextureObjData(PCRStateTracker pState, CRTextureObj *pTexture, PSSMHANDLE pSSM) 399 409 { 400 410 int32_t rc, face, i; … … 433 443 { 434 444 GLenum getEnum; 435 diff_api.BindTexture(pTexture->target, pTexture->hwid);445 pState->diff_api.BindTexture(pTexture->target, pTexture->hwid); 436 446 bound = 1; 437 447 … … 465 475 { 466 476 GLint curTex; 467 diff_api.GetIntegerv(getEnum, &curTex);477 pState->diff_api.GetIntegerv(getEnum, &curTex); 468 478 if ((GLuint)curTex != pTexture->hwid) 469 479 { … … 506 516 crDebug("get image: compressed %i, face %i, level %i, width %i, height %i, bytes %i", 507 517 ptl->compressed, face, i, ptl->width, ptl->height, ptl->bytes); 508 diff_api.GetTexLevelParameteriv(target, i, GL_TEXTURE_WIDTH, &w);509 diff_api.GetTexLevelParameteriv(target, i, GL_TEXTURE_HEIGHT, &h);518 pState->diff_api.GetTexLevelParameteriv(target, i, GL_TEXTURE_WIDTH, &w); 519 pState->diff_api.GetTexLevelParameteriv(target, i, GL_TEXTURE_HEIGHT, &h); 510 520 if (w!=ptl->width || h!=ptl->height) 511 521 { … … 523 533 if (!ptl->compressed) 524 534 { 525 diff_api.GetTexImage(target, i, ptl->format, ptl->type, pImg);535 pState->diff_api.GetTexImage(target, i, ptl->format, ptl->type, pImg); 526 536 } 527 537 else 528 538 { 529 diff_api.GetCompressedTexImageARB(target, i, pImg);539 pState->diff_api.GetCompressedTexImageARB(target, i, pImg); 530 540 } 531 541 } … … 602 612 { 603 613 CRTextureObj *pTexture = (CRTextureObj *) data1; 604 PSSMHANDLE pSSM = (PSSMHANDLE) data2; 614 PCRStateSnapshotWalkArgs pArgs = (PCRStateSnapshotWalkArgs)data2; 615 PCRStateTracker pState = pArgs->pState; 616 PSSMHANDLE pSSM = pArgs->pSSM; 605 617 int32_t rc; 606 618 … … 611 623 rc = SSMR3PutMem(pSSM, pTexture, sizeof(*pTexture)); 612 624 CRASSERT(rc == VINF_SUCCESS); 613 rc = crStateSaveTextureObjData(p Texture, pSSM);625 rc = crStateSaveTextureObjData(pState, pTexture, pSSM); 614 626 CRASSERT(rc == VINF_SUCCESS); 615 627 } … … 857 869 { 858 870 CRBufferObject *pBufferObj = (CRBufferObject *) data1; 859 PSSMHANDLE pSSM = (PSSMHANDLE) data2; 871 PCRStateSnapshotWalkArgs pArgs = (PCRStateSnapshotWalkArgs)data2; 872 PCRStateTracker pState = pArgs->pState; 873 PSSMHANDLE pSSM = pArgs->pSSM; 860 874 int32_t rc; 861 875 … … 877 891 else if (pBufferObj->id!=0 && pBufferObj->size>0) 878 892 { 879 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pBufferObj->hwid);880 pBufferObj->pointer = diff_api.MapBufferARB(GL_ARRAY_BUFFER_ARB, GL_READ_ONLY_ARB);893 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pBufferObj->hwid); 894 pBufferObj->pointer = pState->diff_api.MapBufferARB(GL_ARRAY_BUFFER_ARB, GL_READ_ONLY_ARB); 881 895 rc = SSMR3PutMem(pSSM, &pBufferObj->pointer, sizeof(pBufferObj->pointer)); 882 896 CRASSERT(rc == VINF_SUCCESS); … … 886 900 CRASSERT(rc == VINF_SUCCESS); 887 901 } 888 diff_api.UnmapBufferARB(GL_ARRAY_BUFFER_ARB);902 pState->diff_api.UnmapBufferARB(GL_ARRAY_BUFFER_ARB); 889 903 pBufferObj->pointer = NULL; 890 904 } … … 1049 1063 { 1050 1064 CRGLSLShader *pShader = (CRGLSLShader*) data1; 1051 PSSMHANDLE pSSM = (PSSMHANDLE) data2; 1065 PCRStateSnapshotWalkArgs pArgs = (PCRStateSnapshotWalkArgs)data2; 1066 PCRStateTracker pState = pArgs->pState; 1067 PSSMHANDLE pSSM = pArgs->pSSM; 1052 1068 int32_t rc; 1053 1069 … … 1067 1083 GLchar *source=NULL; 1068 1084 1069 diff_api.GetShaderiv(pShader->hwid, GL_SHADER_SOURCE_LENGTH, &sLen);1085 pState->diff_api.GetShaderiv(pShader->hwid, GL_SHADER_SOURCE_LENGTH, &sLen); 1070 1086 if (sLen>0) 1071 1087 { 1072 1088 source = (GLchar*) crAlloc(sLen); 1073 diff_api.GetShaderSource(pShader->hwid, sLen, NULL, source);1089 pState->diff_api.GetShaderSource(pShader->hwid, sLen, NULL, source); 1074 1090 } 1075 1091 … … 1128 1144 { 1129 1145 CRGLSLProgram *pProgram = (CRGLSLProgram*) data1; 1130 PSSMHANDLE pSSM = (PSSMHANDLE) data2; 1146 PCRStateSnapshotWalkArgs pArgs = (PCRStateSnapshotWalkArgs)data2; 1147 PCRStateTracker pState = pArgs->pState; 1148 PSSMHANDLE pSSM = pArgs->pSSM; 1131 1149 int32_t rc; 1132 1150 uint32_t ui32; … … 1153 1171 rc = SSMR3PutU32(pSSM, ui32); 1154 1172 CRASSERT(rc == VINF_SUCCESS); 1155 crHashtableWalk(pProgram->currentState.attachedShaders, crStateSaveGLSLShaderCB, p SSM);1173 crHashtableWalk(pProgram->currentState.attachedShaders, crStateSaveGLSLShaderCB, pArgs); 1156 1174 } 1157 1175 … … 1159 1177 crStateSaveGLSLProgramAttribs(&pProgram->activeState, pSSM); 1160 1178 1161 diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformLen);1162 diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_UNIFORMS, &activeUniforms);1179 pState->diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformLen); 1180 pState->diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_UNIFORMS, &activeUniforms); 1163 1181 1164 1182 if (!maxUniformLen) … … 1184 1202 for (i=0; i<activeUniforms; ++i) 1185 1203 { 1186 diff_api.GetActiveUniform(pProgram->hwid, i, maxUniformLen, NULL, &size, &type, name);1204 pState->diff_api.GetActiveUniform(pProgram->hwid, i, maxUniformLen, NULL, &size, &type, name); 1187 1205 uniformsCount += size; 1188 1206 } … … 1200 1218 for (i=0; i<activeUniforms; ++i) 1201 1219 { 1202 diff_api.GetActiveUniform(pProgram->hwid, i, maxUniformLen, NULL, &size, &type, name);1220 pState->diff_api.GetActiveUniform(pProgram->hwid, i, maxUniformLen, NULL, &size, &type, name); 1203 1221 1204 1222 if (size>1) … … 1217 1235 sprintf(pIndexStr, "[%i]", j); 1218 1236 } 1219 location = diff_api.GetUniformLocation(pProgram->hwid, name);1237 location = pState->diff_api.GetUniformLocation(pProgram->hwid, name); 1220 1238 1221 1239 rc = SSMR3PutMem(pSSM, &type, sizeof(type)); … … 1224 1242 crStateSaveString(name, pSSM); 1225 1243 1226 if (crStateIsIntUniform( type))1244 if (crStateIsIntUniform(pState, type)) 1227 1245 { 1228 diff_api.GetUniformiv(pProgram->hwid, location, &idata[0]);1229 rc = SSMR3PutMem(pSSM, &idata[0], crStateGetUniformSize( type)*sizeof(idata[0]));1246 pState->diff_api.GetUniformiv(pProgram->hwid, location, &idata[0]); 1247 rc = SSMR3PutMem(pSSM, &idata[0], crStateGetUniformSize(pState, type)*sizeof(idata[0])); 1230 1248 CRASSERT(rc == VINF_SUCCESS); 1231 1249 } 1232 1250 else 1233 1251 { 1234 diff_api.GetUniformfv(pProgram->hwid, location, &fdata[0]);1235 rc = SSMR3PutMem(pSSM, &fdata[0], crStateGetUniformSize( type)*sizeof(fdata[0]));1252 pState->diff_api.GetUniformfv(pProgram->hwid, location, &fdata[0]); 1253 rc = SSMR3PutMem(pSSM, &fdata[0], crStateGetUniformSize(pState, type)*sizeof(fdata[0])); 1236 1254 CRASSERT(rc == VINF_SUCCESS); 1237 1255 } … … 1473 1491 int32_t crStateSaveContext(CRContext *pContext, PSSMHANDLE pSSM) 1474 1492 { 1493 PCRStateTracker pState = pContext->pStateTracker; 1475 1494 int32_t rc, i; 1476 1495 uint32_t ui32, j; 1477 1496 GLboolean bSaveShared = GL_TRUE; 1497 CRStateSnapshotWalkArgs Args; 1498 1499 Args.pSSM = pSSM; 1500 Args.pState = pState; 1478 1501 1479 1502 CRASSERT(pContext && pSSM); … … 1539 1562 1540 1563 /* Save textures */ 1541 rc = crStateSaveTextureObjData( &pContext->texture.base1D, pSSM);1542 AssertRCReturn(rc, rc); 1543 rc = crStateSaveTextureObjData( &pContext->texture.base2D, pSSM);1544 AssertRCReturn(rc, rc); 1545 rc = crStateSaveTextureObjData( &pContext->texture.base3D, pSSM);1546 AssertRCReturn(rc, rc); 1547 rc = crStateSaveTextureObjData( &pContext->texture.proxy1D, pSSM);1548 AssertRCReturn(rc, rc); 1549 rc = crStateSaveTextureObjData( &pContext->texture.proxy2D, pSSM);1550 AssertRCReturn(rc, rc); 1551 rc = crStateSaveTextureObjData( &pContext->texture.proxy3D, pSSM);1564 rc = crStateSaveTextureObjData(pState, &pContext->texture.base1D, pSSM); 1565 AssertRCReturn(rc, rc); 1566 rc = crStateSaveTextureObjData(pState, &pContext->texture.base2D, pSSM); 1567 AssertRCReturn(rc, rc); 1568 rc = crStateSaveTextureObjData(pState, &pContext->texture.base3D, pSSM); 1569 AssertRCReturn(rc, rc); 1570 rc = crStateSaveTextureObjData(pState, &pContext->texture.proxy1D, pSSM); 1571 AssertRCReturn(rc, rc); 1572 rc = crStateSaveTextureObjData(pState, &pContext->texture.proxy2D, pSSM); 1573 AssertRCReturn(rc, rc); 1574 rc = crStateSaveTextureObjData(pState, &pContext->texture.proxy3D, pSSM); 1552 1575 #ifdef CR_ARB_texture_cube_map 1553 rc = crStateSaveTextureObjData( &pContext->texture.baseCubeMap, pSSM);1554 AssertRCReturn(rc, rc); 1555 rc = crStateSaveTextureObjData( &pContext->texture.proxyCubeMap, pSSM);1576 rc = crStateSaveTextureObjData(pState, &pContext->texture.baseCubeMap, pSSM); 1577 AssertRCReturn(rc, rc); 1578 rc = crStateSaveTextureObjData(pState, &pContext->texture.proxyCubeMap, pSSM); 1556 1579 AssertRCReturn(rc, rc); 1557 1580 #endif 1558 1581 #ifdef CR_NV_texture_rectangle 1559 rc = crStateSaveTextureObjData( &pContext->texture.baseRect, pSSM);1560 AssertRCReturn(rc, rc); 1561 rc = crStateSaveTextureObjData( &pContext->texture.proxyRect, pSSM);1582 rc = crStateSaveTextureObjData(pState, &pContext->texture.baseRect, pSSM); 1583 AssertRCReturn(rc, rc); 1584 rc = crStateSaveTextureObjData(pState, &pContext->texture.proxyRect, pSSM); 1562 1585 AssertRCReturn(rc, rc); 1563 1586 #endif … … 1582 1605 pTexUnit = &pContext->texture.unit[pContext->texture.curTextureUnit]; 1583 1606 1584 diff_api.BindTexture(GL_TEXTURE_1D, pTexUnit->currentTexture1D->hwid);1585 diff_api.BindTexture(GL_TEXTURE_2D, pTexUnit->currentTexture2D->hwid);1586 diff_api.BindTexture(GL_TEXTURE_3D, pTexUnit->currentTexture3D->hwid);1607 pState->diff_api.BindTexture(GL_TEXTURE_1D, pTexUnit->currentTexture1D->hwid); 1608 pState->diff_api.BindTexture(GL_TEXTURE_2D, pTexUnit->currentTexture2D->hwid); 1609 pState->diff_api.BindTexture(GL_TEXTURE_3D, pTexUnit->currentTexture3D->hwid); 1587 1610 #ifdef CR_ARB_texture_cube_map 1588 diff_api.BindTexture(GL_TEXTURE_CUBE_MAP_ARB, pTexUnit->currentTextureCubeMap->hwid);1611 pState->diff_api.BindTexture(GL_TEXTURE_CUBE_MAP_ARB, pTexUnit->currentTextureCubeMap->hwid); 1589 1612 #endif 1590 1613 #ifdef CR_NV_texture_rectangle 1591 diff_api.BindTexture(GL_TEXTURE_RECTANGLE_NV, pTexUnit->currentTextureRect->hwid);1614 pState->diff_api.BindTexture(GL_TEXTURE_RECTANGLE_NV, pTexUnit->currentTextureRect->hwid); 1592 1615 #endif 1593 1616 } … … 1676 1699 1677 1700 /* Save default one*/ 1678 crStateSaveBufferObjectCB(0, pContext->bufferobject.nullBuffer, pSSM);1701 crStateSaveBufferObjectCB(0, pContext->bufferobject.nullBuffer, &Args); 1679 1702 1680 1703 if (bSaveShared) 1681 1704 { 1682 1705 /* Save all the rest */ 1683 crHashtableWalk(pContext->shared->buffersTable, crStateSaveBufferObjectCB, pSSM);1706 crHashtableWalk(pContext->shared->buffersTable, crStateSaveBufferObjectCB, &Args); 1684 1707 } 1685 1708 1686 1709 /* Restore binding */ 1687 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pContext->bufferobject.arrayBuffer->hwid);1710 pState->diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pContext->bufferobject.arrayBuffer->hwid); 1688 1711 1689 1712 /* Save pointers */ … … 1794 1817 } 1795 1818 1796 int32_t crStateSaveGlobals(P SSMHANDLE pSSM)1819 int32_t crStateSaveGlobals(PCRStateTracker pState, PSSMHANDLE pSSM) 1797 1820 { 1798 1821 /* don't need that for now */ … … 1812 1835 #undef CRSTATE_BITS_OP 1813 1836 #else 1814 RT_NOREF(pS SM);1837 RT_NOREF(pState, pSSM); 1815 1838 #endif 1816 1839 return VINF_SUCCESS; 1817 1840 } 1818 1841 1819 int32_t crStateLoadGlobals(P SSMHANDLE pSSM, uint32_t u32Version)1842 int32_t crStateLoadGlobals(PCRStateTracker pState, PSSMHANDLE pSSM, uint32_t u32Version) 1820 1843 { 1821 1844 CRStateBits *pBits; 1822 1845 int rc; 1823 CRASSERT( g_cContexts >= 1);1824 if ( g_cContexts <= 1)1846 CRASSERT(pState->cContexts >= 1); 1847 if (pState->cContexts <= 1) 1825 1848 return VINF_SUCCESS; 1826 1849 1827 pBits = GetCurrentBits( );1850 pBits = GetCurrentBits(pState); 1828 1851 1829 1852 if (u32Version >= SHCROGL_SSM_VERSION_WITH_STATE_BITS) … … 1879 1902 int32_t crStateLoadContext(CRContext *pContext, CRHashTable * pCtxTable, PFNCRSTATE_CONTEXT_GET pfnCtxGet, PSSMHANDLE pSSM, uint32_t u32Version) 1880 1903 { 1904 PCRStateTracker pState = pContext->pStateTracker; 1881 1905 CRContext* pTmpContext; 1882 1906 int32_t rc, i, j; … … 2040 2064 CRASSERT(pContext->shared->refCount==1); 2041 2065 bLoadShared = GL_FALSE; 2042 crStateFreeShared(p Context, pContext->shared);2066 crStateFreeShared(pState, pContext, pContext->shared); 2043 2067 pContext->shared = NULL; 2044 2068 pTmpContext->shared->refCount++; … … 2657 2681 pProgram->pUniforms[k].name = crStateLoadString(pSSM); 2658 2682 2659 if (crStateIsIntUniform(p Program->pUniforms[k].type))2683 if (crStateIsIntUniform(pState, pProgram->pUniforms[k].type)) 2660 2684 { 2661 2685 itemsize = sizeof(GLint); 2662 2686 } else itemsize = sizeof(GLfloat); 2663 2687 2664 datasize = crStateGetUniformSize(p Program->pUniforms[k].type)*itemsize;2688 datasize = crStateGetUniformSize(pState, pProgram->pUniforms[k].type)*itemsize; 2665 2689 pProgram->pUniforms[k].data = crAlloc((unsigned int /* this case is just so stupid */)datasize); 2666 2690 if (!pProgram->pUniforms[k].data) return VERR_NO_MEMORY; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_stencil.c
r69392 r78375 11 11 12 12 13 static GLint crStateStencilBufferGetIdxAndCount( CRStencilState *s, GLenum face, GLint *pIdx, GLint *pBitsIdx)13 static GLint crStateStencilBufferGetIdxAndCount(PCRStateTracker pState, CRStencilState *s, GLenum face, GLint *pIdx, GLint *pBitsIdx) 14 14 { 15 15 switch (face) … … 39 39 return 1; 40 40 default: 41 crStateError( __LINE__,__FILE__,GL_INVALID_ENUM, "crStateStencilBufferGetIdxAndCount");41 crStateError(pState, __LINE__,__FILE__,GL_INVALID_ENUM, "crStateStencilBufferGetIdxAndCount"); 42 42 return 0; 43 43 } … … 68 68 { 69 69 CRStencilState *s = &ctx->stencil; 70 CRStateBits *stateb = GetCurrentBits( );70 CRStateBits *stateb = GetCurrentBits(ctx->pStateTracker); 71 71 CRStencilBits *sb = &(stateb->stencil); 72 72 int i; … … 108 108 } 109 109 110 static void crStateStencilFuncPerform( GLenum face, GLenum func, GLint ref, GLuint mask)111 { 112 CRContext *g = GetCurrentContext( );110 static void crStateStencilFuncPerform(PCRStateTracker pState, GLenum face, GLenum func, GLint ref, GLuint mask) 111 { 112 CRContext *g = GetCurrentContext(pState); 113 113 CRStencilState *s = &(g->stencil); 114 CRStateBits *stateb = GetCurrentBits( );114 CRStateBits *stateb = GetCurrentBits(pState); 115 115 CRStencilBits *sb = &(stateb->stencil); 116 116 GLint idx, bitsIdx, count, i; … … 119 119 if (g->current.inBeginEnd) 120 120 { 121 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,121 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 122 122 "glStencilFunc called in begin/end"); 123 123 return; … … 135 135 func != GL_ALWAYS) 136 136 { 137 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,137 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 138 138 "glStencilFunc called with bogu func: %d", func); 139 139 return; 140 140 } 141 141 142 count = crStateStencilBufferGetIdxAndCount( s, face, &idx, &bitsIdx);142 count = crStateStencilBufferGetIdxAndCount(pState, s, face, &idx, &bitsIdx); 143 143 if (count) 144 144 { … … 153 153 } 154 154 155 void STATE_APIENTRY crStateStencilFuncSeparate( GLenum face, GLenum func, GLint ref, GLuint mask)155 void STATE_APIENTRY crStateStencilFuncSeparate(PCRStateTracker pState, GLenum face, GLenum func, GLint ref, GLuint mask) 156 156 { 157 157 if (!face) … … 159 159 /* crStateStencilFuncPerform accepts 0 value, while glStencilFuncSeparate does not, 160 160 * filter it out here */ 161 crStateError( __LINE__,__FILE__,GL_INVALID_ENUM, "crStateStencilFuncSeparate");161 crStateError(pState, __LINE__,__FILE__,GL_INVALID_ENUM, "crStateStencilFuncSeparate"); 162 162 return; 163 163 } 164 crStateStencilFuncPerform( face, func, ref, mask);165 } 166 167 void STATE_APIENTRY crStateStencilFunc( GLenum func, GLint ref, GLuint mask)168 { 169 crStateStencilFuncPerform( 0, func, ref, mask);164 crStateStencilFuncPerform(pState, face, func, ref, mask); 165 } 166 167 void STATE_APIENTRY crStateStencilFunc(PCRStateTracker pState, GLenum func, GLint ref, GLuint mask) 168 { 169 crStateStencilFuncPerform(pState, 0, func, ref, mask); 170 170 } 171 171 … … 178 178 } 179 179 180 static void crStateStencilOpPerform ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass)181 { 182 CRContext *g = GetCurrentContext( );180 static void crStateStencilOpPerform (PCRStateTracker pState, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) 181 { 182 CRContext *g = GetCurrentContext(pState); 183 183 CRStencilState *s = &(g->stencil); 184 CRStateBits *stateb = GetCurrentBits( );184 CRStateBits *stateb = GetCurrentBits(pState); 185 185 CRStencilBits *sb = &(stateb->stencil); 186 186 GLint idx, bitsIdx, count, i; … … 188 188 if (g->current.inBeginEnd) 189 189 { 190 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,190 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 191 191 "glStencilOp called in begin/end"); 192 192 return; … … 208 208 break; 209 209 default: 210 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,210 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 211 211 "glStencilOp called with bogus fail: %d", fail); 212 212 return; … … 226 226 break; 227 227 default: 228 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,228 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 229 229 "glStencilOp called with bogus zfail: %d", zfail); 230 230 return; … … 244 244 break; 245 245 default: 246 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,246 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 247 247 "glStencilOp called with bogus zpass: %d", zpass); 248 248 return; 249 249 } 250 250 251 count = crStateStencilBufferGetIdxAndCount( s, face, &idx, &bitsIdx);251 count = crStateStencilBufferGetIdxAndCount(pState, s, face, &idx, &bitsIdx); 252 252 if (count) 253 253 { … … 263 263 } 264 264 265 void STATE_APIENTRY crStateStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass)265 void STATE_APIENTRY crStateStencilOpSeparate (PCRStateTracker pState, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) 266 266 { 267 267 if (!face) … … 269 269 /* crStateStencilOpPerform accepts 0 value, while glStencilOpSeparate does not, 270 270 * filter it out here */ 271 crStateError( __LINE__,__FILE__,GL_INVALID_ENUM, "crStateStencilOpSeparate");271 crStateError(pState, __LINE__,__FILE__,GL_INVALID_ENUM, "crStateStencilOpSeparate"); 272 272 return; 273 273 } 274 crStateStencilOpPerform ( 0, fail, zfail, zpass);275 } 276 277 void STATE_APIENTRY crStateStencilOp ( GLenum fail, GLenum zfail, GLenum zpass)278 { 279 crStateStencilOpPerform ( 0, fail, zfail, zpass);280 } 281 282 void STATE_APIENTRY crStateClearStencil ( GLint c)283 { 284 CRContext *g = GetCurrentContext( );274 crStateStencilOpPerform (pState, 0, fail, zfail, zpass); 275 } 276 277 void STATE_APIENTRY crStateStencilOp (PCRStateTracker pState, GLenum fail, GLenum zfail, GLenum zpass) 278 { 279 crStateStencilOpPerform (pState, 0, fail, zfail, zpass); 280 } 281 282 void STATE_APIENTRY crStateClearStencil (PCRStateTracker pState, GLint c) 283 { 284 CRContext *g = GetCurrentContext(pState); 285 285 CRStencilState *s = &(g->stencil); 286 CRStateBits *stateb = GetCurrentBits( );286 CRStateBits *stateb = GetCurrentBits(pState); 287 287 CRStencilBits *sb = &(stateb->stencil); 288 288 289 289 if (g->current.inBeginEnd) 290 290 { 291 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,291 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 292 292 "glClearStencil called in begin/end"); 293 293 return; … … 302 302 } 303 303 304 void STATE_APIENTRY crStateStencilMask ( GLuint mask)305 { 306 CRContext *g = GetCurrentContext( );304 void STATE_APIENTRY crStateStencilMask (PCRStateTracker pState, GLuint mask) 305 { 306 CRContext *g = GetCurrentContext(pState); 307 307 CRStencilState *s = &(g->stencil); 308 CRStateBits *stateb = GetCurrentBits( );308 CRStateBits *stateb = GetCurrentBits(pState); 309 309 CRStencilBits *sb = &(stateb->stencil); 310 310 311 311 if (g->current.inBeginEnd) 312 312 { 313 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,313 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 314 314 "glStencilMask called in begin/end"); 315 315 return; … … 324 324 } 325 325 326 void STATE_APIENTRY crStateActiveStencilFaceEXT ( GLenum face)327 { 328 CRContext *g = GetCurrentContext( );326 void STATE_APIENTRY crStateActiveStencilFaceEXT (PCRStateTracker pState, GLenum face) 327 { 328 CRContext *g = GetCurrentContext(pState); 329 329 CRStencilState *s = &(g->stencil); 330 CRStateBits *stateb = GetCurrentBits( );330 CRStateBits *stateb = GetCurrentBits(pState); 331 331 CRStencilBits *sb = &(stateb->stencil); 332 332 … … 338 338 break; 339 339 default: 340 crStateError( __LINE__,__FILE__,GL_INVALID_ENUM, "crStateActiveStencilFaceEXT");340 crStateError(pState, __LINE__,__FILE__,GL_INVALID_ENUM, "crStateActiveStencilFaceEXT"); 341 341 return; 342 342 } … … 348 348 #ifdef CRSTATE_DEBUG_STENCIL_ERR 349 349 #define CRSTATE_CLEARERR() do { \ 350 while ( diff_api.GetError() != GL_NO_ERROR) {} \350 while (pState->diff_api.GetError() != GL_NO_ERROR) {} \ 351 351 } while (0) 352 352 … … 355 355 CRSTATE_CLEARERR(); \ 356 356 _op; \ 357 while ((_glErr = diff_api.GetError()) != GL_NO_ERROR) { Assert(0);} \357 while ((_glErr = pState->diff_api.GetError()) != GL_NO_ERROR) { Assert(0);} \ 358 358 }while (0) 359 359 #else … … 388 388 CRContext *fromCtx, CRContext *toCtx) 389 389 { 390 PCRStateTracker pState = fromCtx->pStateTracker; 390 391 CRStencilState *from = &(fromCtx->stencil); 391 392 CRStencilState *to = &(toCtx->stencil); … … 395 396 GLchar frontMatch = -1, backMatch = -1, toFrontBackMatch = -1; 396 397 CRbitvalue nbitID[CR_MAX_BITARRAY]; 398 399 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 400 397 401 for (j=0;j<CR_MAX_BITARRAY;j++) 398 402 nbitID[j] = ~bitID[j]; … … 402 406 { 403 407 glAble able[2]; 404 able[0] = diff_api.Disable;405 able[1] = diff_api.Enable;408 able[0] = pState->diff_api.Disable; 409 able[1] = pState->diff_api.Enable; 406 410 if (from->stencilTest != to->stencilTest) 407 411 { … … 415 419 { 416 420 glAble able[2]; 417 able[0] = diff_api.Disable;418 able[1] = diff_api.Enable;421 able[0] = pState->diff_api.Disable; 422 able[1] = pState->diff_api.Enable; 419 423 if (from->stencilTwoSideEXT != to->stencilTwoSideEXT) 420 424 { … … 429 433 if (from->clearValue != to->clearValue) 430 434 { 431 diff_api.ClearStencil (to->clearValue);435 pState->diff_api.ClearStencil (to->clearValue); 432 436 from->clearValue = to->clearValue; 433 437 } … … 466 470 if (activeFace == GL_BACK) 467 471 { 468 diff_api.ActiveStencilFaceEXT(GL_FRONT);472 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 469 473 activeFace = GL_FRONT; 470 474 } 471 475 472 diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,476 pState->diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 473 477 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 474 478 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask); … … 483 487 if (activeFace == GL_BACK) 484 488 { 485 diff_api.ActiveStencilFaceEXT(GL_FRONT);489 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 486 490 activeFace = GL_FRONT; 487 491 } 488 492 489 diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,493 pState->diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 490 494 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 491 495 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask); … … 498 502 if (activeFace == GL_BACK) 499 503 { 500 diff_api.ActiveStencilFaceEXT(GL_FRONT);504 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 501 505 activeFace = GL_FRONT; 502 506 } 503 507 504 diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func,508 pState->diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func, 505 509 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].ref, 506 510 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].mask); … … 525 529 if (activeFace == GL_BACK) 526 530 { 527 diff_api.ActiveStencilFaceEXT(GL_FRONT);528 activeFace = GL_FRONT; 529 } 530 531 diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,531 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 532 activeFace = GL_FRONT; 533 } 534 535 pState->diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 532 536 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 533 537 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask); … … 546 550 if (activeFace == GL_BACK) 547 551 { 548 diff_api.ActiveStencilFaceEXT(GL_FRONT);549 activeFace = GL_FRONT; 550 } 551 552 diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,552 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 553 activeFace = GL_FRONT; 554 } 555 556 pState->diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 553 557 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 554 558 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask); … … 564 568 if (activeFace == GL_BACK) 565 569 { 566 diff_api.ActiveStencilFaceEXT(GL_FRONT);567 activeFace = GL_FRONT; 568 } 569 570 diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func,570 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 571 activeFace = GL_FRONT; 572 } 573 574 pState->diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func, 571 575 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].ref, 572 576 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].mask); … … 590 594 if (activeFace == GL_BACK) 591 595 { 592 diff_api.ActiveStencilFaceEXT(GL_FRONT);593 activeFace = GL_FRONT; 594 } 595 596 diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,596 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 597 activeFace = GL_FRONT; 598 } 599 600 pState->diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 597 601 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 598 602 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask); … … 611 615 if (activeFace == GL_BACK) 612 616 { 613 diff_api.ActiveStencilFaceEXT(GL_FRONT);614 activeFace = GL_FRONT; 615 } 616 617 diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,617 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 618 activeFace = GL_FRONT; 619 } 620 621 pState->diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 618 622 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 619 623 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask); … … 629 633 if (activeFace == GL_BACK) 630 634 { 631 diff_api.ActiveStencilFaceEXT(GL_FRONT);632 activeFace = GL_FRONT; 633 } 634 635 diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func,635 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 636 activeFace = GL_FRONT; 637 } 638 639 pState->diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func, 636 640 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].ref, 637 641 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].mask); … … 650 654 if (activeFace == GL_FRONT) 651 655 { 652 diff_api.ActiveStencilFaceEXT(GL_BACK);656 pState->diff_api.ActiveStencilFaceEXT(GL_BACK); 653 657 activeFace = GL_BACK; 654 658 } 655 659 656 diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].func,660 pState->diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].func, 657 661 to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].ref, 658 662 to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].mask); … … 697 701 if (activeFace == GL_BACK) 698 702 { 699 diff_api.ActiveStencilFaceEXT(GL_FRONT);703 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 700 704 activeFace = GL_FRONT; 701 705 } 702 706 703 diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,707 pState->diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 704 708 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 705 709 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass); … … 715 719 if (activeFace == GL_BACK) 716 720 { 717 diff_api.ActiveStencilFaceEXT(GL_FRONT);721 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 718 722 activeFace = GL_FRONT; 719 723 } 720 724 721 diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,725 pState->diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 722 726 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 723 727 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass); … … 729 733 if (activeFace == GL_BACK) 730 734 { 731 diff_api.ActiveStencilFaceEXT(GL_FRONT);735 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 732 736 activeFace = GL_FRONT; 733 737 } 734 738 735 diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail,739 pState->diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail, 736 740 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthFail, 737 741 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthPass); … … 754 758 if (activeFace == GL_BACK) 755 759 { 756 diff_api.ActiveStencilFaceEXT(GL_FRONT);757 activeFace = GL_FRONT; 758 } 759 760 diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,760 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 761 activeFace = GL_FRONT; 762 } 763 764 pState->diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 761 765 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 762 766 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass); … … 775 779 if (activeFace == GL_BACK) 776 780 { 777 diff_api.ActiveStencilFaceEXT(GL_FRONT);778 activeFace = GL_FRONT; 779 } 780 781 diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,781 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 782 activeFace = GL_FRONT; 783 } 784 785 pState->diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 782 786 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 783 787 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass); … … 794 798 if (activeFace == GL_BACK) 795 799 { 796 diff_api.ActiveStencilFaceEXT(GL_FRONT);797 activeFace = GL_FRONT; 798 } 799 800 diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail,800 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 801 activeFace = GL_FRONT; 802 } 803 804 pState->diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail, 801 805 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthFail, 802 806 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthPass); … … 820 824 if (activeFace == GL_BACK) 821 825 { 822 diff_api.ActiveStencilFaceEXT(GL_FRONT);823 activeFace = GL_FRONT; 824 } 825 826 diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,826 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 827 activeFace = GL_FRONT; 828 } 829 830 pState->diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 827 831 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 828 832 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass); … … 841 845 if (activeFace == GL_BACK) 842 846 { 843 diff_api.ActiveStencilFaceEXT(GL_FRONT);844 activeFace = GL_FRONT; 845 } 846 847 diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,847 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 848 activeFace = GL_FRONT; 849 } 850 851 pState->diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 848 852 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 849 853 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass); … … 860 864 if (activeFace == GL_BACK) 861 865 { 862 diff_api.ActiveStencilFaceEXT(GL_FRONT);863 activeFace = GL_FRONT; 864 } 865 866 diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail,866 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 867 activeFace = GL_FRONT; 868 } 869 870 pState->diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail, 867 871 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthFail, 868 872 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthPass); … … 881 885 if (activeFace == GL_FRONT) 882 886 { 883 diff_api.ActiveStencilFaceEXT(GL_BACK);887 pState->diff_api.ActiveStencilFaceEXT(GL_BACK); 884 888 activeFace = GL_BACK; 885 889 } 886 890 887 diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].fail,891 pState->diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].fail, 888 892 to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].passDepthFail, 889 893 to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].passDepthPass); … … 900 904 if (activeFace != to->activeStencilFace) 901 905 { 902 diff_api.ActiveStencilFaceEXT(activeFace);906 pState->diff_api.ActiveStencilFaceEXT(activeFace); 903 907 } 904 908 … … 918 922 if (from->writeMask != to->writeMask) 919 923 { 920 diff_api.StencilMask (to->writeMask);924 pState->diff_api.StencilMask (to->writeMask); 921 925 from->writeMask = to->writeMask; 922 926 } … … 929 933 CRContext *fromCtx, CRContext *toCtx) 930 934 { 935 PCRStateTracker pState = fromCtx->pStateTracker; 931 936 CRStencilState *from = &(fromCtx->stencil); 932 937 CRStencilState *to = &(toCtx->stencil); … … 936 941 GLchar frontMatch = -1, backMatch = -1, toFrontBackMatch = -1; 937 942 CRbitvalue nbitID[CR_MAX_BITARRAY]; 943 944 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 945 938 946 for (j=0;j<CR_MAX_BITARRAY;j++) 939 947 nbitID[j] = ~bitID[j]; … … 943 951 { 944 952 glAble able[2]; 945 able[0] = diff_api.Disable;946 able[1] = diff_api.Enable;953 able[0] = pState->diff_api.Disable; 954 able[1] = pState->diff_api.Enable; 947 955 if (from->stencilTest != to->stencilTest) 948 956 { … … 956 964 { 957 965 glAble able[2]; 958 able[0] = diff_api.Disable;959 able[1] = diff_api.Enable;966 able[0] = pState->diff_api.Disable; 967 able[1] = pState->diff_api.Enable; 960 968 if (from->stencilTwoSideEXT != to->stencilTwoSideEXT) 961 969 { … … 970 978 if (from->clearValue != to->clearValue) 971 979 { 972 CRSTATE_CHECKGLERR( diff_api.ClearStencil (to->clearValue));980 CRSTATE_CHECKGLERR(pState->diff_api.ClearStencil (to->clearValue)); 973 981 FILLDIRTY(b->clearValue); 974 982 FILLDIRTY(b->dirty); … … 1007 1015 if (activeFace == GL_BACK) 1008 1016 { 1009 diff_api.ActiveStencilFaceEXT(GL_FRONT);1017 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1010 1018 activeFace = GL_FRONT; 1011 1019 } 1012 1020 1013 CRSTATE_CHECKGLERR( diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,1021 CRSTATE_CHECKGLERR(pState->diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 1014 1022 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 1015 1023 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask)); … … 1022 1030 if (activeFace == GL_BACK) 1023 1031 { 1024 diff_api.ActiveStencilFaceEXT(GL_FRONT);1032 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1025 1033 activeFace = GL_FRONT; 1026 1034 } 1027 1035 1028 CRSTATE_CHECKGLERR( diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,1036 CRSTATE_CHECKGLERR(pState->diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 1029 1037 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 1030 1038 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask)); … … 1035 1043 if (activeFace == GL_BACK) 1036 1044 { 1037 diff_api.ActiveStencilFaceEXT(GL_FRONT);1045 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1038 1046 activeFace = GL_FRONT; 1039 1047 } 1040 1048 1041 CRSTATE_CHECKGLERR( diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func,1049 CRSTATE_CHECKGLERR(pState->diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func, 1042 1050 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].ref, 1043 1051 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].mask)); … … 1061 1069 if (activeFace == GL_BACK) 1062 1070 { 1063 diff_api.ActiveStencilFaceEXT(GL_FRONT);1064 activeFace = GL_FRONT; 1065 } 1066 1067 CRSTATE_CHECKGLERR( diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,1071 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1072 activeFace = GL_FRONT; 1073 } 1074 1075 CRSTATE_CHECKGLERR(pState->diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 1068 1076 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 1069 1077 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask)); … … 1079 1087 if (activeFace == GL_BACK) 1080 1088 { 1081 diff_api.ActiveStencilFaceEXT(GL_FRONT);1082 activeFace = GL_FRONT; 1083 } 1084 1085 CRSTATE_CHECKGLERR( diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,1089 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1090 activeFace = GL_FRONT; 1091 } 1092 1093 CRSTATE_CHECKGLERR(pState->diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 1086 1094 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 1087 1095 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask)); … … 1095 1103 if (activeFace == GL_BACK) 1096 1104 { 1097 diff_api.ActiveStencilFaceEXT(GL_FRONT);1098 activeFace = GL_FRONT; 1099 } 1100 1101 CRSTATE_CHECKGLERR( diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func,1105 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1106 activeFace = GL_FRONT; 1107 } 1108 1109 CRSTATE_CHECKGLERR(pState->diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func, 1102 1110 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].ref, 1103 1111 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].mask)); … … 1122 1130 if (activeFace == GL_BACK) 1123 1131 { 1124 diff_api.ActiveStencilFaceEXT(GL_FRONT);1125 activeFace = GL_FRONT; 1126 } 1127 1128 CRSTATE_CHECKGLERR( diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,1132 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1133 activeFace = GL_FRONT; 1134 } 1135 1136 CRSTATE_CHECKGLERR(pState->diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 1129 1137 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 1130 1138 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask)); … … 1140 1148 if (activeFace == GL_BACK) 1141 1149 { 1142 diff_api.ActiveStencilFaceEXT(GL_FRONT);1143 activeFace = GL_FRONT; 1144 } 1145 1146 CRSTATE_CHECKGLERR( diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func,1150 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1151 activeFace = GL_FRONT; 1152 } 1153 1154 CRSTATE_CHECKGLERR(pState->diff_api.StencilFuncSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].func, 1147 1155 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].ref, 1148 1156 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].mask)); … … 1156 1164 if (activeFace == GL_BACK) 1157 1165 { 1158 diff_api.ActiveStencilFaceEXT(GL_FRONT);1159 activeFace = GL_FRONT; 1160 } 1161 1162 CRSTATE_CHECKGLERR( diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func,1166 pState->diff_api.ActiveStencilFaceEXT(GL_FRONT); 1167 activeFace = GL_FRONT; 1168 } 1169 1170 CRSTATE_CHECKGLERR(pState->diff_api.StencilFuncSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].func, 1163 1171 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].ref, 1164 1172 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].mask)); … … 1178 1186 if (activeFace == GL_FRONT) 1179 1187 { 1180 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_BACK));1188 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_BACK)); 1181 1189 activeFace = GL_BACK; 1182 1190 } 1183 1191 1184 CRSTATE_CHECKGLERR( diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].func,1192 CRSTATE_CHECKGLERR(pState->diff_api.StencilFunc (to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].func, 1185 1193 to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].ref, 1186 1194 to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].mask)); … … 1227 1235 if (activeFace == GL_BACK) 1228 1236 { 1229 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1237 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1230 1238 activeFace = GL_FRONT; 1231 1239 } 1232 1240 1233 CRSTATE_CHECKGLERR( diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,1241 CRSTATE_CHECKGLERR(pState->diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 1234 1242 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 1235 1243 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass)); … … 1242 1250 if (activeFace == GL_BACK) 1243 1251 { 1244 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1252 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1245 1253 activeFace = GL_FRONT; 1246 1254 } 1247 1255 1248 CRSTATE_CHECKGLERR( diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,1256 CRSTATE_CHECKGLERR(pState->diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 1249 1257 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 1250 1258 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass)); … … 1255 1263 if (activeFace == GL_BACK) 1256 1264 { 1257 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1265 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1258 1266 activeFace = GL_FRONT; 1259 1267 } 1260 1268 1261 CRSTATE_CHECKGLERR( diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail,1269 CRSTATE_CHECKGLERR(pState->diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail, 1262 1270 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthFail, 1263 1271 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthPass)); … … 1281 1289 if (activeFace == GL_BACK) 1282 1290 { 1283 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1284 activeFace = GL_FRONT; 1285 } 1286 1287 CRSTATE_CHECKGLERR( diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,1291 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1292 activeFace = GL_FRONT; 1293 } 1294 1295 CRSTATE_CHECKGLERR(pState->diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 1288 1296 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 1289 1297 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass)); … … 1299 1307 if (activeFace == GL_BACK) 1300 1308 { 1301 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1302 activeFace = GL_FRONT; 1303 } 1304 1305 CRSTATE_CHECKGLERR( diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,1309 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1310 activeFace = GL_FRONT; 1311 } 1312 1313 CRSTATE_CHECKGLERR(pState->diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 1306 1314 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 1307 1315 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass)); … … 1315 1323 if (activeFace == GL_BACK) 1316 1324 { 1317 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1318 activeFace = GL_FRONT; 1319 } 1320 1321 CRSTATE_CHECKGLERR( diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail,1325 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1326 activeFace = GL_FRONT; 1327 } 1328 1329 CRSTATE_CHECKGLERR(pState->diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail, 1322 1330 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthFail, 1323 1331 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthPass)); … … 1343 1351 if (activeFace == GL_BACK) 1344 1352 { 1345 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1346 activeFace = GL_FRONT; 1347 } 1348 1349 CRSTATE_CHECKGLERR( diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,1353 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1354 activeFace = GL_FRONT; 1355 } 1356 1357 CRSTATE_CHECKGLERR(pState->diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 1350 1358 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 1351 1359 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass)); … … 1361 1369 if (activeFace == GL_BACK) 1362 1370 { 1363 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1364 activeFace = GL_FRONT; 1365 } 1366 1367 CRSTATE_CHECKGLERR( diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail,1371 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1372 activeFace = GL_FRONT; 1373 } 1374 1375 CRSTATE_CHECKGLERR(pState->diff_api.StencilOpSeparate (GL_FRONT, to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].fail, 1368 1376 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthFail, 1369 1377 to->buffers[CRSTATE_STENCIL_BUFFER_ID_FRONT].passDepthPass)); … … 1377 1385 if (activeFace == GL_BACK) 1378 1386 { 1379 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_FRONT));1380 activeFace = GL_FRONT; 1381 } 1382 1383 CRSTATE_CHECKGLERR( diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail,1387 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_FRONT)); 1388 activeFace = GL_FRONT; 1389 } 1390 1391 CRSTATE_CHECKGLERR(pState->diff_api.StencilOpSeparate (GL_BACK, to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].fail, 1384 1392 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthFail, 1385 1393 to->buffers[CRSTATE_STENCIL_BUFFER_ID_BACK].passDepthPass)); … … 1400 1408 if (activeFace == GL_FRONT) 1401 1409 { 1402 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(GL_BACK));1410 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(GL_BACK)); 1403 1411 activeFace = GL_BACK; 1404 1412 } 1405 1413 1406 CRSTATE_CHECKGLERR( diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].fail,1414 CRSTATE_CHECKGLERR(pState->diff_api.StencilOp (to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].fail, 1407 1415 to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].passDepthFail, 1408 1416 to->buffers[CRSTATE_STENCIL_BUFFER_ID_TWO_SIDE_BACK].passDepthPass)); … … 1420 1428 if (activeFace != to->activeStencilFace) 1421 1429 { 1422 CRSTATE_CHECKGLERR( diff_api.ActiveStencilFaceEXT(activeFace));1430 CRSTATE_CHECKGLERR(pState->diff_api.ActiveStencilFaceEXT(activeFace)); 1423 1431 } 1424 1432 … … 1439 1447 if (from->writeMask != to->writeMask) 1440 1448 { 1441 CRSTATE_CHECKGLERR( diff_api.StencilMask (to->writeMask));1449 CRSTATE_CHECKGLERR(pState->diff_api.StencilMask (to->writeMask)); 1442 1450 FILLDIRTY(b->writeMask); 1443 1451 FILLDIRTY(b->dirty); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_texdiff.c
r69392 r78375 15 15 16 16 17 #define UNIMPLEMENTED() crStateError( __LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented something or other" )17 #define UNIMPLEMENTED() crStateError(pState, __LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented something or other" ) 18 18 19 19 … … 98 98 CRContext *fromCtx, CRContext *toCtx ) 99 99 { 100 PCRStateTracker pState = fromCtx->pStateTracker; 100 101 CRTextureState *from = &(fromCtx->texture); 101 102 const CRTextureState *to = &(toCtx->texture); … … 105 106 unsigned int activeUnit = (unsigned int) -1; 106 107 108 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 109 107 110 for (j=0;j<CR_MAX_BITARRAY;j++) 108 111 nbitID[j] = ~bitID[j]; 109 able[0] = diff_api.Disable;110 able[1] = diff_api.Enable;112 able[0] = pState->diff_api.Disable; 113 able[1] = pState->diff_api.Enable; 111 114 112 115 for (i = 0; i < fromCtx->limits.maxTextureUnits; i++) … … 115 118 { 116 119 if (activeUnit != i) { 117 diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB );120 pState->diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB ); 118 121 activeUnit = i; 119 122 } … … 182 185 { 183 186 if (activeUnit != i) { 184 diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB );187 pState->diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB ); 185 188 activeUnit = i; 186 189 } 187 190 if (from->unit[i].currentTexture1D->hwid != to->unit[i].currentTexture1D->hwid) 188 191 { 189 diff_api.BindTexture(GL_TEXTURE_1D, crStateGetTextureObjHWID(to->unit[i].currentTexture1D));192 pState->diff_api.BindTexture(GL_TEXTURE_1D, crStateGetTextureObjHWID(pState, to->unit[i].currentTexture1D)); 190 193 FILLDIRTY(tb->current[i]); 191 194 FILLDIRTY(tb->dirty); … … 193 196 if (from->unit[i].currentTexture2D->hwid != to->unit[i].currentTexture2D->hwid) 194 197 { 195 diff_api.BindTexture(GL_TEXTURE_2D, crStateGetTextureObjHWID(to->unit[i].currentTexture2D));198 pState->diff_api.BindTexture(GL_TEXTURE_2D, crStateGetTextureObjHWID(pState, to->unit[i].currentTexture2D)); 196 199 FILLDIRTY(tb->current[i]); 197 200 FILLDIRTY(tb->dirty); … … 200 203 if (from->unit[i].currentTexture3D->hwid != to->unit[i].currentTexture3D->hwid) 201 204 { 202 diff_api.BindTexture(GL_TEXTURE_3D, crStateGetTextureObjHWID(to->unit[i].currentTexture3D));205 pState->diff_api.BindTexture(GL_TEXTURE_3D, crStateGetTextureObjHWID(pState, to->unit[i].currentTexture3D)); 203 206 FILLDIRTY(tb->current[i]); 204 207 FILLDIRTY(tb->dirty); … … 209 212 from->unit[i].currentTextureCubeMap->hwid != to->unit[i].currentTextureCubeMap->hwid) 210 213 { 211 diff_api.BindTexture(GL_TEXTURE_CUBE_MAP_ARB, crStateGetTextureObjHWID(to->unit[i].currentTextureCubeMap));214 pState->diff_api.BindTexture(GL_TEXTURE_CUBE_MAP_ARB, crStateGetTextureObjHWID(pState, to->unit[i].currentTextureCubeMap)); 212 215 FILLDIRTY(tb->current[i]); 213 216 FILLDIRTY(tb->dirty); … … 218 221 from->unit[i].currentTextureRect->hwid != to->unit[i].currentTextureRect->hwid) 219 222 { 220 diff_api.BindTexture(GL_TEXTURE_RECTANGLE_NV, crStateGetTextureObjHWID(to->unit[i].currentTextureRect));223 pState->diff_api.BindTexture(GL_TEXTURE_RECTANGLE_NV, crStateGetTextureObjHWID(pState, to->unit[i].currentTextureRect)); 221 224 FILLDIRTY(tb->current[i]); 222 225 FILLDIRTY(tb->dirty); … … 229 232 { 230 233 if (activeUnit != i) { 231 diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB );234 pState->diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB ); 232 235 activeUnit = i; 233 236 } … … 242 245 f[2] = to->unit[i].objSCoeff.z; 243 246 f[3] = to->unit[i].objSCoeff.w; 244 diff_api.TexGenfv (GL_S, GL_OBJECT_PLANE, (const GLfloat *) f);247 pState->diff_api.TexGenfv (GL_S, GL_OBJECT_PLANE, (const GLfloat *) f); 245 248 FILLDIRTY(tb->objGen[i]); 246 249 FILLDIRTY(tb->dirty); … … 255 258 f[2] = to->unit[i].objTCoeff.z; 256 259 f[3] = to->unit[i].objTCoeff.w; 257 diff_api.TexGenfv (GL_T, GL_OBJECT_PLANE, (const GLfloat *) f);260 pState->diff_api.TexGenfv (GL_T, GL_OBJECT_PLANE, (const GLfloat *) f); 258 261 FILLDIRTY(tb->objGen[i]); 259 262 FILLDIRTY(tb->dirty); … … 268 271 f[2] = to->unit[i].objRCoeff.z; 269 272 f[3] = to->unit[i].objRCoeff.w; 270 diff_api.TexGenfv (GL_R, GL_OBJECT_PLANE, (const GLfloat *) f);273 pState->diff_api.TexGenfv (GL_R, GL_OBJECT_PLANE, (const GLfloat *) f); 271 274 FILLDIRTY(tb->objGen[i]); 272 275 FILLDIRTY(tb->dirty); … … 281 284 f[2] = to->unit[i].objQCoeff.z; 282 285 f[3] = to->unit[i].objQCoeff.w; 283 diff_api.TexGenfv (GL_Q, GL_OBJECT_PLANE, (const GLfloat *) f);286 pState->diff_api.TexGenfv (GL_Q, GL_OBJECT_PLANE, (const GLfloat *) f); 284 287 FILLDIRTY(tb->objGen[i]); 285 288 FILLDIRTY(tb->dirty); … … 290 293 { 291 294 if (activeUnit != i) { 292 diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB );295 pState->diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB ); 293 296 activeUnit = i; 294 297 } 295 diff_api.MatrixMode(GL_MODELVIEW);296 diff_api.PushMatrix();297 diff_api.LoadIdentity();298 pState->diff_api.MatrixMode(GL_MODELVIEW); 299 pState->diff_api.PushMatrix(); 300 pState->diff_api.LoadIdentity(); 298 301 if (from->unit[i].eyeSCoeff.x != to->unit[i].eyeSCoeff.x || 299 302 from->unit[i].eyeSCoeff.y != to->unit[i].eyeSCoeff.y || … … 305 308 f[2] = to->unit[i].eyeSCoeff.z; 306 309 f[3] = to->unit[i].eyeSCoeff.w; 307 diff_api.TexGenfv (GL_S, GL_EYE_PLANE, (const GLfloat *) f);310 pState->diff_api.TexGenfv (GL_S, GL_EYE_PLANE, (const GLfloat *) f); 308 311 FILLDIRTY(tb->eyeGen[i]); 309 312 FILLDIRTY(tb->dirty); … … 318 321 f[2] = to->unit[i].eyeTCoeff.z; 319 322 f[3] = to->unit[i].eyeTCoeff.w; 320 diff_api.TexGenfv (GL_T, GL_EYE_PLANE, (const GLfloat *) f);323 pState->diff_api.TexGenfv (GL_T, GL_EYE_PLANE, (const GLfloat *) f); 321 324 FILLDIRTY(tb->eyeGen[i]); 322 325 FILLDIRTY(tb->dirty); … … 331 334 f[2] = to->unit[i].eyeRCoeff.z; 332 335 f[3] = to->unit[i].eyeRCoeff.w; 333 diff_api.TexGenfv (GL_R, GL_EYE_PLANE, (const GLfloat *) f);336 pState->diff_api.TexGenfv (GL_R, GL_EYE_PLANE, (const GLfloat *) f); 334 337 FILLDIRTY(tb->eyeGen[i]); 335 338 FILLDIRTY(tb->dirty); … … 344 347 f[2] = to->unit[i].eyeQCoeff.z; 345 348 f[3] = to->unit[i].eyeQCoeff.w; 346 diff_api.TexGenfv (GL_Q, GL_EYE_PLANE, (const GLfloat *) f);349 pState->diff_api.TexGenfv (GL_Q, GL_EYE_PLANE, (const GLfloat *) f); 347 350 FILLDIRTY(tb->eyeGen[i]); 348 351 FILLDIRTY(tb->dirty); 349 352 } 350 diff_api.PopMatrix();353 pState->diff_api.PopMatrix(); 351 354 CLEARDIRTY(tb->eyeGen[i], nbitID); 352 355 } … … 354 357 { 355 358 if (activeUnit != i) { 356 diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB );359 pState->diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB ); 357 360 activeUnit = i; 358 361 } … … 362 365 from->unit[i].gen.q != to->unit[i].gen.q) 363 366 { 364 diff_api.TexGeni (GL_S, GL_TEXTURE_GEN_MODE, to->unit[i].gen.s);365 diff_api.TexGeni (GL_T, GL_TEXTURE_GEN_MODE, to->unit[i].gen.t);366 diff_api.TexGeni (GL_R, GL_TEXTURE_GEN_MODE, to->unit[i].gen.r);367 diff_api.TexGeni (GL_Q, GL_TEXTURE_GEN_MODE, to->unit[i].gen.q);367 pState->diff_api.TexGeni (GL_S, GL_TEXTURE_GEN_MODE, to->unit[i].gen.s); 368 pState->diff_api.TexGeni (GL_T, GL_TEXTURE_GEN_MODE, to->unit[i].gen.t); 369 pState->diff_api.TexGeni (GL_R, GL_TEXTURE_GEN_MODE, to->unit[i].gen.r); 370 pState->diff_api.TexGeni (GL_Q, GL_TEXTURE_GEN_MODE, to->unit[i].gen.q); 368 371 FILLDIRTY(tb->genMode[i]); 369 372 FILLDIRTY(tb->dirty); … … 377 380 { 378 381 if (activeUnit != i) { 379 diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB );382 pState->diff_api.ActiveTextureARB( i + GL_TEXTURE0_ARB ); 380 383 activeUnit = i; 381 384 } 382 385 if (from->unit[i].envMode != to->unit[i].envMode) 383 386 { 384 diff_api.TexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, to->unit[i].envMode);387 pState->diff_api.TexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, to->unit[i].envMode); 385 388 FILLDIRTY(tb->envBit[i]); 386 389 FILLDIRTY(tb->dirty); … … 396 399 f[2] = to->unit[i].envColor.b; 397 400 f[3] = to->unit[i].envColor.a; 398 diff_api.TexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, (const GLfloat *) f);401 pState->diff_api.TexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, (const GLfloat *) f); 399 402 FILLDIRTY(tb->envBit[i]); 400 403 FILLDIRTY(tb->dirty); … … 402 405 if (from->unit[i].combineModeRGB != to->unit[i].combineModeRGB) 403 406 { 404 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, to->unit[i].combineModeRGB);407 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, to->unit[i].combineModeRGB); 405 408 FILLDIRTY(tb->envBit[i]); 406 409 FILLDIRTY(tb->dirty); … … 408 411 if (from->unit[i].combineModeA != to->unit[i].combineModeA) 409 412 { 410 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, to->unit[i].combineModeA);413 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, to->unit[i].combineModeA); 411 414 FILLDIRTY(tb->envBit[i]); 412 415 FILLDIRTY(tb->dirty); … … 414 417 if (from->unit[i].combineSourceRGB[0] != to->unit[i].combineSourceRGB[0]) 415 418 { 416 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, to->unit[i].combineSourceRGB[0]);419 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, to->unit[i].combineSourceRGB[0]); 417 420 FILLDIRTY(tb->envBit[i]); 418 421 FILLDIRTY(tb->dirty); … … 420 423 if (from->unit[i].combineSourceRGB[1] != to->unit[i].combineSourceRGB[1]) 421 424 { 422 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, to->unit[i].combineSourceRGB[1]);425 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, to->unit[i].combineSourceRGB[1]); 423 426 FILLDIRTY(tb->envBit[i]); 424 427 FILLDIRTY(tb->dirty); … … 426 429 if (from->unit[i].combineSourceRGB[2] != to->unit[i].combineSourceRGB[2]) 427 430 { 428 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, to->unit[i].combineSourceRGB[2]);431 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, to->unit[i].combineSourceRGB[2]); 429 432 FILLDIRTY(tb->envBit[i]); 430 433 FILLDIRTY(tb->dirty); … … 432 435 if (from->unit[i].combineSourceA[0] != to->unit[i].combineSourceA[0]) 433 436 { 434 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, to->unit[i].combineSourceA[0]);437 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, to->unit[i].combineSourceA[0]); 435 438 FILLDIRTY(tb->envBit[i]); 436 439 FILLDIRTY(tb->dirty); … … 438 441 if (from->unit[i].combineSourceA[1] != to->unit[i].combineSourceA[1]) 439 442 { 440 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, to->unit[i].combineSourceA[1]);443 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, to->unit[i].combineSourceA[1]); 441 444 FILLDIRTY(tb->envBit[i]); 442 445 FILLDIRTY(tb->dirty); … … 444 447 if (from->unit[i].combineSourceA[2] != to->unit[i].combineSourceA[2]) 445 448 { 446 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA_ARB, to->unit[i].combineSourceA[2]);449 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA_ARB, to->unit[i].combineSourceA[2]); 447 450 FILLDIRTY(tb->envBit[i]); 448 451 FILLDIRTY(tb->dirty); … … 450 453 if (from->unit[i].combineOperandRGB[0] != to->unit[i].combineOperandRGB[0]) 451 454 { 452 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, to->unit[i].combineOperandRGB[0]);455 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, to->unit[i].combineOperandRGB[0]); 453 456 FILLDIRTY(tb->envBit[i]); 454 457 FILLDIRTY(tb->dirty); … … 456 459 if (from->unit[i].combineOperandRGB[1] != to->unit[i].combineOperandRGB[1]) 457 460 { 458 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, to->unit[i].combineOperandRGB[1]);461 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, to->unit[i].combineOperandRGB[1]); 459 462 FILLDIRTY(tb->envBit[i]); 460 463 FILLDIRTY(tb->dirty); … … 462 465 if (from->unit[i].combineOperandRGB[2] != to->unit[i].combineOperandRGB[2]) 463 466 { 464 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, to->unit[i].combineOperandRGB[2]);467 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, to->unit[i].combineOperandRGB[2]); 465 468 FILLDIRTY(tb->envBit[i]); 466 469 FILLDIRTY(tb->dirty); … … 468 471 if (from->unit[i].combineOperandA[0] != to->unit[i].combineOperandA[0]) 469 472 { 470 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, to->unit[i].combineOperandA[0]);473 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, to->unit[i].combineOperandA[0]); 471 474 FILLDIRTY(tb->envBit[i]); 472 475 FILLDIRTY(tb->dirty); … … 474 477 if (from->unit[i].combineOperandA[1] != to->unit[i].combineOperandA[1]) 475 478 { 476 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, to->unit[i].combineOperandA[1]);479 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, to->unit[i].combineOperandA[1]); 477 480 FILLDIRTY(tb->envBit[i]); 478 481 FILLDIRTY(tb->dirty); … … 480 483 if (from->unit[i].combineOperandA[2] != to->unit[i].combineOperandA[2]) 481 484 { 482 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_ARB, to->unit[i].combineOperandA[2]);485 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_ARB, to->unit[i].combineOperandA[2]); 483 486 FILLDIRTY(tb->envBit[i]); 484 487 FILLDIRTY(tb->dirty); … … 486 489 if (from->unit[i].combineScaleRGB != to->unit[i].combineScaleRGB) 487 490 { 488 diff_api.TexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, to->unit[i].combineScaleRGB);491 pState->diff_api.TexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, to->unit[i].combineScaleRGB); 489 492 FILLDIRTY(tb->envBit[i]); 490 493 FILLDIRTY(tb->dirty); … … 492 495 if (from->unit[i].combineScaleA != to->unit[i].combineScaleA) 493 496 { 494 diff_api.TexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, to->unit[i].combineScaleA);497 pState->diff_api.TexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, to->unit[i].combineScaleA); 495 498 FILLDIRTY(tb->envBit[i]); 496 499 FILLDIRTY(tb->dirty); … … 510 513 /* After possible fiddling put them back now */ 511 514 if (activeUnit != toCtx->texture.curTextureUnit) { 512 diff_api.ActiveTextureARB( toCtx->texture.curTextureUnit + GL_TEXTURE0_ARB );515 pState->diff_api.ActiveTextureARB( toCtx->texture.curTextureUnit + GL_TEXTURE0_ARB ); 513 516 } 514 diff_api.MatrixMode(toCtx->transform.matrixMode);517 pState->diff_api.MatrixMode(toCtx->transform.matrixMode); 515 518 } 516 519 … … 523 526 int crStateTextureCheckDirtyImages(CRContext *from, CRContext *to, GLenum target, int textureUnit) 524 527 { 525 CRContext *g = GetCurrentContext( );528 CRContext *g = GetCurrentContext(from->pStateTracker); 526 529 CRTextureState *tsto; 527 530 CRbitvalue *bitID; … … 532 535 CRASSERT(to); 533 536 CRASSERT(from); 537 CRASSERT(from->pStateTracker == to->pStateTracker); 534 538 535 539 tsto = &(to->texture); … … 601 605 CRTextureObj *tobj, GLboolean alwaysDirty) 602 606 { 607 PCRStateTracker pState = fromCtx->pStateTracker; 603 608 CRTextureState *from = &(fromCtx->texture); 604 609 glAble able[2]; 605 610 int u = 0; /* always use texture unit 0 for diff'ing */ 606 GLuint hwid = crStateGetTextureObjHWID( tobj);611 GLuint hwid = crStateGetTextureObjHWID(pState, tobj); 607 612 608 613 if (!hwid) 609 614 return; 610 615 611 able[0] = diff_api.Disable;612 able[1] = diff_api.Enable;616 able[0] = pState->diff_api.Disable; 617 able[1] = pState->diff_api.Enable; 613 618 614 619 #if 0 … … 619 624 /* Set active texture unit, and bind this texture object */ 620 625 if (from->curTextureUnit != u) { 621 diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB );626 pState->diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB ); 622 627 from->curTextureUnit = u; 623 628 } 624 629 #endif 625 630 626 diff_api.BindTexture(tobj->target, hwid);631 pState->diff_api.BindTexture(tobj->target, hwid); 627 632 628 633 if (alwaysDirty || CHECKDIRTY(tobj->paramsBit[u], bitID)) … … 633 638 f[2] = tobj->borderColor.b; 634 639 f[3] = tobj->borderColor.a; 635 diff_api.TexParameteri(tobj->target, GL_TEXTURE_BASE_LEVEL, tobj->baseLevel);636 diff_api.TexParameteri(tobj->target, GL_TEXTURE_MAX_LEVEL, tobj->maxLevel);637 diff_api.TexParameteri(tobj->target, GL_TEXTURE_MIN_FILTER, tobj->minFilter);638 diff_api.TexParameteri(tobj->target, GL_TEXTURE_MAG_FILTER, tobj->magFilter);639 diff_api.TexParameteri(tobj->target, GL_TEXTURE_WRAP_S, tobj->wrapS);640 diff_api.TexParameteri(tobj->target, GL_TEXTURE_WRAP_T, tobj->wrapT);640 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_BASE_LEVEL, tobj->baseLevel); 641 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_MAX_LEVEL, tobj->maxLevel); 642 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_MIN_FILTER, tobj->minFilter); 643 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_MAG_FILTER, tobj->magFilter); 644 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_WRAP_S, tobj->wrapS); 645 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_WRAP_T, tobj->wrapT); 641 646 #ifdef CR_OPENGL_VERSION_1_2 642 diff_api.TexParameteri(tobj->target, GL_TEXTURE_WRAP_R, tobj->wrapR);643 diff_api.TexParameterf(tobj->target, GL_TEXTURE_PRIORITY, tobj->priority);644 #endif 645 diff_api.TexParameterfv(tobj->target, GL_TEXTURE_BORDER_COLOR, (const GLfloat *) f);647 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_WRAP_R, tobj->wrapR); 648 pState->diff_api.TexParameterf(tobj->target, GL_TEXTURE_PRIORITY, tobj->priority); 649 #endif 650 pState->diff_api.TexParameterfv(tobj->target, GL_TEXTURE_BORDER_COLOR, (const GLfloat *) f); 646 651 #ifdef CR_EXT_texture_filter_anisotropic 647 652 if (fromCtx->extensions.EXT_texture_filter_anisotropic) { 648 diff_api.TexParameterf(tobj->target, GL_TEXTURE_MAX_ANISOTROPY_EXT, tobj->maxAnisotropy);653 pState->diff_api.TexParameterf(tobj->target, GL_TEXTURE_MAX_ANISOTROPY_EXT, tobj->maxAnisotropy); 649 654 } 650 655 #endif 651 656 #ifdef CR_ARB_depth_texture 652 657 if (fromCtx->extensions.ARB_depth_texture) 653 diff_api.TexParameteri(tobj->target, GL_DEPTH_TEXTURE_MODE_ARB, tobj->depthMode);658 pState->diff_api.TexParameteri(tobj->target, GL_DEPTH_TEXTURE_MODE_ARB, tobj->depthMode); 654 659 #endif 655 660 #ifdef CR_ARB_shadow 656 661 if (fromCtx->extensions.ARB_shadow) { 657 diff_api.TexParameteri(tobj->target, GL_TEXTURE_COMPARE_MODE_ARB, tobj->compareMode);658 diff_api.TexParameteri(tobj->target, GL_TEXTURE_COMPARE_FUNC_ARB, tobj->compareFunc);662 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_COMPARE_MODE_ARB, tobj->compareMode); 663 pState->diff_api.TexParameteri(tobj->target, GL_TEXTURE_COMPARE_FUNC_ARB, tobj->compareFunc); 659 664 } 660 665 #endif 661 666 #ifdef CR_ARB_shadow_ambient 662 667 if (fromCtx->extensions.ARB_shadow_ambient) { 663 diff_api.TexParameterf(tobj->target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, tobj->compareFailValue);668 pState->diff_api.TexParameterf(tobj->target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, tobj->compareFailValue); 664 669 } 665 670 #endif 666 671 #ifdef CR_SGIS_generate_mipmap 667 672 if (fromCtx->extensions.SGIS_generate_mipmap) { 668 diff_api.TexParameteri(tobj->target, GL_GENERATE_MIPMAP_SGIS, tobj->generateMipmap);673 pState->diff_api.TexParameteri(tobj->target, GL_GENERATE_MIPMAP_SGIS, tobj->generateMipmap); 669 674 } 670 675 #endif … … 688 693 { 689 694 if (tl->generateMipmap) { 690 diff_api.TexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, 1);695 pState->diff_api.TexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, 1); 691 696 } 692 697 if (tl->width) 693 698 { 694 699 if (tl->compressed) { 695 diff_api.CompressedTexImage1DARB(GL_TEXTURE_1D, lvl,700 pState->diff_api.CompressedTexImage1DARB(GL_TEXTURE_1D, lvl, 696 701 tl->internalFormat, tl->width, 697 702 tl->border, tl->bytes, tl->img); … … 699 704 else { 700 705 /* alignment must be one */ 701 diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0);702 diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);703 diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0);704 diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1);706 pState->diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 707 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 708 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0); 709 pState->diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1); 705 710 if (tl->generateMipmap) { 706 diff_api.TexParameteri(GL_TEXTURE_1D, GL_GENERATE_MIPMAP_SGIS, 1);711 pState->diff_api.TexParameteri(GL_TEXTURE_1D, GL_GENERATE_MIPMAP_SGIS, 1); 707 712 } 708 diff_api.TexImage1D(GL_TEXTURE_1D, lvl,713 pState->diff_api.TexImage1D(GL_TEXTURE_1D, lvl, 709 714 tl->internalFormat, 710 715 tl->width, tl->border, … … 733 738 { 734 739 if (tl->generateMipmap) { 735 diff_api.TexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, 1);740 pState->diff_api.TexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, 1); 736 741 } 737 742 … … 739 744 { 740 745 if (tl->compressed) { 741 diff_api.CompressedTexImage2DARB(GL_TEXTURE_2D, lvl,746 pState->diff_api.CompressedTexImage2DARB(GL_TEXTURE_2D, lvl, 742 747 tl->internalFormat, tl->width, 743 748 tl->height, tl->border, … … 746 751 else { 747 752 /* alignment must be one */ 748 diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0);749 diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);750 diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0);751 diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1);752 diff_api.TexImage2D(GL_TEXTURE_2D, lvl,753 pState->diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 754 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 755 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0); 756 pState->diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1); 757 pState->diff_api.TexImage2D(GL_TEXTURE_2D, lvl, 753 758 tl->internalFormat, 754 759 tl->width, tl->height, tl->border, … … 779 784 { 780 785 if (tl->generateMipmap) { 781 diff_api.TexParameteri(GL_TEXTURE_3D, GL_GENERATE_MIPMAP_SGIS, 1);786 pState->diff_api.TexParameteri(GL_TEXTURE_3D, GL_GENERATE_MIPMAP_SGIS, 1); 782 787 } 783 788 … … 785 790 { 786 791 if (tl->compressed) { 787 diff_api.CompressedTexImage3DARB(GL_TEXTURE_3D, lvl,792 pState->diff_api.CompressedTexImage3DARB(GL_TEXTURE_3D, lvl, 788 793 tl->internalFormat, tl->width, 789 794 tl->height, tl->depth, … … 792 797 else { 793 798 /* alignment must be one */ 794 diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0);795 diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);796 diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0);797 diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1);798 diff_api.TexImage3D(GL_TEXTURE_3D, lvl,799 pState->diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 800 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 801 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0); 802 pState->diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1); 803 pState->diff_api.TexImage3D(GL_TEXTURE_3D, lvl, 799 804 tl->internalFormat, 800 805 tl->width, tl->height, tl->depth, … … 830 835 { 831 836 if (tl->compressed) { 832 diff_api.CompressedTexImage2DARB(GL_TEXTURE_RECTANGLE_NV, lvl,837 pState->diff_api.CompressedTexImage2DARB(GL_TEXTURE_RECTANGLE_NV, lvl, 833 838 tl->internalFormat, tl->width, 834 839 tl->height, tl->border, … … 837 842 else { 838 843 /* alignment must be one */ 839 diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0);840 diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);841 diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0);842 diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1);843 diff_api.TexImage2D(GL_TEXTURE_RECTANGLE_NV, lvl,844 pState->diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 845 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 846 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0); 847 pState->diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1); 848 pState->diff_api.TexImage2D(GL_TEXTURE_RECTANGLE_NV, lvl, 844 849 tl->internalFormat, 845 850 tl->width, tl->height, tl->border, … … 874 879 { 875 880 if (tl->generateMipmap) { 876 diff_api.TexParameteri(GL_TEXTURE_CUBE_MAP_ARB,881 pState->diff_api.TexParameteri(GL_TEXTURE_CUBE_MAP_ARB, 877 882 GL_GENERATE_MIPMAP_SGIS, 1); 878 883 } … … 881 886 { 882 887 if (tl->compressed) { 883 diff_api.CompressedTexImage2DARB(target,888 pState->diff_api.CompressedTexImage2DARB(target, 884 889 lvl, tl->internalFormat, 885 890 tl->width, tl->height, … … 888 893 else { 889 894 /* alignment must be one */ 890 diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0);891 diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);892 diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0);893 diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1);894 diff_api.TexImage2D(target, lvl,895 pState->diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 896 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 897 pState->diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0); 898 pState->diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1); 899 pState->diff_api.TexImage2D(target, lvl, 895 900 tl->internalFormat, 896 901 tl->width, tl->height, tl->border, … … 928 933 CRContext *fromCtx, CRContext *toCtx ) 929 934 { 935 PCRStateTracker pState = fromCtx->pStateTracker; 930 936 CRTextureState *from = &(fromCtx->texture); 931 937 CRTextureState *to = &(toCtx->texture); … … 935 941 const GLboolean haveFragProg = fromCtx->extensions.ARB_fragment_program || fromCtx->extensions.NV_fragment_program; 936 942 943 CRASSERT(fromCtx->pStateTracker == toCtx->pStateTracker); 944 937 945 for (j=0;j<CR_MAX_BITARRAY;j++) 938 946 nbitID[j] = ~bitID[j]; 939 947 940 able[0] = diff_api.Disable;941 able[1] = diff_api.Enable;948 able[0] = pState->diff_api.Disable; 949 able[1] = pState->diff_api.Enable; 942 950 943 951 /* loop over texture units */ … … 953 961 /* Activate texture unit u if needed */ 954 962 if (fromCtx->texture.curTextureUnit != u) { 955 diff_api.ActiveTextureARB( GL_TEXTURE0_ARB + u);963 pState->diff_api.ActiveTextureARB( GL_TEXTURE0_ARB + u); 956 964 fromCtx->texture.curTextureUnit = u; 957 965 } … … 1011 1019 { 1012 1020 if (fromCtx->texture.curTextureUnit != u) { 1013 diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB );1021 pState->diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB ); 1014 1022 fromCtx->texture.curTextureUnit = u; 1015 1023 } … … 1024 1032 f[2] = to->unit[u].objSCoeff.z; 1025 1033 f[3] = to->unit[u].objSCoeff.w; 1026 diff_api.TexGenfv (GL_S, GL_OBJECT_PLANE, (const GLfloat *) f);1034 pState->diff_api.TexGenfv (GL_S, GL_OBJECT_PLANE, (const GLfloat *) f); 1027 1035 from->unit[u].objSCoeff = to->unit[u].objSCoeff; 1028 1036 } … … 1037 1045 f[2] = to->unit[u].objTCoeff.z; 1038 1046 f[3] = to->unit[u].objTCoeff.w; 1039 diff_api.TexGenfv (GL_T, GL_OBJECT_PLANE, (const GLfloat *) f);1047 pState->diff_api.TexGenfv (GL_T, GL_OBJECT_PLANE, (const GLfloat *) f); 1040 1048 from->unit[u].objTCoeff = to->unit[u].objTCoeff; 1041 1049 } … … 1050 1058 f[2] = to->unit[u].objRCoeff.z; 1051 1059 f[3] = to->unit[u].objRCoeff.w; 1052 diff_api.TexGenfv (GL_R, GL_OBJECT_PLANE, (const GLfloat *) f);1060 pState->diff_api.TexGenfv (GL_R, GL_OBJECT_PLANE, (const GLfloat *) f); 1053 1061 from->unit[u].objRCoeff = to->unit[u].objRCoeff; 1054 1062 } … … 1063 1071 f[2] = to->unit[u].objQCoeff.z; 1064 1072 f[3] = to->unit[u].objQCoeff.w; 1065 diff_api.TexGenfv (GL_Q, GL_OBJECT_PLANE, (const GLfloat *) f);1073 pState->diff_api.TexGenfv (GL_Q, GL_OBJECT_PLANE, (const GLfloat *) f); 1066 1074 from->unit[u].objQCoeff = to->unit[u].objQCoeff; 1067 1075 } … … 1071 1079 { 1072 1080 if (fromCtx->texture.curTextureUnit != u) { 1073 diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB );1081 pState->diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB ); 1074 1082 fromCtx->texture.curTextureUnit = u; 1075 1083 } 1076 1084 if (fromCtx->transform.matrixMode != GL_MODELVIEW) { 1077 diff_api.MatrixMode(GL_MODELVIEW);1085 pState->diff_api.MatrixMode(GL_MODELVIEW); 1078 1086 fromCtx->transform.matrixMode = GL_MODELVIEW; 1079 1087 } 1080 diff_api.PushMatrix();1081 diff_api.LoadIdentity();1088 pState->diff_api.PushMatrix(); 1089 pState->diff_api.LoadIdentity(); 1082 1090 if (from->unit[u].eyeSCoeff.x != to->unit[u].eyeSCoeff.x || 1083 1091 from->unit[u].eyeSCoeff.y != to->unit[u].eyeSCoeff.y || … … 1090 1098 f[2] = to->unit[u].eyeSCoeff.z; 1091 1099 f[3] = to->unit[u].eyeSCoeff.w; 1092 diff_api.TexGenfv (GL_S, GL_EYE_PLANE, (const GLfloat *) f);1100 pState->diff_api.TexGenfv (GL_S, GL_EYE_PLANE, (const GLfloat *) f); 1093 1101 from->unit[u].eyeSCoeff = to->unit[u].eyeSCoeff; 1094 1102 } … … 1103 1111 f[2] = to->unit[u].eyeTCoeff.z; 1104 1112 f[3] = to->unit[u].eyeTCoeff.w; 1105 diff_api.TexGenfv (GL_T, GL_EYE_PLANE, (const GLfloat *) f);1113 pState->diff_api.TexGenfv (GL_T, GL_EYE_PLANE, (const GLfloat *) f); 1106 1114 from->unit[u].eyeTCoeff = to->unit[u].eyeTCoeff; 1107 1115 } … … 1116 1124 f[2] = to->unit[u].eyeRCoeff.z; 1117 1125 f[3] = to->unit[u].eyeRCoeff.w; 1118 diff_api.TexGenfv (GL_R, GL_EYE_PLANE, (const GLfloat *) f);1126 pState->diff_api.TexGenfv (GL_R, GL_EYE_PLANE, (const GLfloat *) f); 1119 1127 from->unit[u].eyeRCoeff = to->unit[u].eyeRCoeff; 1120 1128 } … … 1129 1137 f[2] = to->unit[u].eyeQCoeff.z; 1130 1138 f[3] = to->unit[u].eyeQCoeff.w; 1131 diff_api.TexGenfv (GL_Q, GL_EYE_PLANE, (const GLfloat *) f);1139 pState->diff_api.TexGenfv (GL_Q, GL_EYE_PLANE, (const GLfloat *) f); 1132 1140 from->unit[u].eyeQCoeff = to->unit[u].eyeQCoeff; 1133 1141 } 1134 diff_api.PopMatrix();1142 pState->diff_api.PopMatrix(); 1135 1143 CLEARDIRTY(tb->eyeGen[u], nbitID); 1136 1144 } … … 1138 1146 { 1139 1147 if (fromCtx->texture.curTextureUnit != u) { 1140 diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB );1148 pState->diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB ); 1141 1149 fromCtx->texture.curTextureUnit = u; 1142 1150 } … … 1146 1154 from->unit[u].gen.q != to->unit[u].gen.q) 1147 1155 { 1148 diff_api.TexGeni (GL_S, GL_TEXTURE_GEN_MODE, to->unit[u].gen.s);1149 diff_api.TexGeni (GL_T, GL_TEXTURE_GEN_MODE, to->unit[u].gen.t);1150 diff_api.TexGeni (GL_R, GL_TEXTURE_GEN_MODE, to->unit[u].gen.r);1151 diff_api.TexGeni (GL_Q, GL_TEXTURE_GEN_MODE, to->unit[u].gen.q);1156 pState->diff_api.TexGeni (GL_S, GL_TEXTURE_GEN_MODE, to->unit[u].gen.s); 1157 pState->diff_api.TexGeni (GL_T, GL_TEXTURE_GEN_MODE, to->unit[u].gen.t); 1158 pState->diff_api.TexGeni (GL_R, GL_TEXTURE_GEN_MODE, to->unit[u].gen.r); 1159 pState->diff_api.TexGeni (GL_Q, GL_TEXTURE_GEN_MODE, to->unit[u].gen.q); 1152 1160 from->unit[u].gen = to->unit[u].gen; 1153 1161 } … … 1160 1168 if (from->unit[u].envMode != to->unit[u].envMode) 1161 1169 { 1162 diff_api.TexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, to->unit[u].envMode);1170 pState->diff_api.TexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, to->unit[u].envMode); 1163 1171 from->unit[u].envMode = to->unit[u].envMode; 1164 1172 } … … 1173 1181 f[2] = to->unit[u].envColor.b; 1174 1182 f[3] = to->unit[u].envColor.a; 1175 diff_api.TexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, (const GLfloat *) f);1183 pState->diff_api.TexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, (const GLfloat *) f); 1176 1184 from->unit[u].envColor = to->unit[u].envColor; 1177 1185 } … … 1179 1187 if (from->unit[u].combineModeRGB != to->unit[u].combineModeRGB) 1180 1188 { 1181 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, to->unit[u].combineModeRGB);1189 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, to->unit[u].combineModeRGB); 1182 1190 from->unit[u].combineModeRGB = to->unit[u].combineModeRGB; 1183 1191 } 1184 1192 if (from->unit[u].combineModeA != to->unit[u].combineModeA) 1185 1193 { 1186 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, to->unit[u].combineModeA);1194 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, to->unit[u].combineModeA); 1187 1195 from->unit[u].combineModeA = to->unit[u].combineModeA; 1188 1196 } 1189 1197 if (from->unit[u].combineSourceRGB[0] != to->unit[u].combineSourceRGB[0]) 1190 1198 { 1191 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, to->unit[u].combineSourceRGB[0]);1199 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, to->unit[u].combineSourceRGB[0]); 1192 1200 from->unit[u].combineSourceRGB[0] = to->unit[u].combineSourceRGB[0]; 1193 1201 } 1194 1202 if (from->unit[u].combineSourceRGB[1] != to->unit[u].combineSourceRGB[1]) 1195 1203 { 1196 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, to->unit[u].combineSourceRGB[1]);1204 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, to->unit[u].combineSourceRGB[1]); 1197 1205 from->unit[u].combineSourceRGB[1] = to->unit[u].combineSourceRGB[1]; 1198 1206 } 1199 1207 if (from->unit[u].combineSourceRGB[2] != to->unit[u].combineSourceRGB[2]) 1200 1208 { 1201 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, to->unit[u].combineSourceRGB[2]);1209 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, to->unit[u].combineSourceRGB[2]); 1202 1210 from->unit[u].combineSourceRGB[2] = to->unit[u].combineSourceRGB[2]; 1203 1211 } 1204 1212 if (from->unit[u].combineSourceA[0] != to->unit[u].combineSourceA[0]) 1205 1213 { 1206 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, to->unit[u].combineSourceA[0]);1214 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, to->unit[u].combineSourceA[0]); 1207 1215 from->unit[u].combineSourceA[0] = to->unit[u].combineSourceA[0]; 1208 1216 } 1209 1217 if (from->unit[u].combineSourceA[1] != to->unit[u].combineSourceA[1]) 1210 1218 { 1211 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, to->unit[u].combineSourceA[1]);1219 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, to->unit[u].combineSourceA[1]); 1212 1220 from->unit[u].combineSourceA[1] = to->unit[u].combineSourceA[1]; 1213 1221 } 1214 1222 if (from->unit[u].combineSourceA[2] != to->unit[u].combineSourceA[2]) 1215 1223 { 1216 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA_ARB, to->unit[u].combineSourceA[2]);1224 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA_ARB, to->unit[u].combineSourceA[2]); 1217 1225 from->unit[u].combineSourceA[2] = to->unit[u].combineSourceA[2]; 1218 1226 } 1219 1227 if (from->unit[u].combineOperandRGB[0] != to->unit[u].combineOperandRGB[0]) 1220 1228 { 1221 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, to->unit[u].combineOperandRGB[0]);1229 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, to->unit[u].combineOperandRGB[0]); 1222 1230 from->unit[u].combineOperandRGB[0] = to->unit[u].combineOperandRGB[0]; 1223 1231 } 1224 1232 if (from->unit[u].combineOperandRGB[1] != to->unit[u].combineOperandRGB[1]) 1225 1233 { 1226 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, to->unit[u].combineOperandRGB[1]);1234 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, to->unit[u].combineOperandRGB[1]); 1227 1235 from->unit[u].combineOperandRGB[1] = to->unit[u].combineOperandRGB[1]; 1228 1236 } 1229 1237 if (from->unit[u].combineOperandRGB[2] != to->unit[u].combineOperandRGB[2]) 1230 1238 { 1231 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, to->unit[u].combineOperandRGB[2]);1239 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, to->unit[u].combineOperandRGB[2]); 1232 1240 from->unit[u].combineOperandRGB[2] = to->unit[u].combineOperandRGB[2]; 1233 1241 } 1234 1242 if (from->unit[u].combineOperandA[0] != to->unit[u].combineOperandA[0]) 1235 1243 { 1236 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, to->unit[u].combineOperandA[0]);1244 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, to->unit[u].combineOperandA[0]); 1237 1245 from->unit[u].combineOperandA[0] = to->unit[u].combineOperandA[0]; 1238 1246 } 1239 1247 if (from->unit[u].combineOperandA[1] != to->unit[u].combineOperandA[1]) 1240 1248 { 1241 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, to->unit[u].combineOperandA[1]);1249 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, to->unit[u].combineOperandA[1]); 1242 1250 from->unit[u].combineOperandA[1] = to->unit[u].combineOperandA[1]; 1243 1251 } 1244 1252 if (from->unit[u].combineOperandA[2] != to->unit[u].combineOperandA[2]) 1245 1253 { 1246 diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_ARB, to->unit[u].combineOperandA[2]);1254 pState->diff_api.TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_ARB, to->unit[u].combineOperandA[2]); 1247 1255 from->unit[u].combineOperandA[2] = to->unit[u].combineOperandA[2]; 1248 1256 } 1249 1257 if (from->unit[u].combineScaleRGB != to->unit[u].combineScaleRGB) 1250 1258 { 1251 diff_api.TexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, to->unit[u].combineScaleRGB);1259 pState->diff_api.TexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, to->unit[u].combineScaleRGB); 1252 1260 from->unit[u].combineScaleRGB = to->unit[u].combineScaleRGB; 1253 1261 } 1254 1262 if (from->unit[u].combineScaleA != to->unit[u].combineScaleA) 1255 1263 { 1256 diff_api.TexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, to->unit[u].combineScaleA);1264 pState->diff_api.TexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, to->unit[u].combineScaleA); 1257 1265 from->unit[u].combineScaleA = to->unit[u].combineScaleA; 1258 1266 } … … 1261 1269 if (from->unit[u].lodBias != to->unit[u].lodBias) 1262 1270 { 1263 diff_api.TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, to->unit[u].lodBias);1271 pState->diff_api.TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, to->unit[u].lodBias); 1264 1272 from->unit[u].lodBias = to->unit[u].lodBias; 1265 1273 } … … 1323 1331 /* Activate texture unit u if needed */ 1324 1332 if (fromCtx->texture.curTextureUnit != u) { 1325 diff_api.ActiveTextureARB( GL_TEXTURE0_ARB + u);1333 pState->diff_api.ActiveTextureARB( GL_TEXTURE0_ARB + u); 1326 1334 fromCtx->texture.curTextureUnit = u; 1327 1335 } … … 1332 1340 if (*fromBinding != tobj) 1333 1341 { 1334 diff_api.BindTexture(tobj->target, crStateGetTextureObjHWID(tobj));1342 pState->diff_api.BindTexture(tobj->target, crStateGetTextureObjHWID(pState, tobj)); 1335 1343 *fromBinding = tobj; 1336 1344 } … … 1352 1360 /* After possible fiddling with the active unit, put it back now */ 1353 1361 if (fromCtx->texture.curTextureUnit != toCtx->texture.curTextureUnit) { 1354 diff_api.ActiveTextureARB( toCtx->texture.curTextureUnit + GL_TEXTURE0_ARB );1362 pState->diff_api.ActiveTextureARB( toCtx->texture.curTextureUnit + GL_TEXTURE0_ARB ); 1355 1363 fromCtx->texture.curTextureUnit = toCtx->texture.curTextureUnit; 1356 1364 } 1357 1365 if (fromCtx->transform.matrixMode != toCtx->transform.matrixMode) { 1358 diff_api.MatrixMode(toCtx->transform.matrixMode);1366 pState->diff_api.MatrixMode(toCtx->transform.matrixMode); 1359 1367 fromCtx->transform.matrixMode = toCtx->transform.matrixMode; 1360 1368 } … … 1404 1412 crStateDiffAllTextureObjects( CRContext *g, CRbitvalue *bitID, GLboolean bForceUpdate ) 1405 1413 { 1414 PCRStateTracker pState = g->pStateTracker; 1406 1415 CRbitvalue nbitID[CR_MAX_BITARRAY]; 1407 1416 struct callback_info info; … … 1419 1428 /* save current texture bindings */ 1420 1429 origUnit = g->texture.curTextureUnit; 1421 orig1D = crStateGetTextureObjHWID( g->texture.unit[0].currentTexture1D);1422 orig2D = crStateGetTextureObjHWID( g->texture.unit[0].currentTexture2D);1423 orig3D = crStateGetTextureObjHWID( g->texture.unit[0].currentTexture3D);1430 orig1D = crStateGetTextureObjHWID(pState, g->texture.unit[0].currentTexture1D); 1431 orig2D = crStateGetTextureObjHWID(pState, g->texture.unit[0].currentTexture2D); 1432 orig3D = crStateGetTextureObjHWID(pState, g->texture.unit[0].currentTexture3D); 1424 1433 #ifdef CR_ARB_texture_cube_map 1425 origCube = crStateGetTextureObjHWID( g->texture.unit[0].currentTextureCubeMap);1434 origCube = crStateGetTextureObjHWID(pState, g->texture.unit[0].currentTextureCubeMap); 1426 1435 #endif 1427 1436 #ifdef CR_NV_texture_rectangle 1428 origRect = crStateGetTextureObjHWID( g->texture.unit[0].currentTextureRect);1437 origRect = crStateGetTextureObjHWID(pState, g->texture.unit[0].currentTextureRect); 1429 1438 #endif 1430 1439 1431 1440 /* use texture unit 0 for updates */ 1432 diff_api.ActiveTextureARB(GL_TEXTURE0_ARB);1441 pState->diff_api.ActiveTextureARB(GL_TEXTURE0_ARB); 1433 1442 1434 1443 /* diff all the textures */ … … 1456 1465 /* restore bindings */ 1457 1466 /* first restore unit 0 bindings the unit 0 is active currently */ 1458 diff_api.BindTexture(GL_TEXTURE_1D, orig1D);1459 diff_api.BindTexture(GL_TEXTURE_2D, orig2D);1460 diff_api.BindTexture(GL_TEXTURE_3D, orig3D);1467 pState->diff_api.BindTexture(GL_TEXTURE_1D, orig1D); 1468 pState->diff_api.BindTexture(GL_TEXTURE_2D, orig2D); 1469 pState->diff_api.BindTexture(GL_TEXTURE_3D, orig3D); 1461 1470 #ifdef CR_ARB_texture_cube_map 1462 diff_api.BindTexture(GL_TEXTURE_CUBE_MAP_ARB, origCube);1471 pState->diff_api.BindTexture(GL_TEXTURE_CUBE_MAP_ARB, origCube); 1463 1472 #endif 1464 1473 #ifdef CR_NV_texture_rectangle 1465 diff_api.BindTexture(GL_TEXTURE_RECTANGLE_NV, origRect);1474 pState->diff_api.BindTexture(GL_TEXTURE_RECTANGLE_NV, origRect); 1466 1475 #endif 1467 1476 /* now restore the proper active unit */ 1468 diff_api.ActiveTextureARB(GL_TEXTURE0_ARB + origUnit);1477 pState->diff_api.ActiveTextureARB(GL_TEXTURE0_ARB + origUnit); 1469 1478 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_teximage.c
r78105 r78375 335 335 */ 336 336 static GLboolean 337 ErrorCheckTexImage( GLuint dims, GLenum target, GLint level,337 ErrorCheckTexImage(PCRStateTracker pState, GLuint dims, GLenum target, GLint level, 338 338 GLsizei width, GLsizei height, GLsizei depth, GLint border) 339 339 { 340 CRContext *g = GetCurrentContext( );340 CRContext *g = GetCurrentContext(pState); 341 341 342 342 if (g->current.inBeginEnd) 343 343 { 344 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,344 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 345 345 "glTexImage%uD called in Begin/End", dims); 346 346 return GL_TRUE; … … 355 355 case GL_PROXY_TEXTURE_1D: 356 356 if (dims != 1) { 357 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,357 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 358 358 "glTexImage(invalid target=0x%x)", target); 359 359 return GL_TRUE; … … 363 363 case GL_PROXY_TEXTURE_2D: 364 364 if (dims != 2) { 365 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,365 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 366 366 "glTexImage(invalid target=0x%x)", target); 367 367 return GL_TRUE; … … 371 371 case GL_PROXY_TEXTURE_3D: 372 372 if (dims != 3) { 373 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,373 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 374 374 "glTexImage(invalid target=0x%x)", target); 375 375 return GL_TRUE; … … 380 380 case GL_PROXY_TEXTURE_RECTANGLE_NV: 381 381 if (dims != 2 || !g->extensions.NV_texture_rectangle) { 382 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,382 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 383 383 "glTexImage2D(invalid target=0x%x)", target); 384 384 return GL_TRUE; … … 395 395 case GL_PROXY_TEXTURE_CUBE_MAP_ARB: 396 396 if (dims != 2 || !g->extensions.ARB_texture_cube_map) { 397 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,397 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 398 398 "glTexImage2D(invalid target=0x%x)", target); 399 399 return GL_TRUE; … … 402 402 #endif 403 403 default: 404 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,404 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 405 405 "glTexImage%uD(invalid target=0x%x)", dims, target); 406 406 return GL_TRUE; … … 412 412 if (level < 0 || level > MaxTextureLevel(g, target)) { 413 413 if (!IsProxyTarget(target)) 414 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,414 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 415 415 "glTexImage%uD(level=%d)", dims, level); 416 416 return GL_TRUE; … … 422 422 if (border != 0 && border != 1) { 423 423 if (!IsProxyTarget(target)) 424 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,424 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 425 425 "glTexImage%uD(border=%d)", dims, border); 426 426 return GL_TRUE; … … 430 430 target == GL_TEXTURE_RECTANGLE_NV) && border != 0) { 431 431 if (!IsProxyTarget(target)) 432 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,432 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 433 433 "glTexImage2D(border=%d)", border); 434 434 return GL_TRUE; … … 441 441 if (!isLegalSize(g, width - 2 * border, g->limits.maxTextureSize)) { 442 442 if (!IsProxyTarget(target)) 443 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,443 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 444 444 "glTexImage1D(width=%d)", width); 445 445 return GL_TRUE; … … 450 450 !isLegalSize(g, height - 2 * border, g->limits.maxTextureSize)) { 451 451 if (!IsProxyTarget(target)) 452 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,452 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 453 453 "glTexImage2D(width=%d, height=%d)", width, height); 454 454 return GL_TRUE; … … 460 460 !isLegalSize(g, depth - 2 * border, g->limits.max3DTextureSize)) { 461 461 if (!IsProxyTarget(target)) 462 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,462 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 463 463 "glTexImage3D(width=%d, height=%d, depth=%d)", 464 464 width, height, depth); … … 471 471 height < 0 || height > (int) g->limits.maxRectTextureSize) { 472 472 if (!IsProxyTarget(target)) 473 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,473 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 474 474 "glTexImage2D(width=%d, height=%d)", width, height); 475 475 return GL_TRUE; … … 482 482 width != height) { 483 483 if (!IsProxyTarget(target)) 484 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,484 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 485 485 "glTexImage2D(width=%d, height=%d)", width, height); 486 486 return GL_TRUE; … … 499 499 */ 500 500 static GLboolean 501 ErrorCheckTexSubImage( GLuint dims, GLenum target, GLint level,501 ErrorCheckTexSubImage(PCRStateTracker pState, GLuint dims, GLenum target, GLint level, 502 502 GLint xoffset, GLint yoffset, GLint zoffset, 503 503 GLsizei width, GLsizei height, GLsizei depth) 504 504 { 505 CRContext *g = GetCurrentContext( );505 CRContext *g = GetCurrentContext(pState); 506 506 CRTextureObj *tobj; 507 507 CRTextureLevel *tl; 508 508 509 509 if (g->current.inBeginEnd) { 510 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,510 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 511 511 "glTexSubImage%uD called in Begin/End", dims); 512 512 return GL_TRUE; … … 515 515 if (dims == 1) { 516 516 if (target != GL_TEXTURE_1D) { 517 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,517 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 518 518 "glTexSubImage1D(target=0x%x)", target); 519 519 return GL_TRUE; … … 529 529 target != GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && 530 530 target != GL_TEXTURE_RECTANGLE_NV) { 531 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,531 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 532 532 "glTexSubImage2D(target=0x%x)", target); 533 533 return GL_TRUE; … … 536 536 else if (dims == 3) { 537 537 if (target != GL_TEXTURE_3D) { 538 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,538 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 539 539 "glTexSubImage3D(target=0x%x)", target); 540 540 return GL_TRUE; … … 544 544 /* test level */ 545 545 if (level < 0 || level > MaxTextureLevel(g, target)) { 546 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,546 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 547 547 "glTexSubImage%uD(level=%d)", dims, level); 548 548 return GL_TRUE; … … 551 551 crStateGetTextureObjectAndImage(g, target, level, &tobj, &tl); 552 552 if (!tobj || !tl) { 553 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,553 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 554 554 "glTexSubImage%uD(target or level)", dims); 555 555 return GL_TRUE; … … 558 558 /* test x/y/zoffset and size */ 559 559 if (xoffset < -tl->border || xoffset + width > tl->width) { 560 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,560 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 561 561 "glTexSubImage%uD(xoffset=%d + width=%d > %d)", 562 562 dims, xoffset, width, tl->width); … … 564 564 } 565 565 if (dims > 1 && (yoffset < -tl->border || yoffset + height > tl->height)) { 566 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,566 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 567 567 "glTexSubImage%uD(yoffset=%d + height=%d > %d)", 568 568 dims, yoffset, height, tl->height); … … 570 570 } 571 571 if (dims > 2 && (zoffset < -tl->border || zoffset + depth > tl->depth)) { 572 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,572 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 573 573 "glTexSubImage%uD(zoffset=%d and/or depth=%d)", 574 574 dims, zoffset, depth); … … 583 583 584 584 void STATE_APIENTRY 585 crStateTexImage1D( GLenum target, GLint level, GLint internalFormat,585 crStateTexImage1D(PCRStateTracker pState, GLenum target, GLint level, GLint internalFormat, 586 586 GLsizei width, GLint border, GLenum format, 587 587 GLenum type, const GLvoid * pixels) 588 588 { 589 CRContext *g = GetCurrentContext( );589 CRContext *g = GetCurrentContext(pState); 590 590 CRTextureState *t = &(g->texture); 591 591 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE … … 594 594 CRTextureObj *tobj; 595 595 CRTextureLevel *tl; 596 CRStateBits *sb = GetCurrentBits( );596 CRStateBits *sb = GetCurrentBits(pState); 597 597 CRTextureBits *tb = &(sb->texture); 598 598 #ifdef CR_STATE_NO_TEXTURE_IMAGE_STORE … … 602 602 FLUSH(); 603 603 604 if (ErrorCheckTexImage( 1, target, level, width, 1, 1, border)) {604 if (ErrorCheckTexImage(pState, 1, target, level, width, 1, 1, border)) { 605 605 if (IsProxyTarget(target)) { 606 606 /* clear all state, but don't generate error */ … … 631 631 if (!tl->img) 632 632 { 633 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY,633 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, 634 634 "glTexImage1D out of memory"); 635 635 return; 636 636 } 637 637 if (pixels) 638 crPixelCopy1D( (GLvoid *) tl->img, format, type,638 crPixelCopy1D(pState, (GLvoid *) tl->img, format, type, 639 639 pixels, format, type, width, &(c->unpack)); 640 640 } … … 699 699 700 700 void STATE_APIENTRY 701 crStateCopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)702 { 703 CRContext *g = GetCurrentContext( );701 crStateCopyTexImage2D(PCRStateTracker pState, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) 702 { 703 CRContext *g = GetCurrentContext(pState); 704 704 CRTextureObj *tobj = NULL; 705 705 CRTextureLevel *tl = NULL; … … 707 707 708 708 if (level < 0 || level > MaxTextureLevel(g, target)) { 709 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,709 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 710 710 "crStateCopyTexImage2D: invalid level: %d", level); 711 711 return; … … 718 718 if (tobj == NULL || tl == NULL) 719 719 { 720 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,720 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 721 721 "crStateCopyTexImage2D: invalid target: 0x%x", target); 722 722 return; … … 754 754 755 755 void STATE_APIENTRY 756 crStateTexImage2D( GLenum target, GLint level, GLint internalFormat,756 crStateTexImage2D(PCRStateTracker pState, GLenum target, GLint level, GLint internalFormat, 757 757 GLsizei width, GLsizei height, GLint border, 758 758 GLenum format, GLenum type, const GLvoid * pixels) 759 759 { 760 CRContext *g = GetCurrentContext( );760 CRContext *g = GetCurrentContext(pState); 761 761 CRTextureState *t = &(g->texture); 762 762 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE … … 765 765 CRTextureObj *tobj = NULL; 766 766 CRTextureLevel *tl = NULL; 767 CRStateBits *sb = GetCurrentBits( );767 CRStateBits *sb = GetCurrentBits(pState); 768 768 CRTextureBits *tb = &(sb->texture); 769 769 // Distributed textures are not used by VBox … … 776 776 */ 777 777 if (!is_distrib 778 && ErrorCheckTexImage( 2, target, level, width, height, 1, border)) {778 && ErrorCheckTexImage(pState, 2, target, level, width, height, 1, border)) { 779 779 if (IsProxyTarget(target)) { 780 780 /* clear all state, but don't generate error */ … … 818 818 if (!tl->img) 819 819 { 820 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY,820 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, 821 821 "glTexImage2D out of memory"); 822 822 return; … … 892 892 #if defined( CR_OPENGL_VERSION_1_2 ) || defined( GL_EXT_texture3D ) 893 893 void STATE_APIENTRY 894 crStateTexImage3D( GLenum target, GLint level,894 crStateTexImage3D(PCRStateTracker pState, GLenum target, GLint level, 895 895 GLint internalFormat, 896 896 GLsizei width, GLsizei height, … … 898 898 GLenum format, GLenum type, const GLvoid * pixels) 899 899 { 900 CRContext *g = GetCurrentContext( );900 CRContext *g = GetCurrentContext(pState); 901 901 CRTextureState *t = &(g->texture); 902 902 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE … … 905 905 CRTextureObj *tobj = NULL; 906 906 CRTextureLevel *tl = NULL; 907 CRStateBits *sb = GetCurrentBits( );907 CRStateBits *sb = GetCurrentBits(pState); 908 908 CRTextureBits *tb = &(sb->texture); 909 909 (void)pixels; … … 911 911 FLUSH(); 912 912 913 if (ErrorCheckTexImage( 3, target, level, width, height, depth, border)) {913 if (ErrorCheckTexImage(pState, 3, target, level, width, height, depth, border)) { 914 914 if (IsProxyTarget(target)) { 915 915 /* clear all state, but don't generate error */ … … 940 940 if (!tl->img) 941 941 { 942 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY,942 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, 943 943 "glTexImage3D out of memory"); 944 944 return; … … 979 979 #ifdef GL_EXT_texture3D 980 980 void STATE_APIENTRY 981 crStateTexImage3DEXT( GLenum target, GLint level,981 crStateTexImage3DEXT(PCRStateTracker pState, GLenum target, GLint level, 982 982 GLenum internalFormat, 983 983 GLsizei width, GLsizei height, GLsizei depth, … … 985 985 const GLvoid * pixels) 986 986 { 987 crStateTexImage3D( target, level, (GLint) internalFormat, width, height,987 crStateTexImage3D(pState, target, level, (GLint) internalFormat, width, height, 988 988 depth, border, format, type, pixels); 989 989 } … … 992 992 993 993 void STATE_APIENTRY 994 crStateTexSubImage1D( GLenum target, GLint level, GLint xoffset,994 crStateTexSubImage1D(PCRStateTracker pState, GLenum target, GLint level, GLint xoffset, 995 995 GLsizei width, GLenum format, 996 996 GLenum type, const GLvoid * pixels) 997 997 { 998 CRContext *g = GetCurrentContext( );998 CRContext *g = GetCurrentContext(pState); 999 999 CRTextureState *t = &(g->texture); 1000 1000 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1001 1001 CRClientState *c = &(g->client); 1002 1002 #endif 1003 CRStateBits *sb = GetCurrentBits( );1003 CRStateBits *sb = GetCurrentBits(pState); 1004 1004 CRTextureBits *tb = &(sb->texture); 1005 1005 CRTextureUnit *unit = t->unit + t->curTextureUnit; … … 1010 1010 FLUSH(); 1011 1011 1012 if (ErrorCheckTexSubImage( 1, target, level, xoffset, 0, 0,1012 if (ErrorCheckTexSubImage(pState, 1, target, level, xoffset, 0, 0, 1013 1013 width, 1, 1)) { 1014 1014 return; /* GL error state already set */ … … 1025 1025 xoffset += tl->border; 1026 1026 1027 crPixelCopy1D( (void *) (tl->img + xoffset * tl->bytesPerPixel),1027 crPixelCopy1D(pState, (void *) (tl->img + xoffset * tl->bytesPerPixel), 1028 1028 tl->format, tl->type, 1029 1029 pixels, format, type, width, &(c->unpack)); … … 1047 1047 1048 1048 void STATE_APIENTRY 1049 crStateTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset,1049 crStateTexSubImage2D(PCRStateTracker pState, GLenum target, GLint level, GLint xoffset, GLint yoffset, 1050 1050 GLsizei width, GLsizei height, 1051 1051 GLenum format, GLenum type, const GLvoid * pixels) 1052 1052 { 1053 CRContext *g = GetCurrentContext( );1054 CRStateBits *sb = GetCurrentBits( );1053 CRContext *g = GetCurrentContext(pState); 1054 CRStateBits *sb = GetCurrentBits(pState); 1055 1055 CRTextureBits *tb = &(sb->texture); 1056 1056 CRTextureObj *tobj; … … 1067 1067 FLUSH(); 1068 1068 1069 if (ErrorCheckTexSubImage( 2, target, level, xoffset, yoffset, 0,1069 if (ErrorCheckTexSubImage(pState, 2, target, level, xoffset, yoffset, 0, 1070 1070 width, height, 1)) { 1071 1071 return; /* GL error state already set */ … … 1089 1089 subimg = (GLubyte *) crAlloc(crImageSize(tl->format, tl->type, width, height)); 1090 1090 1091 crPixelCopy2D( width, height, subimg, tl->format, tl->type, NULL, /* dst */1091 crPixelCopy2D(pState, width, height, subimg, tl->format, tl->type, NULL, /* dst */ 1092 1092 pixels, format, type, &(c->unpack)); /* src */ 1093 1093 … … 1127 1127 char *data; 1128 1128 1129 diff_api.GetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &w);1130 diff_api.GetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &h);1129 pState->diff_api.GetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &w); 1130 pState->diff_api.GetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &h); 1131 1131 1132 1132 data = crAlloc(w*h*4); … … 1141 1141 #if defined( CR_OPENGL_VERSION_1_2 ) 1142 1142 void STATE_APIENTRY 1143 crStateTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset,1143 crStateTexSubImage3D(PCRStateTracker pState, GLenum target, GLint level, GLint xoffset, GLint yoffset, 1144 1144 GLint zoffset, GLsizei width, GLsizei height, 1145 1145 GLsizei depth, GLenum format, GLenum type, 1146 1146 const GLvoid * pixels) 1147 1147 { 1148 CRContext *g = GetCurrentContext( );1148 CRContext *g = GetCurrentContext(pState); 1149 1149 CRTextureState *t = &(g->texture); 1150 CRStateBits *sb = GetCurrentBits( );1150 CRStateBits *sb = GetCurrentBits(pState); 1151 1151 CRTextureBits *tb = &(sb->texture); 1152 1152 CRTextureUnit *unit = t->unit + t->curTextureUnit; … … 1164 1164 FLUSH(); 1165 1165 1166 if (ErrorCheckTexSubImage( 3, target, level, xoffset, yoffset, zoffset,1166 if (ErrorCheckTexSubImage(pState, 3, target, level, xoffset, yoffset, zoffset, 1167 1167 width, height, depth)) { 1168 1168 return; /* GL error state already set */ … … 1186 1186 crAlloc(crTextureSize(tl->format, tl->type, width, height, depth)); 1187 1187 1188 crPixelCopy3D( width, height, depth, subimg, tl->format, tl->type, NULL,1188 crPixelCopy3D(pState, width, height, depth, subimg, tl->format, tl->type, NULL, 1189 1189 pixels, format, type, &(c->unpack)); 1190 1190 … … 1224 1224 1225 1225 void STATE_APIENTRY 1226 crStateCompressedTexImage1DARB( GLenum target, GLint level,1226 crStateCompressedTexImage1DARB(PCRStateTracker pState, GLenum target, GLint level, 1227 1227 GLenum internalFormat, GLsizei width, 1228 1228 GLint border, GLsizei imageSize, 1229 1229 const GLvoid * data) 1230 1230 { 1231 CRContext *g = GetCurrentContext( );1231 CRContext *g = GetCurrentContext(pState); 1232 1232 CRTextureState *t = &(g->texture); 1233 1233 CRTextureObj *tobj; 1234 1234 CRTextureLevel *tl; 1235 CRStateBits *sb = GetCurrentBits( );1235 CRStateBits *sb = GetCurrentBits(pState); 1236 1236 CRTextureBits *tb = &(sb->texture); 1237 1237 (void)data; … … 1239 1239 FLUSH(); 1240 1240 1241 if (ErrorCheckTexImage( 1, target, level, width, 1, 1, border)) {1241 if (ErrorCheckTexImage(pState, 1, target, level, width, 1, 1, border)) { 1242 1242 if (IsProxyTarget(target)) { 1243 1243 /* clear all state, but don't generate error */ … … 1268 1268 if (!tl->img) 1269 1269 { 1270 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY,1270 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, 1271 1271 "glTexImage1D out of memory"); 1272 1272 return; … … 1305 1305 1306 1306 void STATE_APIENTRY 1307 crStateCompressedTexImage2DARB( GLenum target, GLint level,1307 crStateCompressedTexImage2DARB(PCRStateTracker pState, GLenum target, GLint level, 1308 1308 GLenum internalFormat, GLsizei width, 1309 1309 GLsizei height, GLint border, 1310 1310 GLsizei imageSize, const GLvoid * data) 1311 1311 { 1312 CRContext *g = GetCurrentContext( );1312 CRContext *g = GetCurrentContext(pState); 1313 1313 CRTextureState *t = &(g->texture); 1314 1314 CRTextureObj *tobj = NULL; 1315 1315 CRTextureLevel *tl = NULL; 1316 CRStateBits *sb = GetCurrentBits( );1316 CRStateBits *sb = GetCurrentBits(pState); 1317 1317 CRTextureBits *tb = &(sb->texture); 1318 1318 (void)data; … … 1320 1320 FLUSH(); 1321 1321 1322 if (ErrorCheckTexImage( 2, target, level, width, height, 1, border)) {1322 if (ErrorCheckTexImage(pState, 2, target, level, width, height, 1, border)) { 1323 1323 if (IsProxyTarget(target)) { 1324 1324 /* clear all state, but don't generate error */ … … 1349 1349 if (!tl->img) 1350 1350 { 1351 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY,1351 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, 1352 1352 "glTexImage2D out of memory"); 1353 1353 return; … … 1387 1387 1388 1388 void STATE_APIENTRY 1389 crStateCompressedTexImage3DARB( GLenum target, GLint level,1389 crStateCompressedTexImage3DARB(PCRStateTracker pState, GLenum target, GLint level, 1390 1390 GLenum internalFormat, GLsizei width, 1391 1391 GLsizei height, GLsizei depth, GLint border, 1392 1392 GLsizei imageSize, const GLvoid * data) 1393 1393 { 1394 CRContext *g = GetCurrentContext( );1394 CRContext *g = GetCurrentContext(pState); 1395 1395 CRTextureState *t = &(g->texture); 1396 1396 CRTextureObj *tobj = NULL; 1397 1397 CRTextureLevel *tl = NULL; 1398 CRStateBits *sb = GetCurrentBits( );1398 CRStateBits *sb = GetCurrentBits(pState); 1399 1399 CRTextureBits *tb = &(sb->texture); 1400 1400 (void)data; … … 1402 1402 FLUSH(); 1403 1403 1404 if (ErrorCheckTexImage( 3, target, level, width, height, depth, border)) {1404 if (ErrorCheckTexImage(pState, 3, target, level, width, height, depth, border)) { 1405 1405 if (IsProxyTarget(target)) { 1406 1406 /* clear all state, but don't generate error */ … … 1431 1431 if (!tl->img) 1432 1432 { 1433 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY,1433 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, 1434 1434 "glCompressedTexImage3D out of memory"); 1435 1435 return; … … 1469 1469 1470 1470 void STATE_APIENTRY 1471 crStateCompressedTexSubImage1DARB( GLenum target, GLint level, GLint xoffset,1471 crStateCompressedTexSubImage1DARB(PCRStateTracker pState, GLenum target, GLint level, GLint xoffset, 1472 1472 GLsizei width, GLenum format, 1473 1473 GLsizei imageSize, const GLvoid * data) 1474 1474 { 1475 CRContext *g = GetCurrentContext( );1475 CRContext *g = GetCurrentContext(pState); 1476 1476 CRTextureState *t = &(g->texture); 1477 CRStateBits *sb = GetCurrentBits( );1477 CRStateBits *sb = GetCurrentBits(pState); 1478 1478 CRTextureBits *tb = &(sb->texture); 1479 1479 CRTextureUnit *unit = t->unit + t->curTextureUnit; … … 1484 1484 FLUSH(); 1485 1485 1486 if (ErrorCheckTexSubImage( 1, target, level, xoffset, 0, 0, width, 1, 1)) {1486 if (ErrorCheckTexSubImage(pState, 1, target, level, xoffset, 0, 0, width, 1, 1)) { 1487 1487 return; /* GL error state already set */ 1488 1488 } … … 1526 1526 1527 1527 void STATE_APIENTRY 1528 crStateCompressedTexSubImage2DARB( GLenum target, GLint level, GLint xoffset,1528 crStateCompressedTexSubImage2DARB(PCRStateTracker pState, GLenum target, GLint level, GLint xoffset, 1529 1529 GLint yoffset, GLsizei width, 1530 1530 GLsizei height, GLenum format, 1531 1531 GLsizei imageSize, const GLvoid * data) 1532 1532 { 1533 CRContext *g = GetCurrentContext( );1533 CRContext *g = GetCurrentContext(pState); 1534 1534 CRTextureState *t = &(g->texture); 1535 CRStateBits *sb = GetCurrentBits( );1535 CRStateBits *sb = GetCurrentBits(pState); 1536 1536 CRTextureBits *tb = &(sb->texture); 1537 1537 CRTextureUnit *unit = t->unit + t->curTextureUnit; … … 1550 1550 #endif 1551 1551 1552 if (ErrorCheckTexSubImage( 2, target, level, xoffset, yoffset, 0,1552 if (ErrorCheckTexSubImage(pState, 2, target, level, xoffset, yoffset, 0, 1553 1553 width, height, 1)) { 1554 1554 return; /* GL error state already set */ … … 1588 1588 1589 1589 void STATE_APIENTRY 1590 crStateCompressedTexSubImage3DARB( GLenum target, GLint level, GLint xoffset,1590 crStateCompressedTexSubImage3DARB(PCRStateTracker pState, GLenum target, GLint level, GLint xoffset, 1591 1591 GLint yoffset, GLint zoffset, GLsizei width, 1592 1592 GLsizei height, GLsizei depth, … … 1594 1594 const GLvoid * data) 1595 1595 { 1596 CRContext *g = GetCurrentContext( );1596 CRContext *g = GetCurrentContext(pState); 1597 1597 CRTextureState *t = &(g->texture); 1598 CRStateBits *sb = GetCurrentBits( );1598 CRStateBits *sb = GetCurrentBits(pState); 1599 1599 CRTextureBits *tb = &(sb->texture); 1600 1600 CRTextureUnit *unit = t->unit + t->curTextureUnit; … … 1613 1613 #endif 1614 1614 1615 if (ErrorCheckTexSubImage( 3, target, level, xoffset, yoffset, zoffset,1615 if (ErrorCheckTexSubImage(pState, 3, target, level, xoffset, yoffset, zoffset, 1616 1616 width, height, depth)) { 1617 1617 return; /* GL error state already set */ … … 1652 1652 1653 1653 void STATE_APIENTRY 1654 crStateGetCompressedTexImageARB( GLenum target, GLint level, GLvoid * img)1655 { 1656 CRContext *g = GetCurrentContext( );1654 crStateGetCompressedTexImageARB(PCRStateTracker pState, GLenum target, GLint level, GLvoid * img) 1655 { 1656 CRContext *g = GetCurrentContext(pState); 1657 1657 CRTextureObj *tobj; 1658 1658 CRTextureLevel *tl; … … 1660 1660 if (g->current.inBeginEnd) 1661 1661 { 1662 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1662 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1663 1663 "glGetCompressedTexImage called in begin/end"); 1664 1664 return; … … 1667 1667 crStateGetTextureObjectAndImage(g, target, level, &tobj, &tl); 1668 1668 if (!tobj || !tl) { 1669 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1669 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1670 1670 "glGetCompressedTexImage(invalid target or level)"); 1671 1671 return; … … 1673 1673 1674 1674 if (!tl->compressed) { 1675 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1675 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1676 1676 "glGetCompressedTexImage(not a compressed texture)"); 1677 1677 return; … … 1688 1688 crMemcpy(img, tl->img, tl->bytes); 1689 1689 #else 1690 diff_api.GetCompressedTexImageARB(target, level, img);1690 pState->diff_api.GetCompressedTexImageARB(target, level, img); 1691 1691 #endif 1692 1692 } … … 1694 1694 1695 1695 void STATE_APIENTRY 1696 crStateGetTexImage( GLenum target, GLint level, GLenum format,1696 crStateGetTexImage(PCRStateTracker pState, GLenum target, GLint level, GLenum format, 1697 1697 GLenum type, GLvoid * pixels) 1698 1698 { 1699 CRContext *g = GetCurrentContext( );1699 CRContext *g = GetCurrentContext(pState); 1700 1700 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1701 1701 CRClientState *c = &(g->client); … … 1706 1706 if (g->current.inBeginEnd) 1707 1707 { 1708 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1708 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1709 1709 "glGetTexImage called in begin/end"); 1710 1710 return; … … 1713 1713 crStateGetTextureObjectAndImage(g, target, level, &tobj, &tl); 1714 1714 if (!tobj || !tl) { 1715 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1715 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1716 1716 "glGetTexImage(invalid target or level)"); 1717 1717 return; … … 1742 1742 break; 1743 1743 default: 1744 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1744 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1745 1745 "glGetTexImage called with bogus format: %d", format); 1746 1746 return; … … 1758 1758 break; 1759 1759 default: 1760 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1760 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1761 1761 "glGetTexImage called with bogus type: %d", type); 1762 1762 return; … … 1767 1767 if (target == GL_TEXTURE_3D) 1768 1768 { 1769 crPixelCopy3D( tl->width, tl->height, tl->depth, (GLvoid *) pixels, format,1769 crPixelCopy3D(pState, tl->width, tl->height, tl->depth, (GLvoid *) pixels, format, 1770 1770 type, NULL, (tl->img), format, type, &(c->pack)); 1771 1771 } … … 1774 1774 if ((target == GL_TEXTURE_1D) || (target == GL_TEXTURE_2D)) 1775 1775 { 1776 crPixelCopy2D( tl->width, tl->height, (GLvoid *) pixels, format, type, NULL, /* dst */1776 crPixelCopy2D(pState, tl->width, tl->height, (GLvoid *) pixels, format, type, NULL, /* dst */ 1777 1777 tl->img, format, type, &(c->pack)); /* src */ 1778 1778 } 1779 1779 #else 1780 diff_api.GetTexImage(target, level, format, type, pixels);1781 #endif 1782 } 1780 pState->diff_api.GetTexImage(target, level, format, type, pixels); 1781 #endif 1782 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_texture.c
r69392 r78375 49 49 CRLimitsState *limits = &ctx->limits; 50 50 CRTextureState *t = &ctx->texture; 51 CRStateBits *sb = GetCurrentBits( );51 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 52 52 CRTextureBits *tb = &(sb->texture); 53 53 unsigned int i; … … 202 202 203 203 #ifndef IN_GUEST 204 crStateGetTextureObjHWID( tobj);204 crStateGetTextureObjHWID(ctx->pStateTracker, tobj); 205 205 #endif 206 206 … … 520 520 */ 521 521 CRTextureObj * 522 crStateTextureGet( GLenum target, GLuint name)523 { 524 CRContext *g = GetCurrentContext( );522 crStateTextureGet(PCRStateTracker pState, GLenum target, GLuint name) 523 { 524 CRContext *g = GetCurrentContext(pState); 525 525 CRTextureState *t = &(g->texture); 526 526 CRTextureObj *tobj; … … 635 635 } 636 636 637 void crStateRegTextures( GLsizei n, GLuint *names)638 { 639 CRContext *g = GetCurrentContext( );637 void crStateRegTextures(PCRStateTracker pState, GLsizei n, GLuint *names) 638 { 639 CRContext *g = GetCurrentContext(pState); 640 640 crStateRegNames(g, g->shared->textureTable, n, names); 641 641 } … … 643 643 void crStateGenNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names) 644 644 { 645 PCRStateTracker pState = g->pStateTracker; 645 646 GLint start; 646 647 … … 649 650 if (g->current.inBeginEnd) 650 651 { 651 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,652 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 652 653 "crStateGenNames called in Begin/End"); 653 654 return; … … 656 657 if (n < 0) 657 658 { 658 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,659 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 659 660 "Negative n passed to crStateGenNames: %d", n); 660 661 return; … … 670 671 else 671 672 { 672 crStateError( __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glGenTextures");673 } 674 } 675 676 void STATE_APIENTRY crStateGenTextures( GLsizei n, GLuint *textures)677 { 678 CRContext *g = GetCurrentContext( );673 crStateError(pState, __LINE__, __FILE__, GL_OUT_OF_MEMORY, "glGenTextures"); 674 } 675 } 676 677 void STATE_APIENTRY crStateGenTextures(PCRStateTracker pState, GLsizei n, GLuint *textures) 678 { 679 CRContext *g = GetCurrentContext(pState); 679 680 crStateGenNames(g, g->shared->textureTable, n, textures); 680 681 } 681 682 682 static void crStateTextureCheckFBOAPs( GLenum target, GLuint texture)683 static void crStateTextureCheckFBOAPs(PCRStateTracker pState, GLenum target, GLuint texture) 683 684 { 684 685 GLuint u; 685 686 CRFBOAttachmentPoint *ap; 686 CRContext *g = GetCurrentContext( );687 CRContext *g = GetCurrentContext(pState); 687 688 CRFramebufferObjectState *fbo = &g->framebufferobject; 688 689 CRFramebufferObject *pFBO; … … 696 697 if (ap->type==GL_TEXTURE && ap->name==texture) 697 698 { 698 crStateFramebufferTexture1DEXT( target, u+GL_COLOR_ATTACHMENT0_EXT, 0, 0, 0);699 crStateFramebufferTexture1DEXT(pState, target, u+GL_COLOR_ATTACHMENT0_EXT, 0, 0, 0); 699 700 } 700 701 } … … 703 704 if (ap->type==GL_TEXTURE && ap->name==texture) 704 705 { 705 crStateFramebufferTexture1DEXT( target, GL_DEPTH_ATTACHMENT_EXT, 0, 0, 0);706 crStateFramebufferTexture1DEXT(pState, target, GL_DEPTH_ATTACHMENT_EXT, 0, 0, 0); 706 707 } 707 708 … … 709 710 if (ap->type==GL_TEXTURE && ap->name==texture) 710 711 { 711 crStateFramebufferTexture1DEXT( target, GL_STENCIL_ATTACHMENT_EXT, 0, 0, 0);712 crStateFramebufferTexture1DEXT(pState, target, GL_STENCIL_ATTACHMENT_EXT, 0, 0, 0); 712 713 } 713 714 } … … 715 716 static void crStateCleanupTextureRefs(CRContext *g, CRTextureObj *tObj) 716 717 { 718 PCRStateTracker pState = g->pStateTracker; 717 719 CRTextureState *t = &(g->texture); 718 720 GLuint u; … … 751 753 752 754 #ifdef CR_EXT_framebuffer_object 753 crStateTextureCheckFBOAPs( GL_DRAW_FRAMEBUFFER, tObj->id);754 crStateTextureCheckFBOAPs( GL_READ_FRAMEBUFFER, tObj->id);755 #endif 756 } 757 } 758 759 void STATE_APIENTRY crStateDeleteTextures( GLsizei n, const GLuint *textures)760 { 761 CRContext *g = GetCurrentContext( );755 crStateTextureCheckFBOAPs(pState, GL_DRAW_FRAMEBUFFER, tObj->id); 756 crStateTextureCheckFBOAPs(pState, GL_READ_FRAMEBUFFER, tObj->id); 757 #endif 758 } 759 } 760 761 void STATE_APIENTRY crStateDeleteTextures(PCRStateTracker pState, GLsizei n, const GLuint *textures) 762 { 763 CRContext *g = GetCurrentContext(pState); 762 764 CRTextureState *t = &(g->texture); 763 CRStateBits *sb = GetCurrentBits( );765 CRStateBits *sb = GetCurrentBits(pState); 764 766 CRTextureBits *tb = &(sb->texture); 765 767 int i; … … 769 771 if (g->current.inBeginEnd) 770 772 { 771 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,773 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 772 774 "glDeleteTextures called in Begin/End"); 773 775 return; … … 776 778 if (n < 0) 777 779 { 778 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,780 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 779 781 "Negative n passed to glDeleteTextures: %d", n); 780 782 return; … … 803 805 * This is why g_pAvailableContexts[j] could be NULL 804 806 * also g_pAvailableContexts[0] will hold default context, which we should discard */ 805 CRContext *ctx = g_pAvailableContexts[j];807 CRContext *ctx = pState->apAvailableContexts[j]; 806 808 if (j && ctx) 807 809 { … … 831 833 832 834 833 void STATE_APIENTRY crStateClientActiveTextureARB( GLenum texture )834 { 835 CRContext *g = GetCurrentContext( );835 void STATE_APIENTRY crStateClientActiveTextureARB(PCRStateTracker pState, GLenum texture ) 836 { 837 CRContext *g = GetCurrentContext(pState); 836 838 CRClientState *c = &(g->client); 837 839 … … 839 841 840 842 if (!g->extensions.ARB_multitexture) { 841 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,843 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 842 844 "glClientActiveTextureARB not available"); 843 845 return; … … 846 848 if (g->current.inBeginEnd) 847 849 { 848 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,850 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 849 851 "glClientActiveTextureARB called in Begin/End"); 850 852 return; … … 854 856 texture >= GL_TEXTURE0_ARB + g->limits.maxTextureUnits) 855 857 { 856 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,858 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 857 859 "crStateClientActiveTexture: unit = %d (max is %d)", 858 860 texture, g->limits.maxTextureUnits ); … … 862 864 c->curClientTextureUnit = texture - GL_TEXTURE0_ARB; 863 865 864 DIRTY(GetCurrentBits( )->client.dirty, g->neg_bitid);865 } 866 867 void STATE_APIENTRY crStateActiveTextureARB( GLenum texture )868 { 869 CRContext *g = GetCurrentContext( );866 DIRTY(GetCurrentBits(pState)->client.dirty, g->neg_bitid); 867 } 868 869 void STATE_APIENTRY crStateActiveTextureARB(PCRStateTracker pState, GLenum texture ) 870 { 871 CRContext *g = GetCurrentContext(pState); 870 872 CRTextureState *t = &(g->texture); 871 873 … … 873 875 874 876 if (!g->extensions.ARB_multitexture) { 875 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,877 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 876 878 "glActiveTextureARB not available"); 877 879 return; … … 880 882 if (g->current.inBeginEnd) 881 883 { 882 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glActiveTextureARB called in Begin/End");884 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glActiveTextureARB called in Begin/End"); 883 885 return; 884 886 } … … 886 888 if ( texture < GL_TEXTURE0_ARB || texture >= GL_TEXTURE0_ARB + g->limits.maxTextureUnits) 887 889 { 888 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "Bad texture unit passed to crStateActiveTexture: %d (max is %d)", texture, g->limits.maxTextureUnits );890 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "Bad texture unit passed to crStateActiveTexture: %d (max is %d)", texture, g->limits.maxTextureUnits ); 889 891 return; 890 892 } … … 894 896 /* update the current matrix pointer, etc. */ 895 897 if (g->transform.matrixMode == GL_TEXTURE) { 896 crStateMatrixMode( GL_TEXTURE);898 crStateMatrixMode(pState, GL_TEXTURE); 897 899 } 898 900 } … … 903 905 # endif 904 906 905 DECLEXPORT(void) crStatePinTexture( GLuint texture, GLboolean pin)907 DECLEXPORT(void) crStatePinTexture(PCRStateTracker pState, GLuint texture, GLboolean pin) 906 908 { 907 909 CRTextureObj * pTobj; 908 CRSharedState *pShared = crStateGlobalSharedAcquire( );910 CRSharedState *pShared = crStateGlobalSharedAcquire(pState); 909 911 if (pShared) 910 912 { … … 929 931 { 930 932 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pTobj)) 931 crStateOnTextureUsageRelease(pS hared, pTobj);933 crStateOnTextureUsageRelease(pState, pShared, pTobj); 932 934 } 933 935 } … … 935 937 WARN(("texture %d not defined", texture)); 936 938 937 crStateGlobalSharedRelease( );939 crStateGlobalSharedRelease(pState); 938 940 } 939 941 else … … 942 944 #endif 943 945 944 DECLEXPORT(void) crStateSetTextureUsed( GLuint texture, GLboolean used)945 { 946 CRContext *g = GetCurrentContext( );946 DECLEXPORT(void) crStateSetTextureUsed(PCRStateTracker pState, GLuint texture, GLboolean used) 947 { 948 CRContext *g = GetCurrentContext(pState); 947 949 CRTextureObj *tobj; 948 950 … … 973 975 else 974 976 { 975 CRStateBits *sb = GetCurrentBits( );977 CRStateBits *sb = GetCurrentBits(pState); 976 978 CRTextureBits *tb = &(sb->texture); 977 979 CRTextureState *t = &(g->texture); … … 986 988 } 987 989 988 void STATE_APIENTRY crStateBindTexture( GLenum target, GLuint texture)989 { 990 CRContext *g = GetCurrentContext( );990 void STATE_APIENTRY crStateBindTexture(PCRStateTracker pState, GLenum target, GLuint texture) 991 { 992 CRContext *g = GetCurrentContext(pState); 991 993 CRTextureState *t = &(g->texture); 992 994 CRTextureObj *tobj; 993 CRStateBits *sb = GetCurrentBits( );995 CRStateBits *sb = GetCurrentBits(pState); 994 996 CRTextureBits *tb = &(sb->texture); 995 997 … … 998 1000 if (g->current.inBeginEnd) 999 1001 { 1000 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glBindTexture called in Begin/End");1002 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glBindTexture called in Begin/End"); 1001 1003 return; 1002 1004 } … … 1021 1023 case GL_TEXTURE_CUBE_MAP_ARB: 1022 1024 if (!g->extensions.ARB_texture_cube_map) { 1023 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1025 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1024 1026 "Invalid target passed to glBindTexture: %d", target); 1025 1027 return; … … 1031 1033 case GL_TEXTURE_RECTANGLE_NV: 1032 1034 if (!g->extensions.NV_texture_rectangle) { 1033 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1035 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1034 1036 "Invalid target passed to glBindTexture: %d", target); 1035 1037 return; … … 1039 1041 #endif 1040 1042 default: 1041 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid target passed to glBindTexture: %d", target);1043 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "Invalid target passed to glBindTexture: %d", target); 1042 1044 return; 1043 1045 } … … 1070 1072 { 1071 1073 crWarning( "You called glBindTexture with a target of 0x%x, but the texture you wanted was target 0x%x [1D: %x 2D: %x 3D: %x cube: %x]", (int) target, (int) tobj->target, GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP ); 1072 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "Attempt to bind a texture of different dimensions");1074 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "Attempt to bind a texture of different dimensions"); 1073 1075 return; 1074 1076 } … … 1099 1101 #endif 1100 1102 default: 1101 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1103 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1102 1104 "Invalid target passed to glBindTexture: %d", target); 1103 1105 return; … … 1110 1112 1111 1113 void STATE_APIENTRY 1112 crStateTexParameterfv( GLenum target, GLenum pname, const GLfloat *param)1113 { 1114 CRContext *g = GetCurrentContext( );1114 crStateTexParameterfv(PCRStateTracker pState, GLenum target, GLenum pname, const GLfloat *param) 1115 { 1116 CRContext *g = GetCurrentContext(pState); 1115 1117 CRTextureObj *tobj = NULL; 1116 1118 CRTextureLevel *tl = NULL; 1117 1119 GLenum e = (GLenum) *param; 1118 CRStateBits *sb = GetCurrentBits( );1120 CRStateBits *sb = GetCurrentBits(pState); 1119 1121 CRTextureBits *tb = &(sb->texture); 1120 1122 unsigned int i; … … 1124 1126 if (g->current.inBeginEnd) 1125 1127 { 1126 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1128 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1127 1129 "TexParameterfv called in Begin/End"); 1128 1130 return; … … 1131 1133 crStateGetTextureObjectAndImage(g, target, 0, &tobj, &tl); 1132 1134 if (!tobj) { 1133 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1135 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1134 1136 "TexParamterfv(invalid target=0x%x)", target); 1135 1137 return; … … 1146 1148 e != GL_LINEAR_MIPMAP_LINEAR) 1147 1149 { 1148 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1150 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1149 1151 "TexParamterfv: GL_TEXTURE_MIN_FILTER invalid param: %d", e); 1150 1152 return; … … 1155 1157 if (e != GL_NEAREST && e != GL_LINEAR) 1156 1158 { 1157 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1159 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1158 1160 "TexParamterfv: GL_TEXTURE_MAG_FILTER invalid param: %d", e); 1159 1161 return; … … 1191 1193 #endif 1192 1194 else { 1193 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1195 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1194 1196 "TexParameterfv: GL_TEXTURE_WRAP_S invalid param: 0x%x", e); 1195 1197 return; … … 1226 1228 #endif 1227 1229 else { 1228 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1230 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1229 1231 "TexParameterfv: GL_TEXTURE_WRAP_T invalid param: 0x%x", e); 1230 1232 return; … … 1260 1262 #endif 1261 1263 else { 1262 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1264 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1263 1265 "TexParameterfv: GL_TEXTURE_WRAP_R invalid param: 0x%x", e); 1264 1266 return; … … 1277 1279 if (e < 0.0f) 1278 1280 { 1279 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1281 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1280 1282 "TexParameterfv: GL_TEXTURE_BASE_LEVEL invalid param: 0x%x", e); 1281 1283 return; … … 1286 1288 if (e < 0.0f) 1287 1289 { 1288 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1290 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1289 1291 "TexParameterfv: GL_TEXTURE_MAX_LEVEL invalid param: 0x%x", e); 1290 1292 return; … … 1304 1306 if (param[0] < 1.0f) 1305 1307 { 1306 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1308 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1307 1309 "TexParameterfv: GL_TEXTURE_MAX_ANISOTROPY_EXT called with parameter less than 1: %f", param[0]); 1308 1310 return; … … 1326 1328 else 1327 1329 { 1328 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1330 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1329 1331 "TexParameterfv: GL_DEPTH_TEXTURE_MODE_ARB called with invalid parameter: 0x%x", param[0]); 1330 1332 return; … … 1342 1344 else 1343 1345 { 1344 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1346 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1345 1347 "TexParameterfv: GL_TEXTURE_COMPARE_MODE_ARB called with invalid parameter: 0x%x", param[0]); 1346 1348 return; … … 1368 1370 #endif 1369 1371 else { 1370 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,1372 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 1371 1373 "TexParameterfv: GL_TEXTURE_COMPARE_FUNC_ARB called with invalid parameter: 0x%x", param[0]); 1372 1374 return; … … 1389 1391 #endif 1390 1392 default: 1391 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1393 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1392 1394 "TexParamterfv: Invalid pname: %d", pname); 1393 1395 return; … … 1404 1406 1405 1407 void STATE_APIENTRY 1406 crStateTexParameteriv( GLenum target, GLenum pname, const GLint *param)1408 crStateTexParameteriv(PCRStateTracker pState, GLenum target, GLenum pname, const GLint *param) 1407 1409 { 1408 1410 GLfloat f_param; … … 1439 1441 #endif 1440 1442 f_param = (GLfloat) (*param); 1441 crStateTexParameterfv( target, pname, &(f_param) );1443 crStateTexParameterfv(pState, target, pname, &(f_param) ); 1442 1444 break; 1443 1445 case GL_TEXTURE_BORDER_COLOR: … … 1446 1448 f_color.b = ((GLfloat) param[2])/CR_MAXINT; 1447 1449 f_color.a = ((GLfloat) param[3])/CR_MAXINT; 1448 crStateTexParameterfv( target, pname, (const GLfloat *) &(f_color) );1450 crStateTexParameterfv(pState, target, pname, (const GLfloat *) &(f_color) ); 1449 1451 break; 1450 1452 default: 1451 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1453 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1452 1454 "TexParamteriv: Invalid pname: %d", pname); 1453 1455 return; … … 1457 1459 1458 1460 void STATE_APIENTRY 1459 crStateTexParameterf( GLenum target, GLenum pname, GLfloat param)1460 { 1461 crStateTexParameterfv( target, pname, ¶m );1461 crStateTexParameterf(PCRStateTracker pState, GLenum target, GLenum pname, GLfloat param) 1462 { 1463 crStateTexParameterfv(pState, target, pname, ¶m ); 1462 1464 } 1463 1465 1464 1466 1465 1467 void STATE_APIENTRY 1466 crStateTexParameteri( GLenum target, GLenum pname, GLint param) {1468 crStateTexParameteri(PCRStateTracker pState, GLenum target, GLenum pname, GLint param) { 1467 1469 GLfloat f_param = (GLfloat) param; 1468 crStateTexParameterfv( target, pname, &f_param );1470 crStateTexParameterfv(pState, target, pname, &f_param ); 1469 1471 } 1470 1472 1471 1473 1472 1474 void STATE_APIENTRY 1473 crStateTexEnvfv( GLenum target, GLenum pname, const GLfloat *param)1474 { 1475 CRContext *g = GetCurrentContext( );1475 crStateTexEnvfv(PCRStateTracker pState, GLenum target, GLenum pname, const GLfloat *param) 1476 { 1477 CRContext *g = GetCurrentContext(pState); 1476 1478 CRTextureState *t = &(g->texture); 1477 CRStateBits *sb = GetCurrentBits( );1479 CRStateBits *sb = GetCurrentBits(pState); 1478 1480 CRTextureBits *tb = &(sb->texture); 1479 1481 GLenum e; … … 1487 1489 if (g->current.inBeginEnd) 1488 1490 { 1489 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,1491 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 1490 1492 "glTexEnvfv called in begin/end"); 1491 1493 return; … … 1495 1497 if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { 1496 1498 if (!g->extensions.EXT_texture_lod_bias || pname != GL_TEXTURE_LOD_BIAS_EXT) { 1497 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnv");1499 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnv"); 1498 1500 } 1499 1501 else { … … 1509 1511 if (target == GL_POINT_SPRITE_ARB) { 1510 1512 if (!g->extensions.ARB_point_sprite || pname != GL_COORD_REPLACE_ARB) { 1511 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnv");1513 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnv"); 1512 1514 } 1513 1515 else { … … 1523 1525 if (target != GL_TEXTURE_ENV) 1524 1526 { 1525 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1527 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1526 1528 "glTexEnvfv: target != GL_TEXTURE_ENV: %d", target); 1527 1529 return; … … 1539 1541 e != GL_COMBINE_ARB) 1540 1542 { 1541 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1543 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1542 1544 "glTexEnvfv: invalid param: %f", *param); 1543 1545 return; … … 1583 1585 #endif 1584 1586 else { 1585 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv(param=0x%x", e);1587 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv(param=0x%x", e); 1586 1588 return; 1587 1589 } … … 1599 1601 } 1600 1602 else { 1601 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv");1603 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv"); 1602 1604 return; 1603 1605 } … … 1621 1623 } 1622 1624 else { 1623 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv");1625 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv"); 1624 1626 return; 1625 1627 } … … 1643 1645 } 1644 1646 else { 1645 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv");1647 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv"); 1646 1648 return; 1647 1649 } … … 1660 1662 } 1661 1663 else { 1662 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv");1664 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv"); 1663 1665 return; 1664 1666 } … … 1675 1677 } 1676 1678 else { 1677 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv(param=0x%x)", e);1679 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glTexEnvfv(param=0x%x)", e); 1678 1680 return; 1679 1681 } … … 1687 1689 } 1688 1690 else { 1689 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glTexEnvfv");1691 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glTexEnvfv"); 1690 1692 return; 1691 1693 } … … 1699 1701 } 1700 1702 else { 1701 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "glTexEnvfv");1703 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, "glTexEnvfv"); 1702 1704 return; 1703 1705 } … … 1706 1708 1707 1709 default: 1708 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1710 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1709 1711 "glTexEnvfv: invalid pname: %d", pname); 1710 1712 return; … … 1717 1719 1718 1720 void STATE_APIENTRY 1719 crStateTexEnviv( GLenum target, GLenum pname, const GLint *param)1721 crStateTexEnviv(PCRStateTracker pState, GLenum target, GLenum pname, const GLint *param) 1720 1722 { 1721 1723 GLfloat f_param; … … 1725 1727 case GL_TEXTURE_ENV_MODE: 1726 1728 f_param = (GLfloat) (*param); 1727 crStateTexEnvfv( target, pname, &f_param );1729 crStateTexEnvfv(pState, target, pname, &f_param ); 1728 1730 break; 1729 1731 case GL_TEXTURE_ENV_COLOR: … … 1732 1734 f_color.b = ((GLfloat) param[2]) / CR_MAXINT; 1733 1735 f_color.a = ((GLfloat) param[3]) / CR_MAXINT; 1734 crStateTexEnvfv( target, pname, (const GLfloat *) &f_color );1736 crStateTexEnvfv(pState, target, pname, (const GLfloat *) &f_color ); 1735 1737 break; 1736 1738 #ifdef CR_ARB_texture_env_combine … … 1752 1754 case GL_ALPHA_SCALE: 1753 1755 f_param = (GLfloat) (*param); 1754 crStateTexEnvfv( target, pname, &f_param );1756 crStateTexEnvfv(pState, target, pname, &f_param ); 1755 1757 break; 1756 1758 #endif … … 1758 1760 case GL_TEXTURE_LOD_BIAS_EXT: 1759 1761 f_param = (GLfloat) (*param); 1760 crStateTexEnvfv( target, pname, &f_param);1762 crStateTexEnvfv(pState, target, pname, &f_param); 1761 1763 break; 1762 1764 #endif … … 1764 1766 case GL_COORD_REPLACE_ARB: 1765 1767 f_param = (GLfloat) *param; 1766 crStateTexEnvfv( target, pname, &f_param);1768 crStateTexEnvfv(pState, target, pname, &f_param); 1767 1769 break; 1768 1770 #endif 1769 1771 1770 1772 default: 1771 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1773 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1772 1774 "glTexEnvfv: invalid pname: %d", pname); 1773 1775 return; … … 1777 1779 1778 1780 void STATE_APIENTRY 1779 crStateTexEnvf( GLenum target, GLenum pname, GLfloat param)1780 { 1781 crStateTexEnvfv( target, pname, ¶m );1781 crStateTexEnvf(PCRStateTracker pState, GLenum target, GLenum pname, GLfloat param) 1782 { 1783 crStateTexEnvfv(pState, target, pname, ¶m ); 1782 1784 } 1783 1785 1784 1786 1785 1787 void STATE_APIENTRY 1786 crStateTexEnvi( GLenum target, GLenum pname, GLint param)1788 crStateTexEnvi(PCRStateTracker pState, GLenum target, GLenum pname, GLint param) 1787 1789 { 1788 1790 GLfloat f_param = (GLfloat) param; 1789 crStateTexEnvfv( target, pname, &f_param );1791 crStateTexEnvfv(pState, target, pname, &f_param ); 1790 1792 } 1791 1793 1792 1794 1793 1795 void STATE_APIENTRY 1794 crStateGetTexEnvfv( GLenum target, GLenum pname, GLfloat *param)1795 { 1796 CRContext *g = GetCurrentContext( );1796 crStateGetTexEnvfv(PCRStateTracker pState, GLenum target, GLenum pname, GLfloat *param) 1797 { 1798 CRContext *g = GetCurrentContext(pState); 1797 1799 CRTextureState *t = &(g->texture); 1798 1800 1799 1801 if (g->current.inBeginEnd) 1800 1802 { 1801 crStateError( __LINE__, __FILE__,GL_INVALID_OPERATION,1803 crStateError(pState, __LINE__, __FILE__,GL_INVALID_OPERATION, 1802 1804 "glGetTexEnvfv called in begin/end"); 1803 1805 return; … … 1807 1809 if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { 1808 1810 if (!g->extensions.EXT_texture_lod_bias || pname != GL_TEXTURE_LOD_BIAS_EXT) { 1809 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnv");1811 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnv"); 1810 1812 } 1811 1813 else { … … 1819 1821 if (target == GL_POINT_SPRITE_ARB) { 1820 1822 if (!g->extensions.ARB_point_sprite || pname != GL_COORD_REPLACE_ARB) { 1821 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnv");1823 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnv"); 1822 1824 } 1823 1825 else { … … 1830 1832 if (target != GL_TEXTURE_ENV) 1831 1833 { 1832 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1834 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1833 1835 "glGetTexEnvfv: target != GL_TEXTURE_ENV: %d", target); 1834 1836 return; … … 1850 1852 } 1851 1853 else { 1852 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1854 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1853 1855 return; 1854 1856 } … … 1859 1861 } 1860 1862 else { 1861 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1863 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1862 1864 return; 1863 1865 } … … 1868 1870 } 1869 1871 else { 1870 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1872 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1871 1873 return; 1872 1874 } … … 1877 1879 } 1878 1880 else { 1879 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1881 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1880 1882 return; 1881 1883 } … … 1886 1888 } 1887 1889 else { 1888 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1890 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1889 1891 return; 1890 1892 } … … 1895 1897 } 1896 1898 else { 1897 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1899 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1898 1900 return; 1899 1901 } … … 1904 1906 } 1905 1907 else { 1906 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1908 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1907 1909 return; 1908 1910 } … … 1913 1915 } 1914 1916 else { 1915 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1917 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1916 1918 return; 1917 1919 } … … 1922 1924 } 1923 1925 else { 1924 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1926 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1925 1927 return; 1926 1928 } … … 1931 1933 } 1932 1934 else { 1933 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1935 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1934 1936 return; 1935 1937 } … … 1940 1942 } 1941 1943 else { 1942 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1944 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1943 1945 return; 1944 1946 } … … 1949 1951 } 1950 1952 else { 1951 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1953 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1952 1954 return; 1953 1955 } … … 1958 1960 } 1959 1961 else { 1960 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1962 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1961 1963 return; 1962 1964 } … … 1967 1969 } 1968 1970 else { 1969 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1971 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1970 1972 return; 1971 1973 } … … 1976 1978 } 1977 1979 else { 1978 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1980 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1979 1981 return; 1980 1982 } … … 1985 1987 } 1986 1988 else { 1987 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");1989 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); 1988 1990 return; 1989 1991 } 1990 1992 break; 1991 1993 default: 1992 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,1994 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 1993 1995 "glGetTexEnvfv: invalid pname: %d", pname); 1994 1996 return; … … 1998 2000 1999 2001 void STATE_APIENTRY 2000 crStateGetTexEnviv( GLenum target, GLenum pname, GLint *param)2001 { 2002 CRContext *g = GetCurrentContext( );2002 crStateGetTexEnviv(PCRStateTracker pState, GLenum target, GLenum pname, GLint *param) 2003 { 2004 CRContext *g = GetCurrentContext(pState); 2003 2005 CRTextureState *t = &(g->texture); 2004 2006 2005 2007 if (g->current.inBeginEnd) 2006 2008 { 2007 crStateError( __LINE__, __FILE__,GL_INVALID_OPERATION,2009 crStateError(pState, __LINE__, __FILE__,GL_INVALID_OPERATION, 2008 2010 "glGetTexEnviv called in begin/end"); 2009 2011 return; … … 2013 2015 if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { 2014 2016 if (!g->extensions.EXT_texture_lod_bias || pname != GL_TEXTURE_LOD_BIAS_EXT) { 2015 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnv");2017 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnv"); 2016 2018 } 2017 2019 else { … … 2025 2027 if (target == GL_POINT_SPRITE_ARB) { 2026 2028 if (!g->extensions.ARB_point_sprite || pname != GL_COORD_REPLACE_ARB) { 2027 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnv");2029 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnv"); 2028 2030 } 2029 2031 else { … … 2036 2038 if (target != GL_TEXTURE_ENV) 2037 2039 { 2038 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2040 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2039 2041 "glGetTexEnviv: target != GL_TEXTURE_ENV: %d", target); 2040 2042 return; … … 2056 2058 } 2057 2059 else { 2058 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2060 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2059 2061 return; 2060 2062 } … … 2065 2067 } 2066 2068 else { 2067 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2069 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2068 2070 return; 2069 2071 } … … 2074 2076 } 2075 2077 else { 2076 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2078 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2077 2079 return; 2078 2080 } … … 2083 2085 } 2084 2086 else { 2085 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2087 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2086 2088 return; 2087 2089 } … … 2092 2094 } 2093 2095 else { 2094 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2096 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2095 2097 return; 2096 2098 } … … 2101 2103 } 2102 2104 else { 2103 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2105 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2104 2106 return; 2105 2107 } … … 2110 2112 } 2111 2113 else { 2112 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2114 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2113 2115 return; 2114 2116 } … … 2119 2121 } 2120 2122 else { 2121 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2123 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2122 2124 return; 2123 2125 } … … 2128 2130 } 2129 2131 else { 2130 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2132 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2131 2133 return; 2132 2134 } … … 2137 2139 } 2138 2140 else { 2139 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2141 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2140 2142 return; 2141 2143 } … … 2146 2148 } 2147 2149 else { 2148 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2150 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2149 2151 return; 2150 2152 } … … 2155 2157 } 2156 2158 else { 2157 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2159 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2158 2160 return; 2159 2161 } … … 2164 2166 } 2165 2167 else { 2166 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2168 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2167 2169 return; 2168 2170 } … … 2173 2175 } 2174 2176 else { 2175 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2177 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2176 2178 return; 2177 2179 } … … 2182 2184 } 2183 2185 else { 2184 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2186 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2185 2187 return; 2186 2188 } … … 2191 2193 } 2192 2194 else { 2193 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)");2195 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); 2194 2196 return; 2195 2197 } 2196 2198 break; 2197 2199 default: 2198 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2200 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2199 2201 "glGetTexEnviv: invalid pname: %d", pname); 2200 2202 return; … … 2204 2206 2205 2207 void STATE_APIENTRY 2206 crStateTexGendv( GLenum coord, GLenum pname, const GLdouble *param)2207 { 2208 CRContext *g = GetCurrentContext( );2208 crStateTexGendv(PCRStateTracker pState, GLenum coord, GLenum pname, const GLdouble *param) 2209 { 2210 CRContext *g = GetCurrentContext(pState); 2209 2211 CRTextureState *t = &(g->texture); 2210 2212 CRTransformState *trans = &(g->transform); … … 2212 2214 GLenum e; 2213 2215 CRmatrix inv; 2214 CRStateBits *sb = GetCurrentBits( );2216 CRStateBits *sb = GetCurrentBits(pState); 2215 2217 CRTextureBits *tb = &(sb->texture); 2216 2218 … … 2219 2221 if (g->current.inBeginEnd) 2220 2222 { 2221 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2223 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2222 2224 "glTexGen called in begin/end"); 2223 2225 return; … … 2244 2246 } 2245 2247 else { 2246 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2248 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2247 2249 "glTexGendv called with bad param: %lf", *param); 2248 2250 return; … … 2270 2272 break; 2271 2273 default: 2272 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2274 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2273 2275 "glTexGendv called with bogus pname: %d", pname); 2274 2276 return; … … 2292 2294 } 2293 2295 else { 2294 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2296 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2295 2297 "glTexGendv called with bad param: %lf", *param); 2296 2298 return; … … 2318 2320 break; 2319 2321 default: 2320 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2322 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2321 2323 "glTexGen called with bogus pname: %d", pname); 2322 2324 return; … … 2340 2342 } 2341 2343 else { 2342 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2344 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2343 2345 "glTexGen called with bad param: %lf", *param); 2344 2346 return; … … 2366 2368 break; 2367 2369 default: 2368 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2370 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2369 2371 "glTexGen called with bogus pname: %d", pname); 2370 2372 return; … … 2388 2390 } 2389 2391 else { 2390 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2392 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2391 2393 "glTexGen called with bad param: %lf", *param); 2392 2394 return; … … 2414 2416 break; 2415 2417 default: 2416 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2418 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2417 2419 "glTexGen called with bogus pname: %d", pname); 2418 2420 return; … … 2420 2422 break; 2421 2423 default: 2422 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2424 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2423 2425 "glTexGen called with bogus coord: %d", coord); 2424 2426 return; … … 2428 2430 2429 2431 void STATE_APIENTRY 2430 crStateTexGenfv( GLenum coord, GLenum pname, const GLfloat *param)2432 crStateTexGenfv(PCRStateTracker pState, GLenum coord, GLenum pname, const GLfloat *param) 2431 2433 { 2432 2434 GLdouble d_param; … … 2436 2438 case GL_TEXTURE_GEN_MODE: 2437 2439 d_param = (GLdouble) *param; 2438 crStateTexGendv( coord, pname, &d_param );2440 crStateTexGendv(pState, coord, pname, &d_param ); 2439 2441 break; 2440 2442 case GL_OBJECT_PLANE: … … 2444 2446 d_vector.z = (GLdouble) param[2]; 2445 2447 d_vector.w = (GLdouble) param[3]; 2446 crStateTexGendv( coord, pname, (const double *) &d_vector );2448 crStateTexGendv(pState, coord, pname, (const double *) &d_vector ); 2447 2449 break; 2448 2450 default: 2449 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2451 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2450 2452 "glTexGen called with bogus pname: %d", pname); 2451 2453 return; … … 2455 2457 2456 2458 void STATE_APIENTRY 2457 crStateTexGeniv( GLenum coord, GLenum pname, const GLint *param)2459 crStateTexGeniv(PCRStateTracker pState, GLenum coord, GLenum pname, const GLint *param) 2458 2460 { 2459 2461 GLdouble d_param; … … 2463 2465 case GL_TEXTURE_GEN_MODE: 2464 2466 d_param = (GLdouble) *param; 2465 crStateTexGendv( coord, pname, &d_param );2467 crStateTexGendv(pState, coord, pname, &d_param ); 2466 2468 break; 2467 2469 case GL_OBJECT_PLANE: … … 2471 2473 d_vector.z = (GLdouble) param[2]; 2472 2474 d_vector.w = (GLdouble) param[3]; 2473 crStateTexGendv( coord, pname, (const double *) &d_vector );2475 crStateTexGendv(pState, coord, pname, (const double *) &d_vector ); 2474 2476 break; 2475 2477 default: 2476 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2478 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2477 2479 "glTexGen called with bogus pname: %d", pname); 2478 2480 return; … … 2482 2484 2483 2485 void STATE_APIENTRY 2484 crStateTexGend ( GLenum coord, GLenum pname, GLdouble param)2485 { 2486 crStateTexGendv( coord, pname, ¶m );2486 crStateTexGend (PCRStateTracker pState, GLenum coord, GLenum pname, GLdouble param) 2487 { 2488 crStateTexGendv(pState, coord, pname, ¶m ); 2487 2489 } 2488 2490 2489 2491 2490 2492 void STATE_APIENTRY 2491 crStateTexGenf( GLenum coord, GLenum pname, GLfloat param)2493 crStateTexGenf(PCRStateTracker pState, GLenum coord, GLenum pname, GLfloat param) 2492 2494 { 2493 2495 GLdouble d_param = (GLdouble) param; 2494 crStateTexGendv( coord, pname, &d_param );2496 crStateTexGendv(pState, coord, pname, &d_param ); 2495 2497 } 2496 2498 2497 2499 2498 2500 void STATE_APIENTRY 2499 crStateTexGeni( GLenum coord, GLenum pname, GLint param)2501 crStateTexGeni(PCRStateTracker pState, GLenum coord, GLenum pname, GLint param) 2500 2502 { 2501 2503 GLdouble d_param = (GLdouble) param; 2502 crStateTexGendv( coord, pname, &d_param );2504 crStateTexGendv(pState, coord, pname, &d_param ); 2503 2505 } 2504 2506 2505 2507 2506 2508 void STATE_APIENTRY 2507 crStateGetTexGendv( GLenum coord, GLenum pname, GLdouble *param)2508 { 2509 CRContext *g = GetCurrentContext( );2509 crStateGetTexGendv(PCRStateTracker pState, GLenum coord, GLenum pname, GLdouble *param) 2510 { 2511 CRContext *g = GetCurrentContext(pState); 2510 2512 CRTextureState *t = &(g->texture); 2511 2513 2512 2514 if (g->current.inBeginEnd) 2513 2515 { 2514 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2516 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2515 2517 "glGetTexGen called in begin/end"); 2516 2518 return; … … 2533 2535 break; 2534 2536 default: 2535 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2537 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2536 2538 "glGetTexGen called with bogus coord: %d", coord); 2537 2539 return; … … 2565 2567 break; 2566 2568 default: 2567 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2569 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2568 2570 "glGetTexGen called with bogus coord: %d", coord); 2569 2571 return; … … 2597 2599 break; 2598 2600 default: 2599 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2601 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2600 2602 "glGetTexGen called with bogus coord: %d", coord); 2601 2603 return; … … 2603 2605 break; 2604 2606 default: 2605 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2607 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2606 2608 "glGetTexGen called with bogus pname: %d", pname); 2607 2609 return; … … 2611 2613 2612 2614 void STATE_APIENTRY 2613 crStateGetTexGenfv( GLenum coord, GLenum pname, GLfloat *param)2614 { 2615 CRContext *g = GetCurrentContext( );2615 crStateGetTexGenfv(PCRStateTracker pState, GLenum coord, GLenum pname, GLfloat *param) 2616 { 2617 CRContext *g = GetCurrentContext(pState); 2616 2618 CRTextureState *t = &(g->texture); 2617 2619 2618 2620 if (g->current.inBeginEnd) 2619 2621 { 2620 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2622 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2621 2623 "glGetTexGenfv called in begin/end"); 2622 2624 return; … … 2639 2641 break; 2640 2642 default: 2641 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2643 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2642 2644 "glGetTexGenfv called with bogus coord: %d", coord); 2643 2645 return; … … 2671 2673 break; 2672 2674 default: 2673 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2675 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2674 2676 "glGetTexGenfv called with bogus coord: %d", coord); 2675 2677 return; … … 2703 2705 break; 2704 2706 default: 2705 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2707 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2706 2708 "glGetTexGenfv called with bogus coord: %d", coord); 2707 2709 return; … … 2709 2711 break; 2710 2712 default: 2711 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2713 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2712 2714 "glGetTexGenfv called with bogus pname: %d", pname); 2713 2715 return; … … 2717 2719 2718 2720 void STATE_APIENTRY 2719 crStateGetTexGeniv( GLenum coord, GLenum pname, GLint *param)2720 { 2721 CRContext *g = GetCurrentContext( );2721 crStateGetTexGeniv(PCRStateTracker pState, GLenum coord, GLenum pname, GLint *param) 2722 { 2723 CRContext *g = GetCurrentContext(pState); 2722 2724 CRTextureState *t = &(g->texture); 2723 2725 2724 2726 if (g->current.inBeginEnd) 2725 2727 { 2726 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2728 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2727 2729 "glGetTexGeniv called in begin/end"); 2728 2730 return; … … 2745 2747 break; 2746 2748 default: 2747 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2749 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2748 2750 "glGetTexGeniv called with bogus coord: %d", coord); 2749 2751 return; … … 2777 2779 break; 2778 2780 default: 2779 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2781 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2780 2782 "glGetTexGeniv called with bogus coord: %d", coord); 2781 2783 return; … … 2809 2811 break; 2810 2812 default: 2811 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2813 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2812 2814 "glGetTexGeniv called with bogus coord: %d", coord); 2813 2815 return; … … 2815 2817 break; 2816 2818 default: 2817 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2819 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2818 2820 "glGetTexGen called with bogus pname: %d", pname); 2819 2821 return; … … 2823 2825 2824 2826 void STATE_APIENTRY 2825 crStateGetTexLevelParameterfv( GLenum target, GLint level,2827 crStateGetTexLevelParameterfv(PCRStateTracker pState, GLenum target, GLint level, 2826 2828 GLenum pname, GLfloat *params) 2827 2829 { 2828 CRContext *g = GetCurrentContext( );2830 CRContext *g = GetCurrentContext(pState); 2829 2831 CRTextureState *t = &(g->texture); 2830 2832 CRTextureObj *tobj; … … 2833 2835 if (g->current.inBeginEnd) 2834 2836 { 2835 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2837 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2836 2838 "glGetTexLevelParameterfv called in begin/end"); 2837 2839 return; … … 2840 2842 if (level < 0 || level > t->maxLevel) 2841 2843 { 2842 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,2844 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 2843 2845 "glGetTexLevelParameterfv: Invalid level: %d", level); 2844 2846 return; … … 2848 2850 if (!timg) 2849 2851 { 2850 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2852 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2851 2853 "GetTexLevelParameterfv: invalid target: 0x%x or level %d", 2852 2854 target, level); … … 2900 2902 #endif 2901 2903 default: 2902 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2904 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2903 2905 "GetTexLevelParameterfv: invalid pname: 0x%x", 2904 2906 pname); … … 2909 2911 2910 2912 void STATE_APIENTRY 2911 crStateGetTexLevelParameteriv( GLenum target, GLint level,2913 crStateGetTexLevelParameteriv(PCRStateTracker pState, GLenum target, GLint level, 2912 2914 GLenum pname, GLint *params) 2913 2915 { 2914 CRContext *g = GetCurrentContext( );2916 CRContext *g = GetCurrentContext(pState); 2915 2917 CRTextureState *t = &(g->texture); 2916 2918 CRTextureObj *tobj; … … 2919 2921 if (g->current.inBeginEnd) 2920 2922 { 2921 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,2923 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 2922 2924 "glGetTexLevelParameteriv called in begin/end"); 2923 2925 return; … … 2926 2928 if (level < 0 || level > t->maxLevel) 2927 2929 { 2928 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,2930 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 2929 2931 "glGetTexLevelParameteriv: Invalid level: %d", level); 2930 2932 return; … … 2934 2936 if (!timg) 2935 2937 { 2936 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2938 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2937 2939 "GetTexLevelParameteriv: invalid target: 0x%x", 2938 2940 target); … … 2993 2995 #endif 2994 2996 default: 2995 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,2997 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 2996 2998 "GetTexLevelParameteriv: invalid pname: 0x%x", 2997 2999 pname); … … 3002 3004 3003 3005 void STATE_APIENTRY 3004 crStateGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params)3005 { 3006 CRContext *g = GetCurrentContext( );3006 crStateGetTexParameterfv(PCRStateTracker pState, GLenum target, GLenum pname, GLfloat *params) 3007 { 3008 CRContext *g = GetCurrentContext(pState); 3007 3009 CRTextureObj *tobj; 3008 3010 CRTextureLevel *tl; … … 3010 3012 if (g->current.inBeginEnd) 3011 3013 { 3012 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,3014 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 3013 3015 "glGetTexParameterfv called in begin/end"); 3014 3016 return; … … 3018 3020 if (!tobj) 3019 3021 { 3020 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3022 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3021 3023 "glGetTexParameterfv: invalid target: 0x%x", target); 3022 3024 return; … … 3057 3059 } 3058 3060 else { 3059 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3061 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3060 3062 "glGetTexParameterfv: invalid pname: 0x%x", pname); 3061 3063 return; … … 3069 3071 } 3070 3072 else { 3071 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3073 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3072 3074 "glGetTexParameter: invalid pname: 0x%x", pname); 3073 3075 return; … … 3081 3083 } 3082 3084 else { 3083 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3085 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3084 3086 "glGetTexParameter: invalid pname: 0x%x", pname); 3085 3087 return; … … 3091 3093 } 3092 3094 else { 3093 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3095 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3094 3096 "glGetTexParameter: invalid pname: 0x%x", pname); 3095 3097 return; … … 3103 3105 } 3104 3106 else { 3105 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3107 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3106 3108 "glGetTexParameter: invalid pname: 0x%x", pname); 3107 3109 return; … … 3115 3117 } 3116 3118 else { 3117 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3119 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3118 3120 "glGetTexParameter: invalid pname: 0x%x", pname); 3119 3121 return; … … 3146 3148 break; 3147 3149 default: 3148 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3150 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3149 3151 "glGetTexParameterfv: invalid pname: %d", pname); 3150 3152 return; … … 3154 3156 3155 3157 void STATE_APIENTRY 3156 crStateGetTexParameteriv( GLenum target, GLenum pname, GLint *params)3157 { 3158 CRContext *g = GetCurrentContext( );3158 crStateGetTexParameteriv(PCRStateTracker pState, GLenum target, GLenum pname, GLint *params) 3159 { 3160 CRContext *g = GetCurrentContext(pState); 3159 3161 CRTextureObj *tobj; 3160 3162 CRTextureLevel *tl; … … 3162 3164 if (g->current.inBeginEnd) 3163 3165 { 3164 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,3166 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 3165 3167 "glGetTexParameter called in begin/end"); 3166 3168 return; … … 3170 3172 if (!tobj) 3171 3173 { 3172 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3174 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3173 3175 "glGetTexParameteriv: invalid target: 0x%x", target); 3174 3176 return; … … 3223 3225 } 3224 3226 else { 3225 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3227 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3226 3228 "glGetTexParameter: invalid pname: 0x%x", pname); 3227 3229 return; … … 3235 3237 } 3236 3238 else { 3237 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3239 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3238 3240 "glGetTexParameter: invalid pname: 0x%x", pname); 3239 3241 return; … … 3247 3249 } 3248 3250 else { 3249 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3251 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3250 3252 "glGetTexParameter: invalid pname: 0x%x", pname); 3251 3253 return; … … 3257 3259 } 3258 3260 else { 3259 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3261 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3260 3262 "glGetTexParameter: invalid pname: 0x%x", pname); 3261 3263 return; … … 3269 3271 } 3270 3272 else { 3271 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3273 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3272 3274 "glGetTexParameter: invalid pname: 0x%x", pname); 3273 3275 return; … … 3281 3283 } 3282 3284 else { 3283 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3285 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3284 3286 "glGetTexParameter: invalid pname: 0x%x", pname); 3285 3287 return; … … 3292 3294 break; 3293 3295 default: 3294 crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,3296 crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, 3295 3297 "glGetTexParameter: invalid pname: %d", pname); 3296 3298 return; … … 3300 3302 3301 3303 void STATE_APIENTRY 3302 crStatePrioritizeTextures( GLsizei n, const GLuint *textures,3304 crStatePrioritizeTextures(PCRStateTracker pState, GLsizei n, const GLuint *textures, 3303 3305 const GLclampf *priorities) 3304 3306 { 3305 CRContext *g = GetCurrentContext( );3307 CRContext *g = GetCurrentContext(pState); 3306 3308 CRTextureObj *tobj; 3307 3309 GLsizei i; … … 3330 3332 3331 3333 GLboolean STATE_APIENTRY 3332 crStateAreTexturesResident( GLsizei n, const GLuint *textures,3334 crStateAreTexturesResident(PCRStateTracker pState, GLsizei n, const GLuint *textures, 3333 3335 GLboolean *residences) 3334 3336 { 3337 RT_NOREF(pState); 3335 3338 UNUSED(n); 3336 3339 UNUSED(textures); … … 3342 3345 3343 3346 GLboolean STATE_APIENTRY 3344 crStateIsTexture( GLuint texture)3345 { 3346 CRContext *g = GetCurrentContext( );3347 crStateIsTexture(PCRStateTracker pState, GLuint texture) 3348 { 3349 CRContext *g = GetCurrentContext(pState); 3347 3350 CRTextureObj *tobj; 3348 3351 … … 3357 3360 (void) key; 3358 3361 3359 if (crStateGetTextureObjHWID(p Tex)==pParms->hwid)3362 if (crStateGetTextureObjHWID(pParms->pState, pTex)==pParms->hwid) 3360 3363 pParms->id = pTex->id; 3361 3364 } 3362 3365 3363 DECLEXPORT(GLuint) STATE_APIENTRY crStateTextureHWIDtoID( GLuint hwid)3364 { 3365 CRContext *g = GetCurrentContext( );3366 DECLEXPORT(GLuint) STATE_APIENTRY crStateTextureHWIDtoID(PCRStateTracker pState, GLuint hwid) 3367 { 3368 CRContext *g = GetCurrentContext(pState); 3366 3369 crCheckIDHWID_t parms; 3367 3370 3368 3371 parms.id = hwid; 3369 3372 parms.hwid = hwid; 3373 parms.pState = pState; 3370 3374 3371 3375 crHashtableWalk(g->shared->textureTable, crStateCheckTextureHWIDCB, &parms); … … 3373 3377 } 3374 3378 3375 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetTextureHWID( GLuint id)3376 { 3377 CRContext *g = GetCurrentContext( );3379 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetTextureHWID(PCRStateTracker pState, GLuint id) 3380 { 3381 CRContext *g = GetCurrentContext(pState); 3378 3382 CRTextureObj *tobj; 3379 3383 … … 3396 3400 3397 3401 3398 return tobj ? crStateGetTextureObjHWID( tobj) : 0;3399 } 3400 3401 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetTextureObjHWID( CRTextureObj *tobj)3402 return tobj ? crStateGetTextureObjHWID(pState, tobj) : 0; 3403 } 3404 3405 DECLEXPORT(GLuint) STATE_APIENTRY crStateGetTextureObjHWID(PCRStateTracker pState, CRTextureObj *tobj) 3402 3406 { 3403 3407 CRASSERT(tobj); … … 3406 3410 if (tobj->id && !tobj->hwid) 3407 3411 { 3408 CRASSERT( diff_api.GenTextures);3409 diff_api.GenTextures(1, &tobj->hwid);3412 CRASSERT(pState->diff_api.GenTextures); 3413 pState->diff_api.GenTextures(1, &tobj->hwid); 3410 3414 #if 0 /*def DEBUG_misha*/ 3411 3415 crDebug("tex id(%d), hwid(%d)", tobj->id, tobj->hwid); -
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 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_viewport.c
r69392 r78375 13 13 { 14 14 CRViewportState *v = &ctx->viewport; 15 CRStateBits *sb = GetCurrentBits( );15 CRStateBits *sb = GetCurrentBits(ctx->pStateTracker); 16 16 CRViewportBits *vb = &(sb->viewport); 17 17 CRTransformBits *tb = &(sb->transform); … … 56 56 } 57 57 58 void STATE_APIENTRY crStateViewport( GLint x, GLint y, GLsizei width,58 void STATE_APIENTRY crStateViewport(PCRStateTracker pState, GLint x, GLint y, GLsizei width, 59 59 GLsizei height) 60 60 { 61 CRContext *g = GetCurrentContext( );61 CRContext *g = GetCurrentContext(pState); 62 62 CRViewportState *v = &(g->viewport); 63 CRStateBits *sb = GetCurrentBits( );63 CRStateBits *sb = GetCurrentBits(pState); 64 64 CRViewportBits *vb = &(sb->viewport); 65 65 CRTransformBits *tb = &(sb->transform); … … 67 67 if (g->current.inBeginEnd) 68 68 { 69 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,69 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 70 70 "calling glViewport() between glBegin/glEnd" ); 71 71 return; … … 76 76 if (width < 0 || height < 0) 77 77 { 78 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,78 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 79 79 "glViewport(bad width or height)" ); 80 80 return; … … 102 102 } 103 103 104 void STATE_APIENTRY crStateDepthRange( GLclampd znear, GLclampd zfar)104 void STATE_APIENTRY crStateDepthRange(PCRStateTracker pState, GLclampd znear, GLclampd zfar) 105 105 { 106 CRContext *g = GetCurrentContext( );106 CRContext *g = GetCurrentContext(pState); 107 107 CRViewportState *v = &(g->viewport); 108 CRStateBits *sb = GetCurrentBits( );108 CRStateBits *sb = GetCurrentBits(pState); 109 109 CRViewportBits *vb = &(sb->viewport); 110 110 CRTransformBits *tb = &(sb->transform); … … 112 112 if (g->current.inBeginEnd) 113 113 { 114 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glDepthRange called in Begin/End");114 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glDepthRange called in Begin/End"); 115 115 return; 116 116 } … … 130 130 } 131 131 132 void STATE_APIENTRY crStateScissor ( GLint x, GLint y,132 void STATE_APIENTRY crStateScissor (PCRStateTracker pState, GLint x, GLint y, 133 133 GLsizei width, GLsizei height) 134 134 { 135 CRContext *g = GetCurrentContext( );135 CRContext *g = GetCurrentContext(pState); 136 136 CRViewportState *v = &(g->viewport); 137 CRStateBits *sb = GetCurrentBits( );137 CRStateBits *sb = GetCurrentBits(pState); 138 138 CRViewportBits *vb = &(sb->viewport); 139 139 140 140 if (g->current.inBeginEnd) 141 141 { 142 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,142 crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, 143 143 "glScissor called in begin/end"); 144 144 return; … … 149 149 if (width < 0 || height < 0) 150 150 { 151 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE,151 crStateError(pState, __LINE__, __FILE__, GL_INVALID_VALUE, 152 152 "glScissor called with negative width/height: %d,%d", 153 153 width, height); -
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r78267 r78375 1582 1582 case DLL_THREAD_ATTACH: 1583 1583 { 1584 cr StateVBoxAttachThread();1584 crVBoxServerAttachThread(); 1585 1585 break; 1586 1586 } … … 1591 1591 case DLL_THREAD_DETACH: 1592 1592 { 1593 cr StateVBoxDetachThread();1593 crVBoxServerDetachThread(); 1594 1594 break; 1595 1595 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp
r78264 r78375 975 975 976 976 crStateReleaseTexture(cr_server.MainContextInfo.pContext, pTobj); 977 978 979 crStateGlobalSharedRelease(); 977 crStateGlobalSharedRelease(&cr_server.StateTracker); 980 978 } 981 979 … … 1026 1024 } 1027 1025 1028 CRSharedState *pShared = crStateGlobalSharedAcquire( );1026 CRSharedState *pShared = crStateGlobalSharedAcquire(&cr_server.StateTracker); 1029 1027 if (!pShared) 1030 1028 { … … 1037 1035 { 1038 1036 LOG(("pTobj is null!")); 1039 crStateGlobalSharedRelease( );1037 crStateGlobalSharedRelease(&cr_server.StateTracker); 1040 1038 return NULL; 1041 1039 } … … 1043 1041 Assert(pTobj->id == idTexture); 1044 1042 1045 GLuint hwid = crStateGetTextureObjHWID( pTobj);1043 GLuint hwid = crStateGetTextureObjHWID(&cr_server.StateTracker, pTobj); 1046 1044 if (!hwid) 1047 1045 { 1048 1046 WARN(("hwId is null!")); 1049 crStateGlobalSharedRelease( );1047 crStateGlobalSharedRelease(&cr_server.StateTracker); 1050 1048 return NULL; 1051 1049 } … … 1061 1059 { 1062 1060 WARN(("crFbTexCreate failed!")); 1063 crStateGlobalSharedRelease( );1061 crStateGlobalSharedRelease(&cr_server.StateTracker); 1064 1062 return NULL; 1065 1063 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r78263 r78375 341 341 CRContext *pCurCtx = pCurCtxInfo ? pCurCtxInfo->pContext : NULL; 342 342 343 CRASSERT(pCurCtx == crStateGetCurrent( ));343 CRASSERT(pCurCtx == crStateGetCurrent(&cr_server.StateTracker)); 344 344 345 345 if (pCurrentMural) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_bufferobject.cpp
r78263 r78375 46 46 } 47 47 48 crStateGenBuffersARB( n, local_buffers);48 crStateGenBuffersARB(&cr_server.StateTracker, n, local_buffers); 49 49 50 50 crServerReturnValue( local_buffers, n * sizeof(*local_buffers) ); … … 60 60 } 61 61 62 crStateDeleteBuffersARB( n, buffer );62 crStateDeleteBuffersARB(&cr_server.StateTracker, n, buffer ); 63 63 } 64 64 … … 101 101 crServerDispatchBindBufferARB(GLenum target, GLuint buffer) 102 102 { 103 crStateBindBufferARB( target, buffer);104 cr_server.head_spu->dispatch_table.BindBufferARB(target, crStateGetBufferHWID( buffer));103 crStateBindBufferARB(&cr_server.StateTracker, target, buffer); 104 cr_server.head_spu->dispatch_table.BindBufferARB(target, crStateGetBufferHWID(&cr_server.StateTracker, buffer)); 105 105 } 106 106 … … 110 110 /* since GenBuffersARB issued to host ogl only on bind + some other ops, the host drivers may not know about them 111 111 * so use state data*/ 112 GLboolean retval = crStateIsBufferARB( buffer);112 GLboolean retval = crStateIsBufferARB(&cr_server.StateTracker, buffer); 113 113 crServerReturnValue( &retval, sizeof(retval) ); 114 114 return retval; /* WILL PROBABLY BE IGNORED */ -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_clear.cpp
r78263 r78375 423 423 window = 0; 424 424 425 ctx = crStateGetCurrent( );425 ctx = crStateGetCurrent(&cr_server.StateTracker); 426 426 427 427 CRASSERT(cr_server.curClient && cr_server.curClient->currentMural == mural); … … 449 449 crServerDispatchFlush(void) 450 450 { 451 CRContext *ctx = crStateGetCurrent( );451 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 452 452 cr_server.head_spu->dispatch_table.Flush(); 453 453 … … 470 470 crServerDispatchFinish(void) 471 471 { 472 CRContext *ctx = crStateGetCurrent( );472 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 473 473 474 474 cr_server.head_spu->dispatch_table.Finish(); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.cpp
r78263 r78375 63 63 return -1; 64 64 } 65 cr_server.MainContextInfo.pContext = crStateCreateContext(&cr_server. limits, visualBits, NULL);65 cr_server.MainContextInfo.pContext = crStateCreateContext(&cr_server.StateTracker, &cr_server.limits, visualBits, NULL); 66 66 CRASSERT(cr_server.MainContextInfo.pContext); 67 67 cr_server.firstCallCreateContext = GL_FALSE; … … 114 114 if (pContextInfo->SpuContext < 0) { 115 115 crWarning("crServerDispatchCreateContext() failed."); 116 crStateEnableDiffOnMakeCurrent( GL_TRUE);116 crStateEnableDiffOnMakeCurrent(&cr_server.StateTracker, GL_TRUE); 117 117 cr_server.bUseMultipleContexts = GL_FALSE; 118 118 if (!fFirst) … … 121 121 else if (fFirst) 122 122 { 123 crStateEnableDiffOnMakeCurrent( GL_FALSE);123 crStateEnableDiffOnMakeCurrent(&cr_server.StateTracker, GL_FALSE); 124 124 } 125 125 } … … 132 132 * dispatch function pointers. 133 133 */ 134 newCtx = crStateCreateContextEx(&cr_server. limits, visualBits, NULL, internalID);134 newCtx = crStateCreateContextEx(&cr_server.StateTracker, &cr_server.limits, visualBits, NULL, internalID); 135 135 if (newCtx) { 136 crStateSetCurrentPointers( 136 crStateSetCurrentPointers(newCtx, &(cr_server.current) ); 137 137 crStateResetCurrentPointers(&(cr_server.current)); 138 138 retVal = preloadCtxID<0 ? (GLint)crHashtableAllocKeys( cr_server.contextTable, 1 ) : preloadCtxID; … … 214 214 crCtxInfo->currentMural = NULL; 215 215 crHashtableDelete(cr_server.contextTable, ctx, NULL); 216 crStateDestroyContext( crCtx);216 crStateDestroyContext(&cr_server.StateTracker, crCtx); 217 217 218 218 if (crCtxInfo->CreateInfo.pszDpyName) … … 306 306 * crStateSwitchPrepare restores the FBO state to its default values before the context window switch, 307 307 * while crStateSwitchPostprocess restores it back to the original values */ 308 oldCtx = crStateGetCurrent( );308 oldCtx = crStateGetCurrent(&cr_server.StateTracker); 309 309 if (oldMural && oldMural->fRedirected && crServerSupportRedirMuralFBO()) 310 310 { … … 335 335 336 336 /* This is a hack to force updating the 'current' attribs */ 337 crStateUpdateColorBits( );337 crStateUpdateColorBits(&cr_server.StateTracker); 338 338 339 339 if (ctx) 340 crStateSetCurrentPointers( 340 crStateSetCurrentPointers(ctx, &(cr_server.current) ); 341 341 342 342 /* check if being made current for first time, update viewport */ … … 387 387 388 388 /* This used to be earlier, after crStateUpdateColorBits() call */ 389 crStateMakeCurrent( ctx );389 crStateMakeCurrent(&cr_server.StateTracker, ctx ); 390 390 391 391 if (mural && mural->fRedirected && crServerSupportRedirMuralFBO()) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py
r78190 r78375 37 37 print('void SERVER_DISPATCH_APIENTRY crServerDispatch%s(%s)' % ( func_name, apiutil.MakeDeclarationStringForDispatcher( params ) )) 38 38 print('{') 39 print('\tcrState%s(%s);' % (func_name, apiutil.MakeCallStringForDispatcher( params ) )) 39 if len(params) == 0: 40 print('\tcrState%s(&cr_server.StateTracker);' % (func_name)) 41 else: 42 print('\tcrState%s(&cr_server.StateTracker, %s);' % (func_name, apiutil.MakeCallStringForDispatcher( params ) )) 40 43 print('\tcr_server.head_spu->dispatch_table.%s(%s);' % (func_name, apiutil.MakeCallStringForDispatcher( params ) )) 41 44 print('}') -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_framebuffer.cpp
r78190 r78375 38 38 local_buffers = (GLuint *)crCalloc(n * sizeof(*local_buffers)); 39 39 40 crStateGenFramebuffersEXT( n, local_buffers);40 crStateGenFramebuffersEXT(&cr_server.StateTracker, n, local_buffers); 41 41 42 42 crServerReturnValue(local_buffers, n * sizeof(*local_buffers)); … … 58 58 local_buffers = (GLuint *)crCalloc(n * sizeof(*local_buffers)); 59 59 60 crStateGenRenderbuffersEXT( n, local_buffers);60 crStateGenRenderbuffersEXT(&cr_server.StateTracker, n, local_buffers); 61 61 62 62 crServerReturnValue(local_buffers, n * sizeof(*local_buffers)); … … 66 66 void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 67 67 { 68 crStateFramebufferTexture1DEXT( target, attachment, textarget, texture, level);69 cr_server.head_spu->dispatch_table.FramebufferTexture1DEXT(target, attachment, textarget, crStateGetTextureHWID( texture), level);68 crStateFramebufferTexture1DEXT(&cr_server.StateTracker, target, attachment, textarget, texture, level); 69 cr_server.head_spu->dispatch_table.FramebufferTexture1DEXT(target, attachment, textarget, crStateGetTextureHWID(&cr_server.StateTracker, texture), level); 70 70 } 71 71 72 72 void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 73 73 { 74 crStateFramebufferTexture2DEXT( target, attachment, textarget, texture, level);75 cr_server.head_spu->dispatch_table.FramebufferTexture2DEXT(target, attachment, textarget, crStateGetTextureHWID( texture), level);74 crStateFramebufferTexture2DEXT(&cr_server.StateTracker, target, attachment, textarget, texture, level); 75 cr_server.head_spu->dispatch_table.FramebufferTexture2DEXT(target, attachment, textarget, crStateGetTextureHWID(&cr_server.StateTracker, texture), level); 76 76 } 77 77 78 78 void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) 79 79 { 80 crStateFramebufferTexture3DEXT( target, attachment, textarget, texture, level, zoffset);81 cr_server.head_spu->dispatch_table.FramebufferTexture3DEXT(target, attachment, textarget, crStateGetTextureHWID( texture), level, zoffset);80 crStateFramebufferTexture3DEXT(&cr_server.StateTracker, target, attachment, textarget, texture, level, zoffset); 81 cr_server.head_spu->dispatch_table.FramebufferTexture3DEXT(target, attachment, textarget, crStateGetTextureHWID(&cr_server.StateTracker, texture), level, zoffset); 82 82 } 83 83 … … 87 87 GLint rfb = 0, dfb = 0; 88 88 #endif 89 crStateBindFramebufferEXT(target, framebuffer);89 crStateBindFramebufferEXT(&cr_server.StateTracker, target, framebuffer); 90 90 91 91 if (0==framebuffer) 92 92 { 93 CRContext *ctx = crStateGetCurrent( );93 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 94 94 if (ctx->buffer.drawBuffer == GL_FRONT || ctx->buffer.drawBuffer == GL_FRONT_LEFT || ctx->buffer.drawBuffer == GL_FRONT_RIGHT) 95 95 cr_server.curClient->currentMural->bFbDraw = GL_TRUE; … … 149 149 else 150 150 { 151 cr_server.head_spu->dispatch_table.BindFramebufferEXT(target, crStateGetFramebufferHWID( framebuffer));151 cr_server.head_spu->dispatch_table.BindFramebufferEXT(target, crStateGetFramebufferHWID(&cr_server.StateTracker, framebuffer)); 152 152 #ifdef DEBUG_misha 153 153 cr_server.head_spu->dispatch_table.GetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &rfb); … … 155 155 if (GL_FRAMEBUFFER_EXT == target) 156 156 { 157 Assert(rfb == crStateGetFramebufferHWID( framebuffer));158 Assert(dfb == crStateGetFramebufferHWID( framebuffer));157 Assert(rfb == crStateGetFramebufferHWID(&cr_server.StateTracker, framebuffer)); 158 Assert(dfb == crStateGetFramebufferHWID(&cr_server.StateTracker, framebuffer)); 159 159 } 160 160 else if (GL_READ_FRAMEBUFFER_EXT == target) 161 161 { 162 Assert(rfb == crStateGetFramebufferHWID( framebuffer));162 Assert(rfb == crStateGetFramebufferHWID(&cr_server.StateTracker, framebuffer)); 163 163 } 164 164 else if (GL_DRAW_FRAMEBUFFER_EXT == target) 165 165 { 166 Assert(dfb == crStateGetFramebufferHWID( framebuffer));166 Assert(dfb == crStateGetFramebufferHWID(&cr_server.StateTracker, framebuffer)); 167 167 } 168 168 else … … 176 176 void SERVER_DISPATCH_APIENTRY crServerDispatchBindRenderbufferEXT(GLenum target, GLuint renderbuffer) 177 177 { 178 crStateBindRenderbufferEXT( target, renderbuffer);179 cr_server.head_spu->dispatch_table.BindRenderbufferEXT(target, crStateGetRenderbufferHWID( renderbuffer));178 crStateBindRenderbufferEXT(&cr_server.StateTracker, target, renderbuffer); 179 cr_server.head_spu->dispatch_table.BindRenderbufferEXT(target, crStateGetRenderbufferHWID(&cr_server.StateTracker, renderbuffer)); 180 180 } 181 181 … … 188 188 } 189 189 190 crStateDeleteFramebuffersEXT( n, framebuffers);190 crStateDeleteFramebuffersEXT(&cr_server.StateTracker, n, framebuffers); 191 191 } 192 192 … … 199 199 } 200 200 201 crStateDeleteRenderbuffersEXT( n, renderbuffers);201 crStateDeleteRenderbuffersEXT(&cr_server.StateTracker, n, renderbuffers); 202 202 } 203 203 … … 205 205 crServerDispatchFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) 206 206 { 207 crStateFramebufferRenderbufferEXT( target, attachment, renderbuffertarget, renderbuffer);208 cr_server.head_spu->dispatch_table.FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, crStateGetRenderbufferHWID( renderbuffer));207 crStateFramebufferRenderbufferEXT(&cr_server.StateTracker, target, attachment, renderbuffertarget, renderbuffer); 208 cr_server.head_spu->dispatch_table.FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, crStateGetRenderbufferHWID(&cr_server.StateTracker, renderbuffer)); 209 209 } 210 210 … … 214 214 GLint local_params[1]; 215 215 (void) params; 216 crStateGetFramebufferAttachmentParameterivEXT( target, attachment, pname, local_params);216 crStateGetFramebufferAttachmentParameterivEXT(&cr_server.StateTracker, target, attachment, pname, local_params); 217 217 218 218 crServerReturnValue(&(local_params[0]), 1*sizeof(GLint)); … … 223 223 /* since GenFramebuffers/Renderbuffers issued to host ogl only on bind + some other ops, the host drivers may not know about them 224 224 * so use state data*/ 225 GLboolean retval = crStateIsFramebufferEXT( framebuffer);225 GLboolean retval = crStateIsFramebufferEXT(&cr_server.StateTracker, framebuffer); 226 226 crServerReturnValue( &retval, sizeof(retval) ); 227 227 return retval; /* WILL PROBABLY BE IGNORED */ … … 232 232 /* since GenFramebuffers/Renderbuffers issued to host ogl only on bind + some other ops, the host drivers may not know about them 233 233 * so use state data*/ 234 GLboolean retval = crStateIsRenderbufferEXT( renderbuffer);234 GLboolean retval = crStateIsRenderbufferEXT(&cr_server.StateTracker, renderbuffer); 235 235 crServerReturnValue( &retval, sizeof(retval) ); 236 236 return retval; /* WILL PROBABLY BE IGNORED */ -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_gentextures.cpp
r78190 r78375 31 31 } 32 32 33 crStateGenTextures( n, local_textures);33 crStateGenTextures(&cr_server.StateTracker, n, local_textures); 34 34 35 35 crServerReturnValue(local_textures, n*sizeof(*local_textures)); … … 112 112 { 113 113 GLuint tID = crServerTranslateProgramID(local_progs[i]); 114 while (crStateIsProgramARB( tID))114 while (crStateIsProgramARB(&cr_server.StateTracker, tID)) 115 115 { 116 116 cr_server.head_spu->dispatch_table.GenProgramsARB(1, &tID); … … 138 138 } 139 139 140 crStateCopyTexImage2D( target, level, internalFormat, x, y, width, height, border);140 crStateCopyTexImage2D(&cr_server.StateTracker, target, level, internalFormat, x, y, width, height, border); 141 141 cr_server.head_spu->dispatch_table.CopyTexImage2D(target, level, internalFormat, x, y, width, height, border); 142 142 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_get.py
r78105 r78375 138 138 if func_name in convert_bufferid: 139 139 print('\tif (pname==GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB){') 140 print('\t\tlocal_params[0]=(%s)crStateBufferHWIDtoID( (GLint)local_params[0]);' % (local_argtype))140 print('\t\tlocal_params[0]=(%s)crStateBufferHWIDtoID(&cr_server.StateTracker, (GLint)local_params[0]);' % (local_argtype)) 141 141 print('\t}') 142 142 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getpixelmap.cpp
r78190 r78375 64 64 { 65 65 #ifdef CR_ARB_pixel_buffer_object 66 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))66 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 67 67 { 68 68 GLvoid *pbo_offset; … … 91 91 { 92 92 #ifdef CR_ARB_pixel_buffer_object 93 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))93 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 94 94 { 95 95 GLvoid *pbo_offset; … … 118 118 { 119 119 #ifdef CR_ARB_pixel_buffer_object 120 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))120 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 121 121 { 122 122 GLvoid *pbo_offset; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.cpp
r78263 r78375 52 52 } 53 53 54 cr_server.head_spu->dispatch_table.GetActiveAttrib(crStateGetProgramHWID( program), index, bufSize, &pLocal->length, &pLocal->size, &pLocal->type, (char*)&pLocal[1]);54 cr_server.head_spu->dispatch_table.GetActiveAttrib(crStateGetProgramHWID(&cr_server.StateTracker, program), index, bufSize, &pLocal->length, &pLocal->size, &pLocal->type, (char*)&pLocal[1]); 55 55 crServerReturnValue(pLocal, pLocal->length+1+sizeof(crGetActive_t)); 56 56 crFree(pLocal); … … 74 74 } 75 75 76 cr_server.head_spu->dispatch_table.GetActiveUniform(crStateGetProgramHWID( program), index, bufSize, &pLocal->length, &pLocal->size, &pLocal->type, (char*)&pLocal[1]);76 cr_server.head_spu->dispatch_table.GetActiveUniform(crStateGetProgramHWID(&cr_server.StateTracker, program), index, bufSize, &pLocal->length, &pLocal->size, &pLocal->type, (char*)&pLocal[1]); 77 77 crServerReturnValue(pLocal, pLocal->length+1+sizeof(crGetActive_t)); 78 78 crFree(pLocal); … … 96 96 /* initial (fallback )value */ 97 97 *pLocal = 0; 98 cr_server.head_spu->dispatch_table.GetAttachedShaders(crStateGetProgramHWID( program), maxCount, pLocal, (GLuint*)&pLocal[1]);98 cr_server.head_spu->dispatch_table.GetAttachedShaders(crStateGetProgramHWID(&cr_server.StateTracker, program), maxCount, pLocal, (GLuint*)&pLocal[1]); 99 99 100 100 { … … 103 103 104 104 for (i=0; i<*pLocal; ++i) 105 ids[i] = crStateGLSLShaderHWIDtoID( ids[i]);105 ids[i] = crStateGLSLShaderHWIDtoID(&cr_server.StateTracker, ids[i]); 106 106 } 107 107 … … 127 127 /* initial (fallback )value */ 128 128 *pLocal = 0; 129 cr_server.head_spu->dispatch_table.GetAttachedObjectsARB(crStateGetProgramHWID( containerObj), maxCount, pLocal, (VBoxGLhandleARB*)&pLocal[1]);129 cr_server.head_spu->dispatch_table.GetAttachedObjectsARB(crStateGetProgramHWID(&cr_server.StateTracker, containerObj), maxCount, pLocal, (VBoxGLhandleARB*)&pLocal[1]); 130 130 131 131 { … … 134 134 135 135 for (i=0; i<*pLocal; ++i) 136 ids[i] = crStateGLSLShaderHWIDtoID( ids[i]);136 ids[i] = crStateGLSLShaderHWIDtoID(&cr_server.StateTracker, ids[i]); 137 137 } 138 138 … … 162 162 *pLocal = 0; 163 163 /** @todo recheck*/ 164 hwid = crStateGetProgramHWID( obj);165 if (!hwid) hwid = crStateGetShaderHWID( obj);164 hwid = crStateGetProgramHWID(&cr_server.StateTracker, obj); 165 if (!hwid) hwid = crStateGetShaderHWID(&cr_server.StateTracker, obj); 166 166 cr_server.head_spu->dispatch_table.GetInfoLogARB(hwid, maxLength, pLocal, (char*)&pLocal[1]); 167 167 CRASSERT((*pLocal) <= maxLength); … … 187 187 /* initial (fallback )value */ 188 188 *pLocal = 0; 189 cr_server.head_spu->dispatch_table.GetShaderInfoLog(crStateGetShaderHWID( shader), bufSize, pLocal, (char*)&pLocal[1]);189 cr_server.head_spu->dispatch_table.GetShaderInfoLog(crStateGetShaderHWID(&cr_server.StateTracker, shader), bufSize, pLocal, (char*)&pLocal[1]); 190 190 crServerReturnValue(pLocal, pLocal[0]+sizeof(GLsizei)); 191 191 crFree(pLocal); … … 209 209 /* initial (fallback )value */ 210 210 *pLocal = 0; 211 cr_server.head_spu->dispatch_table.GetProgramInfoLog(crStateGetProgramHWID( program), bufSize, pLocal, (char*)&pLocal[1]);211 cr_server.head_spu->dispatch_table.GetProgramInfoLog(crStateGetProgramHWID(&cr_server.StateTracker, program), bufSize, pLocal, (char*)&pLocal[1]); 212 212 CRASSERT(pLocal[0] <= bufSize); 213 213 crServerReturnValue(pLocal, pLocal[0]+sizeof(GLsizei)); … … 232 232 /* initial (fallback )value */ 233 233 *pLocal = 0; 234 cr_server.head_spu->dispatch_table.GetShaderSource(crStateGetShaderHWID( shader), bufSize, pLocal, (char*)&pLocal[1]);234 cr_server.head_spu->dispatch_table.GetShaderSource(crStateGetShaderHWID(&cr_server.StateTracker, shader), bufSize, pLocal, (char*)&pLocal[1]); 235 235 CRASSERT(pLocal[0] <= bufSize); 236 236 crServerReturnValue(pLocal, pLocal[0]+sizeof(GLsizei)); … … 258 258 /* initial (fallback )value */ 259 259 *pLocal = 0; 260 crStateGLSLProgramCacheUniforms( program, maxcbData, pLocal, (char*)&pLocal[1]);260 crStateGLSLProgramCacheUniforms(&cr_server.StateTracker, program, maxcbData, pLocal, (char*)&pLocal[1]); 261 261 262 262 crServerReturnValue(pLocal, (*pLocal)+sizeof(GLsizei)); … … 284 284 /* initial (fallback )value */ 285 285 *pLocal = 0; 286 crStateGLSLProgramCacheAttribs( program, maxcbData, pLocal, (char*)&pLocal[1]);286 crStateGLSLProgramCacheAttribs(&cr_server.StateTracker, program, maxcbData, pLocal, (char*)&pLocal[1]); 287 287 288 288 crServerReturnValue(pLocal, (*pLocal)+sizeof(GLsizei)); … … 296 296 297 297 /** @todo check if index and location is the same*/ 298 cr_server.head_spu->dispatch_table.GetActiveUniform(crStateGetProgramHWID( program), location, 0, NULL, &size, &type, NULL);299 300 return crStateGetUniformSize( type);298 cr_server.head_spu->dispatch_table.GetActiveUniform(crStateGetProgramHWID(&cr_server.StateTracker, program), location, 0, NULL, &size, &type, NULL); 299 300 return crStateGetUniformSize(&cr_server.StateTracker, type); 301 301 } 302 302 … … 316 316 } 317 317 318 cr_server.head_spu->dispatch_table.GetUniformfv(crStateGetProgramHWID( program), location, pLocal);318 cr_server.head_spu->dispatch_table.GetUniformfv(crStateGetProgramHWID(&cr_server.StateTracker, program), location, pLocal); 319 319 320 320 crServerReturnValue(pLocal, size); … … 337 337 } 338 338 339 cr_server.head_spu->dispatch_table.GetUniformiv(crStateGetProgramHWID( program), location, pLocal);339 cr_server.head_spu->dispatch_table.GetUniformiv(crStateGetProgramHWID(&cr_server.StateTracker, program), location, pLocal); 340 340 341 341 crServerReturnValue(pLocal, size); … … 347 347 GLuint retval, hwVal; 348 348 hwVal = cr_server.head_spu->dispatch_table.CreateShader(type); 349 retval = crStateCreateShader( hwVal, type);349 retval = crStateCreateShader(&cr_server.StateTracker, hwVal, type); 350 350 crServerReturnValue(&retval, sizeof(retval)); 351 351 return retval; /* ignored */ … … 356 356 GLuint retval, hwVal; 357 357 hwVal = cr_server.head_spu->dispatch_table.CreateProgram(); 358 retval = crStateCreateProgram( hwVal);358 retval = crStateCreateProgram(&cr_server.StateTracker, hwVal); 359 359 crServerReturnValue(&retval, sizeof(retval)); 360 360 return retval; /* ignored */ … … 364 364 { 365 365 GLboolean retval; 366 retval = cr_server.head_spu->dispatch_table.IsShader(crStateGetShaderHWID( shader));366 retval = cr_server.head_spu->dispatch_table.IsShader(crStateGetShaderHWID(&cr_server.StateTracker, shader)); 367 367 crServerReturnValue(&retval, sizeof(retval)); 368 368 return retval; /* ignored */ … … 372 372 { 373 373 GLboolean retval; 374 retval = cr_server.head_spu->dispatch_table.IsProgram(crStateGetProgramHWID( program));374 retval = cr_server.head_spu->dispatch_table.IsProgram(crStateGetProgramHWID(&cr_server.StateTracker, program)); 375 375 crServerReturnValue(&retval, sizeof(retval)); 376 376 return retval; /* ignored */ … … 380 380 { 381 381 GLfloat local_params[1] = {0}; 382 GLuint hwid = crStateGetProgramHWID( obj);382 GLuint hwid = crStateGetProgramHWID(&cr_server.StateTracker, obj); 383 383 (void) params; 384 384 385 385 if (!hwid) 386 386 { 387 hwid = crStateGetShaderHWID( obj);387 hwid = crStateGetShaderHWID(&cr_server.StateTracker, obj); 388 388 if (!hwid) 389 389 { … … 399 399 { 400 400 GLint local_params[1] = {0}; 401 GLuint hwid = crStateGetProgramHWID( obj);401 GLuint hwid = crStateGetProgramHWID(&cr_server.StateTracker, obj); 402 402 if (!hwid) 403 403 { 404 hwid = crStateGetShaderHWID( obj);404 hwid = crStateGetShaderHWID(&cr_server.StateTracker, obj); 405 405 if (!hwid) 406 406 { -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getteximage.cpp
r78190 r78375 21 21 22 22 #ifdef CR_ARB_pixel_buffer_object 23 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))23 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 24 24 { 25 25 GLvoid *pbo_offset; … … 104 104 105 105 #ifdef CR_ARB_pixel_buffer_object 106 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))106 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 107 107 { 108 108 GLvoid *pbo_offset; … … 136 136 { 137 137 #ifdef CR_ARB_pixel_buffer_object 138 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))138 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 139 139 { 140 140 GLvoid *pbo_offset; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.cpp
r78190 r78375 32 32 GLenum err = cr_server.head_spu->dispatch_table.GetError(); 33 33 #endif 34 cr_server.head_spu->dispatch_table.ShaderSource(crStateGetShaderHWID( shader), count, string, length);34 cr_server.head_spu->dispatch_table.ShaderSource(crStateGetShaderHWID(&cr_server.StateTracker, shader), count, string, length); 35 35 #ifdef DEBUG_misha 36 36 err = cr_server.head_spu->dispatch_table.GetError(); … … 45 45 GLint iCompileStatus = GL_FALSE; 46 46 #endif 47 crStateCompileShader( shader);48 cr_server.head_spu->dispatch_table.CompileShader(crStateGetShaderHWID( shader));49 #ifdef DEBUG_misha 50 cr_server.head_spu->dispatch_table.GetShaderiv(crStateGetShaderHWID( shader), GL_COMPILE_STATUS, &iCompileStatus);47 crStateCompileShader(&cr_server.StateTracker, shader); 48 cr_server.head_spu->dispatch_table.CompileShader(crStateGetShaderHWID(&cr_server.StateTracker, shader)); 49 #ifdef DEBUG_misha 50 cr_server.head_spu->dispatch_table.GetShaderiv(crStateGetShaderHWID(&cr_server.StateTracker, shader), GL_COMPILE_STATUS, &iCompileStatus); 51 51 Assert(iCompileStatus == GL_TRUE); 52 52 #endif … … 56 56 void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteShader(GLuint shader) 57 57 { 58 GLuint shaderHW = crStateGetShaderHWID( shader);59 crStateDeleteShader( shader);58 GLuint shaderHW = crStateGetShaderHWID(&cr_server.StateTracker, shader); 59 crStateDeleteShader(&cr_server.StateTracker, shader); 60 60 if (shaderHW) 61 61 cr_server.head_spu->dispatch_table.DeleteShader(shaderHW); … … 66 66 void SERVER_DISPATCH_APIENTRY crServerDispatchAttachShader(GLuint program, GLuint shader) 67 67 { 68 crStateAttachShader(program, shader); 69 cr_server.head_spu->dispatch_table.AttachShader(crStateGetProgramHWID(program), crStateGetShaderHWID(shader)); 68 crStateAttachShader(&cr_server.StateTracker, program, shader); 69 cr_server.head_spu->dispatch_table.AttachShader(crStateGetProgramHWID(&cr_server.StateTracker, program), 70 crStateGetShaderHWID(&cr_server.StateTracker, shader)); 70 71 } 71 72 72 73 void SERVER_DISPATCH_APIENTRY crServerDispatchDetachShader(GLuint program, GLuint shader) 73 74 { 74 crStateDetachShader(program, shader); 75 cr_server.head_spu->dispatch_table.DetachShader(crStateGetProgramHWID(program), crStateGetShaderHWID(shader)); 75 crStateDetachShader(&cr_server.StateTracker, program, shader); 76 cr_server.head_spu->dispatch_table.DetachShader(crStateGetProgramHWID(&cr_server.StateTracker, program), 77 crStateGetShaderHWID(&cr_server.StateTracker, shader)); 76 78 } 77 79 78 80 void SERVER_DISPATCH_APIENTRY crServerDispatchLinkProgram(GLuint program) 79 81 { 80 crStateLinkProgram( program);81 cr_server.head_spu->dispatch_table.LinkProgram(crStateGetProgramHWID( program));82 crStateLinkProgram(&cr_server.StateTracker, program); 83 cr_server.head_spu->dispatch_table.LinkProgram(crStateGetProgramHWID(&cr_server.StateTracker, program)); 82 84 CR_SERVER_DUMP_LINK_PROGRAM(program); 83 85 } … … 85 87 void SERVER_DISPATCH_APIENTRY crServerDispatchUseProgram(GLuint program) 86 88 { 87 crStateUseProgram( program);88 cr_server.head_spu->dispatch_table.UseProgram(crStateGetProgramHWID( program));89 crStateUseProgram(&cr_server.StateTracker, program); 90 cr_server.head_spu->dispatch_table.UseProgram(crStateGetProgramHWID(&cr_server.StateTracker, program)); 89 91 } 90 92 91 93 void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteProgram(GLuint program) 92 94 { 93 GLuint hwId = crStateGetProgramHWID( program);94 crStateDeleteProgram( program);95 GLuint hwId = crStateGetProgramHWID(&cr_server.StateTracker, program); 96 crStateDeleteProgram(&cr_server.StateTracker, program); 95 97 if (hwId) 96 98 cr_server.head_spu->dispatch_table.DeleteProgram(hwId); … … 101 103 void SERVER_DISPATCH_APIENTRY crServerDispatchValidateProgram(GLuint program) 102 104 { 103 crStateValidateProgram( program);104 cr_server.head_spu->dispatch_table.ValidateProgram(crStateGetProgramHWID( program));105 crStateValidateProgram(&cr_server.StateTracker, program); 106 cr_server.head_spu->dispatch_table.ValidateProgram(crStateGetProgramHWID(&cr_server.StateTracker, program)); 105 107 } 106 108 107 109 void SERVER_DISPATCH_APIENTRY crServerDispatchBindAttribLocation(GLuint program, GLuint index, const char * name) 108 110 { 109 crStateBindAttribLocation( program, index, name);110 cr_server.head_spu->dispatch_table.BindAttribLocation(crStateGetProgramHWID( program), index, name);111 crStateBindAttribLocation(&cr_server.StateTracker, program, index, name); 112 cr_server.head_spu->dispatch_table.BindAttribLocation(crStateGetProgramHWID(&cr_server.StateTracker, program), index, name); 111 113 } 112 114 113 115 void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteObjectARB(VBoxGLhandleARB obj) 114 116 { 115 GLuint hwid = crStateDeleteObjectARB( obj);117 GLuint hwid = crStateDeleteObjectARB(&cr_server.StateTracker, obj); 116 118 117 119 if (hwid) … … 124 126 { 125 127 GLint retval; 126 retval = cr_server.head_spu->dispatch_table.GetAttribLocation(crStateGetProgramHWID( program), name );128 retval = cr_server.head_spu->dispatch_table.GetAttribLocation(crStateGetProgramHWID(&cr_server.StateTracker, program), name ); 127 129 crServerReturnValue( &retval, sizeof(retval) ); 128 130 return retval; /* WILL PROBABLY BE IGNORED */ … … 135 137 if (pname==GL_PROGRAM_OBJECT_ARB) 136 138 { 137 retval = crStateGLSLProgramHWIDtoID( retval);139 retval = crStateGLSLProgramHWIDtoID(&cr_server.StateTracker, retval); 138 140 } 139 141 crServerReturnValue( &retval, sizeof(retval) ); … … 144 146 { 145 147 GLint retval; 146 retval = cr_server.head_spu->dispatch_table.GetUniformLocation(crStateGetProgramHWID( program), name);148 retval = cr_server.head_spu->dispatch_table.GetUniformLocation(crStateGetProgramHWID(&cr_server.StateTracker, program), name); 147 149 crServerReturnValue( &retval, sizeof(retval) ); 148 150 return retval; /* WILL PROBABLY BE IGNORED */ … … 153 155 GLint local_params[1] = {0}; 154 156 (void) params; 155 cr_server.head_spu->dispatch_table.GetProgramiv(crStateGetProgramHWID( program), pname, local_params);157 cr_server.head_spu->dispatch_table.GetProgramiv(crStateGetProgramHWID(&cr_server.StateTracker, program), pname, local_params); 156 158 crServerReturnValue( &(local_params[0]), 1*sizeof(GLint) ); 157 159 } … … 161 163 GLint local_params[1] = {0}; 162 164 (void) params; 163 cr_server.head_spu->dispatch_table.GetShaderiv( crStateGetShaderHWID( shader), pname, local_params );165 cr_server.head_spu->dispatch_table.GetShaderiv( crStateGetShaderHWID(&cr_server.StateTracker, shader), pname, local_params ); 164 166 crServerReturnValue( &(local_params[0]), 1*sizeof(GLint) ); 165 167 } … … 197 199 pLocalProgs[i] = crServerTranslateProgramID(programs[i]); 198 200 } 199 crStateDeleteProgramsARB( n, pLocalProgs);201 crStateDeleteProgramsARB(&cr_server.StateTracker, n, pLocalProgs); 200 202 cr_server.head_spu->dispatch_table.DeleteProgramsARB(n, pLocalProgs); 201 203 crFree(pLocalProgs); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_lists.cpp
r78190 r78375 64 64 65 65 list = TranslateListID( list ); 66 crStateNewList( list, mode );66 crStateNewList(&cr_server.StateTracker, list, mode ); 67 67 cr_server.head_spu->dispatch_table.NewList( list, mode ); 68 68 } … … 84 84 fbFbo = bbFbo = 0; 85 85 } 86 crStateQueryHWState( fbFbo, bbFbo);86 crStateQueryHWState(&cr_server.StateTracker, fbFbo, bbFbo); 87 87 } 88 88 } … … 90 90 void SERVER_DISPATCH_APIENTRY crServerDispatchEndList(void) 91 91 { 92 CRContext *g = crStateGetCurrent( );92 CRContext *g = crStateGetCurrent(&cr_server.StateTracker); 93 93 CRListsState *l = &(g->lists); 94 94 95 95 cr_server.head_spu->dispatch_table.EndList(); 96 crStateEndList( );96 crStateEndList(&cr_server.StateTracker); 97 97 98 98 #ifndef IN_GUEST … … 272 272 { 273 273 list = TranslateListID( list ); 274 crStateDeleteLists( list, range );274 crStateDeleteLists(&cr_server.StateTracker, list, range ); 275 275 cr_server.head_spu->dispatch_table.DeleteLists( list, range ); 276 276 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.cpp
r78263 r78375 51 51 */ 52 52 CRServer cr_server; 53 DECLHIDDEN(PCRStateTracker) g_pStateTracker; 53 54 54 55 int tearingdown = 0; /* can't be static */ … … 124 125 { 125 126 CRContextInfo *c = (CRContextInfo *) data; 126 crStateDestroyContext( c->pContext);127 crStateDestroyContext(&cr_server.StateTracker, c->pContext); 127 128 if (c->CreateInfo.pszDpyName) 128 129 crFree(c->CreateInfo.pszDpyName); … … 180 181 } 181 182 182 crStateSetCurrent( NULL);183 crStateSetCurrent(&cr_server.StateTracker, NULL); 183 184 184 185 cr_server.curClient = NULL; … … 218 219 if (!fContextsDeleted) 219 220 { 220 fOldEnableDiff = crStateEnableDiffOnMakeCurrent( GL_FALSE);221 fOldEnableDiff = crStateEnableDiffOnMakeCurrent(&cr_server.StateTracker, GL_FALSE); 221 222 if(cr_server.MainContextInfo.pContext) 222 crStateMakeCurrent( cr_server.MainContextInfo.pContext);223 crStateEnableDiffOnMakeCurrent( fOldEnableDiff);223 crStateMakeCurrent(&cr_server.StateTracker, cr_server.MainContextInfo.pContext); 224 crStateEnableDiffOnMakeCurrent(&cr_server.StateTracker, fOldEnableDiff); 224 225 } 225 226 … … 270 271 #endif 271 272 272 crStateDestroy( );273 crStateDestroy(&cr_server.StateTracker); 273 274 274 275 crNetTearDown(); … … 356 357 cr_server.programTable = crAllocHashtable(); 357 358 358 crStateInit(); 359 crStateInit(&cr_server.StateTracker); 360 g_pStateTracker = &cr_server.StateTracker; 359 361 360 362 crStateLimitsInit( &(cr_server.limits) ); … … 393 395 if (!cr_server.head_spu) 394 396 { 395 crStateDestroy( );397 crStateDestroy(&cr_server.StateTracker); 396 398 return GL_FALSE; 397 399 } … … 399 401 crServerInitDispatch(); 400 402 crServerInitTmpCtxDispatch(); 401 crStateDiffAPI( &(cr_server.head_spu->dispatch_table) );403 crStateDiffAPI(&cr_server.StateTracker, &(cr_server.head_spu->dispatch_table) ); 402 404 403 405 #ifdef VBOX_WITH_CRSERVER_DUMPER … … 410 412 411 413 /*Check for PBO support*/ 412 if (crStateGetCurrent( )->extensions.ARB_pixel_buffer_object)414 if (crStateGetCurrent(&cr_server.StateTracker)->extensions.ARB_pixel_buffer_object) 413 415 { 414 416 cr_server.bUsePBOForReadback=GL_TRUE; … … 1422 1424 crVBoxServerBuildSaveStateGlobal(&Data); 1423 1425 1424 rc = crStateSaveGlobals( pSSM);1426 rc = crStateSaveGlobals(&cr_server.StateTracker, pSSM); 1425 1427 AssertRCReturn(rc, rc); 1426 1428 … … 2084 2086 } 2085 2087 2086 rc = crStateLoadGlobals( pSSM, version);2088 rc = crStateLoadGlobals(&cr_server.StateTracker, pSSM, version); 2087 2089 AssertLogRelRCReturn(rc, rc); 2088 2090 … … 2604 2606 2605 2607 cr_server.head_spu->dispatch_table.MakeCurrent(0, 0, 0); 2606 crStateCleanupCurrent( );2608 crStateCleanupCurrent(&cr_server.StateTracker); 2607 2609 2608 2610 /* note: we need to clean all contexts, since otherwise renderspu leanup won't work, … … 2612 2614 { 2613 2615 cr_server.head_spu->dispatch_table.DestroyContext(cr_server.MainContextInfo.SpuContext); 2614 crStateDestroyContext( cr_server.MainContextInfo.pContext);2616 crStateDestroyContext(&cr_server.StateTracker, cr_server.MainContextInfo.pContext); 2615 2617 if (cr_server.MainContextInfo.CreateInfo.pszDpyName) 2616 2618 crFree(cr_server.MainContextInfo.CreateInfo.pszDpyName); … … 2630 2632 cr_server.currentMural = NULL; 2631 2633 2632 crStateDestroy( );2634 crStateDestroy(&cr_server.StateTracker); 2633 2635 // crStateCleanupCurrent(); 2634 2636 … … 2651 2653 2652 2654 // crStateSetCurrent(NULL); 2653 crStateInit( );2654 crStateDiffAPI( &(cr_server.head_spu->dispatch_table) );2655 crStateInit(&cr_server.StateTracker); 2656 crStateDiffAPI(&cr_server.StateTracker, &(cr_server.head_spu->dispatch_table) ); 2655 2657 2656 2658 CrPMgrEnable(); … … 3835 3837 } 3836 3838 3839 void crVBoxServerDetachThread(void) 3840 { 3841 crStateVBoxDetachThread(&cr_server.StateTracker); 3842 } 3843 3844 void crVBoxServerAttachThread(void) 3845 { 3846 crStateVBoxAttachThread(&cr_server.StateTracker); 3847 } 3848 3849 3837 3850 #endif -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.cpp
r78263 r78375 328 328 switch (target) { 329 329 case GL_SHARE_CONTEXT_RESOURCES_CR: 330 crStateShareContext( value);330 crStateShareContext(&cr_server.StateTracker, value); 331 331 break; 332 332 case GL_RCUSAGE_TEXTURE_SET_CR: 333 crStateSetTextureUsed( value, GL_TRUE);333 crStateSetTextureUsed(&cr_server.StateTracker, value, GL_TRUE); 334 334 break; 335 335 case GL_RCUSAGE_TEXTURE_CLEAR_CR: 336 crStateSetTextureUsed( value, GL_FALSE);336 crStateSetTextureUsed(&cr_server.StateTracker, value, GL_FALSE); 337 337 break; 338 338 case GL_PIN_TEXTURE_SET_CR: 339 crStatePinTexture( value, GL_TRUE);339 crStatePinTexture(&cr_server.StateTracker, value, GL_TRUE); 340 340 break; 341 341 case GL_PIN_TEXTURE_CLEAR_CR: 342 crStatePinTexture( value, GL_FALSE);342 crStatePinTexture(&cr_server.StateTracker, value, GL_FALSE); 343 343 break; 344 344 case GL_SHARED_DISPLAY_LISTS_CR: … … 502 502 GLuint tID, fboID; 503 503 GLenum status; 504 CRContext *ctx = crStateGetCurrent( );504 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 505 505 506 506 gl->GenTextures(1, &tID); … … 601 601 GLint dRow; 602 602 GLuint pboId, sRow; 603 CRContext *ctx = crStateGetCurrent( );603 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 604 604 605 605 gl->GenBuffersARB(1, &pboId); … … 897 897 CR_BLITTER_CONTEXT Ctx; 898 898 CRMuralInfo *mural; 899 CRContext *ctx = crStateGetCurrent( );899 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 900 900 PVBOXVR_TEXTURE pDrawTex, pReadTex; 901 901 VBOXVR_TEXTURE DrawTex, ReadTex; … … 992 992 GLbitfield mask, GLenum filter) 993 993 { 994 CRContext *ctx = crStateGetCurrent( );994 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 995 995 bool fTryBlitter = false; 996 996 #ifdef CR_CHECK_BLITS … … 1274 1274 void SERVER_DISPATCH_APIENTRY crServerDispatchDrawBuffer( GLenum mode ) 1275 1275 { 1276 crStateDrawBuffer( mode );1277 1278 if (!crStateGetCurrent( )->framebufferobject.drawFB)1276 crStateDrawBuffer(&cr_server.StateTracker, mode ); 1277 1278 if (!crStateGetCurrent(&cr_server.StateTracker)->framebufferobject.drawFB) 1279 1279 { 1280 1280 if (mode == GL_FRONT || mode == GL_FRONT_LEFT || mode == GL_FRONT_RIGHT) … … 1362 1362 void SERVER_DISPATCH_APIENTRY crServerDispatchReadBuffer( GLenum mode ) 1363 1363 { 1364 crStateReadBuffer( mode );1364 crStateReadBuffer(&cr_server.StateTracker, mode ); 1365 1365 1366 1366 if (crServerIsRedirectedToFBO() 1367 1367 && cr_server.curClient->currentMural->aidFBOs[0] 1368 && !crStateGetCurrent( )->framebufferobject.readFB)1368 && !crStateGetCurrent(&cr_server.StateTracker)->framebufferobject.readFB) 1369 1369 { 1370 1370 CRMuralInfo *mural = cr_server.curClient->currentMural; … … 1433 1433 { 1434 1434 GLenum retval, err; 1435 CRContext *ctx = crStateGetCurrent( );1435 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 1436 1436 retval = ctx->error; 1437 1437 … … 1453 1453 crServerMakeTmpCtxCurrent( GLint window, GLint nativeWindow, GLint context ) 1454 1454 { 1455 CRContext *pCtx = crStateGetCurrent( );1455 CRContext *pCtx = crStateGetCurrent(&cr_server.StateTracker); 1456 1456 CRContext *pCurCtx = NULL; 1457 1457 GLuint idDrawFBO = 0, idReadFBO = 0; … … 1890 1890 GLvoid crServerSpriteCoordReplEnable(GLboolean fEnable) 1891 1891 { 1892 CRContext *g = crStateGetCurrent( );1892 CRContext *g = crStateGetCurrent(&cr_server.StateTracker); 1893 1893 CRTextureState *t = &(g->texture); 1894 1894 GLuint curTextureUnit = t->curTextureUnit; … … 1948 1948 void SERVER_DISPATCH_APIENTRY crServerDispatchEnd( void ) 1949 1949 { 1950 CRContext *g = crStateGetCurrent( );1950 CRContext *g = crStateGetCurrent(&cr_server.StateTracker); 1951 1951 GLenum mode = g->current.mode; 1952 1952 1953 crStateEnd( );1953 crStateEnd(&cr_server.StateTracker); 1954 1954 cr_server.head_spu->dispatch_table.End(); 1955 1955 … … 1963 1963 { 1964 1964 #ifdef DEBUG 1965 CRContext *ctx = crStateGetCurrent( );1965 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 1966 1966 SPUDispatchTable *gl = &cr_server.head_spu->dispatch_table; 1967 1967 … … 2012 2012 CR_SERVER_DUMP_DRAW_ENTER(); 2013 2013 2014 crStateBegin( mode);2014 crStateBegin(&cr_server.StateTracker, mode); 2015 2015 cr_server.head_spu->dispatch_table.Begin(mode); 2016 2016 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.cpp
r78263 r78375 477 477 if (cr_server.curClient && cr_server.curClient->currentMural == mural) 478 478 { 479 if (!crStateGetCurrent()->framebufferobject.drawFB) 479 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 480 481 if (!ctx->framebufferobject.drawFB) 480 482 { 481 483 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer)); 482 484 } 483 if (!c rStateGetCurrent()->framebufferobject.readFB)485 if (!ctx->framebufferobject.readFB) 484 486 { 485 487 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer)); 486 488 } 487 489 488 c rStateGetCurrent()->buffer.width = 0;489 c rStateGetCurrent()->buffer.height = 0;490 ctx->buffer.width = 0; 491 ctx->buffer.height = 0; 490 492 } 491 493 } … … 494 496 if (cr_server.curClient && cr_server.curClient->currentMural == mural) 495 497 { 496 if (!crStateGetCurrent()->framebufferobject.drawFB) 498 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 499 500 if (!ctx->framebufferobject.drawFB) 497 501 { 498 502 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0); 499 503 } 500 if (!c rStateGetCurrent()->framebufferobject.readFB)504 if (!ctx->framebufferobject.readFB) 501 505 { 502 506 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0); 503 507 } 504 508 505 c rStateGetCurrent()->buffer.width = mural->width;506 c rStateGetCurrent()->buffer.height = mural->height;509 ctx->buffer.width = mural->width; 510 ctx->buffer.height = mural->height; 507 511 } 508 512 } … … 513 517 static void crServerCreateMuralFBO(CRMuralInfo *mural) 514 518 { 515 CRContext *ctx = crStateGetCurrent( );519 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 516 520 GLuint uid, i; 517 521 GLenum status; … … 540 544 /*Color texture*/ 541 545 542 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))546 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 543 547 { 544 548 gl->BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); … … 605 609 gl->BindFramebufferEXT(GL_READ_FRAMEBUFFER, uid); 606 610 607 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))611 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 608 612 { 609 613 gl->BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, ctx->bufferobject.unpackBuffer->hwid); 610 614 } 611 615 612 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))616 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 613 617 { 614 618 gl->BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, ctx->bufferobject.packBuffer->hwid); … … 825 829 void crServerMuralFBOSwapBuffers(CRMuralInfo *mural) 826 830 { 827 CRContext *ctx = crStateGetCurrent( );831 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 828 832 GLint iOldCurDrawBuffer = mural->iCurDrawBuffer; 829 833 GLint iOldCurReadBuffer = mural->iCurReadBuffer; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_projmatrix.cpp
r78263 r78375 44 44 const GLenum matMode = cr_server.curClient->currentCtxInfo->pContext->transform.matrixMode; 45 45 46 crStateLoadMatrixf( m );46 crStateLoadMatrixf(&cr_server.StateTracker, m ); 47 47 48 48 if (matMode == GL_MODELVIEW && cr_server.viewOverride) { … … 60 60 const GLenum matMode = cr_server.curClient->currentCtxInfo->pContext->transform.matrixMode; 61 61 62 crStateLoadMatrixd( m );62 crStateLoadMatrixd(&cr_server.StateTracker, m ); 63 63 64 64 if (matMode == GL_MODELVIEW && cr_server.viewOverride) { … … 79 79 /* load the overriding projection matrix */ 80 80 int eye = crServerGetCurrentEye(); 81 crStateLoadMatrix( &cr_server.projectionMatrix[eye] );81 crStateLoadMatrix(&cr_server.StateTracker, &cr_server.projectionMatrix[eye] ); 82 82 } 83 83 else { 84 84 /* the usual case */ 85 crStateMultMatrixf( m );85 crStateMultMatrixf(&cr_server.StateTracker, m ); 86 86 cr_server.head_spu->dispatch_table.MultMatrixf( m ); 87 87 } … … 96 96 /* load the overriding projection matrix */ 97 97 int eye = crServerGetCurrentEye(); 98 crStateLoadMatrix( &cr_server.projectionMatrix[eye] );98 crStateLoadMatrix(&cr_server.StateTracker, &cr_server.projectionMatrix[eye] ); 99 99 } 100 100 else { 101 101 /* the usual case */ 102 crStateMultMatrixd( m );102 crStateMultMatrixd(&cr_server.StateTracker, m ); 103 103 cr_server.head_spu->dispatch_table.MultMatrixd( m ); 104 104 } … … 111 111 const GLenum matMode = cr_server.curClient->currentCtxInfo->pContext->transform.matrixMode; 112 112 113 crStateLoadIdentity( );113 crStateLoadIdentity(&cr_server.StateTracker); 114 114 115 115 if (matMode == GL_MODELVIEW && cr_server.viewOverride) { … … 322 322 323 323 /* pass through */ 324 crStateProgramStringARB( target, format, len, string);324 crStateProgramStringARB(&cr_server.StateTracker, target, format, len, string); 325 325 cr_server.head_spu->dispatch_table.ProgramStringARB(target, format, len, string); 326 326 } … … 364 364 365 365 /* pass through */ 366 crStateLoadProgramNV( target, id, len, string);366 crStateLoadProgramNV(&cr_server.StateTracker, target, id, len, string); 367 367 cr_server.head_spu->dispatch_table.LoadProgramNV(target, id, len, string); 368 368 } … … 381 381 382 382 /* pass through */ 383 crStateBindProgramARB( target, id);383 crStateBindProgramARB(&cr_server.StateTracker, target, id); 384 384 cr_server.head_spu->dispatch_table.BindProgramARB(target, id); 385 385 } … … 395 395 } 396 396 /* pass through */ 397 crStateBindProgramNV( target, id);397 crStateBindProgramNV(&cr_server.StateTracker, target, id); 398 398 cr_server.head_spu->dispatch_table.BindProgramNV(target, id); 399 399 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_readpixels.cpp
r78190 r78375 33 33 34 34 #ifdef CR_ARB_pixel_buffer_object 35 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))35 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 36 36 { 37 37 GLvoid *pbo_offset; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_rpw.cpp
r78263 r78375 470 470 pContext = cr_server.currentCtxInfo->pContext; 471 471 472 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))472 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 473 473 { 474 474 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); … … 490 490 pEntry->iTexDraw = -pEntry->iTexDraw; 491 491 492 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))492 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 493 493 { 494 494 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pContext->bufferobject.unpackBuffer->hwid); … … 504 504 } 505 505 506 if (crStateIsBufferBound( GL_PIXEL_PACK_BUFFER_ARB))506 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_PACK_BUFFER_ARB)) 507 507 { 508 508 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pContext->bufferobject.packBuffer->hwid); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py
r69390 r78375 62 62 CRASSERT(tablesize/sizeof(%s)==1); 63 63 texid = (GLuint) *get_values; 64 *get_values = (%s) crStateTextureHWIDtoID( texid);64 *get_values = (%s) crStateTextureHWIDtoID(&cr_server.StateTracker, texid); 65 65 } 66 66 else if (GL_CURRENT_PROGRAM==pname) … … 69 69 CRASSERT(tablesize/sizeof(%s)==1); 70 70 programid = (GLuint) *get_values; 71 *get_values = (%s) crStateGLSLProgramHWIDtoID( programid);71 *get_values = (%s) crStateGLSLProgramHWIDtoID(&cr_server.StateTracker, programid); 72 72 } 73 73 else if (GL_FRAMEBUFFER_BINDING_EXT==pname … … 85 85 else 86 86 { 87 fboid = crStateFBOHWIDtoID( fboid);87 fboid = crStateFBOHWIDtoID(&cr_server.StateTracker, fboid); 88 88 } 89 89 *get_values = (%s) fboid; … … 93 93 if (crServerIsRedirectedToFBO() 94 94 && CR_SERVER_FBO_FOR_IDX(cr_server.curClient->currentMural, cr_server.curClient->currentMural->iCurReadBuffer) 95 && !crStateGetCurrent( )->framebufferobject.readFB)95 && !crStateGetCurrent(&cr_server.StateTracker)->framebufferobject.readFB) 96 96 { 97 *get_values = (%s) crStateGetCurrent( )->buffer.readBuffer;98 Assert(crStateGetCurrent( )->buffer.readBuffer == GL_BACK || crStateGetCurrent()->buffer.readBuffer == GL_FRONT);97 *get_values = (%s) crStateGetCurrent(&cr_server.StateTracker)->buffer.readBuffer; 98 Assert(crStateGetCurrent(&cr_server.StateTracker)->buffer.readBuffer == GL_BACK || crStateGetCurrent(&cr_server.StateTracker)->buffer.readBuffer == GL_FRONT); 99 99 } 100 100 } … … 103 103 if (crServerIsRedirectedToFBO() 104 104 && CR_SERVER_FBO_FOR_IDX(cr_server.curClient->currentMural, cr_server.curClient->currentMural->iCurDrawBuffer) 105 && !crStateGetCurrent( )->framebufferobject.drawFB)105 && !crStateGetCurrent(&cr_server.StateTracker)->framebufferobject.drawFB) 106 106 { 107 *get_values = (%s) crStateGetCurrent( )->buffer.drawBuffer;108 Assert(crStateGetCurrent( )->buffer.drawBuffer == GL_BACK || crStateGetCurrent()->buffer.drawBuffer == GL_FRONT);107 *get_values = (%s) crStateGetCurrent(&cr_server.StateTracker)->buffer.drawBuffer; 108 Assert(crStateGetCurrent(&cr_server.StateTracker)->buffer.drawBuffer == GL_BACK || crStateGetCurrent(&cr_server.StateTracker)->buffer.drawBuffer == GL_FRONT); 109 109 } 110 110 } … … 114 114 CRASSERT(tablesize/sizeof(%s)==1); 115 115 rbid = (GLuint) *get_values; 116 *get_values = (%s) crStateRBOHWIDtoID( rbid);116 *get_values = (%s) crStateRBOHWIDtoID(&cr_server.StateTracker, rbid); 117 117 } 118 118 else if (GL_ARRAY_BUFFER_BINDING_ARB==pname … … 131 131 CRASSERT(tablesize/sizeof(%s)==1); 132 132 bufid = (GLuint) *get_values; 133 *get_values = (%s) crStateBufferHWIDtoID( bufid);133 *get_values = (%s) crStateBufferHWIDtoID(&cr_server.StateTracker, bufid); 134 134 } 135 135 else if (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS==pname) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.cpp
r78263 r78375 580 580 UnpackerState.pDispatchTbl = &(cr_server.dispatch); 581 581 UnpackerState.rcUnpack = VINF_SUCCESS; 582 UnpackerState.pStateTracker = &cr_server.StateTracker; 582 583 583 584 cr_server.pUnpackerState = &UnpackerState; … … 695 696 UnpackerState.pDispatchTbl = &(cr_server.dispatch); 696 697 UnpackerState.rcUnpack = VINF_SUCCESS; 698 UnpackerState.pStateTracker = &cr_server.StateTracker; 697 699 698 700 cr_server.pUnpackerState = &UnpackerState; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_texture.cpp
r78190 r78375 39 39 #if defined(CR_ARB_pixel_buffer_object) 40 40 # define CR_CHECKBUFFER(name, checkptr) \ 41 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB)) \41 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) \ 42 42 { \ 43 43 CR_FIXPTR(); \ … … 53 53 #if defined(CR_ARB_pixel_buffer_object) && !defined(CR_STATE_NO_TEXTURE_IMAGE_STORE) 54 54 # define CR_FINISHBUFFER() \ 55 if (crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))\55 if (crStateIsBufferBound(&cr_server.StateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) \ 56 56 { \ 57 57 if (!cr_server.head_spu->dispatch_table.UnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)) \ … … 64 64 #endif 65 65 66 #define CR_FUNC_SUBIMAGE(name, def, call, ptrname) \67 void SERVER_DISPATCH_APIENTRY \68 crServerDispatch##name def \69 { \70 const GLvoid *realptr = ptrname; \71 CR_CHECKBUFFER(name, CR_CHECKPTR(name)) \72 crState##name call;\73 CR_FINISHBUFFER() \74 realptr = ptrname; \75 cr_server.head_spu->dispatch_table.name call; \76 } 77 78 #define CR_FUNC_IMAGE(name, def, call, ptrname) \79 void SERVER_DISPATCH_APIENTRY \80 crServerDispatch##name def \81 { \82 const GLvoid *realptr = ptrname; \83 CR_CHECKBUFFER(name, CR_NOTHING()) \84 crState##name call;\85 CR_FINISHBUFFER() \86 realptr = ptrname; \87 cr_server.head_spu->dispatch_table.name call; \66 #define CR_FUNC_SUBIMAGE(name, def, state_call, call, ptrname) \ 67 void SERVER_DISPATCH_APIENTRY \ 68 crServerDispatch##name def \ 69 { \ 70 const GLvoid *realptr = ptrname; \ 71 CR_CHECKBUFFER(name, CR_CHECKPTR(name)) \ 72 crState##name state_call; \ 73 CR_FINISHBUFFER() \ 74 realptr = ptrname; \ 75 cr_server.head_spu->dispatch_table.name call; \ 76 } 77 78 #define CR_FUNC_IMAGE(name, def, state_call, call, ptrname) \ 79 void SERVER_DISPATCH_APIENTRY \ 80 crServerDispatch##name def \ 81 { \ 82 const GLvoid *realptr = ptrname; \ 83 CR_CHECKBUFFER(name, CR_NOTHING()) \ 84 crState##name state_call; \ 85 CR_FINISHBUFFER() \ 86 realptr = ptrname; \ 87 cr_server.head_spu->dispatch_table.name call; \ 88 88 } 89 89 … … 91 91 CR_FUNC_SUBIMAGE(CompressedTexSubImage1DARB, 92 92 (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imagesize, const GLvoid * data), 93 (&cr_server.StateTracker, target, level, xoffset, width, format, imagesize, realptr), 93 94 (target, level, xoffset, width, format, imagesize, realptr), data) 94 95 95 96 CR_FUNC_SUBIMAGE(CompressedTexSubImage2DARB, 96 97 (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imagesize, const GLvoid * data), 98 (&cr_server.StateTracker, target, level, xoffset, yoffset, width, height, format, imagesize, realptr), 97 99 (target, level, xoffset, yoffset, width, height, format, imagesize, realptr), data) 98 100 99 101 CR_FUNC_SUBIMAGE(CompressedTexSubImage3DARB, 100 102 (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imagesize, const GLvoid * data), 103 (&cr_server.StateTracker, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imagesize, realptr), 101 104 (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imagesize, realptr), data) 102 105 103 106 CR_FUNC_IMAGE(CompressedTexImage1DARB, 104 107 (GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imagesize, const GLvoid * data), 108 (&cr_server.StateTracker, target, level, internalFormat, width, border, imagesize, realptr), 105 109 (target, level, internalFormat, width, border, imagesize, realptr), data) 106 110 107 111 CR_FUNC_IMAGE(CompressedTexImage2DARB, 108 112 (GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imagesize, const GLvoid * data), 113 (&cr_server.StateTracker, target, level, internalFormat, width, height, border, imagesize, realptr), 109 114 (target, level, internalFormat, width, height, border, imagesize, realptr), data) 110 115 111 116 CR_FUNC_IMAGE(CompressedTexImage3DARB, 112 117 (GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imagesize, const GLvoid * data), 118 (&cr_server.StateTracker, target, level, internalFormat, width, height, depth, border, imagesize, realptr), 113 119 (target, level, internalFormat, width, height, depth, border, imagesize, realptr), data) 114 120 #endif … … 116 122 CR_FUNC_SUBIMAGE(TexSubImage1D, 117 123 (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels), 124 (&cr_server.StateTracker, target, level, xoffset, width, format, type, realptr), 118 125 (target, level, xoffset, width, format, type, realptr), pixels) 119 126 120 127 CR_FUNC_SUBIMAGE(TexSubImage2D, 121 128 (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels), 129 (&cr_server.StateTracker, target, level, xoffset, yoffset, width, height, format, type, realptr), 122 130 (target, level, xoffset, yoffset, width, height, format, type, realptr), pixels) 123 131 124 132 CR_FUNC_SUBIMAGE(TexSubImage3D, 125 133 (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels), 134 (&cr_server.StateTracker, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, realptr), 126 135 (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, realptr), pixels) 127 136 128 137 CR_FUNC_IMAGE(TexImage1D, 129 138 (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels), 139 (&cr_server.StateTracker, target, level, internalFormat, width, border, format, type, realptr), 130 140 (target, level, internalFormat, width, border, format, type, realptr), pixels) 131 141 132 142 CR_FUNC_IMAGE(TexImage2D, 133 143 (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels), 144 (&cr_server.StateTracker, target, level, internalFormat, width, height, border, format, type, realptr), 134 145 (target, level, internalFormat, width, height, border, format, type, realptr), pixels) 135 146 136 147 CR_FUNC_IMAGE(TexImage3D, 137 148 (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels), 149 (&cr_server.StateTracker, target, level, internalFormat, width, height, depth, border, format, type, realptr), 138 150 (target, level, internalFormat, width, height, depth, border, format, type, realptr), pixels) 139 151 … … 141 153 void SERVER_DISPATCH_APIENTRY crServerDispatchTexEnvf( GLenum target, GLenum pname, GLfloat param ) 142 154 { 143 crStateTexEnvf( target, pname, param );155 crStateTexEnvf(&cr_server.StateTracker, target, pname, param ); 144 156 if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE) 145 157 CR_GLERR_CHECK(cr_server.head_spu->dispatch_table.TexEnvf( target, pname, param );); … … 148 160 void SERVER_DISPATCH_APIENTRY crServerDispatchTexEnvfv( GLenum target, GLenum pname, const GLfloat * params ) 149 161 { 150 crStateTexEnvfv( target, pname, params );162 crStateTexEnvfv(&cr_server.StateTracker, target, pname, params ); 151 163 if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE) 152 164 CR_GLERR_CHECK(cr_server.head_spu->dispatch_table.TexEnvfv( target, pname, params );); … … 155 167 void SERVER_DISPATCH_APIENTRY crServerDispatchTexEnvi( GLenum target, GLenum pname, GLint param ) 156 168 { 157 crStateTexEnvi( target, pname, param );169 crStateTexEnvi(&cr_server.StateTracker, target, pname, param ); 158 170 if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE) 159 171 CR_GLERR_CHECK(cr_server.head_spu->dispatch_table.TexEnvi( target, pname, param );); … … 162 174 void SERVER_DISPATCH_APIENTRY crServerDispatchTexEnviv( GLenum target, GLenum pname, const GLint * params ) 163 175 { 164 crStateTexEnviv( target, pname, params );176 crStateTexEnviv(&cr_server.StateTracker, target, pname, params ); 165 177 if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE) 166 178 CR_GLERR_CHECK(cr_server.head_spu->dispatch_table.TexEnviv( target, pname, params );); … … 175 187 cr_server.head_spu->dispatch_table.GetTexEnvfv( target, pname, local_params ); 176 188 else 177 crStateGetTexEnvfv( target, pname, local_params );189 crStateGetTexEnvfv(&cr_server.StateTracker, target, pname, local_params ); 178 190 179 191 cComponents = RT_MIN(crStateHlpComponentsCount(pname), RT_ELEMENTS(local_params)); … … 189 201 cr_server.head_spu->dispatch_table.GetTexEnviv( target, pname, local_params ); 190 202 else 191 crStateGetTexEnviv( target, pname, local_params );203 crStateGetTexEnviv(&cr_server.StateTracker, target, pname, local_params ); 192 204 193 205 cComponents = RT_MIN(crStateHlpComponentsCount(pname), RT_ELEMENTS(local_params)); … … 197 209 void SERVER_DISPATCH_APIENTRY crServerDispatchBindTexture( GLenum target, GLuint texture ) 198 210 { 199 crStateBindTexture( target, texture );200 cr_server.head_spu->dispatch_table.BindTexture(target, crStateGetTextureHWID( texture));211 crStateBindTexture(&cr_server.StateTracker, target, texture ); 212 cr_server.head_spu->dispatch_table.BindTexture(target, crStateGetTextureHWID(&cr_server.StateTracker, texture)); 201 213 } 202 214 … … 223 235 for (i = 0; i < n; i++) 224 236 { 225 newTextures[i] = crStateGetTextureHWID( textures[i]);237 newTextures[i] = crStateGetTextureHWID(&cr_server.StateTracker, textures[i]); 226 238 } 227 239 … … 232 244 233 245 234 crStateDeleteTextures( n, textures);246 crStateDeleteTextures(&cr_server.StateTracker, n, textures); 235 247 cr_server.head_spu->dispatch_table.DeleteTextures(n, newTextures); 236 248 crFree(newTextures); … … 257 269 } 258 270 259 crStatePrioritizeTextures( n, textures, priorities);271 crStatePrioritizeTextures(&cr_server.StateTracker, n, textures, priorities); 260 272 261 273 for (i = 0; i < n; i++) 262 274 { 263 newTextures[i] = crStateGetTextureHWID( textures[i]);275 newTextures[i] = crStateGetTextureHWID(&cr_server.StateTracker, textures[i]); 264 276 } 265 277 … … 273 285 { 274 286 GLboolean retval; 275 retval = cr_server.head_spu->dispatch_table.IsTexture(crStateGetTextureHWID( texture));287 retval = cr_server.head_spu->dispatch_table.IsTexture(crStateGetTextureHWID(&cr_server.StateTracker, texture)); 276 288 crServerReturnValue( &retval, sizeof(retval) ); 277 289 return retval; /* WILL PROBABLY BE IGNORED */ … … 313 325 for (i = 0; i < n; i++) 314 326 { 315 textures2[i] = crStateGetTextureHWID( textures[i]);327 textures2[i] = crStateGetTextureHWID(&cr_server.StateTracker, textures[i]); 316 328 } 317 329 retval = cr_server.head_spu->dispatch_table.AreTexturesResident(n, textures2, res); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_viewport.cpp
r78263 r78375 276 276 void SERVER_DISPATCH_APIENTRY crServerDispatchViewport( GLint x, GLint y, GLsizei width, GLsizei height ) 277 277 { 278 CRContext *ctx = crStateGetCurrent( );278 CRContext *ctx = crStateGetCurrent(&cr_server.StateTracker); 279 279 280 280 if (ctx->viewport.viewportX != x || … … 284 284 /* Note -- If there are tiles, this will be overridden in the 285 285 * process of decoding the BoundsInfo packet, so no worries. */ 286 crStateViewport( x, y, width, height );286 crStateViewport(&cr_server.StateTracker, x, y, width, height ); 287 287 } 288 288 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.cpp
r78263 r78375 351 351 && !mural->fRedirected) 352 352 { 353 crStateGetCurrent( )->buffer.width = mural->width;354 crStateGetCurrent( )->buffer.height = mural->height;353 crStateGetCurrent(&cr_server.StateTracker)->buffer.width = mural->width; 354 crStateGetCurrent(&cr_server.StateTracker)->buffer.height = mural->height; 355 355 } 356 356 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_winpos.cpp
r78190 r78375 9 9 static void crServerWindowPos( GLfloat x, GLfloat y, GLfloat z ) 10 10 { 11 crStateWindowPos3fARB( x, y, z);11 crStateWindowPos3fARB(&cr_server.StateTracker, x, y, z); 12 12 cr_server.head_spu->dispatch_table.WindowPos3fARB(x, y, z); 13 13 } -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_arrays.cpp
r78191 r78375 8 8 #include "unpack_extend.h" 9 9 #include "unpacker.h" 10 #include "cr_glstate.h"11 10 12 11 … … 292 291 int numenabled = READ_DATA(pState, sizeof(int) + 12, int); 293 292 294 CRContext *g = crStateGetCurrent( );293 CRContext *g = crStateGetCurrent(pState->pStateTracker); 295 294 CRClientState *c = &g->client; 296 295 CRClientPointer *cp; … … 364 363 { 365 364 int i; 366 CRContext *g = crStateGetCurrent( );365 CRContext *g = crStateGetCurrent(pState->pStateTracker); 367 366 CRClientState *c = &g->client; 368 367 CRClientPointer *cp; -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_drawpixels.cpp
r78190 r78375 22 22 GLvoid *pixels; 23 23 24 if (noimagedata && !crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))24 if (noimagedata && !crStateIsBufferBound(pState->pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 25 25 return; 26 26 … … 63 63 GLubyte *bitmap; 64 64 65 if (noimagedata && !crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))65 if (noimagedata && !crStateIsBufferBound(pState->pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 66 66 return; 67 67 -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_misc.cpp
r78190 r78375 54 54 const GLuint *ids = DATA_POINTER(pState, 12, GLuint); 55 55 56 if (n < =0 || n >= INT32_MAX / sizeof(GLint) / 4 || !DATA_POINTER_CHECK(pState, 12 + n * sizeof(GLuint)))56 if (n < 0 || n >= INT32_MAX / sizeof(GLint) / 4 || !DATA_POINTER_CHECK(pState, 12 + n * sizeof(GLuint))) 57 57 { 58 58 crError("crUnpackExtendDeleteQueriesARB: parameter 'n' is out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_pixelmap.cpp
r78212 r78375 17 17 GLfloat *values; 18 18 19 if (nodata && !crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))19 if (nodata && !crStateIsBufferBound(pState->pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 20 20 return; 21 21 … … 47 47 GLuint *values; 48 48 49 if (nodata && !crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))49 if (nodata && !crStateIsBufferBound(pState->pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 50 50 return; 51 51 … … 77 77 GLushort *values; 78 78 79 if (nodata && !crStateIsBufferBound( GL_PIXEL_UNPACK_BUFFER_ARB))79 if (nodata && !crStateIsBufferBound(pState->pStateTracker, GL_PIXEL_UNPACK_BUFFER_ARB)) 80 80 return; 81 81
Note:
See TracChangeset
for help on using the changeset viewer.