VirtualBox

Ignore:
Timestamp:
Dec 21, 2012 12:02:47 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
82932
Message:

crOpenGL: glGetError fixes

File:
1 edited

Legend:

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

    r43999 r44196  
    761761
    762762#ifdef CR_STATE_NO_TEXTURE_IMAGE_STORE
     763    CRASSERT(cr_server.curClient);
    763764    if (cr_server.curClient)
    764765    {
    765         unsigned long id;
    766         if (!crHashtableGetDataKey(cr_server.contextTable, pContextInfo, &id))
    767         {
    768             crWarning("No client id for server ctx %d", pContext->id);
    769         }
    770         else
    771         {
    772             crServerDispatchMakeCurrent(cr_server.curClient->currentWindow, 0, id);
    773         }
     766# ifdef DEBUG_misha
     767        {
     768            unsigned long id;
     769            if (!crHashtableGetDataKey(cr_server.contextTable, pContextInfo, &id))
     770                crWarning("No client id for server ctx %d", pContext->id);
     771            else
     772                CRASSERT(id == key);
     773        }
     774# endif
     775        crServerDispatchMakeCurrent(cr_server.curClient->currentWindow, 0, key);
    774776    }
    775777#endif
     
    778780    CRASSERT(rc == VINF_SUCCESS);
    779781}
     782
     783#if 0
     784typedef struct CR_SERVER_CHECK_BUFFERS
     785{
     786    CRBufferObject *obj;
     787    CRContext *ctx;
     788}CR_SERVER_CHECK_BUFFERS, *PCR_SERVER_CHECK_BUFFERS;
     789
     790static void crVBoxServerCheckConsistencyContextBuffersCB(unsigned long key, void *data1, void *data2)
     791{
     792    CRContextInfo* pContextInfo = (CRContextInfo*)data1;
     793    CRContext *ctx = pContextInfo->pContext;
     794    PCR_SERVER_CHECK_BUFFERS pBuffers = (PCR_SERVER_CHECK_BUFFERS)data2;
     795    CRBufferObject *obj = pBuffers->obj;
     796    CRBufferObjectState *b = &(ctx->bufferobject);
     797    int j, k;
     798
     799    if (obj == b->arrayBuffer)
     800    {
     801        Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
     802        pBuffers->ctx = ctx;
     803    }
     804    if (obj == b->elementsBuffer)
     805    {
     806        Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
     807        pBuffers->ctx = ctx;
     808    }
     809#ifdef CR_ARB_pixel_buffer_object
     810    if (obj == b->packBuffer)
     811    {
     812        Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
     813        pBuffers->ctx = ctx;
     814    }
     815    if (obj == b->unpackBuffer)
     816    {
     817        Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
     818        pBuffers->ctx = ctx;
     819    }
     820#endif
     821
     822#ifdef CR_ARB_vertex_buffer_object
     823    for (j=0; j<CRSTATECLIENT_MAX_VERTEXARRAYS; ++j)
     824    {
     825        CRClientPointer *cp = crStateGetClientPointerByIndex(j, &ctx->client.array);
     826        if (obj == cp->buffer)
     827        {
     828            Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
     829            pBuffers->ctx = ctx;
     830        }
     831    }
     832
     833    for (k=0; k<ctx->client.vertexArrayStackDepth; ++k)
     834    {
     835        CRVertexArrays *pArray = &ctx->client.vertexArrayStack[k];
     836        for (j=0; j<CRSTATECLIENT_MAX_VERTEXARRAYS; ++j)
     837        {
     838            CRClientPointer *cp = crStateGetClientPointerByIndex(j, pArray);
     839            if (obj == cp->buffer)
     840            {
     841                Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
     842                pBuffers->ctx = ctx;
     843            }
     844        }
     845    }
     846#endif
     847}
     848
     849static void crVBoxServerCheckConsistencyBuffersCB(unsigned long key, void *data1, void *data2)
     850{
     851    CRBufferObject *obj = (CRBufferObject *)data1;
     852    CR_SERVER_CHECK_BUFFERS Buffers = {0};
     853    Buffers.obj = obj;
     854    crHashtableWalk(cr_server.contextTable, crVBoxServerCheckConsistencyContextBuffersCB, (void*)&Buffers);
     855}
     856
     857//static void crVBoxServerCheckConsistency2CB(unsigned long key, void *data1, void *data2)
     858//{
     859//    CRContextInfo* pContextInfo1 = (CRContextInfo*)data1;
     860//    CRContextInfo* pContextInfo2 = (CRContextInfo*)data2;
     861//
     862//    CRASSERT(pContextInfo1->pContext);
     863//    CRASSERT(pContextInfo2->pContext);
     864//
     865//    if (pContextInfo1 == pContextInfo2)
     866//    {
     867//        CRASSERT(pContextInfo1->pContext == pContextInfo2->pContext);
     868//        return;
     869//    }
     870//
     871//    CRASSERT(pContextInfo1->pContext != pContextInfo2->pContext);
     872//    CRASSERT(pContextInfo1->pContext->shared);
     873//    CRASSERT(pContextInfo2->pContext->shared);
     874//    CRASSERT(pContextInfo1->pContext->shared == pContextInfo2->pContext->shared);
     875//    if (pContextInfo1->pContext->shared != pContextInfo2->pContext->shared)
     876//        return;
     877//
     878//    crHashtableWalk(pContextInfo1->pContext->shared->buffersTable, crVBoxServerCheckConsistencyBuffersCB, pContextInfo2);
     879//}
     880static void crVBoxServerCheckSharedCB(unsigned long key, void *data1, void *data2)
     881{
     882    CRContextInfo* pContextInfo = (CRContextInfo*)data1;
     883    void **ppShared = (void**)data2;
     884    if (!*ppShared)
     885        *ppShared = pContextInfo->pContext->shared;
     886    else
     887        Assert(pContextInfo->pContext->shared == *ppShared);
     888}
     889
     890static void crVBoxServerCheckConsistency()
     891{
     892    CRSharedState *pShared = NULL;
     893    crHashtableWalk(cr_server.contextTable, crVBoxServerCheckSharedCB, (void*)&pShared);
     894    Assert(pShared);
     895    if (pShared)
     896    {
     897        crHashtableWalk(pShared->buffersTable, crVBoxServerCheckConsistencyBuffersCB, NULL);
     898    }
     899}
     900#endif
    780901
    781902static uint32_t g_hackVBoxServerSaveLoadCallsLeft = 0;
     
    787908    GLboolean b;
    788909    unsigned long key;
     910    GLenum err;
    789911#ifdef CR_STATE_NO_TEXTURE_IMAGE_STORE
    790912    unsigned long ctxID=-1, winID=-1;
     913#endif
     914
     915#if 0
     916    crVBoxServerCheckConsistency();
    791917#endif
    792918
     
    9041030    }
    9051031
     1032    /* all context gl error states should have now be synced with chromium erro states,
     1033     * reset the error if any */
     1034    while ((err = cr_server.head_spu->dispatch_table.GetError()) != GL_NO_ERROR)
     1035        crWarning("crServer: glGetError %d after saving snapshot", err);
     1036
    9061037    cr_server.bIsInSavingState = GL_FALSE;
    9071038
     
    9221053    uint32_t ui, uiNumElems;
    9231054    unsigned long key;
     1055    GLenum err;
    9241056
    9251057    if (!cr_server.bIsInLoadingState)
     
    12001332    cr_server.curClient = NULL;
    12011333
    1202     {
    1203         GLenum err = crServerDispatchGetError();
    1204 
    1205         if (err != GL_NO_ERROR)
    1206         {
    1207             crWarning("crServer: glGetError %d after loading snapshot", err);
    1208         }
    1209     }
     1334    while ((err = cr_server.head_spu->dispatch_table.GetError()) != GL_NO_ERROR)
     1335        crWarning("crServer: glGetError %d after loading snapshot", err);
    12101336
    12111337    cr_server.bIsInLoadingState = GL_FALSE;
     1338
     1339#if 0
     1340    crVBoxServerCheckConsistency();
     1341#endif
    12121342
    12131343    return VINF_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette