VirtualBox

Ignore:
Timestamp:
Sep 6, 2013 1:54:29 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: dummy window handling, shared context creation, window destruction fixes

Location:
trunk/src/VBox/HostServices/SharedOpenGL/render
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r48322 r48356  
    535535    WindowInfo *window;
    536536
    537     GLboolean showIt;
    538 
    539537    if (id <= 0)
    540538    {
     
    588586    if (pCtx->currentWindow==pWindow)
    589587    {
    590         renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, pCtx->BltInfo.Base.id);
    591         pCtx->currentWindow=0;
     588        WindowInfo* pDummy = renderspuGetDummyWindow(pCtx->BltInfo.Base.visualBits);
     589        if (pDummy)
     590        {
     591            renderspuPerformMakeCurrent(pDummy, 0, pCtx);
     592        }
     593        else
     594        {
     595            crWarning("failed to get dummy window");
     596            renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, pCtx->BltInfo.Base.id);
     597        }
    592598    }
    593599}
     
    596602{
    597603    GET_CONTEXT(pOldCtx);
     604    WindowInfo * pOldWindow = pOldCtx ? pOldCtx->currentWindow : NULL;
     605    CRASSERT(!pOldCtx == !pOldWindow);
    598606    /* ensure no concurrent draws can take place */
    599607    renderspuVBoxCompositorSet(window, NULL);
     
    606614    {
    607615        GET_CONTEXT(pNewCtx);
    608         if (pNewCtx!=pOldCtx)
    609         {
    610             renderspuMakeCurrent(pOldCtx&&pOldCtx->currentWindow ? pOldCtx->currentWindow->BltInfo.Base.id:CR_RENDER_DEFAULT_WINDOW_ID, 0,
    611                                      pOldCtx ? pOldCtx->BltInfo.Base.id:CR_RENDER_DEFAULT_CONTEXT_ID);
     616        WindowInfo * pNewWindow = pNewCtx ? pNewCtx->currentWindow : NULL;
     617        CRASSERT(!pNewCtx == !pNewWindow);
     618
     619        if (pOldWindow == window)
     620            renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, CR_RENDER_DEFAULT_CONTEXT_ID);
     621        else if (pNewCtx != pOldCtx || pOldWindow != pNewWindow)
     622        {
     623            if (pOldCtx)
     624                renderspuPerformMakeCurrent(pOldWindow, 0, pOldCtx);
     625            else
     626                renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, CR_RENDER_DEFAULT_CONTEXT_ID);
    612627        }
    613628    }
     
    17111726}
    17121727
     1728static void renderspuReparentWindowCB(unsigned long key, void *data1, void *data2)
     1729{
     1730    WindowInfo *pWindow = (WindowInfo *)data1;
     1731
     1732    renderspu_SystemReparentWindow(pWindow);
     1733}
     1734
    17131735DECLEXPORT(void) renderspuReparentWindow(GLint window)
    17141736{
     
    17251747
    17261748    renderspu_SystemReparentWindow(pWindow);
     1749
     1750    /* special case: reparent all internal windows as well */
     1751    if (window == CR_RENDER_DEFAULT_WINDOW_ID)
     1752    {
     1753        crHashtableWalk(render_spu.dummyWindowTable, renderspuReparentWindowCB, NULL);
     1754    }
    17271755}
    17281756
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c

    r48291 r48356  
    12221222    {
    12231223        LONG_PTR oldVal = SetWindowLongPtr(window->hWnd, GWLP_USERDATA, (LONG_PTR)window);
    1224         Assert(!oldVal && GetLastError() == NO_ERROR);
     1224        DWORD winEr = GetLastError();
     1225        Assert(!oldVal && winEr == NO_ERROR);
    12251226    }
    12261227
     
    13111312static GLboolean renderspuChkActivateSharedContext(ContextInfo *sharedContext)
    13121313{
    1313     GLint crWindow;
    13141314    WindowInfo *window;
    13151315
     
    13221322        renderspuChkActivateSharedContext(sharedContext->shared);
    13231323
    1324     crWindow = renderspuWindowCreate(sharedContext->visual->displayName, sharedContext->visual->visAttribs);
    1325     if (!crWindow)
    1326     {
    1327         crError("renderspuChkActivateSharedContext: renderspuWindowCreate failed!");
    1328         return GL_FALSE;
    1329     }
    1330 
    1331     window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, crWindow);
     1324    window = renderspuGetDummyWindow(sharedContext->visual->visAttribs);
    13321325    if (!window)
    13331326    {
    1334         crError("renderspuChkActivateSharedContext: crHashtableSearch failed!");
    1335         renderspuWindowDestroy(crWindow);
     1327        crError("renderspuChkActivateSharedContext: renderspuGetDummyWindow failed!");
    13361328        return GL_FALSE;
    13371329    }
     
    13451337    {
    13461338        crError( "Render SPU: (renderspuChkActivateSharedContext) Couldn't create the context for the window (error 0x%x)", GetLastError() );
    1347         renderspuWindowDestroy(crWindow);
    13481339        return GL_FALSE;
    13491340    }
     
    13681359             * various tables. This is hack which just hides the root case.
    13691360             */
    1370 //            crWarning("Recreating window in renderspu_SystemMakeCurrent\n");
     1361            crWarning("Recreating window in renderspu_SystemMakeCurrent\n");
    13711362            renderspu_SystemDestroyWindow( window );
    13721363            renderspu_SystemVBoxCreateWindow( context->visual, window->visible, window );
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