VirtualBox

忽略:
時間撮記:
2009-9-18 上午11:21:22 (15 年 以前)
作者:
vboxsync
訊息:

crOpenGL: snapshots support for VBOs

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c

    r22832 r23123  
    4848
    4949    b->buffers = crAllocHashtable();
     50
     51    b->bResyncNeeded = GL_FALSE;
    5052}
    5153
     
    7274    crFree(b->nullBuffer);
    7375}
    74 
    7576
    7677void STATE_APIENTRY
     
    750751}
    751752
     753static void crStateBufferObjectSyncCB(unsigned long key, void *data1, void *data2)
     754{
     755    CRBufferObject *pBufferObj = (CRBufferObject *) data1;
     756    CRBufferObjectState *pState = (CRBufferObjectState *) data2;
     757
     758    if (pBufferObj->data)
     759    {
     760        diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pBufferObj->name);
     761        diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, pBufferObj->size, pBufferObj->data, pBufferObj->usage);
     762
     763        if (!pState->retainBufferData)
     764        {
     765            crFree(pBufferObj->data);
     766            pBufferObj->data = NULL;
     767        }
     768    }
     769}
    752770
    753771/*
     
    758776{
    759777    const CRBufferObjectState *from = &(fromCtx->bufferobject);
    760     const CRBufferObjectState *to = &(toCtx->bufferobject);
     778    CRBufferObjectState *to = &(toCtx->bufferobject);
     779    int i;
    761780
    762781    if (!HaveBufferObjectExtension())
    763782        return;
     783
     784    if (to->bResyncNeeded)
     785    {
     786        CRClientPointer *cp;
     787
     788        crHashtableWalk(to->buffers, crStateBufferObjectSyncCB, to);
     789        to->bResyncNeeded = GL_FALSE;
     790
     791        /*@todo, move to state_client.c*/
     792
     793        cp = &toCtx->client.array.v;
     794        if (cp->buffer->name)
     795        {
     796            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     797            diff_api.VertexPointer(cp->size, cp->type, cp->stride, cp->p);
     798        }
     799
     800        cp = &toCtx->client.array.c;
     801        if (cp->buffer->name)
     802        {
     803            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     804            diff_api.ColorPointer(cp->size, cp->type, cp->stride, cp->p);
     805        }
     806
     807        cp = &toCtx->client.array.f;
     808        if (cp->buffer->name)
     809        {
     810            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     811            diff_api.FogCoordPointerEXT(cp->type, cp->stride, cp->p);
     812        }
     813
     814        cp = &toCtx->client.array.s;
     815        if (cp->buffer->name)
     816        {
     817            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     818            diff_api.SecondaryColorPointerEXT(cp->size, cp->type, cp->stride, cp->p);
     819        }
     820
     821        cp = &toCtx->client.array.e;
     822        if (cp->buffer->name)
     823        {
     824            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     825            diff_api.EdgeFlagPointer(cp->stride, cp->p);
     826        }
     827
     828        cp = &toCtx->client.array.i;
     829        if (cp->buffer->name)
     830        {
     831            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     832            diff_api.IndexPointer(cp->type, cp->stride, cp->p);
     833        }
     834
     835        cp = &toCtx->client.array.n;
     836        if (cp->buffer->name)
     837        {
     838            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     839            diff_api.NormalPointer(cp->type, cp->stride, cp->p);
     840        }
     841
     842        for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++)
     843        {
     844            cp = &toCtx->client.array.t[i];
     845            if (cp->buffer->name)
     846            {
     847                if (diff_api.ActiveTextureARB)
     848                    diff_api.ActiveTextureARB(i+GL_TEXTURE0_ARB);
     849                diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     850                diff_api.TexCoordPointer(cp->size, cp->type, cp->stride, cp->p);
     851            }
     852        }
     853
     854        if (diff_api.ActiveTextureARB)
     855            diff_api.ActiveTextureARB(toCtx->client.curClientTextureUnit+GL_TEXTURE0_ARB);
     856
     857#ifdef CR_NV_vertex_program
     858        for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++)
     859        {
     860            cp = &toCtx->client.array.a[i];
     861            if (cp->buffer->name)
     862            {
     863                diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name);
     864                diff_api.VertexAttribPointerARB(i, cp->size, cp->type, cp->normalized, cp->stride, cp->p);
     865            }
     866        }
     867#endif
     868        diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, to->arrayBuffer->name);
     869        diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, to->elementsBuffer->name);
     870    }
    764871
    765872    /* ARRAY_BUFFER binding */
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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