Changeset 27072 in vbox
- Timestamp:
- Mar 5, 2010 11:21:34 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58391
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_pixel.c
r15532 r27072 13 13 void crStatePixelInit(CRContext *ctx) 14 14 { 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 15 CRPixelState *p = &ctx->pixel; 16 CRStateBits *sb = GetCurrentBits(); 17 CRPixelBits *pb = &(sb->pixel); 18 GLcolorf zero_color = {0.0f, 0.0f, 0.0f, 0.0f}; 19 GLcolorf one_color = {1.0f, 1.0f, 1.0f, 1.0f}; 20 21 p->mapColor = GL_FALSE; 22 p->mapStencil = GL_FALSE; 23 p->indexShift = 0; 24 p->indexOffset = 0; 25 p->scale = one_color; 26 p->depthScale = 1.0f; 27 p->bias = zero_color; 28 p->depthBias = 0.0f; 29 p->xZoom = 1.0f; 30 p->yZoom = 1.0f; 31 RESET(pb->transfer, ctx->bitid); 32 RESET(pb->zoom, ctx->bitid); 33 34 p->mapStoS[0] = 0; 35 p->mapItoI[0] = 0; 36 p->mapItoR[0] = 0.0; 37 p->mapItoG[0] = 0.0; 38 p->mapItoB[0] = 0.0; 39 p->mapItoA[0] = 0.0; 40 p->mapRtoR[0] = 0.0; 41 p->mapGtoG[0] = 0.0; 42 p->mapBtoB[0] = 0.0; 43 p->mapAtoA[0] = 0.0; 44 45 p->mapItoIsize = 1; 46 p->mapStoSsize = 1; 47 p->mapItoRsize = 1; 48 p->mapItoGsize = 1; 49 p->mapItoBsize = 1; 50 p->mapItoAsize = 1; 51 p->mapRtoRsize = 1; 52 p->mapGtoGsize = 1; 53 p->mapBtoBsize = 1; 54 p->mapAtoAsize = 1; 55 RESET(pb->maps, ctx->bitid); 56 57 RESET(pb->dirty, ctx->bitid); 58 58 } 59 59 60 60 void STATE_APIENTRY crStatePixelTransferi (GLenum pname, GLint param) 61 61 { 62 62 crStatePixelTransferf( pname, (GLfloat) param ); 63 63 } 64 64 65 65 void STATE_APIENTRY crStatePixelTransferf (GLenum pname, GLfloat param) 66 66 { 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 67 CRContext *g = GetCurrentContext(); 68 CRPixelState *p = &(g->pixel); 69 CRStateBits *sb = GetCurrentBits(); 70 CRPixelBits *pb = &(sb->pixel); 71 72 if (g->current.inBeginEnd) 73 { 74 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "PixelTransfer{if} called in Begin/End"); 75 return; 76 } 77 78 FLUSH(); 79 80 switch( pname ) 81 { 82 case GL_MAP_COLOR: 83 p->mapColor = (GLboolean) ((param == 0.0f) ? GL_FALSE : GL_TRUE); 84 break; 85 case GL_MAP_STENCIL: 86 p->mapStencil = (GLboolean) ((param == 0.0f) ? GL_FALSE : GL_TRUE); 87 break; 88 case GL_INDEX_SHIFT: 89 p->indexShift = (GLint) param; 90 break; 91 case GL_INDEX_OFFSET: 92 p->indexOffset = (GLint) param; 93 break; 94 case GL_RED_SCALE: 95 p->scale.r = param; 96 break; 97 case GL_GREEN_SCALE: 98 p->scale.g = param; 99 break; 100 case GL_BLUE_SCALE: 101 p->scale.b = param; 102 break; 103 case GL_ALPHA_SCALE: 104 p->scale.a = param; 105 break; 106 case GL_DEPTH_SCALE: 107 p->depthScale = param; 108 break; 109 case GL_RED_BIAS: 110 p->bias.r = param; 111 break; 112 case GL_GREEN_BIAS: 113 p->bias.g = param; 114 break; 115 case GL_BLUE_BIAS: 116 p->bias.b = param; 117 break; 118 case GL_ALPHA_BIAS: 119 p->bias.a = param; 120 break; 121 case GL_DEPTH_BIAS: 122 p->depthBias = param; 123 break; 124 default: 125 crStateError( __LINE__, __FILE__, GL_INVALID_VALUE, "Unknown glPixelTransfer pname: %d", pname ); 126 return; 127 } 128 DIRTY(pb->transfer, g->neg_bitid); 129 DIRTY(pb->dirty, g->neg_bitid); 130 130 } 131 131 132 132 void STATE_APIENTRY crStatePixelZoom (GLfloat xfactor, GLfloat yfactor) 133 133 { 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 134 CRContext *g = GetCurrentContext(); 135 CRPixelState *p = &(g->pixel); 136 CRStateBits *sb = GetCurrentBits(); 137 CRPixelBits *pb = &(sb->pixel); 138 139 if (g->current.inBeginEnd) 140 { 141 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "PixelZoom called in Begin/End"); 142 return; 143 } 144 145 FLUSH(); 146 147 p->xZoom = xfactor; 148 p->yZoom = yfactor; 149 DIRTY(pb->zoom, g->neg_bitid); 150 DIRTY(pb->dirty, g->neg_bitid); 151 151 } 152 152 153 153 154 154 void STATE_APIENTRY crStateBitmap( GLsizei width, GLsizei height, 155 156 157 { 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 155 GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, 156 const GLubyte *bitmap) 157 { 158 CRContext *g = GetCurrentContext(); 159 CRCurrentState *c = &(g->current); 160 CRStateBits *sb = GetCurrentBits(); 161 CRCurrentBits *cb = &(sb->current); 162 163 (void) xorig; 164 (void) yorig; 165 (void) bitmap; 166 167 if (g->lists.mode == GL_COMPILE) 168 return; 169 170 if (g->current.inBeginEnd) 171 { 172 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 173 "Bitmap called in begin/end"); 174 return; 175 } 176 177 if (width < 0 || height < 0) 178 { 179 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, 180 "Bitmap called with neg dims: %dx%d", width, height); 181 return; 182 } 183 184 if (!c->rasterValid) 185 { 186 return; 187 } 188 189 c->rasterAttrib[VERT_ATTRIB_POS][0] += xmove; 190 c->rasterAttrib[VERT_ATTRIB_POS][1] += ymove; 191 DIRTY(cb->rasterPos, g->neg_bitid); 192 DIRTY(cb->dirty, g->neg_bitid); 193 194 c->rasterAttribPre[VERT_ATTRIB_POS][0] += xmove; 195 c->rasterAttribPre[VERT_ATTRIB_POS][1] += ymove; 196 196 } 197 197 … … 203 203 void STATE_APIENTRY crStatePixelMapfv (GLenum map, GLint mapsize, const GLfloat * values) 204 204 { 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 205 CRContext *g = GetCurrentContext(); 206 CRPixelState *p = &(g->pixel); 207 CRStateBits *sb = GetCurrentBits(); 208 CRPixelBits *pb = &(sb->pixel); 209 GLint i; 210 211 if (g->current.inBeginEnd) { 212 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "PixelMap called in Begin/End"); 213 return; 214 } 215 216 FLUSH(); 217 218 if (mapsize < 0 || mapsize > CR_MAX_PIXEL_MAP_TABLE) { 219 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "PixelMap(mapsize)"); 220 return; 221 } 222 223 if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) { 224 /* XXX check that mapsize is a power of two */ 225 } 226 227 switch (map) { 228 case GL_PIXEL_MAP_S_TO_S: 229 p->mapStoSsize = mapsize; 230 for (i=0;i<mapsize;i++) { 231 p->mapStoS[i] = (GLint) values[i]; 232 } 233 break; 234 case GL_PIXEL_MAP_I_TO_I: 235 p->mapItoIsize = mapsize; 236 for (i=0;i<mapsize;i++) { 237 p->mapItoI[i] = (GLint) values[i]; 238 } 239 break; 240 case GL_PIXEL_MAP_I_TO_R: 241 p->mapItoRsize = mapsize; 242 for (i=0;i<mapsize;i++) { 243 GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); 244 p->mapItoR[i] = val; 245 } 246 break; 247 case GL_PIXEL_MAP_I_TO_G: 248 p->mapItoGsize = mapsize; 249 for (i=0;i<mapsize;i++) { 250 GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); 251 p->mapItoG[i] = val; 252 } 253 break; 254 case GL_PIXEL_MAP_I_TO_B: 255 p->mapItoBsize = mapsize; 256 for (i=0;i<mapsize;i++) { 257 GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); 258 p->mapItoB[i] = val; 259 } 260 break; 261 case GL_PIXEL_MAP_I_TO_A: 262 p->mapItoAsize = mapsize; 263 for (i=0;i<mapsize;i++) { 264 GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); 265 p->mapItoA[i] = val; 266 } 267 break; 268 case GL_PIXEL_MAP_R_TO_R: 269 p->mapRtoRsize = mapsize; 270 for (i=0;i<mapsize;i++) { 271 p->mapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F ); 272 } 273 break; 274 case GL_PIXEL_MAP_G_TO_G: 275 p->mapGtoGsize = mapsize; 276 for (i=0;i<mapsize;i++) { 277 p->mapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F ); 278 } 279 break; 280 case GL_PIXEL_MAP_B_TO_B: 281 p->mapBtoBsize = mapsize; 282 for (i=0;i<mapsize;i++) { 283 p->mapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F ); 284 } 285 break; 286 case GL_PIXEL_MAP_A_TO_A: 287 p->mapAtoAsize = mapsize; 288 for (i=0;i<mapsize;i++) { 289 p->mapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F ); 290 } 291 break; 292 default: 293 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "PixelMap(map)"); 294 return; 295 } 296 297 DIRTY(pb->maps, g->neg_bitid); 298 DIRTY(pb->dirty, g->neg_bitid); 299 299 } 300 300 … … 336 336 void STATE_APIENTRY crStateGetPixelMapfv (GLenum map, GLfloat * values) 337 337 { 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 338 CRContext *g = GetCurrentContext(); 339 CRPixelState *p = &(g->pixel); 340 GLint i; 341 342 if (g->current.inBeginEnd) { 343 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 344 "GetPixelMapfv called in Begin/End"); 345 return; 346 } 347 348 switch (map) { 349 case GL_PIXEL_MAP_S_TO_S: 350 for (i = 0; i < p->mapStoSsize; i++) { 351 values[i] = (GLfloat) p->mapStoS[i]; 352 } 353 break; 354 case GL_PIXEL_MAP_I_TO_I: 355 for (i = 0; i < p->mapItoIsize; i++) { 356 values[i] = (GLfloat) p->mapItoI[i]; 357 } 358 break; 359 case GL_PIXEL_MAP_I_TO_R: 360 crMemcpy(values, p->mapItoR, p->mapItoRsize * sizeof(GLfloat)); 361 break; 362 case GL_PIXEL_MAP_I_TO_G: 363 crMemcpy(values, p->mapItoG, p->mapItoGsize * sizeof(GLfloat)); 364 break; 365 case GL_PIXEL_MAP_I_TO_B: 366 crMemcpy(values, p->mapItoB, p->mapItoBsize * sizeof(GLfloat)); 367 break; 368 case GL_PIXEL_MAP_I_TO_A: 369 crMemcpy(values, p->mapItoA, p->mapItoAsize * sizeof(GLfloat)); 370 break; 371 case GL_PIXEL_MAP_R_TO_R: 372 crMemcpy(values, p->mapRtoR, p->mapRtoRsize * sizeof(GLfloat)); 373 break; 374 case GL_PIXEL_MAP_G_TO_G: 375 crMemcpy(values, p->mapGtoG, p->mapGtoGsize * sizeof(GLfloat)); 376 break; 377 case GL_PIXEL_MAP_B_TO_B: 378 crMemcpy(values, p->mapBtoB, p->mapBtoBsize * sizeof(GLfloat)); 379 break; 380 case GL_PIXEL_MAP_A_TO_A: 381 crMemcpy(values, p->mapAtoA, p->mapAtoAsize * sizeof(GLfloat)); 382 break; 383 default: 384 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMap(map)"); 385 return; 386 } 387 387 } 388 388 389 389 void STATE_APIENTRY crStateGetPixelMapuiv (GLenum map, GLuint * values) 390 390 { 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 391 CRContext *g = GetCurrentContext(); 392 const GLfloat maxUint = 4294967295.0F; 393 CRPixelState *p = &(g->pixel); 394 GLint i; 395 396 if (g->current.inBeginEnd) { 397 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 398 "GetPixelMapuiv called in Begin/End"); 399 return; 400 } 401 402 switch (map) { 403 case GL_PIXEL_MAP_S_TO_S: 404 for (i = 0; i < p->mapStoSsize; i++) { 405 values[i] = p->mapStoS[i]; 406 } 407 break; 408 case GL_PIXEL_MAP_I_TO_I: 409 for (i = 0; i < p->mapItoIsize; i++) { 410 values[i] = p->mapItoI[i]; 411 } 412 break; 413 case GL_PIXEL_MAP_I_TO_R: 414 for (i = 0; i < p->mapItoRsize; i++) { 415 values[i] = (GLuint) (p->mapItoR[i] * maxUint); 416 } 417 break; 418 case GL_PIXEL_MAP_I_TO_G: 419 for (i = 0; i < p->mapItoGsize; i++) { 420 values[i] = (GLuint) (p->mapItoG[i] * maxUint); 421 } 422 break; 423 case GL_PIXEL_MAP_I_TO_B: 424 for (i = 0; i < p->mapItoBsize; i++) { 425 values[i] = (GLuint) (p->mapItoB[i] * maxUint); 426 } 427 break; 428 case GL_PIXEL_MAP_I_TO_A: 429 for (i = 0; i < p->mapItoAsize; i++) { 430 values[i] = (GLuint) (p->mapItoA[i] * maxUint); 431 } 432 break; 433 case GL_PIXEL_MAP_R_TO_R: 434 for (i = 0; i < p->mapRtoRsize; i++) { 435 values[i] = (GLuint) (p->mapRtoR[i] * maxUint); 436 } 437 break; 438 case GL_PIXEL_MAP_G_TO_G: 439 for (i = 0; i < p->mapGtoGsize; i++) { 440 values[i] = (GLuint) (p->mapGtoG[i] * maxUint); 441 } 442 break; 443 case GL_PIXEL_MAP_B_TO_B: 444 for (i = 0; i < p->mapBtoBsize; i++) { 445 values[i] = (GLuint) (p->mapBtoB[i] * maxUint); 446 } 447 break; 448 case GL_PIXEL_MAP_A_TO_A: 449 for (i = 0; i < p->mapAtoAsize; i++) { 450 values[i] = (GLuint) (p->mapAtoA[i] * maxUint); 451 } 452 break; 453 default: 454 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMapuiv(map)"); 455 return; 456 } 457 457 } 458 458 459 459 void STATE_APIENTRY crStateGetPixelMapusv (GLenum map, GLushort * values) 460 460 { 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 461 CRContext *g = GetCurrentContext(); 462 const GLfloat maxUshort = 65535.0F; 463 CRPixelState *p = &(g->pixel); 464 GLint i; 465 466 if (g->current.inBeginEnd) { 467 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 468 "GetPixelMapusv called in Begin/End"); 469 return; 470 } 471 472 switch (map) { 473 case GL_PIXEL_MAP_S_TO_S: 474 for (i = 0; i < p->mapStoSsize; i++) { 475 values[i] = p->mapStoS[i]; 476 } 477 break; 478 case GL_PIXEL_MAP_I_TO_I: 479 for (i = 0; i < p->mapItoIsize; i++) { 480 values[i] = p->mapItoI[i]; 481 } 482 break; 483 case GL_PIXEL_MAP_I_TO_R: 484 for (i = 0; i < p->mapItoRsize; i++) { 485 values[i] = (GLushort) (p->mapItoR[i] * maxUshort); 486 } 487 break; 488 case GL_PIXEL_MAP_I_TO_G: 489 for (i = 0; i < p->mapItoGsize; i++) { 490 values[i] = (GLushort) (p->mapItoG[i] * maxUshort); 491 } 492 break; 493 case GL_PIXEL_MAP_I_TO_B: 494 for (i = 0; i < p->mapItoBsize; i++) { 495 values[i] = (GLushort) (p->mapItoB[i] * maxUshort); 496 } 497 break; 498 case GL_PIXEL_MAP_I_TO_A: 499 for (i = 0; i < p->mapItoAsize; i++) { 500 values[i] = (GLushort) (p->mapItoA[i] * maxUshort); 501 } 502 break; 503 case GL_PIXEL_MAP_R_TO_R: 504 for (i = 0; i < p->mapRtoRsize; i++) { 505 values[i] = (GLushort) (p->mapRtoR[i] * maxUshort); 506 } 507 break; 508 case GL_PIXEL_MAP_G_TO_G: 509 for (i = 0; i < p->mapGtoGsize; i++) { 510 values[i] = (GLushort) (p->mapGtoG[i] * maxUshort); 511 } 512 break; 513 case GL_PIXEL_MAP_B_TO_B: 514 for (i = 0; i < p->mapBtoBsize; i++) { 515 values[i] = (GLushort) (p->mapBtoB[i] * maxUshort); 516 } 517 break; 518 case GL_PIXEL_MAP_A_TO_A: 519 for (i = 0; i < p->mapAtoAsize; i++) { 520 values[i] = (GLushort) (p->mapAtoA[i] * maxUshort); 521 } 522 break; 523 default: 524 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "GetPixelMapusv(map)"); 525 return; 526 } 527 527 } 528 528 … … 530 530 CRContext *fromCtx, CRContext *toCtx) 531 531 { 532 533 534 535 536 537 538 539 540 541 542 { 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 532 CRPixelState *from = &(fromCtx->pixel); 533 CRPixelState *to = &(toCtx->pixel); 534 int j, i; 535 CRbitvalue nbitID[CR_MAX_BITARRAY]; 536 for (j=0;j<CR_MAX_BITARRAY;j++) 537 nbitID[j] = ~bitID[j]; 538 i = 0; /* silence compiler */ 539 if (CHECKDIRTY(b->transfer, bitID)) 540 { 541 if (from->mapColor != to->mapColor) 542 { 543 diff_api.PixelTransferi (GL_MAP_COLOR, to->mapColor); 544 from->mapColor = to->mapColor; 545 } 546 if (from->mapStencil != to->mapStencil) 547 { 548 diff_api.PixelTransferi (GL_MAP_STENCIL, to->mapStencil); 549 from->mapStencil = to->mapStencil; 550 } 551 if (from->indexOffset != to->indexOffset) 552 { 553 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->indexOffset); 554 from->indexOffset = to->indexOffset; 555 } 556 if (from->indexShift != to->indexShift) 557 { 558 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->indexShift); 559 from->indexShift = to->indexShift; 560 } 561 if (from->scale.r != to->scale.r) 562 { 563 diff_api.PixelTransferf (GL_RED_SCALE, to->scale.r); 564 from->scale.r = to->scale.r; 565 } 566 if (from->scale.g != to->scale.g) 567 { 568 diff_api.PixelTransferf (GL_GREEN_SCALE, to->scale.g); 569 from->scale.g = to->scale.g; 570 } 571 if (from->scale.b != to->scale.b) 572 { 573 diff_api.PixelTransferf (GL_BLUE_SCALE, to->scale.b); 574 from->scale.b = to->scale.b; 575 } 576 if (from->scale.a != to->scale.a) 577 { 578 diff_api.PixelTransferf (GL_ALPHA_SCALE, to->scale.a); 579 from->scale.a = to->scale.a; 580 } 581 if (from->bias.r != to->bias.r) 582 { 583 diff_api.PixelTransferf (GL_RED_BIAS, to->bias.r); 584 from->bias.r = to->bias.r; 585 } 586 if (from->bias.g != to->bias.g) 587 { 588 diff_api.PixelTransferf (GL_GREEN_BIAS, to->bias.g); 589 from->bias.g = to->bias.g; 590 } 591 if (from->bias.b != to->bias.b) 592 { 593 diff_api.PixelTransferf (GL_BLUE_BIAS, to->bias.b); 594 from->bias.b = to->bias.b; 595 } 596 if (from->bias.a != to->bias.a) 597 { 598 diff_api.PixelTransferf (GL_ALPHA_BIAS, to->bias.a); 599 from->bias.a = to->bias.a; 600 } 601 if (from->depthScale != to->depthScale) 602 { 603 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->depthScale); 604 from->depthScale = to->depthScale; 605 } 606 if (from->depthBias != to->depthBias) 607 { 608 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->depthBias); 609 from->depthBias = to->depthBias; 610 } 611 CLEARDIRTY(b->transfer, nbitID); 612 } 613 if (CHECKDIRTY(b->zoom, bitID)) 614 { 615 if (from->xZoom != to->xZoom || 616 from->yZoom != to->yZoom) 617 { 618 diff_api.PixelZoom (to->xZoom, 619 to->yZoom); 620 from->xZoom = to->xZoom; 621 from->yZoom = to->yZoom; 622 } 623 CLEARDIRTY(b->zoom, nbitID); 624 } 625 if (CHECKDIRTY(b->maps, bitID)) 626 { 627 if (crMemcmp(to->mapStoS, from->mapStoS, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 628 diff_api.PixelMapfv(GL_PIXEL_MAP_S_TO_S,to->mapStoSsize,(GLfloat*)to->mapStoS); 629 if (crMemcmp(to->mapItoI, from->mapItoI, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 630 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_I,to->mapItoIsize,(GLfloat*)to->mapItoI); 631 if (crMemcmp(to->mapItoR, from->mapItoR, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 632 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_R,to->mapItoRsize,(GLfloat*)to->mapItoR); 633 if (crMemcmp(to->mapItoG, from->mapItoG, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 634 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_G,to->mapItoGsize,(GLfloat*)to->mapItoG); 635 if (crMemcmp(to->mapItoB, from->mapItoB, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 636 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_B,to->mapItoBsize,(GLfloat*)to->mapItoB); 637 if (crMemcmp(to->mapItoA, from->mapItoA, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 638 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_A,to->mapItoAsize,(GLfloat*)to->mapItoA); 639 if (crMemcmp(to->mapRtoR, from->mapRtoR, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 640 diff_api.PixelMapfv(GL_PIXEL_MAP_R_TO_R,to->mapRtoRsize,(GLfloat*)to->mapRtoR); 641 if (crMemcmp(to->mapGtoG, from->mapGtoG, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 642 diff_api.PixelMapfv(GL_PIXEL_MAP_G_TO_G,to->mapGtoGsize,(GLfloat*)to->mapGtoG); 643 if (crMemcmp(to->mapBtoB, from->mapBtoB, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 644 diff_api.PixelMapfv(GL_PIXEL_MAP_B_TO_B,to->mapBtoBsize,(GLfloat*)to->mapBtoB); 645 if (crMemcmp(to->mapAtoA, from->mapAtoA, CR_MAX_PIXEL_MAP_TABLE*sizeof(GLfloat))) 646 diff_api.PixelMapfv(GL_PIXEL_MAP_A_TO_A,to->mapAtoAsize,(GLfloat*)to->mapAtoA); 647 CLEARDIRTY(b->maps, nbitID); 648 } 649 CLEARDIRTY(b->dirty, nbitID); 650 650 } 651 651 … … 653 653 CRContext *fromCtx, CRContext *toCtx) 654 654 { 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 } 818 655 CRPixelState *from = &(fromCtx->pixel); 656 CRPixelState *to = &(toCtx->pixel); 657 int j, i; 658 CRbitvalue nbitID[CR_MAX_BITARRAY]; 659 for (j=0;j<CR_MAX_BITARRAY;j++) 660 nbitID[j] = ~bitID[j]; 661 i = 0; /* silence compiler */ 662 if (CHECKDIRTY(b->transfer, bitID)) 663 { 664 if (from->mapColor != to->mapColor) 665 { 666 diff_api.PixelTransferi (GL_MAP_COLOR, to->mapColor); 667 FILLDIRTY(b->transfer); 668 FILLDIRTY(b->dirty); 669 } 670 if (from->mapStencil != to->mapStencil) 671 { 672 diff_api.PixelTransferi (GL_MAP_STENCIL, to->mapStencil); 673 FILLDIRTY(b->transfer); 674 FILLDIRTY(b->dirty); 675 } 676 if (from->indexOffset != to->indexOffset) 677 { 678 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->indexOffset); 679 FILLDIRTY(b->transfer); 680 FILLDIRTY(b->dirty); 681 } 682 if (from->indexShift != to->indexShift) 683 { 684 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->indexShift); 685 FILLDIRTY(b->transfer); 686 FILLDIRTY(b->dirty); 687 } 688 if (from->scale.r != to->scale.r) 689 { 690 diff_api.PixelTransferf (GL_RED_SCALE, to->scale.r); 691 FILLDIRTY(b->transfer); 692 FILLDIRTY(b->dirty); 693 } 694 if (from->scale.g != to->scale.g) 695 { 696 diff_api.PixelTransferf (GL_GREEN_SCALE, to->scale.g); 697 FILLDIRTY(b->transfer); 698 FILLDIRTY(b->dirty); 699 } 700 if (from->scale.b != to->scale.b) 701 { 702 diff_api.PixelTransferf (GL_BLUE_SCALE, to->scale.b); 703 FILLDIRTY(b->transfer); 704 FILLDIRTY(b->dirty); 705 } 706 if (from->scale.a != to->scale.a) 707 { 708 diff_api.PixelTransferf (GL_ALPHA_SCALE, to->scale.a); 709 FILLDIRTY(b->transfer); 710 FILLDIRTY(b->dirty); 711 } 712 if (from->bias.r != to->bias.r) 713 { 714 diff_api.PixelTransferf (GL_RED_BIAS, to->bias.r); 715 FILLDIRTY(b->transfer); 716 FILLDIRTY(b->dirty); 717 } 718 if (from->bias.g != to->bias.g) 719 { 720 diff_api.PixelTransferf (GL_GREEN_BIAS, to->bias.g); 721 FILLDIRTY(b->transfer); 722 FILLDIRTY(b->dirty); 723 } 724 if (from->bias.b != to->bias.b) 725 { 726 diff_api.PixelTransferf (GL_BLUE_BIAS, to->bias.b); 727 FILLDIRTY(b->transfer); 728 FILLDIRTY(b->dirty); 729 } 730 if (from->bias.a != to->bias.a) 731 { 732 diff_api.PixelTransferf (GL_ALPHA_BIAS, to->bias.a); 733 FILLDIRTY(b->transfer); 734 FILLDIRTY(b->dirty); 735 } 736 if (from->depthScale != to->depthScale) 737 { 738 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->depthScale); 739 FILLDIRTY(b->transfer); 740 FILLDIRTY(b->dirty); 741 } 742 if (from->depthBias != to->depthBias) 743 { 744 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->depthBias); 745 FILLDIRTY(b->transfer); 746 FILLDIRTY(b->dirty); 747 } 748 CLEARDIRTY(b->transfer, nbitID); 749 } 750 if (CHECKDIRTY(b->zoom, bitID)) 751 { 752 if (from->xZoom != to->xZoom || 753 from->yZoom != to->yZoom) 754 { 755 diff_api.PixelZoom (to->xZoom, 756 to->yZoom); 757 FILLDIRTY(b->zoom); 758 FILLDIRTY(b->dirty); 759 } 760 CLEARDIRTY(b->zoom, nbitID); 761 } 762 if (CHECKDIRTY(b->maps, bitID)) 763 { 764 if (crMemcmp(to->mapStoS, from->mapStoS, CR_MAX_PIXEL_MAP_TABLE)) { 765 diff_api.PixelMapfv(GL_PIXEL_MAP_S_TO_S,to->mapStoSsize,(GLfloat*)to->mapStoS); 766 FILLDIRTY(b->maps); 767 FILLDIRTY(b->dirty); 768 } 769 if (crMemcmp(to->mapItoI, from->mapItoI, CR_MAX_PIXEL_MAP_TABLE)) { 770 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_I,to->mapItoIsize,(GLfloat*)to->mapItoI); 771 FILLDIRTY(b->maps); 772 FILLDIRTY(b->dirty); 773 } 774 if (crMemcmp(to->mapItoR, from->mapItoR, CR_MAX_PIXEL_MAP_TABLE)) { 775 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_R,to->mapItoRsize,(GLfloat*)to->mapItoR); 776 FILLDIRTY(b->maps); 777 FILLDIRTY(b->dirty); 778 } 779 if (crMemcmp(to->mapItoG, from->mapItoG, CR_MAX_PIXEL_MAP_TABLE)) { 780 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_G,to->mapItoGsize,(GLfloat*)to->mapItoG); 781 FILLDIRTY(b->maps); 782 FILLDIRTY(b->dirty); 783 } 784 if (crMemcmp(to->mapItoB, from->mapItoB, CR_MAX_PIXEL_MAP_TABLE)) { 785 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_B,to->mapItoBsize,(GLfloat*)to->mapItoB); 786 FILLDIRTY(b->maps); 787 FILLDIRTY(b->dirty); 788 } 789 if (crMemcmp(to->mapItoA, from->mapItoA, CR_MAX_PIXEL_MAP_TABLE)) { 790 diff_api.PixelMapfv(GL_PIXEL_MAP_I_TO_A,to->mapItoAsize,(GLfloat*)to->mapItoA); 791 FILLDIRTY(b->maps); 792 FILLDIRTY(b->dirty); 793 } 794 if (crMemcmp(to->mapRtoR, from->mapRtoR, CR_MAX_PIXEL_MAP_TABLE)) { 795 diff_api.PixelMapfv(GL_PIXEL_MAP_R_TO_R,to->mapRtoRsize,(GLfloat*)to->mapRtoR); 796 FILLDIRTY(b->maps); 797 FILLDIRTY(b->dirty); 798 } 799 if (crMemcmp(to->mapGtoG, from->mapGtoG, CR_MAX_PIXEL_MAP_TABLE)) { 800 diff_api.PixelMapfv(GL_PIXEL_MAP_G_TO_G,to->mapGtoGsize,(GLfloat*)to->mapGtoG); 801 FILLDIRTY(b->maps); 802 FILLDIRTY(b->dirty); 803 } 804 if (crMemcmp(to->mapBtoB, from->mapBtoB, CR_MAX_PIXEL_MAP_TABLE)) { 805 diff_api.PixelMapfv(GL_PIXEL_MAP_B_TO_B,to->mapBtoBsize,(GLfloat*)to->mapBtoB); 806 FILLDIRTY(b->maps); 807 FILLDIRTY(b->dirty); 808 } 809 if (crMemcmp(to->mapAtoA, from->mapAtoA, CR_MAX_PIXEL_MAP_TABLE)) { 810 diff_api.PixelMapfv(GL_PIXEL_MAP_A_TO_A,to->mapAtoAsize,(GLfloat*)to->mapAtoA); 811 FILLDIRTY(b->maps); 812 FILLDIRTY(b->dirty); 813 } 814 CLEARDIRTY(b->maps, nbitID); 815 } 816 CLEARDIRTY(b->dirty, nbitID); 817 } 818
Note:
See TracChangeset
for help on using the changeset viewer.