Changeset 43980 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Nov 28, 2012 7:10:56 AM (12 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r43932 r43980 134 134 int32_t crServerSetOffscreenRenderingMode(GLubyte value); 135 135 void crServerRedirMuralFBO(CRMuralInfo *mural, GLubyte redir); 136 void crServerCreateMuralFBO(CRMuralInfo *mural);137 136 void crServerDeleteMuralFBO(CRMuralInfo *mural); 138 137 void crServerPresentFBO(CRMuralInfo *mural); 139 138 GLboolean crServerIsRedirectedToFBO(); 139 GLuint crServerMuralFBOIdxFromBufferName(CRMuralInfo *mural, GLenum buffer); 140 void crServerMuralFBOSwapBuffers(CRMuralInfo *mural); 141 142 #define CR_SERVER_FBO_BB_IDX(_mural) ((_mural)->iBbBuffer) 143 #define CR_SERVER_FBO_FB_IDX(_mural) (((_mural)->iBbBuffer + 1) % ((_mural)->cBuffers)) 144 140 145 PCR_BLITTER crServerGetFBOPresentBlitter(CRMuralInfo*pMural); 141 146 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_blitter.cpp
r43945 r43980 380 380 Assert(CrBltIsEntered(pBlitter)); 381 381 382 if (pBlitter->Flags.SupportsFBO) 383 { 384 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_FRAMEBUFFER, 0); 385 cr_server.head_spu->dispatch_table.DrawBuffer(GL_BACK); 386 cr_server.head_spu->dispatch_table.ReadBuffer(GL_BACK); 387 } 388 389 cr_server.head_spu->dispatch_table.Flush(); 390 382 391 if (pBlitter->pRestoreCtxInfo != &pBlitter->CtxInfo) 392 { 393 GLuint idDrawFBO, idReadFBO; 394 CRMuralInfo *pRestoreMural = pBlitter->pRestoreMural; 395 if (pRestoreMural->fUseFBO && crServerSupportRedirMuralFBO()) 396 { 397 idDrawFBO = pRestoreMural->aidFBOs[pRestoreMural->iCurDrawBuffer]; 398 idReadFBO = pRestoreMural->aidFBOs[pRestoreMural->iCurReadBuffer]; 399 } 400 else 401 { 402 idDrawFBO = 0; 403 idReadFBO = 0; 404 } 405 383 406 cr_server.head_spu->dispatch_table.MakeCurrent(pBlitter->pRestoreMural->spuWindow, 0, 384 407 pBlitter->pRestoreCtxInfo->SpuContext >= 0 385 408 ? pBlitter->pRestoreCtxInfo->SpuContext : cr_server.MainContextInfo.SpuContext); 386 else 409 crStateSwichPostprocess(pBlitter->pRestoreCtxInfo->pContext, pBlitter->pRestoreCtxInfo->pContext, idDrawFBO, idReadFBO); 410 } 411 else 412 { 413 Assert(0); 387 414 cr_server.head_spu->dispatch_table.MakeCurrent(0, 0, 0); 415 } 388 416 389 417 pBlitter->pRestoreCtxInfo = NULL; … … 404 432 } 405 433 406 pBlitter->pRestoreCtxInfo = pRestoreCtxInfo ? pRestoreCtxInfo : &pBlitter->CtxInfo; 407 pBlitter->pRestoreMural = pRestoreMural; 434 if (pRestoreCtxInfo) 435 { 436 GLuint idDrawFBO, idReadFBO; 437 pBlitter->pRestoreCtxInfo = pRestoreCtxInfo; 438 pBlitter->pRestoreMural = pRestoreMural; 439 440 if (pRestoreMural->fUseFBO && crServerSupportRedirMuralFBO()) 441 { 442 idDrawFBO = pRestoreMural->aidFBOs[pRestoreMural->iCurDrawBuffer]; 443 idReadFBO = pRestoreMural->aidFBOs[pRestoreMural->iCurReadBuffer]; 444 } 445 else 446 { 447 idDrawFBO = 0; 448 idReadFBO = 0; 449 } 450 crStateSwichPrepare(NULL, pRestoreCtxInfo->pContext, idDrawFBO, idReadFBO); 451 452 cr_server.head_spu->dispatch_table.Flush(); 453 } 454 else 455 { 456 Assert(0); 457 pBlitter->pRestoreCtxInfo = &pBlitter->CtxInfo; 458 459 } 408 460 409 461 cr_server.head_spu->dispatch_table.MakeCurrent(pBlitter->pCurrentMural->spuWindow, 0, pBlitter->CtxInfo.SpuContext); … … 435 487 RTRECTSIZE DstSize = {pBlitter->pCurrentMural->width, pBlitter->pCurrentMural->height}; 436 488 489 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0); 490 437 491 crBltBlitTexBuf(pBlitter, pSrc, paSrcRects, GL_BACK, &DstSize, paDstRects, cRects, fFlags); 438 492 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_clear.c
r41380 r43980 434 434 if (crServerIsRedirectedToFBO()) 435 435 { 436 crServerMuralFBOSwapBuffers(mural); 436 437 crServerPresentFBO(mural); 437 438 } … … 453 454 if (cr_server.curClient->currentMural->bFbDraw && crServerIsRedirectedToFBO()) 454 455 { 455 #ifdef DEBUG_misha456 CRASSERT(0);457 #endif458 456 crServerPresentFBO(cr_server.curClient->currentMural); 459 457 } … … 473 471 if (cr_server.curClient->currentMural->bFbDraw && crServerIsRedirectedToFBO()) 474 472 { 475 #ifdef DEBUG_misha476 CRASSERT(0);477 #endif478 473 crServerPresentFBO(cr_server.curClient->currentMural); 479 474 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c
r43932 r43980 281 281 CRContextInfo *ctxInfo = NULL; 282 282 CRContext *ctx, *oldCtx = NULL; 283 GLuint idDrawFBO, idReadFBO; 283 284 284 285 if (context >= 0 && window >= 0) { … … 332 333 * crStateSwichPrepare restores the FBO state to its default values before the context window switch, 333 334 * while crStateSwichPostprocess restores it back to the original values */ 334 oldCtx = crStateSwichPrepare(ctx, cr_server.bUseMultipleContexts, oldMural && oldMural->fUseFBO && crServerSupportRedirMuralFBO() ? oldMural->idFBO : 0); 335 oldCtx = crStateGetCurrent(); 336 if (oldMural && oldMural->fUseFBO && crServerSupportRedirMuralFBO()) 337 { 338 idDrawFBO = oldMural->aidFBOs[oldMural->iCurDrawBuffer]; 339 idReadFBO = oldMural->aidFBOs[oldMural->iCurReadBuffer]; 340 } 341 else 342 { 343 idDrawFBO = 0; 344 idReadFBO = 0; 345 } 346 crStateSwichPrepare(cr_server.bUseMultipleContexts ? NULL : ctx, oldCtx, idDrawFBO, idReadFBO); 335 347 336 348 /* … … 395 407 crStateMakeCurrent( ctx ); 396 408 397 crStateSwichPostprocess(oldCtx, cr_server.bUseMultipleContexts, mural->fUseFBO && crServerSupportRedirMuralFBO() ? mural->idFBO : 0); 409 if (mural && mural->fUseFBO && crServerSupportRedirMuralFBO()) 410 { 411 GLuint id = crServerMuralFBOIdxFromBufferName(mural, ctx->buffer.drawBuffer); 412 if (id != mural->iCurDrawBuffer) 413 { 414 crWarning("DBO draw buffer changed on make current"); 415 mural->iCurDrawBuffer = id; 416 } 417 418 id = crServerMuralFBOIdxFromBufferName(mural, ctx->buffer.readBuffer); 419 if (id != mural->iCurReadBuffer) 420 { 421 crWarning("DBO read buffer changed on make current"); 422 mural->iCurReadBuffer = id; 423 } 424 425 idDrawFBO = mural->aidFBOs[mural->iCurDrawBuffer]; 426 idReadFBO = mural->aidFBOs[mural->iCurReadBuffer]; 427 } 428 else 429 { 430 idDrawFBO = 0; 431 idReadFBO = 0; 432 } 433 crStateSwichPostprocess(ctx, cr_server.bUseMultipleContexts ? ctx : oldCtx, idDrawFBO, idReadFBO); 398 434 399 435 if (!ctx->framebufferobject.drawFB -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_framebuffer.c
r41380 r43980 72 72 { 73 73 CRContext *ctx = crStateGetCurrent(); 74 if (ctx->buffer.drawBuffer == GL_FRONT || ctx->buffer.drawBuffer == GL_FRONT_LEFT )74 if (ctx->buffer.drawBuffer == GL_FRONT || ctx->buffer.drawBuffer == GL_FRONT_LEFT || ctx->buffer.drawBuffer == GL_FRONT_RIGHT) 75 75 cr_server.curClient->currentMural->bFbDraw = GL_TRUE; 76 76 } … … 78 78 if (0==framebuffer && crServerIsRedirectedToFBO()) 79 79 { 80 cr_server.head_spu->dispatch_table.BindFramebufferEXT(target, cr_server.curClient->currentMural->idFBO); 80 if (target == GL_FRAMEBUFFER) 81 { 82 GLuint idDrawFBO = cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]; 83 GLuint idReadFBO = cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]; 84 if (idDrawFBO == idReadFBO) 85 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_FRAMEBUFFER, idDrawFBO); 86 else 87 { 88 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idReadFBO); 89 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idDrawFBO); 90 } 91 } 92 else if (target == GL_READ_FRAMEBUFFER) 93 { 94 GLuint idReadFBO = cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]; 95 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idReadFBO); 96 } 97 else if (target == GL_DRAW_FRAMEBUFFER) 98 { 99 GLuint idDrawFBO = cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]; 100 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idDrawFBO); 101 } 102 else 103 { 104 crWarning("unknown target %d", target); 105 } 81 106 #ifdef DEBUG_misha 82 Assert(0);83 107 cr_server.head_spu->dispatch_table.GetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &rfb); 84 108 cr_server.head_spu->dispatch_table.GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &dfb); 85 109 if (GL_FRAMEBUFFER_EXT == target) 86 110 { 87 Assert(rfb == cr_server.curClient->currentMural-> idFBO);88 Assert(dfb == cr_server.curClient->currentMural-> idFBO);111 Assert(rfb == cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]); 112 Assert(dfb == cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]); 89 113 } 90 114 else if (GL_READ_FRAMEBUFFER_EXT == target) 91 115 { 92 Assert(rfb == cr_server.curClient->currentMural-> idFBO);116 Assert(rfb == cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]); 93 117 } 94 118 else if (GL_DRAW_FRAMEBUFFER_EXT == target) 95 119 { 96 Assert(dfb == cr_server.curClient->currentMural-> idFBO);120 Assert(dfb == cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]); 97 121 } 98 122 else -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r43966 r43980 277 277 278 278 # ifdef DEBUG_misha 279 # define CR_CHECK_BLITS279 //# define CR_CHECK_BLITS 280 280 # include <iprt/assert.h> 281 281 # undef CRASSERT /* iprt assert's int3 are inlined that is why are more convenient to use since they can be easily disabled individually */ … … 869 869 if (!crStateGetCurrent()->framebufferobject.drawFB) 870 870 { 871 if (mode == GL_FRONT || mode == GL_FRONT_LEFT )871 if (mode == GL_FRONT || mode == GL_FRONT_LEFT || mode == GL_FRONT_RIGHT) 872 872 cr_server.curClient->currentMural->bFbDraw = GL_TRUE; 873 873 874 874 if (crServerIsRedirectedToFBO() 875 && cr_server.curClient->currentMural->idFBO) 876 { 875 && cr_server.curClient->currentMural->aidFBOs[0]) 876 { 877 GLuint iBufferNeeded; 877 878 switch (mode) 878 879 { 879 880 case GL_BACK: 880 881 case GL_BACK_LEFT: 882 case GL_BACK_RIGHT: 881 883 mode = GL_COLOR_ATTACHMENT0; 884 iBufferNeeded = CR_SERVER_FBO_BB_IDX(cr_server.curClient->currentMural); 882 885 break; 883 886 case GL_FRONT: 884 887 case GL_FRONT_LEFT: 885 crDebug("Setting GL_FRONT with FBO mode! (0x%x)", mode);888 case GL_FRONT_RIGHT: 886 889 mode = GL_COLOR_ATTACHMENT0; 890 iBufferNeeded = CR_SERVER_FBO_FB_IDX(cr_server.curClient->currentMural); 887 891 break; 888 892 default: 889 893 crWarning("unexpected mode! 0x%x", mode); 894 iBufferNeeded = CR_SERVER_FBO_BB_IDX(cr_server.curClient->currentMural); 890 895 break; 891 896 } 897 898 Assert(cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]); 899 if (iBufferNeeded != cr_server.curClient->currentMural->iCurDrawBuffer) 900 { 901 cr_server.curClient->currentMural->iCurDrawBuffer = iBufferNeeded; 902 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 903 cr_server.curClient->currentMural->aidFBOs[iBufferNeeded]); 904 } 892 905 } 893 906 } … … 901 914 902 915 if (crServerIsRedirectedToFBO() 903 && cr_server.curClient->currentMural-> idFBO916 && cr_server.curClient->currentMural->aidFBOs[0] 904 917 && !crStateGetCurrent()->framebufferobject.readFB) 905 918 { 919 GLuint iBufferNeeded; 906 920 switch (mode) 907 921 { 908 922 case GL_BACK: 909 923 case GL_BACK_LEFT: 924 case GL_BACK_RIGHT: 910 925 mode = GL_COLOR_ATTACHMENT0; 926 iBufferNeeded = CR_SERVER_FBO_BB_IDX(cr_server.curClient->currentMural); 911 927 break; 912 928 case GL_FRONT: 913 929 case GL_FRONT_LEFT: 914 crWarning("GL_FRONT not supported for FBO mode!");930 case GL_FRONT_RIGHT: 915 931 mode = GL_COLOR_ATTACHMENT0; 932 iBufferNeeded = CR_SERVER_FBO_FB_IDX(cr_server.curClient->currentMural); 916 933 break; 917 934 default: 918 935 crWarning("unexpected mode! 0x%x", mode); 936 iBufferNeeded = CR_SERVER_FBO_BB_IDX(cr_server.curClient->currentMural); 919 937 break; 938 } 939 940 Assert(cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]); 941 if (iBufferNeeded != cr_server.curClient->currentMural->iCurReadBuffer) 942 { 943 cr_server.curClient->currentMural->iCurReadBuffer = iBufferNeeded; 944 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 945 cr_server.curClient->currentMural->aidFBOs[iBufferNeeded]); 920 946 } 921 947 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r43932 r43980 232 232 } 233 233 234 static void crServerCreateMuralFBO(CRMuralInfo *mural); 235 234 236 void crServerRedirMuralFBO(CRMuralInfo *mural, GLubyte redir) 235 237 { 236 238 if (mural->fUseFBO == redir) 237 239 { 238 crWarning("crServerRedirMuralFBO called with the same redir status %d", redir); 240 if (redir) 241 crWarning("crServerRedirMuralFBO called with the same redir status %d", redir); 239 242 return; 240 243 } … … 253 256 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible); 254 257 255 if (mural-> idFBO==0)258 if (mural->aidFBOs[0]==0) 256 259 { 257 260 crServerCreateMuralFBO(mural); … … 260 263 if (!crStateGetCurrent()->framebufferobject.drawFB) 261 264 { 262 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural-> idFBO);265 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural->aidFBOs[mural->iCurDrawBuffer]); 263 266 } 264 267 if (!crStateGetCurrent()->framebufferobject.readFB) 265 268 { 266 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural-> idFBO);269 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural->aidFBOs[mural->iCurReadBuffer]); 267 270 } 268 271 … … 300 303 } 301 304 302 void crServerCreateMuralFBO(CRMuralInfo *mural)305 static void crServerCreateMuralFBO(CRMuralInfo *mural) 303 306 { 304 307 CRContext *ctx = crStateGetCurrent(); 305 GLuint uid ;308 GLuint uid, i; 306 309 GLenum status; 307 310 SPUDispatchTable *gl = &cr_server.head_spu->dispatch_table; 308 311 309 CRASSERT(mural->idFBO==0); 310 312 CRASSERT(mural->aidFBOs[0]==0); 313 CRASSERT(mural->aidFBOs[1]==0); 314 315 mural->cBuffers = 2; 316 mural->iBbBuffer = 0; 311 317 /*Color texture*/ 312 gl->GenTextures(1, &mural->idColorTex); 313 gl->BindTexture(GL_TEXTURE_2D, mural->idColorTex); 314 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 315 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 316 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 317 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 318 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 319 { 320 gl->BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); 321 } 322 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, mural->width, mural->height, 323 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); 318 for (i = 0; i < mural->cBuffers; ++i) 319 { 320 gl->GenTextures(1, &mural->aidColorTexs[i]); 321 gl->BindTexture(GL_TEXTURE_2D, mural->aidColorTexs[i]); 322 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 323 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 324 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 325 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 326 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 327 { 328 gl->BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); 329 } 330 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, mural->width, mural->height, 331 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); 332 } 324 333 325 334 /*Depth&Stencil*/ … … 327 336 gl->BindRenderbufferEXT(GL_RENDERBUFFER_EXT, mural->idDepthStencilRB); 328 337 gl->RenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, 329 338 mural->width, mural->height); 330 339 331 340 /*FBO*/ 332 gl->GenFramebuffersEXT(1, &mural->idFBO); 333 gl->BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mural->idFBO); 334 335 gl->FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, 336 GL_TEXTURE_2D, mural->idColorTex, 0); 337 gl->FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, 338 GL_RENDERBUFFER_EXT, mural->idDepthStencilRB); 339 gl->FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, 340 GL_RENDERBUFFER_EXT, mural->idDepthStencilRB); 341 342 status = gl->CheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); 343 if (status!=GL_FRAMEBUFFER_COMPLETE_EXT) 344 { 345 crWarning("FBO status(0x%x) isn't complete", status); 341 for (i = 0; i < mural->cBuffers; ++i) 342 { 343 gl->GenFramebuffersEXT(1, &mural->aidFBOs[i]); 344 gl->BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mural->aidFBOs[i]); 345 346 gl->FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, 347 GL_TEXTURE_2D, mural->aidColorTexs[i], 0); 348 gl->FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, 349 GL_RENDERBUFFER_EXT, mural->idDepthStencilRB); 350 gl->FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, 351 GL_RENDERBUFFER_EXT, mural->idDepthStencilRB); 352 353 status = gl->CheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); 354 if (status!=GL_FRAMEBUFFER_COMPLETE_EXT) 355 { 356 crWarning("FBO status(0x%x) isn't complete", status); 357 } 346 358 } 347 359 348 360 mural->fboWidth = mural->width; 349 361 mural->fboHeight = mural->height; 362 363 mural->iCurDrawBuffer = crServerMuralFBOIdxFromBufferName(mural, ctx->buffer.drawBuffer); 364 mural->iCurReadBuffer = crServerMuralFBOIdxFromBufferName(mural, ctx->buffer.readBuffer); 350 365 351 366 /*PBO*/ … … 386 401 CRASSERT(!mural->fUseFBO); 387 402 388 if (mural->idFBO!=0) 389 { 390 cr_server.head_spu->dispatch_table.DeleteTextures(1, &mural->idColorTex); 403 if (mural->aidFBOs[0]!=0) 404 { 405 GLuint i; 406 for (i = 0; i < mural->cBuffers; ++i) 407 { 408 cr_server.head_spu->dispatch_table.DeleteTextures(1, &mural->aidColorTexs[i]); 409 mural->aidColorTexs[i] = 0; 410 } 411 391 412 cr_server.head_spu->dispatch_table.DeleteRenderbuffersEXT(1, &mural->idDepthStencilRB); 392 cr_server.head_spu->dispatch_table.DeleteFramebuffersEXT(1, &mural->idFBO);393 394 mural->idFBO = 0;395 mural->idColorTex = 0;396 413 mural->idDepthStencilRB = 0; 414 415 for (i = 0; i < mural->cBuffers; ++i) 416 { 417 cr_server.head_spu->dispatch_table.DeleteFramebuffersEXT(1, &mural->aidFBOs[i]); 418 mural->aidFBOs[i] = 0; 419 } 397 420 } 398 421 … … 403 426 mural->idPBO = 0; 404 427 } 428 429 mural->cBuffers = 0; 405 430 } 406 431 … … 503 528 Tex.height = mural->height; 504 529 Tex.target = GL_TEXTURE_2D; 505 Tex.hwid = mural-> idColorTex;530 Tex.hwid = mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]; 506 531 Rect.xLeft = 0; 507 532 Rect.yTop = 0; … … 529 554 bUsePBO = cr_server.bUsePBOForReadback && mural->idPBO; 530 555 531 cr_server.head_spu->dispatch_table.BindTexture(GL_TEXTURE_2D, mural-> idColorTex);556 cr_server.head_spu->dispatch_table.BindTexture(GL_TEXTURE_2D, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 532 557 533 558 if (bUsePBO) … … 648 673 && cr_server.curClient->currentMural->fUseFBO; 649 674 } 675 676 GLuint crServerMuralFBOIdxFromBufferName(CRMuralInfo *mural, GLenum buffer) 677 { 678 if (buffer == GL_FRONT 679 || buffer == GL_FRONT_LEFT 680 || buffer == GL_FRONT_RIGHT) 681 return CR_SERVER_FBO_FB_IDX(mural); 682 return CR_SERVER_FBO_BB_IDX(mural); 683 } 684 685 void crServerMuralFBOSwapBuffers(CRMuralInfo *mural) 686 { 687 CRContext *ctx = crStateGetCurrent(); 688 GLuint iOldCurDrawBuffer = mural->iCurDrawBuffer; 689 GLuint iOldCurReadBuffer = mural->iCurReadBuffer; 690 mural->iBbBuffer = ((mural->iBbBuffer + 1) % (mural->cBuffers)); 691 mural->iCurDrawBuffer = ((mural->iCurDrawBuffer + 1) % (mural->cBuffers)); 692 mural->iCurReadBuffer = ((mural->iCurReadBuffer + 1) % (mural->cBuffers)); 693 Assert(iOldCurDrawBuffer != mural->iCurDrawBuffer || mural->cBuffers == 1); 694 Assert(iOldCurReadBuffer != mural->iCurReadBuffer || mural->cBuffers == 1); 695 if (!ctx->framebufferobject.drawFB && iOldCurDrawBuffer != mural->iCurDrawBuffer) 696 { 697 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural->aidFBOs[mural->iCurDrawBuffer]); 698 } 699 if (!ctx->framebufferobject.readFB && iOldCurReadBuffer != mural->iCurReadBuffer) 700 { 701 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural->aidFBOs[mural->iCurReadBuffer]); 702 } 703 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py
r43932 r43980 77 77 fboid = crStateFBOHWIDtoID((GLuint) *get_values); 78 78 if (crServerIsRedirectedToFBO() 79 && fboid==cr_server.curClient->currentMural->idFBO) 79 && (fboid==cr_server.curClient->currentMural->aidFBOs[0] 80 || fboid==cr_server.curClient->currentMural->aidFBOs[1])) 80 81 { 81 82 fboid = 0; … … 86 87 { 87 88 if (crServerIsRedirectedToFBO() 88 && cr_server.curClient->currentMural-> idFBO89 && cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer] 89 90 && !crStateGetCurrent()->framebufferobject.readFB) 90 91 { … … 95 96 { 96 97 if (crServerIsRedirectedToFBO() 97 && cr_server.curClient->currentMural-> idFBO98 && cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer] 98 99 && !crStateGetCurrent()->framebufferobject.drawFB) 99 100 {
Note:
See TracChangeset
for help on using the changeset viewer.