VirtualBox

Changeset 41258 in vbox for trunk/src


Ignore:
Timestamp:
May 11, 2012 4:39:12 PM (13 years ago)
Author:
vboxsync
Message:

crOpenGL: fix VRDP+3D for Intel graphics, more VRDP+3D fixes

Location:
trunk/src/VBox
Files:
10 edited

Legend:

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

    r41128 r41258  
    105105    char   *pszDpyName;
    106106    GLint   visualBits;
    107     int32_t internalID;
     107    int32_t externalID;
    108108} CRCreateInfo_t;
    109109
     
    183183    GLboolean bIsInLoadingState; /* Indicates if we're in process of loading VM snapshot */
    184184    GLboolean bIsInSavingState; /* Indicates if we're in process of saving VM snapshot */
     185    GLboolean bForceMakeCurrentOnClientSwitch;
    185186    CRContextInfo *currentCtxInfo;
    186187    GLint currentWindow;
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_framebuffer.c

    r41160 r41258  
    804804crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx, GLuint idFBO)
    805805{
    806     GLboolean fAdjustDrawReadBuffers = GL_FALSE;
     806    GLuint idReadBuffer = 0, idDrawBuffer = 0;
    807807
    808808    if ((fromCtx->framebufferobject.drawFB) /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */
     
    810810    {
    811811        diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, toCtx->framebufferobject.drawFB->hwid);
    812         fAdjustDrawReadBuffers = GL_TRUE;
     812        idDrawBuffer = toCtx->framebufferobject.drawFB->drawbuffer[0];
    813813    }
    814814    else if (idFBO && !toCtx->framebufferobject.drawFB)
    815815    {
    816816        diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idFBO);
    817         fAdjustDrawReadBuffers = GL_TRUE;
     817        idDrawBuffer = GL_COLOR_ATTACHMENT0;
    818818    }
    819819
     
    822822    {
    823823        diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, toCtx->framebufferobject.readFB->hwid);
    824         fAdjustDrawReadBuffers = GL_TRUE;
     824        idReadBuffer = toCtx->framebufferobject.readFB->readbuffer;
    825825    }
    826826    else if (idFBO && !toCtx->framebufferobject.readFB)
    827827    {
    828828        diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idFBO);
    829         fAdjustDrawReadBuffers = GL_TRUE;
    830     }
    831 
    832     if (fAdjustDrawReadBuffers)
    833     {
    834         diff_api.DrawBuffer(toCtx->framebufferobject.drawFB?toCtx->framebufferobject.drawFB->drawbuffer[0]:toCtx->buffer.drawBuffer);
    835         diff_api.ReadBuffer(toCtx->framebufferobject.readFB?toCtx->framebufferobject.readFB->readbuffer:toCtx->buffer.readBuffer);
    836     }
     829        idReadBuffer = GL_COLOR_ATTACHMENT0;
     830    }
     831
     832    if (idDrawBuffer)
     833        diff_api.DrawBuffer(idDrawBuffer);
     834    if (idReadBuffer)
     835        diff_api.ReadBuffer(idReadBuffer);
    837836
    838837    if (fromCtx->framebufferobject.renderbuffer /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c

    r41160 r41258  
    123123        pContextInfo->pContext = newCtx;
    124124        pContextInfo->CreateInfo.visualBits = visualBits;
    125         pContextInfo->CreateInfo.internalID = newCtx->id;
     125        pContextInfo->CreateInfo.externalID = retVal;
    126126        pContextInfo->CreateInfo.pszDpyName = dpyName ? crStrdup(dpyName) : NULL;
    127127        crHashtableAdd(cr_server.contextTable, retVal, pContextInfo);
     
    268268}
    269269
    270 
    271270void SERVER_DISPATCH_APIENTRY
    272271crServerDispatchMakeCurrent( GLint window, GLint nativeWindow, GLint context )
     
    292291    }
    293292    else {
     293#if 0
    294294        oldMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, cr_server.currentWindow);
    295295        if (oldMural && oldMural->bUseFBO && crServerSupportRedirMuralFBO())
     
    308308        window = -1;
    309309        mural = NULL;
     310#endif
     311        cr_server.bForceMakeCurrentOnClientSwitch = GL_TRUE;
    310312        return;
    311313    }
     314
     315    cr_server.bForceMakeCurrentOnClientSwitch = GL_FALSE;
    312316
    313317    ctx = ctxInfo->pContext;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r41128 r41258  
    288288    cr_server.firstCallCreateContext = GL_TRUE;
    289289    cr_server.firstCallMakeCurrent = GL_TRUE;
     290    cr_server.bForceMakeCurrentOnClientSwitch = GL_FALSE;
    290291
    291292    /*
     
    360361    cr_server.bIsInLoadingState = GL_FALSE;
    361362    cr_server.bIsInSavingState  = GL_FALSE;
    362 
     363    cr_server.bForceMakeCurrentOnClientSwitch = GL_FALSE;
    363364
    364365    cr_server.pCleanupClient = NULL;
     
    728729{
    729730    CRContextInfo *pContextInfo = (CRContextInfo *)data1;
    730     CRCreateInfo_t *pCreateInfo = &pContextInfo->CreateInfo;
    731     crVBoxServerSaveCreateInfoCB(key, pCreateInfo, data2);
     731    CRCreateInfo_t CreateInfo = pContextInfo->CreateInfo;
     732    /* saved state contains internal id */
     733    CreateInfo.externalID = pContextInfo->pContext->id;
     734    crVBoxServerSaveCreateInfoCB(key, &CreateInfo, data2);
    732735}
    733736
     
    966969        }
    967970
    968         ctxID = crServerDispatchCreateContextEx(createInfo.pszDpyName, createInfo.visualBits, 0, key, createInfo.internalID);
     971        ctxID = crServerDispatchCreateContextEx(createInfo.pszDpyName, createInfo.visualBits, 0, key, createInfo.externalID /* <-saved state stores internal id here*/);
    969972        CRASSERT((int64_t)ctxID == (int64_t)key);
    970973
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c

    r41109 r41258  
    284284#endif
    285285
     286# ifdef DEBUG_misha
     287# define CR_CHECK_BLITS
     288#  include <iprt/assert.h>
     289#  undef CRASSERT /* iprt assert's int3 are inlined that is why are more convenient to use since they can be easily disabled individually */
     290#  define CRASSERT Assert
     291# endif
     292
     293
    286294void SERVER_DISPATCH_APIENTRY
    287295crServerDispatchCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
     
    508516}
    509517
     518#ifdef CR_CHECK_BLITS
     519void crDbgFree(void *pvData)
     520{
     521    crFree(pvData);
     522}
     523
     524void crDbgGetTexImage2D(GLint texTarget, GLint texName, GLvoid **ppvImage, GLint *pw, GLint *ph)
     525{
     526    SPUDispatchTable *gl = &cr_server.head_spu->dispatch_table;
     527    GLint ppb, pub, dstw, dsth, otex;
     528    GLint pa, pr, psp, psr, ua, ur, usp, usr;
     529    GLvoid *pvImage;
     530    GLint rfb, dfb, rb, db;
     531
     532    gl->GetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &rfb);
     533    gl->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &dfb);
     534    gl->GetIntegerv(GL_READ_BUFFER, &rb);
     535    gl->GetIntegerv(GL_DRAW_BUFFER, &db);
     536
     537    gl->BindFramebufferEXT(GL_READ_FRAMEBUFFER_BINDING_EXT, 0);
     538    gl->BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_BINDING_EXT, 0);
     539    gl->ReadBuffer(GL_BACK);
     540    gl->DrawBuffer(GL_BACK);
     541
     542    gl->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &ppb);
     543    gl->GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &pub);
     544    gl->GetIntegerv(GL_TEXTURE_BINDING_2D, &otex);
     545
     546    gl->GetIntegerv(GL_PACK_ROW_LENGTH, &pr);
     547    gl->GetIntegerv(GL_PACK_ALIGNMENT, &pa);
     548    gl->GetIntegerv(GL_PACK_SKIP_PIXELS, &psp);
     549    gl->GetIntegerv(GL_PACK_SKIP_ROWS, &psr);
     550
     551    gl->GetIntegerv(GL_UNPACK_ROW_LENGTH, &ur);
     552    gl->GetIntegerv(GL_UNPACK_ALIGNMENT, &ua);
     553    gl->GetIntegerv(GL_UNPACK_SKIP_PIXELS, &usp);
     554    gl->GetIntegerv(GL_UNPACK_SKIP_ROWS, &usr);
     555
     556    gl->BindTexture(texTarget, texName);
     557    gl->GetTexLevelParameteriv(texTarget, 0, GL_TEXTURE_WIDTH, &dstw);
     558    gl->GetTexLevelParameteriv(texTarget, 0, GL_TEXTURE_HEIGHT, &dsth);
     559
     560    gl->PixelStorei(GL_PACK_ROW_LENGTH, 0);
     561    gl->PixelStorei(GL_PACK_ALIGNMENT, 1);
     562    gl->PixelStorei(GL_PACK_SKIP_PIXELS, 0);
     563    gl->PixelStorei(GL_PACK_SKIP_ROWS, 0);
     564
     565    gl->PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
     566    gl->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
     567    gl->PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
     568    gl->PixelStorei(GL_UNPACK_SKIP_ROWS, 0);
     569
     570    gl->BindBufferARB(GL_PIXEL_PACK_BUFFER, 0);
     571    gl->BindBufferARB(GL_PIXEL_UNPACK_BUFFER, 0);
     572
     573    pvImage = crAlloc(4*dstw*dsth);
     574    gl->GetTexImage(texTarget, 0, GL_BGRA, GL_UNSIGNED_BYTE, pvImage);
     575
     576    gl->BindTexture(texTarget, otex);
     577
     578    gl->PixelStorei(GL_PACK_ROW_LENGTH, pr);
     579    gl->PixelStorei(GL_PACK_ALIGNMENT, pa);
     580    gl->PixelStorei(GL_PACK_SKIP_PIXELS, psp);
     581    gl->PixelStorei(GL_PACK_SKIP_ROWS, psr);
     582
     583    gl->PixelStorei(GL_UNPACK_ROW_LENGTH, ur);
     584    gl->PixelStorei(GL_UNPACK_ALIGNMENT, ua);
     585    gl->PixelStorei(GL_UNPACK_SKIP_PIXELS, usp);
     586    gl->PixelStorei(GL_UNPACK_SKIP_ROWS, usr);
     587
     588    gl->BindBufferARB(GL_PIXEL_PACK_BUFFER, ppb);
     589    gl->BindBufferARB(GL_PIXEL_UNPACK_BUFFER, pub);
     590
     591    gl->BindFramebufferEXT(GL_READ_FRAMEBUFFER_BINDING_EXT, rfb);
     592    gl->BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_BINDING_EXT, dfb);
     593    gl->ReadBuffer(rb);
     594    gl->DrawBuffer(db);
     595
     596    *ppvImage = pvImage;
     597    *pw = dstw;
     598    *ph = dsth;
     599}
     600
     601DECLEXPORT(void) crDbgPrint(const char *format, ... )
     602{
     603    va_list args;
     604    static char txt[8092];
     605
     606    va_start( args, format );
     607    vsprintf( txt, format, args );
     608
     609    OutputDebugString(txt);
     610}
     611
     612void crDbgDumpImage2D(const char* pszDesc, const void *pvData, uint32_t width, uint32_t height, uint32_t bpp, uint32_t pitch)
     613{
     614    crDbgPrint("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">%s</exec>, ( !vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d )\n",
     615            pvData, width, height, bpp, pitch,
     616            pszDesc,
     617            pvData, width, height, bpp, pitch);
     618}
     619
     620void crDbgDumpTexImage2D(const char* pszDesc, GLint texTarget, GLint texName, GLboolean fBreak)
     621{
     622    GLvoid *pvImage;
     623    GLint w, h;
     624    crDbgGetTexImage2D(texTarget, texName, &pvImage, &w, &h);
     625    crDbgPrint("%s target(%d), name(%d), width(%d), height(%d)", pszDesc, texTarget, texName, w, h);
     626    crDbgDumpImage2D("texture data", pvImage, w, h, 32, (32 * w)/8);
     627    if (fBreak)
     628    {
     629        CRASSERT(0);
     630    }
     631    crDbgFree(pvImage);
     632}
     633#endif
     634
    510635void SERVER_DISPATCH_APIENTRY
    511636crServerDispatchBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
     
    513638                                   GLbitfield mask, GLenum filter)
    514639{
     640#ifdef CR_CHECK_BLITS
     641//    {
     642        SPUDispatchTable *gl = &cr_server.head_spu->dispatch_table;
     643        GLint rfb=0, dfb=0, dtex=0, dlev=-1, rtex=0, rlev=-1, rb=0, db=0, ppb=0, pub=0, vp[4], otex, dstw, dsth;
     644        GLint sdtex=0, srtex=0;
     645        GLenum dStatus, rStatus;
     646        CRContext *ctx = crStateGetCurrent();
     647
     648        CRTextureObj *tobj = 0;
     649        CRTextureLevel *tl = 0;
     650        GLint id, tuId, pbufId, pbufIdHw, ubufId, ubufIdHw, width, height, depth;
     651
     652        crDebug("===StateTracker===");
     653        crDebug("Current TU: %i", ctx->texture.curTextureUnit);
     654
     655        tobj = ctx->texture.unit[ctx->texture.curTextureUnit].currentTexture2D;
     656        CRASSERT(tobj);
     657        tl = &tobj->level[0][0];
     658        crDebug("Texture %i(hw %i), w=%i, h=%i", tobj->id, tobj->hwid, tl->width, tl->height, tl->depth);
     659
     660        if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     661        {
     662            pbufId = ctx->bufferobject.packBuffer->hwid;
     663        }
     664        else
     665        {
     666            pbufId = 0;
     667        }
     668        crDebug("Pack BufferId %i", pbufId);
     669
     670        if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     671        {
     672            ubufId = ctx->bufferobject.unpackBuffer->hwid;
     673        }
     674        else
     675        {
     676            ubufId = 0;
     677        }
     678        crDebug("Unpack BufferId %i", ubufId);
     679
     680        crDebug("===GPU===");
     681        cr_server.head_spu->dispatch_table.GetIntegerv(GL_ACTIVE_TEXTURE, &tuId);
     682        crDebug("Current TU: %i", tuId - GL_TEXTURE0_ARB);
     683        CRASSERT(tuId - GL_TEXTURE0_ARB == ctx->texture.curTextureUnit);
     684
     685        cr_server.head_spu->dispatch_table.GetIntegerv(GL_TEXTURE_BINDING_2D, &id);
     686        cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
     687        cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height);
     688        cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_DEPTH, &depth);
     689        crDebug("Texture: %i, w=%i, h=%i, d=%i", id, width, height, depth);
     690        CRASSERT(id == tobj->hwid);
     691        CRASSERT(width == tl->width);
     692        CRASSERT(height == tl->height);
     693        CRASSERT(depth == tl->depth);
     694
     695        cr_server.head_spu->dispatch_table.GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &pbufIdHw);
     696        crDebug("Hw Pack BufferId %i", pbufIdHw);
     697        CRASSERT(pbufIdHw == pbufId);
     698
     699        cr_server.head_spu->dispatch_table.GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &ubufIdHw);
     700        crDebug("Hw Unpack BufferId %i", ubufIdHw);
     701        CRASSERT(ubufIdHw == ubufId);
     702
     703        gl->GetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &rfb);
     704        gl->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &dfb);
     705        gl->GetIntegerv(GL_READ_BUFFER, &rb);
     706        gl->GetIntegerv(GL_DRAW_BUFFER, &db);
     707
     708        gl->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &ppb);
     709        gl->GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &pub);
     710
     711        gl->GetIntegerv(GL_VIEWPORT, &vp[0]);
     712
     713        gl->GetIntegerv(GL_TEXTURE_BINDING_2D, &otex);
     714
     715        gl->GetFramebufferAttachmentParameterivEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, &dtex);
     716        gl->GetFramebufferAttachmentParameterivEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT, &dlev);
     717        dStatus = gl->CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT);
     718
     719        gl->GetFramebufferAttachmentParameterivEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, &rtex);
     720        gl->GetFramebufferAttachmentParameterivEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT, &rlev);
     721        rStatus = gl->CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER_EXT);
     722
     723        if (dtex)
     724        {
     725            CRASSERT(!dlev);
     726        }
     727
     728        if (rtex)
     729        {
     730            CRASSERT(!rlev);
     731        }
     732
     733        if (ctx->framebufferobject.drawFB)
     734        {
     735            CRASSERT(dfb);
     736            CRASSERT(ctx->framebufferobject.drawFB->hwid == dfb);
     737            CRASSERT(ctx->framebufferobject.drawFB->drawbuffer[0] == db);
     738
     739            CRASSERT(dStatus==GL_FRAMEBUFFER_COMPLETE_EXT);
     740            CRASSERT(db==GL_COLOR_ATTACHMENT0_EXT);
     741
     742            CRASSERT(ctx->framebufferobject.drawFB->color[0].type == GL_TEXTURE);
     743            CRASSERT(ctx->framebufferobject.drawFB->color[0].level == 0);
     744            sdtex = ctx->framebufferobject.drawFB->color[0].name;
     745            sdtex = crStateGetTextureHWID(sdtex);
     746
     747            CRASSERT(sdtex);
     748        }
     749        else
     750        {
     751            CRASSERT(!dfb);
     752        }
     753
     754        if (ctx->framebufferobject.readFB)
     755        {
     756            CRASSERT(rfb);
     757            CRASSERT(ctx->framebufferobject.readFB->hwid == rfb);
     758            CRASSERT(ctx->framebufferobject.readFB->readbuffer == rb);
     759
     760            CRASSERT(rStatus==GL_FRAMEBUFFER_COMPLETE_EXT);
     761            CRASSERT(rb==GL_COLOR_ATTACHMENT0_EXT);
     762
     763            CRASSERT(ctx->framebufferobject.readFB->color[0].type == GL_TEXTURE);
     764            CRASSERT(ctx->framebufferobject.readFB->color[0].level == 0);
     765            srtex = ctx->framebufferobject.readFB->color[0].name;
     766            srtex = crStateGetTextureHWID(srtex);
     767
     768            CRASSERT(srtex);
     769        }
     770        else
     771        {
     772            CRASSERT(!rfb);
     773        }
     774
     775        CRASSERT(sdtex == dtex);
     776        CRASSERT(srtex == rtex);
     777
     778//        crDbgDumpTexImage2D("==> src tex:", GL_TEXTURE_2D, rtex, true);
     779//        crDbgDumpTexImage2D("==> dst tex:", GL_TEXTURE_2D, dtex, true);
     780
     781//    }
     782#endif
    515783#ifdef CR_DUMP_BLITS
    516784    SPUDispatchTable *gl = &cr_server.head_spu->dispatch_table;
     
    586854                                                          mask, filter);
    587855
     856//#ifdef CR_CHECK_BLITS
     857//    crDbgDumpTexImage2D("<== src tex:", GL_TEXTURE_2D, rtex, true);
     858//    crDbgDumpTexImage2D("<== dst tex:", GL_TEXTURE_2D, dtex, true);
     859//#endif
    588860#ifdef CR_DUMP_BLITS
    589861    gl->BindTexture(GL_TEXTURE_2D, dtex);
     
    595867#endif
    596868}
     869
     870void SERVER_DISPATCH_APIENTRY crServerDispatchDrawBuffer( GLenum mode )
     871{
     872    crStateDrawBuffer( mode );
     873
     874    if (cr_server.curClient->currentMural->bUseFBO && crServerIsRedirectedToFBO()
     875            && cr_server.curClient->currentMural->idFBO
     876            && !crStateGetCurrent()->framebufferobject.drawFB)
     877    {
     878        switch (mode)
     879        {
     880            case GL_BACK:
     881            case GL_BACK_LEFT:
     882                mode = GL_COLOR_ATTACHMENT0;
     883                break;
     884            case GL_FRONT:
     885            case GL_FRONT_LEFT:
     886                crWarning("GL_FRONT not supported for FBO mode! (0x%x)", mode);
     887                mode = GL_COLOR_ATTACHMENT0;
     888                break;
     889            default:
     890                crWarning("unexpected mode! 0x%x", mode);
     891                break;
     892        }
     893    }
     894
     895#ifdef DEBUG_misha
     896    cr_server.head_spu->dispatch_table.GetError();
     897#endif
     898    cr_server.head_spu->dispatch_table.DrawBuffer( mode );
     899#ifdef DEBUG_misha
     900    {
     901        GLint db = 0;
     902        GLenum err = cr_server.head_spu->dispatch_table.GetError();
     903        cr_server.head_spu->dispatch_table.GetIntegerv(GL_DRAW_BUFFER, &db);
     904        Assert(db == mode);
     905    }
     906#endif
     907}
     908
     909void SERVER_DISPATCH_APIENTRY crServerDispatchReadBuffer( GLenum mode )
     910{
     911    crStateReadBuffer( mode );
     912
     913    if (cr_server.curClient->currentMural->bUseFBO && crServerIsRedirectedToFBO()
     914            && cr_server.curClient->currentMural->idFBO
     915            && !crStateGetCurrent()->framebufferobject.readFB)
     916    {
     917        switch (mode)
     918        {
     919            case GL_BACK:
     920            case GL_BACK_LEFT:
     921                mode = GL_COLOR_ATTACHMENT0;
     922                break;
     923            case GL_FRONT:
     924            case GL_FRONT_LEFT:
     925                crWarning("GL_FRONT not supported for FBO mode!");
     926                mode = GL_COLOR_ATTACHMENT0;
     927                break;
     928            default:
     929                crWarning("unexpected mode! 0x%x", mode);
     930                break;
     931        }
     932    }
     933#ifdef DEBUG_misha
     934    cr_server.head_spu->dispatch_table.GetError();
     935#endif
     936    cr_server.head_spu->dispatch_table.ReadBuffer( mode );
     937#ifdef DEBUG_misha
     938    {
     939        GLint rb = 0;
     940        GLenum err = cr_server.head_spu->dispatch_table.GetError();
     941        cr_server.head_spu->dispatch_table.GetIntegerv(GL_READ_BUFFER, &rb);
     942        Assert(rb == mode);
     943    }
     944#endif
     945}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c

    r41160 r41258  
    167167    else
    168168    {
    169         if (!mural->bUseFBO)
    170         {
    171             crServerRedirMuralFBO(mural, GL_TRUE);
    172         }
     169        if (mural->spuWindow)
     170        {
     171            if (!mural->bUseFBO)
     172            {
     173                crServerRedirMuralFBO(mural, GL_TRUE);
     174            }
     175            else
     176            {
     177                if (mural->width!=mural->fboWidth
     178                    || mural->height!=mural->height)
     179                {
     180                    crServerRedirMuralFBO(mural, GL_FALSE);
     181                    crServerDeleteMuralFBO(mural);
     182                    crServerRedirMuralFBO(mural, GL_TRUE);
     183                }
     184            }
     185        }
     186#ifdef DEBUG_misha
    173187        else
    174188        {
    175             if (mural->width!=mural->fboWidth
    176                 || mural->height!=mural->height)
    177             {
    178                 crServerRedirMuralFBO(mural, GL_FALSE);
    179                 crServerDeleteMuralFBO(mural);
    180                 crServerRedirMuralFBO(mural, GL_TRUE);
    181             }
    182         }
     189            Assert(!mural->bUseFBO);
     190        }
     191#endif
    183192
    184193        if (!mural->bUseFBO)
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py

    r38142 r41258  
    7676        CRASSERT(tablesize/sizeof(%s)==1);
    7777        fboid = crStateFBOHWIDtoID((GLuint) *get_values);
    78         if (crServerIsRedirectedToFBO()
     78        if (cr_server.curClient->currentMural->bUseFBO
     79            && crServerIsRedirectedToFBO()
    7980            && fboid==cr_server.curClient->currentMural->idFBO)
    8081        {
     
    8283        }
    8384        *get_values = (%s) fboid;
     85    }
     86    else if (GL_READ_BUFFER==pname)
     87    {
     88        if (cr_server.curClient->currentMural->bUseFBO && crServerIsRedirectedToFBO()
     89            && cr_server.curClient->currentMural->idFBO
     90            && !crStateGetCurrent()->framebufferobject.readFB)
     91        {
     92            *get_values = (%s) crStateGetCurrent()->buffer.readBuffer;
     93        }
     94    }
     95    else if (GL_DRAW_BUFFER==pname)
     96    {
     97        if (cr_server.curClient->currentMural->bUseFBO && crServerIsRedirectedToFBO()
     98            && cr_server.curClient->currentMural->idFBO
     99            && !crStateGetCurrent()->framebufferobject.drawFB)
     100        {
     101            *get_values = (%s) crStateGetCurrent()->buffer.drawBuffer;
     102        }
    84103    }
    85104    else if (GL_RENDERBUFFER_BINDING_EXT==pname)
     
    114133        }
    115134    }
    116     """ % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index])
     135    """ % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index])
    117136    print '\tcrServerReturnValue( get_values, tablesize );'
    118137    print '\tcrFree(get_values);'
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special

    r34725 r41258  
    247247BlitFramebufferEXT
    248248EndList
     249DrawBuffer
     250ReadBuffer
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.c

    r41253 r41258  
    546546             CRContextInfo *clientCtxInfo = cr_server.curClient->currentCtxInfo;
    547547             if (clientCtxInfo != cr_server.currentCtxInfo
    548                      || clientWindow != cr_server.currentWindow) {
     548                     || clientWindow != cr_server.currentWindow
     549                     || cr_server.bForceMakeCurrentOnClientSwitch) {
    549550                 crServerDispatchMakeCurrent(clientWindow, 0, clientContext);
    550551                 /*
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r41139 r41258  
    274274
    275275    cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height);
     276
     277    /* Work-around Intel driver bug */
     278    CRASSERT(cr_server.curClient->currentMural == mural);
     279    if (cr_server.curClient->currentMural == mural)
     280    {
     281        CRContextInfo * ctxInfo = cr_server.currentCtxInfo;
     282        CRASSERT(ctxInfo);
     283        crServerDispatchMakeCurrent(mural->spuWindow, 0, ctxInfo->CreateInfo.externalID);
     284    }
    276285}
    277286
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