VirtualBox

Ignore:
Timestamp:
Sep 4, 2012 7:20:15 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL/win: Intel GPU work-arounds/fixes

File:
1 edited

Legend:

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

    r41073 r43181  
    413413    window->hWnd = NULL;
    414414    window->visual = NULL;
     415    if (window->hRgn)
     416    {
     417        DeleteObject(window->hRgn);
     418        window->hRgn = NULL;
     419    }
    415420}
    416421
     
    687692    int       window_plus_caption_height;
    688693
     694    window->hRgn = NULL;
    689695    window->visual = visual;
    690696    window->nativeWindow = 0;
     
    835841    }
    836842
    837     if (showIt) {
    838         /* NO ERROR CODE FOR SHOWWINDOW */
    839         crDebug( "Render SPU: Showing the window" );
    840         crDebug("renderspu_SystemCreateWindow: showwindow: %x", window->hWnd);
    841         ShowWindow( window->hWnd, SW_SHOWNORMAL );
    842     }
     843    /* Intel drivers require a window to be visible for proper 3D rendering,
     844     * so set it visible and handle the visibility with visible regions (see below) */
     845    ShowWindow( window->hWnd, SW_SHOWNORMAL );
    843846
    844847    SetForegroundWindow( window->hWnd );
     
    863866        crError( "Render SPU: Couldn't set up the device context!  Yikes!" );
    864867        return GL_FALSE;
     868    }
     869
     870    window->visible = showIt;
     871
     872    if (!showIt)
     873    {
     874        renderspu_SystemShowWindow( window, 0 );
     875        if (window->height <= 0 || window->width <= 0)
     876        {
     877            renderspu_SystemWindowSize(window,
     878                    window->width > 0 ? window->width : 4,
     879                    window->height > 0 ? window->height : 4);
     880        }
     881    }
     882    else
     883    {
     884        crDebug( "Render SPU: Showing the window" );
     885        crDebug("renderspu_SystemCreateWindow: showwindow: %x", window->hWnd);
    865886    }
    866887
     
    879900    int       window_plus_caption_height;
    880901
     902    window->hRgn = NULL;
    881903    window->visual = visual;
    882904    window->nativeWindow = 0;
     
    10821104    }
    10831105
    1084     if (showIt) {
    1085         /* NO ERROR CODE FOR SHOWWINDOW */
    1086         crDebug( "Render SPU: Showing the window" );
    1087         crDebug("renderspu_SystemVBoxCreateWindow: showwindow: %x", window->hWnd);
    1088         ShowWindow( window->hWnd, SW_SHOWNORMAL );
    1089     }
     1106    /* Intel drivers require a window to be visible for proper 3D rendering,
     1107     * so set it visible and handle the visibility with visible regions (see below) */
     1108    ShowWindow( window->hWnd, SW_SHOWNORMAL );
    10901109
    10911110    //SetForegroundWindow( visual->hWnd );
     
    11121131    }
    11131132
     1133    window->visible = showIt;
     1134
     1135    if (!showIt)
     1136    {
     1137        renderspu_SystemShowWindow( window, 0 );
     1138        if (window->height <= 0 || window->width <= 0)
     1139        {
     1140            renderspu_SystemWindowSize(window,
     1141                    window->width > 0 ? window->width : 4,
     1142                    window->height > 0 ? window->height : 4);
     1143        }
     1144    }
     1145    else
     1146    {
     1147        crDebug( "Render SPU: Showing the window" );
     1148        crDebug("renderspu_SystemCreateWindow: showwindow: %x", window->hWnd);
     1149    }
     1150
    11141151    return GL_TRUE;
    11151152}
    1116 
    11171153
    11181154/* Either show or hide the render SPU's window. */
     
    11221158    {
    11231159        crDebug("SHOW renderspu_SystemShowWindow: %x", window->hWnd);
    1124         ShowWindow( window->hWnd, SW_SHOWNORMAL );
     1160        SetWindowRgn(window->hWnd, window->hRgn, true);
    11251161    }
    11261162    else
    11271163    {
     1164        HRGN hRgn;
    11281165        crDebug("HIDE renderspu_SystemShowWindow: %x", window->hWnd);
    1129         ShowWindow( window->hWnd, SW_HIDE );
    1130     }
     1166        hRgn = CreateRectRgn(0, 0, 0, 0);
     1167        SetWindowRgn(window->hWnd, hRgn, true);
     1168        DeleteObject(hRgn);
     1169    }
     1170    window->visible = showIt;
    11311171}
    11321172
     
    12231263             * various tables. This is hack which just hides the root case.
    12241264             */
    1225             crDebug("Recreating window in renderspu_SystemMakeCurrent\n");
     1265            crWarning("Recreating window in renderspu_SystemMakeCurrent\n");
    12261266            renderspu_SystemDestroyWindow( window );
    12271267            renderspu_SystemVBoxCreateWindow( context->visual, window->visible, window );
     
    14111451    CRASSERT(window->visual);
    14121452
     1453    if (window->hRgn)
     1454    {
     1455        DeleteObject(window->hRgn);
     1456        window->hRgn = NULL;
     1457    }
     1458
    14131459    hRgn = CreateRectRgn(0, 0, 0, 0);
    14141460
     
    14201466    }
    14211467
    1422     SetWindowRgn(window->hWnd, hRgn, true);
     1468    if (window->visible)
     1469        SetWindowRgn(window->hWnd, hRgn, true);
     1470
    14231471    crDebug("Render SPU: SetWindowRgn (%x, cRects=%i)", window->hWnd, cRects);
     1472
     1473    window->hRgn = hRgn;
    14241474}
    14251475
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