VirtualBox

Changeset 41160 in vbox for trunk/src/VBox/GuestHost/OpenGL


Ignore:
Timestamp:
May 4, 2012 9:55:53 AM (13 years ago)
Author:
vboxsync
Message:

crOpenGL: render to fbo fixes

Location:
trunk/src/VBox/GuestHost/OpenGL
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h

    r41128 r41160  
    219219DECLEXPORT(GLboolean) crStateEnableDiffOnMakeCurrent(GLboolean fEnable);
    220220
    221 CRContext * crStateSwichPrepare(CRContext *toCtx);
    222 void crStateSwichPostprocess(CRContext *fromCtx);
     221CRContext * crStateSwichPrepare(CRContext *toCtx, GLboolean fMultipleContexts, GLuint idFBO);
     222void crStateSwichPostprocess(CRContext *fromCtx, GLboolean fMultipleContexts, GLuint idFBO);
    223223
    224224DECLEXPORT(void) crStateFlushFunc( CRStateFlushFunc ff );
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_framebuffer.h

    r41057 r41160  
    7575DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectSwitch(CRContext *from, CRContext *to);
    7676
    77 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectDisableHW(CRContext *ctx);
    78 DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx);
     77DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectDisableHW(CRContext *ctx, GLuint idFBO);
     78DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx, GLuint idFBO);
    7979
    8080DECLEXPORT(GLuint) STATE_APIENTRY crStateGetFramebufferHWID(GLuint id);
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_diff.c

    r39815 r41160  
    346346}
    347347
    348 CRContext * crStateSwichPrepare(CRContext *toCtx)
     348CRContext * crStateSwichPrepare(CRContext *toCtx, GLboolean fMultipleContexts, GLuint idFBO)
    349349{
    350350    CRContext *fromCtx = GetCurrentContext();
    351351
     352    if (!fMultipleContexts)
     353    {
    352354#ifdef CR_EXT_framebuffer_object
    353     if (fromCtx)
    354         crStateFramebufferObjectDisableHW(fromCtx);
    355 #endif
    356 
     355        if (fromCtx)
     356            crStateFramebufferObjectDisableHW(fromCtx, idFBO);
     357#endif
     358    }
    357359    return fromCtx;
    358360}
    359361
    360 void crStateSwichPostprocess(CRContext *fromCtx)
     362void crStateSwichPostprocess(CRContext *fromCtx, GLboolean fMultipleContexts, GLuint idFBO)
    361363{
    362364    CRContext *toCtx = GetCurrentContext();;
     
    364366        return;
    365367
     368    if (!fMultipleContexts)
     369    {
    366370#ifdef CR_EXT_framebuffer_object
    367     crStateFramebufferObjectReenableHW(fromCtx, toCtx);
    368 #endif
    369 }
     371        crStateFramebufferObjectReenableHW(fromCtx, toCtx, idFBO);
     372#endif
     373    }
     374}
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_framebuffer.c

    r41057 r41160  
    775775
    776776DECLEXPORT(void) STATE_APIENTRY
    777 crStateFramebufferObjectDisableHW(CRContext *ctx)
     777crStateFramebufferObjectDisableHW(CRContext *ctx, GLuint idFBO)
    778778{
    779779    GLboolean fAdjustDrawReadBuffers = GL_FALSE;
    780780
    781     if (ctx->framebufferobject.drawFB)
     781    if (ctx->framebufferobject.drawFB || idFBO)
    782782    {
    783783        diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0);
     
    785785    }
    786786
    787     if (ctx->framebufferobject.readFB)
     787    if (ctx->framebufferobject.readFB ||idFBO)
    788788    {
    789789        diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0);
     
    802802
    803803DECLEXPORT(void) STATE_APIENTRY
    804 crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx)
     804crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx, GLuint idFBO)
    805805{
    806806    GLboolean fAdjustDrawReadBuffers = GL_FALSE;
    807807
    808     if (fromCtx->framebufferobject.drawFB /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */
    809             && fromCtx->framebufferobject.drawFB == toCtx->framebufferobject.drawFB) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */
     808    if ((fromCtx->framebufferobject.drawFB) /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */
     809            && fromCtx->framebufferobject.drawFB == toCtx->framebufferobject.drawFB)  /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */
    810810    {
    811811        diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, toCtx->framebufferobject.drawFB->hwid);
    812812        fAdjustDrawReadBuffers = GL_TRUE;
    813813    }
    814 
    815     if (fromCtx->framebufferobject.readFB /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */
     814    else if (idFBO && !toCtx->framebufferobject.drawFB)
     815    {
     816        diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idFBO);
     817        fAdjustDrawReadBuffers = GL_TRUE;
     818    }
     819
     820    if ((fromCtx->framebufferobject.readFB) /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */
    816821            && fromCtx->framebufferobject.readFB == toCtx->framebufferobject.readFB) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */
    817822    {
    818823        diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, toCtx->framebufferobject.readFB->hwid);
     824        fAdjustDrawReadBuffers = GL_TRUE;
     825    }
     826    else if (idFBO && !toCtx->framebufferobject.readFB)
     827    {
     828        diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idFBO);
    819829        fAdjustDrawReadBuffers = GL_TRUE;
    820830    }
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