Changeset 78375 in vbox for trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.c
- Timestamp:
- May 3, 2019 9:51:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_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]);
Note:
See TracChangeset
for help on using the changeset viewer.