VirtualBox

Ignore:
Timestamp:
Mar 12, 2013 5:27:04 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL: offscreen rendering & VRDP+3D-related fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c

    r44951 r45009  
    265265        }
    266266
    267         if (!crStateGetCurrent()->framebufferobject.drawFB)
    268         {
    269             cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural->aidFBOs[mural->iCurDrawBuffer]);
    270         }
    271         if (!crStateGetCurrent()->framebufferobject.readFB)
    272         {
    273             cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural->aidFBOs[mural->iCurReadBuffer]);
    274         }
    275 
    276         if (cr_server.curClient && cr_server.curClient->currentMural == mural)
    277         {
     267        if (cr_server.currentMural == mural)
     268        {
     269            if (!crStateGetCurrent()->framebufferobject.drawFB)
     270            {
     271                cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural->aidFBOs[mural->iCurDrawBuffer]);
     272            }
     273            if (!crStateGetCurrent()->framebufferobject.readFB)
     274            {
     275                cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural->aidFBOs[mural->iCurReadBuffer]);
     276            }
     277
    278278            crStateGetCurrent()->buffer.width = 0;
    279279            crStateGetCurrent()->buffer.height = 0;
     
    286286            /* tell renderspu we do not want compositor presentation anymore
    287287             * renderspu will ensure its redraw thread is done with using the compositor, etc. */
    288             cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL);
     288            crServerVBoxCompositionDisable(mural);
    289289        }
    290290
     
    292292            cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible);
    293293
    294         if (mural->fUseFBO && crServerSupportRedirMuralFBO())
     294        if (cr_server.currentMural == mural)
    295295        {
    296296            if (!crStateGetCurrent()->framebufferobject.drawFB)
     
    302302                cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0);
    303303            }
    304         }
    305 
    306         if (cr_server.curClient && cr_server.curClient->currentMural == mural)
    307         {
     304
    308305            crStateGetCurrent()->buffer.width = mural->width;
    309306            crStateGetCurrent()->buffer.height = mural->height;
     
    512509}
    513510
     511void crServerVBoxCompositionPresent(CRMuralInfo *mural)
     512{
     513    CRMuralInfo *currentMural = cr_server.currentMural;
     514    CRContextInfo *curCtxInfo = cr_server.currentCtxInfo;
     515    GLuint idDrawFBO, idReadFBO;
     516    CRContext *curCtx = curCtxInfo->pContext;
     517
     518    CRASSERT(curCtx == crStateGetCurrent());
     519
     520    if (!mural->bVisible)
     521    {
     522        return;
     523    }
     524
     525    if (!mural->width || !mural->height)
     526    {
     527        return;
     528    }
     529
     530    if (!CrVrScrCompositorEntryIsInList(&mural->CEntry))
     531        return;
     532
     533    if (currentMural)
     534    {
     535        idDrawFBO = currentMural->aidFBOs[currentMural->iCurDrawBuffer];
     536        idReadFBO = currentMural->aidFBOs[currentMural->iCurReadBuffer];
     537    }
     538    else
     539    {
     540        idDrawFBO = 0;
     541        idReadFBO = 0;
     542    }
     543
     544    crStateSwitchPrepare(NULL, curCtx, idDrawFBO, idReadFBO);
     545
     546    cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry);
     547
     548    crStateSwitchPostprocess(curCtx, NULL, idDrawFBO, idReadFBO);
     549
     550    mural->fCompositorPresented = GL_TRUE;
     551}
     552
     553void crServerVBoxCompositionReenable(CRMuralInfo *mural)
     554{
     555    if (!mural->fCompositorPresented)
     556        return;
     557
     558    crServerVBoxCompositionPresent(mural);
     559}
     560
     561void crServerVBoxCompositionDisable(CRMuralInfo *mural)
     562{
     563    cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL);
     564}
     565
    514566void crServerPresentFBO(CRMuralInfo *mural)
    515567{
     
    539591    if (mural->fUseFBO == CR_SERVER_REDIR_FBO_BLT)
    540592    {
    541         GLuint idDrawFBO, idReadFBO;
    542 
    543         idDrawFBO = mural->aidFBOs[mural->iCurDrawBuffer];
    544         idReadFBO = mural->aidFBOs[mural->iCurReadBuffer];
    545 
    546         crStateSwitchPrepare(NULL, ctx, idDrawFBO, idReadFBO);
    547 
    548         cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry);
    549 
    550         crStateSwitchPostprocess(ctx, NULL, idDrawFBO, idReadFBO);
    551 
     593        crServerVBoxCompositionPresent(mural);
    552594        return;
    553595    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette