VirtualBox

Changeset 54789 in vbox for trunk


Ignore:
Timestamp:
Mar 16, 2015 3:32:09 PM (10 years ago)
Author:
vboxsync
Message:

VMSVGA3d: Changed the surface arrays into pointer arrays to reduce the copying requried when growing (there maybe lots of them and growing by 1 is tedious). This also means the surface pointers remain valid across growths.

Location:
trunk/src/VBox/Devices/Graphics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r54786 r54789  
    847847    PVMSVGA3DCONTEXT       *papContexts;
    848848    uint32_t                cSurfaces;
    849     PVMSVGA3DSURFACE        paSurface;
     849    PVMSVGA3DSURFACE       *papSurfaces;
    850850#ifdef DEBUG_GFX_WINDOW_TEST_CONTEXT
    851851    uint32_t                idTestContext;
     
    900900    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGA3DSTATE, papContexts),
    901901    SSMFIELD_ENTRY(                 VMSVGA3DSTATE, cSurfaces),
    902     SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGA3DSTATE, paSurface),
     902    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGA3DSTATE, papSurfaces),
    903903    SSMFIELD_ENTRY_TERM()
    904904};
     
    18251825    for (uint32_t i = 0; i < pState->cSurfaces; i++)
    18261826    {
    1827         if (pState->paSurface[i].id != SVGA3D_INVALID_ID)
    1828             vmsvga3dSurfaceDestroy(pThis, pState->paSurface[i].id);
     1827        if (pState->papSurfaces[i]->id != SVGA3D_INVALID_ID)
     1828            vmsvga3dSurfaceDestroy(pThis, pState->papSurfaces[i]->id);
    18291829    }
    18301830
     
    26272627    if (sid >= pState->cSurfaces)
    26282628    {
    2629         void *pvNew = RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
     2629        /* Grow the array. */
     2630        uint32_t cNew = RT_ALIGN(sid + 15, 16);
     2631        void *pvNew = RTMemRealloc(pState->papSurfaces, sizeof(pState->papSurfaces[0]) * cNew);
    26302632        AssertReturn(pvNew, VERR_NO_MEMORY);
    2631         pState->paSurface = (PVMSVGA3DSURFACE)pvNew;
    2632         memset(&pState->paSurface[pState->cSurfaces], 0, sizeof(VMSVGA3DSURFACE) * (sid + 1 - pState->cSurfaces));
    2633         for (uint32_t i = pState->cSurfaces; i < sid + 1; i++)
    2634             pState->paSurface[i].id = SVGA3D_INVALID_ID;
    2635 
    2636         pState->cSurfaces = sid + 1;
    2637     }
     2633        pState->papSurfaces = (PVMSVGA3DSURFACE *)pvNew;
     2634        while (pState->cSurfaces < cNew)
     2635        {
     2636            pSurface = (PVMSVGA3DSURFACE)RTMemAllocZ(sizeof(*pSurface));
     2637            AssertReturn(pSurface, VERR_NO_MEMORY);
     2638            pSurface->id = SVGA3D_INVALID_ID;
     2639            pState->papSurfaces[pState->cSurfaces++] = pSurface;
     2640        }
     2641    }
     2642    pSurface = pState->papSurfaces[sid];
     2643
    26382644    /* If one already exists with this id, then destroy it now. */
    2639     if (pState->paSurface[sid].id != SVGA3D_INVALID_ID)
     2645    if (pSurface->id != SVGA3D_INVALID_ID)
    26402646        vmsvga3dSurfaceDestroy(pThis, sid);
    26412647
    2642     pSurface = &pState->paSurface[sid];
    26432648    memset(pSurface, 0, sizeof(*pSurface));
    26442649    pSurface->id                    = sid;
     
    28042809
    28052810    if (    sid < pState->cSurfaces
    2806         &&  pState->paSurface[sid].id == sid)
    2807     {
    2808         PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     2811        &&  pState->papSurfaces[sid]->id == sid)
     2812    {
     2813        PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    28092814        PVMSVGA3DCONTEXT pContext;
    28102815
     
    29262931    AssertReturn(pState, VERR_NO_MEMORY);
    29272932    AssertReturn(sidSrc < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    2928     AssertReturn(sidSrc < pState->cSurfaces && pState->paSurface[sidSrc].id == sidSrc, VERR_INVALID_PARAMETER);
     2933    AssertReturn(sidSrc < pState->cSurfaces && pState->papSurfaces[sidSrc]->id == sidSrc, VERR_INVALID_PARAMETER);
    29292934    AssertReturn(sidDest < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    2930     AssertReturn(sidDest < pState->cSurfaces && pState->paSurface[sidDest].id == sidDest, VERR_INVALID_PARAMETER);
     2935    AssertReturn(sidDest < pState->cSurfaces && pState->papSurfaces[sidDest]->id == sidDest, VERR_INVALID_PARAMETER);
    29312936
    29322937    for (uint32_t i = 0; i < cCopyBoxes; i++)
     
    31703175    AssertReturn(pState, VERR_NO_MEMORY);
    31713176    AssertReturn(sidSrc < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    3172     AssertReturn(sidSrc < pState->cSurfaces && pState->paSurface[sidSrc].id == sidSrc, VERR_INVALID_PARAMETER);
     3177    AssertReturn(sidSrc < pState->cSurfaces && pState->papSurfaces[sidSrc]->id == sidSrc, VERR_INVALID_PARAMETER);
    31733178    AssertReturn(sidDest < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    3174     AssertReturn(sidDest < pState->cSurfaces && pState->paSurface[sidDest].id == sidDest, VERR_INVALID_PARAMETER);
    3175 
    3176     pSurfaceSrc  = &pState->paSurface[sidSrc];
    3177     pSurfaceDest = &pState->paSurface[sidDest];
     3179    AssertReturn(sidDest < pState->cSurfaces && pState->papSurfaces[sidDest]->id == sidDest, VERR_INVALID_PARAMETER);
     3180
     3181    pSurfaceSrc  = pState->papSurfaces[sidSrc];
     3182    pSurfaceDest = pState->papSurfaces[sidDest];
    31783183    AssertReturn(pSurfaceSrc->faces[0].numMipLevels > src.mipmap, VERR_INVALID_PARAMETER);
    31793184    AssertReturn(pSurfaceDest->faces[0].numMipLevels > dest.mipmap, VERR_INVALID_PARAMETER);
     
    33953400    AssertReturn(pState, VERR_NO_MEMORY);
    33963401    AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    3397     AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    3398 
    3399     pSurface = &pState->paSurface[sid];
     3402    AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     3403
     3404    pSurface = pState->papSurfaces[sid];
    34003405    AssertReturn(pSurface->faces[0].numMipLevels > host.mipmap, VERR_INVALID_PARAMETER);
    34013406    pMipLevel = &pSurface->pMipmapLevels[host.mipmap];
     
    38083813    AssertReturn(pState, VERR_NO_MEMORY);
    38093814    AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    3810     AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    3811 
    3812     pSurface = &pState->paSurface[sid];
     3815    AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     3816
     3817    pSurface = pState->papSurfaces[sid];
    38133818#ifndef VMSVGA3D_OGL_WITH_SHARED_CTX
    38143819    AssertReturn(pSurface->idAssociatedContext != SVGA3D_INVALID_ID, VERR_INTERNAL_ERROR);
     
    38873892    AssertReturn(pState, VERR_NO_MEMORY);
    38883893    AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    3889     AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    3890 
    3891     pSurface = &pState->paSurface[sid];
     3894    AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     3895
     3896    pSurface = pState->papSurfaces[sid];
    38923897#ifndef VMSVGA3D_OGL_WITH_SHARED_CTX
    38933898    AssertReturn(pSurface->idAssociatedContext != SVGA3D_INVALID_ID, VERR_INTERNAL_ERROR);
     
    45534558        for (uint32_t sid = 0; sid < pState->cSurfaces; sid++)
    45544559        {
    4555             PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     4560            PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    45564561            if (    pSurface->idAssociatedContext == cid
    45574562                &&  pSurface->id == sid)
     
    58135818
    58145819    AssertReturn(target.sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    5815     AssertReturn(target.sid < pState->cSurfaces && pState->paSurface[target.sid].id == target.sid, VERR_INVALID_PARAMETER);
    5816     pRenderTarget = &pState->paSurface[target.sid];
     5820    AssertReturn(target.sid < pState->cSurfaces && pState->papSurfaces[target.sid]->id == target.sid, VERR_INVALID_PARAMETER);
     5821    pRenderTarget = pState->papSurfaces[target.sid];
    58175822
    58185823    switch (type)
     
    61876192
    61886193                AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    6189                 AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    6190 
    6191                 PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     6194                AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     6195
     6196                PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    61926197
    61936198                Log(("SVGA3D_TS_BIND_TEXTURE: stage %d, texture surface id=%x (%d,%d) replacing=%x\n",
     
    69406945
    69416946    AssertReturn(sidVertex < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    6942     AssertReturn(sidVertex < pState->cSurfaces && pState->paSurface[sidVertex].id == sidVertex, VERR_INVALID_PARAMETER);
    6943 
    6944     pVertexSurface = &pState->paSurface[sidVertex];
     6947    AssertReturn(sidVertex < pState->cSurfaces && pState->papSurfaces[sidVertex]->id == sidVertex, VERR_INVALID_PARAMETER);
     6948
     6949    pVertexSurface = pState->papSurfaces[sidVertex];
    69456950    Log(("vmsvga3dDrawPrimitives: vertex surface %x\n", sidVertex));
    69466951
     
    72037208        if (pContext->sidRenderTarget != SVGA_ID_INVALID)
    72047209        {
    7205             PVMSVGA3DSURFACE pRenderTarget = &pState->paSurface[pContext->sidRenderTarget];
     7210            PVMSVGA3DSURFACE pRenderTarget = pState->papSurfaces[pContext->sidRenderTarget];
    72067211            rtHeight = pRenderTarget->pMipmapLevels[0].size.height;
    72077212        }
     
    72547259            if (    sidIndex >= SVGA3D_MAX_SURFACE_IDS
    72557260                ||  sidIndex >= pState->cSurfaces
    7256                 ||  pState->paSurface[sidIndex].id != sidIndex)
     7261                ||  pState->papSurfaces[sidIndex]->id != sidIndex)
    72577262            {
    72587263                Assert(sidIndex < SVGA3D_MAX_SURFACE_IDS);
    7259                 Assert(sidIndex < pState->cSurfaces && pState->paSurface[sidIndex].id == sidIndex);
     7264                Assert(sidIndex < pState->cSurfaces && pState->papSurfaces[sidIndex]->id == sidIndex);
    72607265                rc = VERR_INVALID_PARAMETER;
    72617266                goto internal_error;
    72627267            }
    7263             pIndexSurface = &pState->paSurface[sidIndex];
     7268            pIndexSurface = pState->papSurfaces[sidIndex];
    72647269            Log(("vmsvga3dDrawPrimitives: index surface %x\n", sidIndex));
    72657270
     
    73897394            {
    73907395                PVMSVGA3DSURFACE pTexture;
    7391                 pTexture = &pState->paSurface[pContext->aSidActiveTexture[activeTextureUnit - GL_TEXTURE0]];
     7396                pTexture = pState->papSurfaces[pContext->aSidActiveTexture[activeTextureUnit - GL_TEXTURE0]];
    73927397
    73937398                AssertMsg(pTexture->oglId.texture == (GLuint)activeTexture, ("%x vs %x unit %d - %d\n", pTexture->oglId.texture, activeTexture, i, activeTextureUnit - GL_TEXTURE0));
    73947399            }
    73957400# else
    7396             PVMSVGA3DSURFACE pTexture = &pState->paSurface[pContext->aSidActiveTexture[i]];
     7401            PVMSVGA3DSURFACE pTexture = pState->papSurfaces[pContext->aSidActiveTexture[i]];
    73977402            AssertMsg(pTexture->id == pContext->aSidActiveTexture[i], ("%x vs %x\n", pTexture->id == pContext->aSidActiveTexture[i]));
    73987403            AssertMsg(pTexture->oglId.texture == (GLuint)activeTexture,
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h

    r54785 r54789  
    207207            }
    208208
    209             PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     209            PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    210210            Assert(pSurface->id == sid);
    211211
     
    436436    for (uint32_t sid = 0; sid < pState->cSurfaces; sid++)
    437437    {
    438         PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     438        PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    439439
    440440        /* Save the id first. */
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp

    r54786 r54789  
    343343    RTSEMEVENT              WndRequestSem;
    344344
    345     /** The size of papContexts  */
     345    /** The size of papContexts. */
    346346    uint32_t                cContexts;
     347    /** The size of papSurfaces. */
    347348    uint32_t                cSurfaces;
    348349    /** Contexts indexed by ID.  Grown as needed. */
    349350    PVMSVGA3DCONTEXT       *papContexts;
    350     PVMSVGA3DSURFACE        paSurface;
     351    /** Surfaces indexed by ID.  Grown as needed. */
     352    PVMSVGA3DSURFACE       *papSurfaces;
    351353
    352354    bool                    fSupportedSurfaceINTZ;
     
    369371    SSMFIELD_ENTRY(                 VMSVGA3DSTATE, cSurfaces),
    370372    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGA3DSTATE, papContexts),
    371     SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGA3DSTATE, paSurface),
     373    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGA3DSTATE, papSurfaces),
    372374    SSMFIELD_ENTRY_IGNORE(          VMSVGA3DSTATE, fSupportedSurfaceINTZ),
    373375    SSMFIELD_ENTRY_IGNORE(          VMSVGA3DSTATE, fSupportedSurfaceNULL),
     
    595597    for (uint32_t i = 0; i < pState->cSurfaces; i++)
    596598    {
    597         if (pState->paSurface[i].id != SVGA3D_INVALID_ID)
    598             vmsvga3dSurfaceDestroy(pThis, pState->paSurface[i].id);
     599        if (pState->papSurfaces[i]->id != SVGA3D_INVALID_ID)
     600            vmsvga3dSurfaceDestroy(pThis, pState->papSurfaces[i]->id);
    599601    }
    600602
     
    14001402    if (sid >= pState->cSurfaces)
    14011403    {
    1402         void *pvNew = RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
     1404        /* Grow the array. */
     1405        uint32_t cNew = RT_ALIGN(sid + 15, 16);
     1406        void *pvNew = RTMemRealloc(pState->papSurfaces, sizeof(pState->papSurfaces[0]) * cNew);
    14031407        AssertReturn(pvNew, VERR_NO_MEMORY);
    1404         pState->paSurface = (PVMSVGA3DSURFACE)pvNew;
    1405         memset(&pState->paSurface[pState->cSurfaces], 0, sizeof(VMSVGA3DSURFACE) * (sid + 1 - pState->cSurfaces));
    1406         for (uint32_t i = pState->cSurfaces; i < sid + 1; i++)
    1407             pState->paSurface[i].id = SVGA3D_INVALID_ID;
    1408 
    1409         pState->cSurfaces = sid + 1;
    1410     }
     1408        pState->papSurfaces = (PVMSVGA3DSURFACE *)pvNew;
     1409        while (pState->cSurfaces < cNew)
     1410        {
     1411            pSurface = (PVMSVGA3DSURFACE)RTMemAllocZ(sizeof(*pSurface));
     1412            AssertReturn(pSurface, VERR_NO_MEMORY);
     1413            pSurface->id = SVGA3D_INVALID_ID;
     1414            pState->papSurfaces[pState->cSurfaces++] = pSurface;
     1415        }
     1416    }
     1417    pSurface = pState->papSurfaces[sid];
     1418
    14111419    /* If one already exists with this id, then destroy it now. */
    1412     if (pState->paSurface[sid].id != SVGA3D_INVALID_ID)
     1420    if (pSurface->id != SVGA3D_INVALID_ID)
    14131421        vmsvga3dSurfaceDestroy(pThis, sid);
    14141422
    1415     pSurface = &pState->paSurface[sid];
    14161423    memset(pSurface, 0, sizeof(*pSurface));
    14171424    pSurface->id                    = sid;
     
    16111618
    16121619    if (    sid < pState->cSurfaces
    1613         &&  pState->paSurface[sid].id == sid)
    1614     {
    1615         PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     1620        &&  pState->papSurfaces[sid]->id == sid)
     1621    {
     1622        PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    16161623
    16171624        Log(("vmsvga3dSurfaceDestroy id %x\n", sid));
     
    17511758{
    17521759    PVMSVGA3DSTATE   pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;
    1753     PVMSVGA3DSURFACE pSurface  = &pState->paSurface[sid];
     1760    PVMSVGA3DSURFACE pSurface  = pState->papSurfaces[sid];
    17541761    HRESULT          hr;
    17551762
    17561763    AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    1757     AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
     1764    AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
    17581765
    17591766    /* Nothing to do if this surface hasn't been shared. */
     
    18201827    AssertReturn(pState, VERR_NO_MEMORY);
    18211828    AssertReturn(sidSrc < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    1822     AssertReturn(sidSrc < pState->cSurfaces && pState->paSurface[sidSrc].id == sidSrc, VERR_INVALID_PARAMETER);
     1829    AssertReturn(sidSrc < pState->cSurfaces && pState->papSurfaces[sidSrc]->id == sidSrc, VERR_INVALID_PARAMETER);
    18231830    AssertReturn(sidDest < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    1824     AssertReturn(sidDest < pState->cSurfaces && pState->paSurface[sidDest].id == sidDest, VERR_INVALID_PARAMETER);
    1825 
    1826     pSurfaceSrc  = &pState->paSurface[sidSrc];
    1827     pSurfaceDest = &pState->paSurface[sidDest];
     1831    AssertReturn(sidDest < pState->cSurfaces && pState->papSurfaces[sidDest]->id == sidDest, VERR_INVALID_PARAMETER);
     1832
     1833    pSurfaceSrc  = pState->papSurfaces[sidSrc];
     1834    pSurfaceDest = pState->papSurfaces[sidDest];
    18281835
    18291836    AssertReturn(pSurfaceSrc->faces[0].numMipLevels > src.mipmap, VERR_INVALID_PARAMETER);
     
    21962203    AssertReturn(pState, VERR_NO_MEMORY);
    21972204    AssertReturn(sidSrc < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    2198     AssertReturn(sidSrc < pState->cSurfaces && pState->paSurface[sidSrc].id == sidSrc, VERR_INVALID_PARAMETER);
     2205    AssertReturn(sidSrc < pState->cSurfaces && pState->papSurfaces[sidSrc]->id == sidSrc, VERR_INVALID_PARAMETER);
    21992206    AssertReturn(sidDest < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    2200     AssertReturn(sidDest < pState->cSurfaces && pState->paSurface[sidDest].id == sidDest, VERR_INVALID_PARAMETER);
    2201 
    2202     pSurfaceSrc  = &pState->paSurface[sidSrc];
    2203     pSurfaceDest = &pState->paSurface[sidDest];
     2207    AssertReturn(sidDest < pState->cSurfaces && pState->papSurfaces[sidDest]->id == sidDest, VERR_INVALID_PARAMETER);
     2208
     2209    pSurfaceSrc  = pState->papSurfaces[sidSrc];
     2210    pSurfaceDest = pState->papSurfaces[sidDest];
    22042211    AssertReturn(pSurfaceSrc->faces[0].numMipLevels > src.mipmap, VERR_INVALID_PARAMETER);
    22052212    AssertReturn(pSurfaceDest->faces[0].numMipLevels > dest.mipmap, VERR_INVALID_PARAMETER);
     
    23232330    AssertReturn(pState, VERR_NO_MEMORY);
    23242331    AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    2325     AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    2326 
    2327     pSurface = &pState->paSurface[sid];
     2332    AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     2333
     2334    pSurface = pState->papSurfaces[sid];
    23282335    AssertReturn(pSurface->faces[0].numMipLevels > host.mipmap, VERR_INVALID_PARAMETER);
    23292336    pMipLevel = &pSurface->pMipmapLevels[host.mipmap];
     
    26872694            uint32_t            sid = src.sid;
    26882695            AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    2689             AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    2690 
    2691             pSurface = &pState->paSurface[sid];
     2696            AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     2697
     2698            pSurface = pState->papSurfaces[sid];
    26922699            uint32_t            cid;
    26932700
     
    27302737    AssertReturn(pState, VERR_NO_MEMORY);
    27312738    AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    2732     AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    2733 
    2734     pSurface = &pState->paSurface[sid];
     2739    AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     2740
     2741    pSurface = pState->papSurfaces[sid];
    27352742    AssertReturn(pSurface->idAssociatedContext != SVGA3D_INVALID_ID, VERR_INTERNAL_ERROR);
    27362743
     
    27942801    AssertReturn(pState, VERR_NO_MEMORY);
    27952802    AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    2796     AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    2797 
    2798     pSurface = &pState->paSurface[sid];
     2803    AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     2804
     2805    pSurface = pState->papSurfaces[sid];
    27992806    AssertReturn(pSurface->idAssociatedContext != SVGA3D_INVALID_ID, VERR_INTERNAL_ERROR);
    28002807
     
    30493056        for (uint32_t sid = 0; sid < pState->cSurfaces; sid++)
    30503057        {
    3051             PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     3058            PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    30523059            if (    pSurface->id == sid
    30533060                &&  pSurface->idAssociatedContext == cid)
     
    31963203            for (uint32_t sid = 0; sid < pState->cSurfaces; sid++)
    31973204            {
    3198                 PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     3205                PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    31993206                if (    pSurface->id == sid
    32003207                    &&  pSurface->idAssociatedContext == cid
     
    43354342
    43364343    AssertReturn(target.sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    4337     AssertReturn(target.sid < pState->cSurfaces && pState->paSurface[target.sid].id == target.sid, VERR_INVALID_PARAMETER);
    4338     pRenderTarget = &pState->paSurface[target.sid];
     4344    AssertReturn(target.sid < pState->cSurfaces && pState->papSurfaces[target.sid]->id == target.sid, VERR_INVALID_PARAMETER);
     4345    pRenderTarget = pState->papSurfaces[target.sid];
    43394346
    43404347    switch (type)
     
    48224829
    48234830                AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    4824                 AssertReturn(sid < pState->cSurfaces && pState->paSurface[sid].id == sid, VERR_INVALID_PARAMETER);
    4825 
    4826                 PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid];
     4831                AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER);
     4832
     4833                PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid];
    48274834
    48284835                Log(("SVGA3D_TS_BIND_TEXTURE: stage %d, texture surface id=%x (%d,%d)\n", currentStage, pTextureState[i].value, pSurface->pMipmapLevels[0].size.width, pSurface->pMipmapLevels[0].size.height));
     
    52955302
    52965303        AssertReturn(sidVertex < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);
    5297         AssertReturn(sidVertex < pState->cSurfaces && pState->paSurface[sidVertex].id == sidVertex, VERR_INVALID_PARAMETER);
    5298 
    5299         pVertexSurface = &pState->paSurface[sidVertex];
     5304        AssertReturn(sidVertex < pState->cSurfaces && pState->papSurfaces[sidVertex]->id == sidVertex, VERR_INVALID_PARAMETER);
     5305
     5306        pVertexSurface = pState->papSurfaces[sidVertex];
    53005307        Log(("vmsvga3dDrawPrimitives: vertex surface %x stream %d\n", sidVertex, idStream));
    53015308        Log(("vmsvga3dDrawPrimitives: type=%s (%d) method=%s (%d) usage=%s (%d) usageIndex=%d stride=%d offset=%d\n", vmsvgaDeclType2String(pVertexDecl[iVertex].identity.type), pVertexDecl[iVertex].identity.type, vmsvgaDeclMethod2String(pVertexDecl[iVertex].identity.method), pVertexDecl[iVertex].identity.method, vmsvgaDeclUsage2String(pVertexDecl[iVertex].identity.usage), pVertexDecl[iVertex].identity.usage, pVertexDecl[iVertex].identity.usageIndex, pVertexDecl[iVertex].array.stride, pVertexDecl[iVertex].array.offset));
     
    53675374    unsigned         strideVertex = pVertexDecl[0].array.stride;
    53685375
    5369     pVertexSurface = &pState->paSurface[sidVertex];
     5376    pVertexSurface = pState->papSurfaces[sidVertex];
    53705377
    53715378    Log(("vmsvga3dDrawPrimitives: SetStreamSource %d min offset=%d stride=%d\n", idStream, uVertexMinOffset, strideVertex));
     
    55055512            if (    sidIndex >= SVGA3D_MAX_SURFACE_IDS
    55065513                ||  sidIndex >= pState->cSurfaces
    5507                 ||  pState->paSurface[sidIndex].id != sidIndex)
     5514                ||  pState->papSurfaces[sidIndex]->id != sidIndex)
    55085515            {
    55095516                Assert(sidIndex < SVGA3D_MAX_SURFACE_IDS);
    5510                 Assert(sidIndex < pState->cSurfaces && pState->paSurface[sidIndex].id == sidIndex);
     5517                Assert(sidIndex < pState->cSurfaces && pState->papSurfaces[sidIndex]->id == sidIndex);
    55115518                rc = VERR_INVALID_PARAMETER;
    55125519                goto internal_error;
    55135520            }
    5514             pIndexSurface = &pState->paSurface[sidIndex];
     5521            pIndexSurface = pState->papSurfaces[sidIndex];
    55155522            Log(("vmsvga3dDrawPrimitives: index surface %x\n", sidIndex));
    55165523
     
    55675574        unsigned         strideVertex = pVertexDecl[0].array.stride;
    55685575
    5569         pVertexSurface = &pState->paSurface[sidVertex];
     5576        pVertexSurface = pState->papSurfaces[sidVertex];
    55705577
    55715578        if (!pIndexSurface)
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