VirtualBox

Ignore:
Timestamp:
Jan 29, 2014 8:23:21 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: correct way of dealing with CreateInfo

File:
1 edited

Legend:

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

    r50095 r50277  
    2929
    3030    dpyName = "";
    31     if (cr_server.fVisualBitsDefault)
    32         visualBits = cr_server.fVisualBitsDefault;
    3331
    3432    if (shareCtx > 0) {
     
    4644    pContextInfo->currentMural = NULL;
    4745
    48     pContextInfo->CreateInfo.visualBits = visualBits;
     46    pContextInfo->CreateInfo.requestedVisualBits = visualBits;
     47
     48    if (cr_server.fVisualBitsDefault)
     49        visualBits = cr_server.fVisualBitsDefault;
     50
     51    pContextInfo->CreateInfo.realVisualBits = visualBits;
    4952
    5053    /* Since the Cr server serialized all incoming clients/contexts into
     
    5356     */
    5457    if (cr_server.firstCallCreateContext) {
    55         cr_server.MainContextInfo.CreateInfo.visualBits = visualBits;
     58        cr_server.MainContextInfo.CreateInfo.realVisualBits = visualBits;
    5659        cr_server.MainContextInfo.SpuContext = cr_server.head_spu->dispatch_table.
    57             CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.visualBits, shareCtx);
     60            CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.realVisualBits, shareCtx);
    5861        if (cr_server.MainContextInfo.SpuContext < 0) {
    5962            crWarning("crServerDispatchCreateContext() failed.");
     
    7073    else {
    7174        /* second or third or ... context */
    72         if (!cr_server.bUseMultipleContexts && ((visualBits & cr_server.MainContextInfo.CreateInfo.visualBits) != visualBits)) {
     75        if (!cr_server.bUseMultipleContexts && ((visualBits & cr_server.MainContextInfo.CreateInfo.realVisualBits) != visualBits)) {
    7376            int oldSpuContext;
    74 
     77            /* should never be here */
     78            CRASSERT(0);
    7579            /* the new context needs new visual attributes */
    76             cr_server.MainContextInfo.CreateInfo.visualBits |= visualBits;
     80            cr_server.MainContextInfo.CreateInfo.realVisualBits |= visualBits;
    7781            crWarning("crServerDispatchCreateContext requires new visual (0x%x).",
    78                     cr_server.MainContextInfo.CreateInfo.visualBits);
     82                    cr_server.MainContextInfo.CreateInfo.realVisualBits);
    7983
    8084            /* Here, we used to just destroy the old rendering context.
     
    9195            oldSpuContext = cr_server.MainContextInfo.SpuContext;
    9296            cr_server.MainContextInfo.SpuContext = cr_server.head_spu->dispatch_table.
    93                 CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.visualBits, cr_server.MainContextInfo.SpuContext);
     97                CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.realVisualBits, cr_server.MainContextInfo.SpuContext);
    9498            /* destroy old rendering context */
    9599            cr_server.head_spu->dispatch_table.DestroyContext(oldSpuContext);
     
    108112    if (cr_server.bUseMultipleContexts) {
    109113        pContextInfo->SpuContext = cr_server.head_spu->dispatch_table.
    110                 CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.visualBits, cr_server.MainContextInfo.SpuContext);
     114                CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.realVisualBits, cr_server.MainContextInfo.SpuContext);
    111115        if (pContextInfo->SpuContext < 0) {
    112116            crWarning("crServerDispatchCreateContext() failed.");
     
    136140
    137141        pContextInfo->pContext = newCtx;
    138         pContextInfo->CreateInfo.visualBits = visualBits;
     142        Assert(pContextInfo->CreateInfo.realVisualBits == visualBits);
    139143        pContextInfo->CreateInfo.externalID = retVal;
    140144        pContextInfo->CreateInfo.pszDpyName = dpyName ? crStrdup(dpyName) : NULL;
     
    202206    if (cr_server.currentCtxInfo == crCtxInfo)
    203207    {
    204         CRMuralInfo *dummyMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     208        CRMuralInfo *dummyMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    205209        crServerPerformMakeCurrent(dummyMural, &cr_server.MainContextInfo);
    206210        CRASSERT(cr_server.currentCtxInfo == &cr_server.MainContextInfo);
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