VirtualBox

Changeset 25216 in vbox


Ignore:
Timestamp:
Dec 7, 2009 4:42:26 PM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: fix black screen after snapshots loading for apps using compiled vertex arrays

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c

    r23123 r25216  
    785785    {
    786786        CRClientPointer *cp;
     787        GLboolean locked = toCtx->client.array.locked;
    787788
    788789        crHashtableWalk(to->buffers, crStateBufferObjectSyncCB, to);
     
    791792        /*@todo, move to state_client.c*/
    792793
     794
     795        /*@todo, patch dirty bits after snapshot loading instead*/
     796        if (toCtx->client.array.v.enabled)
     797        {
     798            diff_api.EnableClientState(GL_VERTEX_ARRAY);
     799        }
     800
    793801        cp = &toCtx->client.array.v;
    794         if (cp->buffer->name)
     802        if (cp->buffer->name || locked)
    795803        {
    796804            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     
    799807
    800808        cp = &toCtx->client.array.c;
    801         if (cp->buffer->name)
     809        if (cp->buffer->name || locked)
    802810        {
    803811            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     
    806814
    807815        cp = &toCtx->client.array.f;
    808         if (cp->buffer->name)
     816        if (cp->buffer->name || locked)
    809817        {
    810818            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     
    813821
    814822        cp = &toCtx->client.array.s;
    815         if (cp->buffer->name)
     823        if (cp->buffer->name || locked)
    816824        {
    817825            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     
    820828
    821829        cp = &toCtx->client.array.e;
    822         if (cp->buffer->name)
     830        if (cp->buffer->name || locked)
    823831        {
    824832            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     
    827835
    828836        cp = &toCtx->client.array.i;
    829         if (cp->buffer->name)
     837        if (cp->buffer->name || locked)
    830838        {
    831839            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     
    834842
    835843        cp = &toCtx->client.array.n;
    836         if (cp->buffer->name)
     844        if (cp->buffer->name || locked)
    837845        {
    838846            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     
    843851        {
    844852            cp = &toCtx->client.array.t[i];
    845             if (cp->buffer->name)
     853            if (cp->buffer->name || locked)
    846854            {
    847855                if (diff_api.ActiveTextureARB)
     
    859867        {
    860868            cp = &toCtx->client.array.a[i];
    861             if (cp->buffer->name)
     869            if (cp->buffer->name || locked)
    862870            {
    863871                diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c

    r25155 r25216  
    852852}
    853853
     854static int32_t crStateSaveClientPointer(CRVertexArrays *pArrays, int32_t index, PSSMHANDLE pSSM)
     855{
     856    int32_t rc;
     857    CRClientPointer *cp;
     858
     859    cp = crStateGetClientPointerByIndex(index, pArrays);
     860
     861    rc = SSMR3PutU32(pSSM, cp->buffer->name);
     862    AssertRCReturn(rc, rc);
     863
     864#ifdef CR_EXT_compiled_vertex_array
     865    if (cp->locked)
     866    {
     867        CRASSERT(cp->p);
     868        rc = SSMR3PutMem(pSSM, cp->p, cp->stride*(pArrays->lockFirst+pArrays->lockCount));
     869        AssertRCReturn(rc, rc);
     870    }
     871#endif
     872
     873    return VINF_SUCCESS;
     874}
     875
     876static int32_t crStateLoadClientPointer(CRVertexArrays *pArrays, int32_t index, CRContext *pContext, PSSMHANDLE pSSM)
     877{
     878    int32_t rc;
     879    uint32_t ui;
     880    CRClientPointer *cp;
     881
     882    cp = crStateGetClientPointerByIndex(index, pArrays);
     883
     884    rc = SSMR3GetU32(pSSM, &ui);
     885    AssertRCReturn(rc, rc);
     886    cp->buffer = ui==0 ? pContext->bufferobject.nullBuffer : crHashtableSearch(pContext->bufferobject.buffers, ui);
     887
     888#ifdef CR_EXT_compiled_vertex_array
     889    if (cp->locked)
     890    {
     891        rc = crStateAllocAndSSMR3GetMem(pSSM, &cp->p, cp->stride*(pArrays->lockFirst+pArrays->lockCount));
     892        AssertRCReturn(rc, rc);
     893    }
     894#endif
     895
     896    return VINF_SUCCESS;
     897}
     898
    854899int32_t crStateSaveContext(CRContext *pContext, PSSMHANDLE pSSM)
    855900{
     
    10271072    rc = SSMR3PutU32(pSSM, pContext->bufferobject.elementsBuffer->name);
    10281073    AssertRCReturn(rc, rc);
    1029     /* Save bound array buffers*/ /*@todo vertexArrayStack*/
    1030     rc = SSMR3PutU32(pSSM, pContext->client.array.v.buffer->name);
    1031     AssertRCReturn(rc, rc);
    1032     rc = SSMR3PutU32(pSSM, pContext->client.array.c.buffer->name);
    1033     AssertRCReturn(rc, rc);
    1034     rc = SSMR3PutU32(pSSM, pContext->client.array.f.buffer->name);
    1035     AssertRCReturn(rc, rc);
    1036     rc = SSMR3PutU32(pSSM, pContext->client.array.s.buffer->name);
    1037     AssertRCReturn(rc, rc);
    1038     rc = SSMR3PutU32(pSSM, pContext->client.array.e.buffer->name);
    1039     AssertRCReturn(rc, rc);
    1040     rc = SSMR3PutU32(pSSM, pContext->client.array.i.buffer->name);
    1041     AssertRCReturn(rc, rc);
    1042     rc = SSMR3PutU32(pSSM, pContext->client.array.n.buffer->name);
    1043     AssertRCReturn(rc, rc);
    1044     for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++)
    1045     {
    1046         rc = SSMR3PutU32(pSSM, pContext->client.array.t[i].buffer->name);
    1047         AssertRCReturn(rc, rc);
    1048     }
    1049 # ifdef CR_NV_vertex_program
    1050     for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++)
    1051     {
    1052         rc = SSMR3PutU32(pSSM, pContext->client.array.a[i].buffer->name);
    1053         AssertRCReturn(rc, rc);
    1054     }
    1055 # endif
     1074    /* Save clint pointers and buffer bindings*/
     1075    for (i=0; i<CRSTATECLIENT_MAX_VERTEXARRAYS; ++i)
     1076    {
     1077        rc = crStateSaveClientPointer(&pContext->client.array, i, pSSM);
     1078        AssertRCReturn(rc, rc);
     1079    }
     1080
     1081    crDebug("client.vertexArrayStackDepth %i", pContext->client.vertexArrayStackDepth);
     1082    for (i=0; i<pContext->client.vertexArrayStackDepth; ++i)
     1083    {
     1084        CRVertexArrays *pArray = &pContext->client.vertexArrayStack[i];
     1085        for (j=0; j<CRSTATECLIENT_MAX_VERTEXARRAYS; ++j)
     1086        {
     1087            rc = crStateSaveClientPointer(pArray, j, pSSM);
     1088            AssertRCReturn(rc, rc);
     1089        }
     1090    }
    10561091#endif /*CR_ARB_vertex_buffer_object*/
    10571092
     
    15311566    AssertRCReturn(rc, rc);
    15321567    pContext->bufferobject.elementsBuffer = CRS_GET_BO(ui);
    1533 
    1534     /* Load bound array buffers*/
    1535     rc = SSMR3GetU32(pSSM, &ui);
    1536     AssertRCReturn(rc, rc);
    1537     pContext->client.array.v.buffer = CRS_GET_BO(ui);
    1538 
    1539     rc = SSMR3GetU32(pSSM, &ui);
    1540     AssertRCReturn(rc, rc);
    1541     pContext->client.array.c.buffer = CRS_GET_BO(ui);
    1542 
    1543     rc = SSMR3GetU32(pSSM, &ui);
    1544     AssertRCReturn(rc, rc);
    1545     pContext->client.array.f.buffer = CRS_GET_BO(ui);
    1546 
    1547     rc = SSMR3GetU32(pSSM, &ui);
    1548     AssertRCReturn(rc, rc);
    1549     pContext->client.array.s.buffer = CRS_GET_BO(ui);
    1550 
    1551     rc = SSMR3GetU32(pSSM, &ui);
    1552     AssertRCReturn(rc, rc);
    1553     pContext->client.array.e.buffer = CRS_GET_BO(ui);
    1554 
    1555     rc = SSMR3GetU32(pSSM, &ui);
    1556     AssertRCReturn(rc, rc);
    1557     pContext->client.array.i.buffer = CRS_GET_BO(ui);
    1558 
    1559     rc = SSMR3GetU32(pSSM, &ui);
    1560     AssertRCReturn(rc, rc);
    1561     pContext->client.array.n.buffer = CRS_GET_BO(ui);
    1562 
    1563     for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++)
    1564     {
    1565         rc = SSMR3GetU32(pSSM, &ui);
    1566         AssertRCReturn(rc, rc);
    1567         pContext->client.array.t[i].buffer = CRS_GET_BO(ui);
    1568     }
    1569 # ifdef CR_NV_vertex_program
    1570     for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++)
    1571     {
    1572         rc = SSMR3GetU32(pSSM, &ui);
    1573         AssertRCReturn(rc, rc);
    1574         pContext->client.array.a[i].buffer = CRS_GET_BO(ui);
    1575     }
    1576 # endif
    15771568#undef CRS_GET_BO
     1569
     1570    /* Load client pointers and array buffer bindings*/
     1571    for (i=0; i<CRSTATECLIENT_MAX_VERTEXARRAYS; ++i)
     1572    {
     1573        rc = crStateLoadClientPointer(&pContext->client.array, i, pContext, pSSM);
     1574        AssertRCReturn(rc, rc);
     1575    }
     1576    for (j=0; j<pContext->client.vertexArrayStackDepth; ++j)
     1577    {
     1578        CRVertexArrays *pArray = &pContext->client.vertexArrayStack[j];
     1579        for (i=0; i<CRSTATECLIENT_MAX_VERTEXARRAYS; ++i)
     1580        {
     1581            rc = crStateLoadClientPointer(pArray, i, pContext, pSSM);
     1582            AssertRCReturn(rc, rc);
     1583        }
     1584    }
    15781585
    15791586    pContext->bufferobject.bResyncNeeded = GL_TRUE;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r25155 r25216  
    7171
    7272static const char* gszVBoxOGLSSMMagic = "***OpenGL state data***";
    73 #define SHCROGL_SSM_VERSION 12
     73#define SHCROGL_SSM_VERSION 13
    7474
    7575typedef struct
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