Changeset 23694 in vbox for trunk/src/VBox/GuestHost/OpenGL
- Timestamp:
- Oct 12, 2009 1:46:26 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53409
- Location:
- trunk/src/VBox/GuestHost/OpenGL
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_framebuffer.h
r23094 r23694 51 51 /*@todo: we don't support drawbufferS yet, so it's a stub*/ 52 52 GLenum drawbuffer[1]; 53 #ifdef IN_GUEST 54 GLenum status; 55 #endif 53 56 } CRFramebufferObject; 54 57 … … 61 64 62 65 typedef struct { 63 CRFramebufferObject * framebuffer;66 CRFramebufferObject *readFB, *drawFB; 64 67 CRRenderbufferObject *renderbuffer; 65 68 CRHashTable *framebuffers; … … 89 92 DECLEXPORT(void) STATE_APIENTRY crStateGenerateMipmapEXT(GLenum target); 90 93 94 #ifdef IN_GUEST 95 DECLEXPORT(GLenum) STATE_APIENTRY crStateCheckFramebufferStatusEXT(GLenum target); 96 DECLEXPORT(GLenum) STATE_APIENTRY crStateSetFramebufferStatus(GLenum target, GLenum status); 97 #endif 98 91 99 #ifdef __cplusplus 92 100 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_buffer.c
r22155 r23694 490 490 case GL_AUX2: 491 491 case GL_AUX3: 492 if (g->framebufferobject. framebuffer)492 if (g->framebufferobject.drawFB) 493 493 { 494 494 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glDrawBuffer invalud mode while fbo is active"); … … 499 499 if (mode>=GL_COLOR_ATTACHMENT0_EXT && mode<=GL_COLOR_ATTACHMENT15_EXT) 500 500 { 501 if (!g->framebufferobject. framebuffer)501 if (!g->framebufferobject.drawFB) 502 502 { 503 503 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glDrawBuffer invalud mode while fbo is inactive"); … … 512 512 } 513 513 514 if (g->framebufferobject. framebuffer)515 { 516 g->framebufferobject. framebuffer->drawbuffer[0] = mode;514 if (g->framebufferobject.drawFB) 515 { 516 g->framebufferobject.drawFB->drawbuffer[0] = mode; 517 517 } 518 518 else … … 555 555 case GL_AUX2: 556 556 case GL_AUX3: 557 if (g->framebufferobject. framebuffer)557 if (g->framebufferobject.readFB) 558 558 { 559 559 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer invalud mode while fbo is active"); … … 564 564 if (mode>=GL_COLOR_ATTACHMENT0_EXT && mode<=GL_COLOR_ATTACHMENT15_EXT) 565 565 { 566 if (!g->framebufferobject. framebuffer)566 if (!g->framebufferobject.readFB) 567 567 { 568 568 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer invalud mode while fbo is inactive"); … … 581 581 } 582 582 583 if (g->framebufferobject. framebuffer)584 { 585 g->framebufferobject. framebuffer->readbuffer = mode;583 if (g->framebufferobject.readFB) 584 { 585 g->framebufferobject.readFB->readbuffer = mode; 586 586 } 587 587 else -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_framebuffer.c
r23094 r23694 38 38 CRFramebufferObjectState *fbo = &ctx->framebufferobject; 39 39 40 fbo->framebuffer = NULL; 40 fbo->readFB = NULL; 41 fbo->drawFB = NULL; 41 42 fbo->renderbuffer = NULL; 42 43 fbo->framebuffers = crAllocHashtable(); … … 78 79 CRFramebufferObjectState *fbo = &ctx->framebufferobject; 79 80 80 fbo->framebuffer = NULL; 81 fbo->readFB = NULL; 82 fbo->drawFB = NULL; 81 83 fbo->renderbuffer = NULL; 82 84 … … 108 110 } 109 111 else fbo->renderbuffer = NULL; 112 } 113 114 static void crStateCheckFBOAttachments(CRFramebufferObject *pFBO, GLuint rbo, GLenum target) 115 { 116 CRFBOAttachmentPoint *ap; 117 int u; 118 119 if (!pFBO) 120 return; 121 122 for (u=0; u<CR_MAX_COLOR_ATTACHMENTS; ++u) 123 { 124 ap = &pFBO->color[u]; 125 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==rbo) 126 { 127 crStateFramebufferRenderbufferEXT(target, u+GL_COLOR_ATTACHMENT0_EXT, 0, 0); 128 #ifdef IN_GUEST 129 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; 130 #endif 131 } 132 } 133 134 ap = &pFBO->depth; 135 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==rbo) 136 { 137 crStateFramebufferRenderbufferEXT(target, GL_DEPTH_ATTACHMENT_EXT, 0, 0); 138 #ifdef IN_GUEST 139 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; 140 #endif 141 } 142 ap = &pFBO->stencil; 143 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==rbo) 144 { 145 crStateFramebufferRenderbufferEXT(target, GL_STENCIL_ATTACHMENT_EXT, 0, 0); 146 #ifdef IN_GUEST 147 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; 148 #endif 149 } 110 150 } 111 151 … … 133 173 } 134 174 135 /* check the attachments of current framebuffer */ 136 if (fbo->framebuffer) 137 { 138 CRFBOAttachmentPoint *ap; 139 int u; 140 141 for (u=0; u<CR_MAX_COLOR_ATTACHMENTS; ++u) 142 { 143 ap = &fbo->framebuffer->color[u]; 144 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==renderbuffers[i]) 145 { 146 crStateFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, u+GL_COLOR_ATTACHMENT0_EXT, 0, 0); 147 } 148 } 149 150 ap = &fbo->framebuffer->depth; 151 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==renderbuffers[i]) 152 { 153 crStateFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, 0, 0); 154 } 155 ap = &g->framebufferobject.framebuffer->stencil; 156 if (ap->type==GL_RENDERBUFFER_EXT && ap->name==renderbuffers[i]) 157 { 158 crStateFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, 0, 0); 159 } 160 } 175 /* check the attachments of current framebuffers */ 176 crStateCheckFBOAttachments(fbo->readFB, renderbuffers[i], GL_READ_FRAMEBUFFER); 177 crStateCheckFBOAttachments(fbo->drawFB, renderbuffers[i], GL_DRAW_FRAMEBUFFER); 161 178 162 179 crHashtableDelete(fbo->renderbuffers, renderbuffers[i], crStateFreeRBO); … … 238 255 fbo->readbuffer = GL_COLOR_ATTACHMENT0_EXT; 239 256 fbo->drawbuffer[0] = GL_COLOR_ATTACHMENT0_EXT; 257 258 #ifdef IN_GUEST 259 fbo->status = GL_FRAMEBUFFER_UNDEFINED; 260 #endif 240 261 } 241 262 … … 266 287 CRContext *g = GetCurrentContext(); 267 288 CRFramebufferObjectState *fbo = &g->framebufferobject; 289 CRFramebufferObject *pFBO=NULL; 268 290 269 291 CRSTATE_FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 270 CRSTATE_FBO_CHECKERR(target!=GL_FRAMEBUFFER_EXT, GL_INVALID_ENUM, "invalid target"); 292 CRSTATE_FBO_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 293 GL_INVALID_ENUM, "invalid target"); 271 294 272 295 if (framebuffer) 273 296 { 274 fbo->framebuffer = (CRFramebufferObject*) crHashtableSearch(fbo->framebuffers, framebuffer); 275 if (!fbo->framebuffer) 276 { 277 fbo->framebuffer = (CRFramebufferObject*) crCalloc(sizeof(CRFramebufferObject)); 278 CRSTATE_FBO_CHECKERR(!fbo->framebuffer, GL_OUT_OF_MEMORY, "glBindFramebufferEXT"); 279 fbo->framebuffer->id = framebuffer; 280 fbo->framebuffer->hwid = framebuffer; 281 crStateInitFrameBuffer(fbo->framebuffer); 282 crHashtableAdd(fbo->framebuffers, framebuffer, fbo->framebuffer); 283 } 284 } 285 else fbo->framebuffer = NULL; 297 pFBO = (CRFramebufferObject*) crHashtableSearch(fbo->framebuffers, framebuffer); 298 if (!pFBO) 299 { 300 pFBO = (CRFramebufferObject*) crCalloc(sizeof(CRFramebufferObject)); 301 CRSTATE_FBO_CHECKERR(!pFBO, GL_OUT_OF_MEMORY, "glBindFramebufferEXT"); 302 pFBO->id = framebuffer; 303 pFBO->hwid = framebuffer; 304 crStateInitFrameBuffer(pFBO); 305 crHashtableAdd(fbo->framebuffers, framebuffer, pFBO); 306 } 307 } 308 309 /* @todo: http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt 310 * FBO status might change when binding a different FBO here...but I doubt it happens. 311 * So no status reset here until a proper check. 312 */ 313 314 switch (target) 315 { 316 case GL_FRAMEBUFFER_EXT: 317 fbo->readFB = pFBO; 318 fbo->drawFB = pFBO; 319 break; 320 case GL_READ_FRAMEBUFFER: 321 fbo->readFB = pFBO; 322 break; 323 case GL_DRAW_FRAMEBUFFER: 324 fbo->drawFB = pFBO; 325 break; 326 } 286 327 } 287 328 … … 304 345 if (fb) 305 346 { 306 if (fbo-> framebuffer==fb)347 if (fbo->readFB==fb) 307 348 { 308 fbo->framebuffer = NULL; 349 fbo->readFB = NULL; 350 } 351 if (fbo->drawFB==fb) 352 { 353 fbo->drawFB = NULL; 309 354 } 310 355 crHashtableDelete(fbo->framebuffers, framebuffers[i], crStateFreeFBO); … … 336 381 CRContext *g = GetCurrentContext(); 337 382 CRFramebufferObjectState *fbo = &g->framebufferobject; 383 CRFramebufferObject *pFBO; 338 384 GLuint maxtexsizelog2; 339 385 … … 341 387 342 388 CRSTATE_FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 343 CRSTATE_FBO_CHECKERR(target!=GL_FRAMEBUFFER_EXT, GL_INVALID_ENUM, "invalid target"); 344 CRSTATE_FBO_CHECKERR(!fbo->framebuffer, GL_INVALID_OPERATION, "no fbo bound"); 345 CRSTATE_FBO_CHECKERR(!crStateGetFBOAttachmentPoint(fbo->framebuffer, attachment, ap), GL_INVALID_ENUM, "invalid attachment"); 389 CRSTATE_FBO_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 390 GL_INVALID_ENUM, "invalid target"); 391 pFBO = GL_READ_FRAMEBUFFER==target ? fbo->readFB : fbo->drawFB; 392 CRSTATE_FBO_CHECKERR(!pFBO, GL_INVALID_OPERATION, "no fbo bound"); 393 CRSTATE_FBO_CHECKERR(!crStateGetFBOAttachmentPoint(pFBO, attachment, ap), GL_INVALID_ENUM, "invalid attachment"); 346 394 347 395 if (!texture) … … 390 438 391 439 *failed = GL_FALSE; 440 441 #ifdef IN_GUEST 442 if ((*ap)->type!=GL_TEXTURE || (*ap)->name!=texture || (*ap)->level!=level) 443 { 444 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; 445 } 446 #endif 392 447 } 393 448 … … 481 536 CRContext *g = GetCurrentContext(); 482 537 CRFramebufferObjectState *fbo = &g->framebufferobject; 538 CRFramebufferObject *pFBO; 483 539 CRFBOAttachmentPoint *ap; 484 540 CRRenderbufferObject *rb; 485 541 486 542 CRSTATE_FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 487 CRSTATE_FBO_CHECKERR(target!=GL_FRAMEBUFFER_EXT, GL_INVALID_ENUM, "invalid target"); 488 CRSTATE_FBO_CHECKERR(!fbo->framebuffer, GL_INVALID_OPERATION, "no fbo bound"); 489 CRSTATE_FBO_CHECKERR(!crStateGetFBOAttachmentPoint(fbo->framebuffer, attachment, &ap), GL_INVALID_ENUM, "invalid attachment"); 543 CRSTATE_FBO_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 544 GL_INVALID_ENUM, "invalid target"); 545 pFBO = GL_READ_FRAMEBUFFER==target ? fbo->readFB : fbo->drawFB; 546 CRSTATE_FBO_CHECKERR(!pFBO, GL_INVALID_OPERATION, "no fbo bound"); 547 CRSTATE_FBO_CHECKERR(!crStateGetFBOAttachmentPoint(pFBO, attachment, &ap), GL_INVALID_ENUM, "invalid attachment"); 490 548 491 549 if (!renderbuffer) 492 550 { 551 #ifdef IN_GUEST 552 if (ap->type!=GL_NONE) 553 { 554 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; 555 } 556 #endif 493 557 crStateInitFBOAttachmentPoint(ap); 494 558 return; … … 498 562 CRSTATE_FBO_CHECKERR(!rb, GL_INVALID_OPERATION, "rb doesn't exist"); 499 563 564 #ifdef IN_GUEST 565 if (ap->type!=GL_RENDERBUFFER_EXT || ap->name!=renderbuffer) 566 { 567 pFBO->status = GL_FRAMEBUFFER_UNDEFINED; 568 } 569 #endif 500 570 crStateInitFBOAttachmentPoint(ap); 501 571 ap->type = GL_RENDERBUFFER_EXT; … … 508 578 CRContext *g = GetCurrentContext(); 509 579 CRFramebufferObjectState *fbo = &g->framebufferobject; 580 CRFramebufferObject *pFBO; 510 581 CRFBOAttachmentPoint *ap; 511 582 512 583 CRSTATE_FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 513 CRSTATE_FBO_CHECKERR(target!=GL_FRAMEBUFFER_EXT, GL_INVALID_ENUM, "invalid target"); 514 CRSTATE_FBO_CHECKERR(!fbo->framebuffer, GL_INVALID_OPERATION, "no fbo bound"); 515 CRSTATE_FBO_CHECKERR(!crStateGetFBOAttachmentPoint(fbo->framebuffer, attachment, &ap), GL_INVALID_ENUM, "invalid attachment"); 584 CRSTATE_FBO_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 585 GL_INVALID_ENUM, "invalid target"); 586 pFBO = GL_READ_FRAMEBUFFER==target ? fbo->readFB : fbo->drawFB; 587 CRSTATE_FBO_CHECKERR(!pFBO, GL_INVALID_OPERATION, "no fbo bound"); 588 CRSTATE_FBO_CHECKERR(!crStateGetFBOAttachmentPoint(pFBO, attachment, &ap), GL_INVALID_ENUM, "invalid attachment"); 516 589 517 590 switch (pname) … … 634 707 crHashtableWalk(to->framebufferobject.framebuffers, crStateSyncFramebuffersCB, to); 635 708 636 diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, to->framebufferobject.framebuffer? 637 to->framebufferobject.framebuffer->hwid:0); 709 if (to->framebufferobject.drawFB==to->framebufferobject.readFB) 710 { 711 diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, to->framebufferobject.drawFB? 712 to->framebufferobject.drawFB->hwid:0); 713 } 714 else 715 { 716 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, to->framebufferobject.drawFB? 717 to->framebufferobject.drawFB->hwid:0); 718 719 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, to->framebufferobject.readFB? 720 to->framebufferobject.readFB->hwid:0); 721 } 638 722 639 723 diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, to->framebufferobject.renderbuffer? … … 642 726 else 643 727 { 644 if (to->framebufferobject.framebuffer!=from->framebufferobject.framebuffer) 645 { 646 diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, to->framebufferobject.framebuffer? 647 to->framebufferobject.framebuffer->hwid:0); 728 if (to->framebufferobject.drawFB!=from->framebufferobject.drawFB 729 || to->framebufferobject.readFB!=from->framebufferobject.readFB) 730 { 731 if (to->framebufferobject.drawFB==to->framebufferobject.readFB) 732 { 733 diff_api.BindFramebufferEXT(GL_FRAMEBUFFER_EXT, to->framebufferobject.drawFB? 734 to->framebufferobject.drawFB->hwid:0); 735 } 736 else 737 { 738 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, to->framebufferobject.drawFB? 739 to->framebufferobject.drawFB->hwid:0); 740 741 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, to->framebufferobject.readFB? 742 to->framebufferobject.readFB->hwid:0); 743 } 648 744 } 649 745 … … 671 767 return pRBO ? pRBO->hwid : 0; 672 768 } 769 770 #ifdef IN_GUEST 771 DECLEXPORT(GLenum) STATE_APIENTRY crStateCheckFramebufferStatusEXT(GLenum target) 772 { 773 GLenum status = GL_FRAMEBUFFER_UNDEFINED; 774 CRContext *g = GetCurrentContext(); 775 CRFramebufferObjectState *fbo = &g->framebufferobject; 776 CRFramebufferObject *pFBO=NULL; 777 778 switch (target) 779 { 780 case GL_FRAMEBUFFER_EXT: 781 pFBO = fbo->drawFB; 782 break; 783 case GL_READ_FRAMEBUFFER: 784 pFBO = fbo->readFB; 785 break; 786 case GL_DRAW_FRAMEBUFFER: 787 pFBO = fbo->drawFB; 788 break; 789 } 790 791 if (pFBO) status = pFBO->status; 792 793 return status; 794 } 795 796 DECLEXPORT(GLenum) STATE_APIENTRY crStateSetFramebufferStatus(GLenum target, GLenum status) 797 { 798 CRContext *g = GetCurrentContext(); 799 CRFramebufferObjectState *fbo = &g->framebufferobject; 800 CRFramebufferObject *pFBO=NULL; 801 802 switch (target) 803 { 804 case GL_FRAMEBUFFER_EXT: 805 pFBO = fbo->drawFB; 806 break; 807 case GL_READ_FRAMEBUFFER: 808 pFBO = fbo->readFB; 809 break; 810 case GL_DRAW_FRAMEBUFFER: 811 pFBO = fbo->drawFB; 812 break; 813 } 814 815 if (pFBO) pFBO->status = status; 816 } 817 #endif -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_get.py
r22155 r23694 134 134 static GLenum __getDrawBuffer(CRContext *g) 135 135 { 136 return g->framebufferobject. framebuffer ? g->framebufferobject.framebuffer->drawbuffer[0] : g->buffer.drawBuffer;136 return g->framebufferobject.drawFB ? g->framebufferobject.drawFB->drawbuffer[0] : g->buffer.drawBuffer; 137 137 } 138 138 139 139 static GLenum __getReadBuffer(CRContext *g) 140 140 { 141 return g->framebufferobject. framebuffer ? g->framebufferobject.framebuffer->readbuffer : g->buffer.readBuffer;141 return g->framebufferobject.readFB ? g->framebufferobject.readFB->readbuffer : g->buffer.readBuffer; 142 142 } 143 143 """ -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_get.txt
r22284 r23694 302 302 303 303 # FBO 304 GLint GL_FRAMEBUFFER_BINDING_EXT (g->framebufferobject.framebuffer?g->framebufferobject.framebuffer->id:0) 304 GLint GL_FRAMEBUFFER_BINDING_EXT (g->framebufferobject.drawFB?g->framebufferobject.drawFB->id:0) 305 GLint GL_READ_FRAMEBUFFER_BINDING (g->framebufferobject.readFB?g->framebufferobject.readFB->id:0) 305 306 GLint GL_RENDERBUFFER_BINDING_EXT (g->framebufferobject.renderbuffer?g->framebufferobject.renderbuffer->id:0) 306 307 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c
r23433 r23694 1028 1028 AssertRCReturn(rc, rc); 1029 1029 crHashtableWalk(pContext->framebufferobject.renderbuffers, crStateSaveRenderbuffersCB, pSSM); 1030 rc = SSMR3PutU32(pSSM, pContext->framebufferobject.framebuffer?pContext->framebufferobject.framebuffer->id:0); 1030 rc = SSMR3PutU32(pSSM, pContext->framebufferobject.drawFB?pContext->framebufferobject.drawFB->id:0); 1031 AssertRCReturn(rc, rc); 1032 rc = SSMR3PutU32(pSSM, pContext->framebufferobject.readFB?pContext->framebufferobject.readFB->id:0); 1031 1033 AssertRCReturn(rc, rc); 1032 1034 rc = SSMR3PutU32(pSSM, pContext->framebufferobject.renderbuffer?pContext->framebufferobject.renderbuffer->id:0); … … 1555 1557 rc = SSMR3GetU32(pSSM, &ui); 1556 1558 AssertRCReturn(rc, rc); 1557 pContext->framebufferobject.framebuffer = ui==0 ? NULL 1558 : crHashtableSearch(pContext->framebufferobject.framebuffers, ui); 1559 pContext->framebufferobject.drawFB = ui==0 ? NULL 1560 : crHashtableSearch(pContext->framebufferobject.framebuffers, ui); 1561 1562 rc = SSMR3GetU32(pSSM, &ui); 1563 AssertRCReturn(rc, rc); 1564 pContext->framebufferobject.readFB = ui==0 ? NULL 1565 : crHashtableSearch(pContext->framebufferobject.framebuffers, ui); 1559 1566 1560 1567 rc = SSMR3GetU32(pSSM, &ui); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_texture.c
r22155 r23694 625 625 } 626 626 627 static void crStateTextureCheckFBOAPs(CRFramebufferObject *pFBO, GLuint texture) 628 { 629 GLuint u; 630 CRFBOAttachmentPoint *ap; 631 632 if (!pFBO) return; 633 634 for (u=0; u<CR_MAX_COLOR_ATTACHMENTS; ++u) 635 { 636 ap = &pFBO->color[u]; 637 if (ap->type==GL_TEXTURE && ap->name==texture) 638 { 639 crStateFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, u+GL_COLOR_ATTACHMENT0_EXT, 0, 0, 0); 640 } 641 } 642 643 ap = &pFBO->depth; 644 if (ap->type==GL_TEXTURE && ap->name==texture) 645 { 646 crStateFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, 0, 0, 0); 647 } 648 649 ap = &pFBO->stencil; 650 if (ap->type==GL_TEXTURE && ap->name==texture) 651 { 652 crStateFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, 0, 0, 0); 653 } 654 } 655 627 656 void STATE_APIENTRY crStateDeleteTextures(GLsizei n, const GLuint *textures) 628 657 { … … 694 723 695 724 #ifdef CR_EXT_framebuffer_object 696 if (g->framebufferobject.framebuffer) 697 { 698 CRFBOAttachmentPoint *ap; 699 for (u=0; u<CR_MAX_COLOR_ATTACHMENTS; ++u) 700 { 701 ap = &g->framebufferobject.framebuffer->color[u]; 702 if (ap->type==GL_TEXTURE && ap->name==name) 703 { 704 crStateFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, u+GL_COLOR_ATTACHMENT0_EXT, 0, 0, 0); 705 } 706 } 707 ap = &g->framebufferobject.framebuffer->depth; 708 if (ap->type==GL_TEXTURE && ap->name==name) 709 { 710 crStateFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, 0, 0, 0); 711 } 712 ap = &g->framebufferobject.framebuffer->stencil; 713 if (ap->type==GL_TEXTURE && ap->name==name) 714 { 715 crStateFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, 0, 0, 0); 716 } 717 } 725 crStateTextureCheckFBOAPs(g->framebufferobject.drawFB, name); 726 crStateTextureCheckFBOAPs(g->framebufferobject.readFB, name); 718 727 #endif 719 728 crStateDeleteTextureObject(tObj);
Note:
See TracChangeset
for help on using the changeset viewer.