VirtualBox

Changeset 82095 in vbox for trunk


Ignore:
Timestamp:
Nov 22, 2019 8:09:37 AM (5 years ago)
Author:
vboxsync
Message:

Devices/Graphics: renamed VMSVGA3DSURFACE::pMipmapLevels to paMipmapLevels; use a helper to get PVMSVGA3DMIPMAPLEVEL pointer.

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

Legend:

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

    r81770 r82095  
    650650    AssertReturnVoid(pProgram);
    651651
    652     uint32_t const cWidth = pSurface->pMipmapLevels[iMipmap].mipmapSize.width;
    653     uint32_t const cHeight = pSurface->pMipmapLevels[iMipmap].mipmapSize.height;
     652    PVMSVGA3DMIPMAPLEVEL pMipmapLevel;
     653    int rc = vmsvga3dMipmapLevel(pSurface, 0, iMipmap, &pMipmapLevel);
     654    AssertRCReturnVoid(rc);
     655
     656    uint32_t const cWidth = pMipmapLevel->mipmapSize.width;
     657    uint32_t const cHeight = pMipmapLevel->mipmapSize.height;
    654658
    655659    /* Use the shared context, where all textures are created. */
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp

    r82090 r82095  
    289289        {
    290290            Assert(pSurface->faces[iFace].numMipLevels <= pSurface->faces[0].numMipLevels);
    291             PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->pMipmapLevels[iFace * pSurface->faces[0].numMipLevels];
     291            PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[iFace * pSurface->faces[0].numMipLevels];
    292292            for (uint32_t i = 0; i < pSurface->faces[iFace].numMipLevels; i++, pMipmapLevel++)
    293293            {
     
    19281928    for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; ++i)
    19291929    {
    1930         if (!pSurface->pMipmapLevels[i].pSurfaceData)
     1930        if (!pSurface->paMipmapLevels[i].pSurfaceData)
    19311931            continue;
    19321932
     
    19381938        const uint32_t cbPixel = vmsvga3dSurfaceFormatSize(pSurface->format, NULL, NULL);
    19391939        int rc = vmsvga3dInfoBmpWrite(szFilepath,
    1940                                       pSurface->pMipmapLevels[i].pSurfaceData,
    1941                                       pSurface->pMipmapLevels[i].mipmapSize.width,
    1942                                       pSurface->pMipmapLevels[i].mipmapSize.height,
     1940                                      pSurface->paMipmapLevels[i].pSurfaceData,
     1941                                      pSurface->paMipmapLevels[i].mipmapSize.width,
     1942                                      pSurface->paMipmapLevels[i].mipmapSize.height,
    19431943                                      cbPixel, 0xFFFFFFFF);
    19441944        if (RT_SUCCESS(rc))
     
    19621962                pszPath, pszNamePrefix, u32Seq, pSurface->id, pszNameSuffix);
    19631963    vmsvga3dInfoBmpWrite(szFilepath,
    1964                          pSurface->pMipmapLevels[0].pSurfaceData,
    1965                          pSurface->pMipmapLevels[0].mipmapSize.width,
    1966                          pSurface->pMipmapLevels[0].mipmapSize.height,
     1964                         pSurface->paMipmapLevels[0].pSurfaceData,
     1965                         pSurface->paMipmapLevels[0].mipmapSize.width,
     1966                         pSurface->paMipmapLevels[0].mipmapSize.height,
    19671967                         cbPixel, 0xFF000000);
    19681968#endif
     
    19981998            pHlp->pfnPrintf(pHlp, "Face #%u, mipmap #%u[%u]:%s  cx=%u, cy=%u, cz=%u, cbSurface=%#x, cbPitch=%#x",
    19991999                            iFace, iLevel, iMipmap, iMipmap < 10 ? " " : "",
    2000                             pSurface->pMipmapLevels[iMipmap].mipmapSize.width,
    2001                             pSurface->pMipmapLevels[iMipmap].mipmapSize.height,
    2002                             pSurface->pMipmapLevels[iMipmap].mipmapSize.depth,
    2003                             pSurface->pMipmapLevels[iMipmap].cbSurface,
    2004                             pSurface->pMipmapLevels[iMipmap].cbSurfacePitch);
    2005             if (pSurface->pMipmapLevels[iMipmap].pSurfaceData)
    2006                 pHlp->pfnPrintf(pHlp, " pvData=%p", pSurface->pMipmapLevels[iMipmap].pSurfaceData);
    2007             if (pSurface->pMipmapLevels[iMipmap].fDirty)
     2000                            pSurface->paMipmapLevels[iMipmap].mipmapSize.width,
     2001                            pSurface->paMipmapLevels[iMipmap].mipmapSize.height,
     2002                            pSurface->paMipmapLevels[iMipmap].mipmapSize.depth,
     2003                            pSurface->paMipmapLevels[iMipmap].cbSurface,
     2004                            pSurface->paMipmapLevels[iMipmap].cbSurfacePitch);
     2005            if (pSurface->paMipmapLevels[iMipmap].pSurfaceData)
     2006                pHlp->pfnPrintf(pHlp, " pvData=%p", pSurface->paMipmapLevels[iMipmap].pSurfaceData);
     2007            if (pSurface->paMipmapLevels[iMipmap].fDirty)
    20082008                pHlp->pfnPrintf(pHlp, " dirty");
    20092009            pHlp->pfnPrintf(pHlp, "\n");
     
    20482048            uint32_t iMipmap = iFace * pSurface->faces[0].numMipLevels;
    20492049            for (uint32_t iLevel = 0; iLevel < pSurface->faces[iFace].numMipLevels; iLevel++, iMipmap++)
    2050                 if (pSurface->pMipmapLevels[iMipmap].pSurfaceData)
     2050                if (pSurface->paMipmapLevels[iMipmap].pSurfaceData)
    20512051                {
    2052                     if (ASMMemIsZero(pSurface->pMipmapLevels[iMipmap].pSurfaceData,
    2053                                      pSurface->pMipmapLevels[iMipmap].cbSurface))
     2052                    if (ASMMemIsZero(pSurface->paMipmapLevels[iMipmap].pSurfaceData,
     2053                                     pSurface->paMipmapLevels[iMipmap].cbSurface))
    20542054                        pHlp->pfnPrintf(pHlp, "--- Face #%u, mipmap #%u[%u]: all zeros ---\n", iFace, iLevel, iMipmap);
    20552055                    else
     
    20572057                        pHlp->pfnPrintf(pHlp, "--- Face #%u, mipmap #%u[%u]: cx=%u, cy=%u, cz=%u ---\n",
    20582058                                        iFace, iLevel, iMipmap,
    2059                                         pSurface->pMipmapLevels[iMipmap].mipmapSize.width,
    2060                                         pSurface->pMipmapLevels[iMipmap].mipmapSize.height,
    2061                                         pSurface->pMipmapLevels[iMipmap].mipmapSize.depth);
     2059                                        pSurface->paMipmapLevels[iMipmap].mipmapSize.width,
     2060                                        pSurface->paMipmapLevels[iMipmap].mipmapSize.height,
     2061                                        pSurface->paMipmapLevels[iMipmap].mipmapSize.depth);
    20622062                        vmsvga3dAsciiPrint(vmsvga3dAsciiPrintlnInfo, (void *)pHlp,
    2063                                            pSurface->pMipmapLevels[iMipmap].pSurfaceData,
    2064                                            pSurface->pMipmapLevels[iMipmap].cbSurface,
    2065                                            pSurface->pMipmapLevels[iMipmap].mipmapSize.width,
    2066                                            pSurface->pMipmapLevels[iMipmap].mipmapSize.height,
    2067                                            pSurface->pMipmapLevels[iMipmap].cbSurfacePitch,
     2063                                           pSurface->paMipmapLevels[iMipmap].pSurfaceData,
     2064                                           pSurface->paMipmapLevels[iMipmap].cbSurface,
     2065                                           pSurface->paMipmapLevels[iMipmap].mipmapSize.width,
     2066                                           pSurface->paMipmapLevels[iMipmap].mipmapSize.height,
     2067                                           pSurface->paMipmapLevels[iMipmap].cbSurfacePitch,
    20682068                                           pSurface->format,
    20692069                                           fInvY,
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h

    r82090 r82095  
    569569    uint32_t                cFaces;
    570570    uint32_t                cMipmapLevels;
    571     PVMSVGA3DMIPMAPLEVEL    pMipmapLevels;
     571    PVMSVGA3DMIPMAPLEVEL    paMipmapLevels;
    572572    uint32_t                multiSampleCount;
    573573    SVGA3dTextureFilter     autogenFilter;
     
    647647    SSMFIELD_ENTRY(                 VMSVGA3DSURFACE, faces),
    648648    SSMFIELD_ENTRY(                 VMSVGA3DSURFACE, cFaces),
    649     SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGA3DSURFACE, pMipmapLevels),
     649    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGA3DSURFACE, paMipmapLevels),
    650650    SSMFIELD_ENTRY(                 VMSVGA3DSURFACE, multiSampleCount),
    651651    SSMFIELD_ENTRY(                 VMSVGA3DSURFACE, autogenFilter),
     
    12621262                    VERR_INVALID_PARAMETER);
    12631263
    1264     *ppMipmapLevel = &pSurface->pMipmapLevels[face * numMipLevels + mipmap];
     1264    *ppMipmapLevel = &pSurface->paMipmapLevels[face * numMipLevels + mipmap];
    12651265    return VINF_SUCCESS;
    12661266}
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r82090 r82095  
    9797
    9898/* Invert y-coordinate for OpenGL's bottom left origin. */
    99 #define D3D_TO_OGL_Y_COORD(ptrSurface, y_coordinate)                (ptrSurface->pMipmapLevels[0].mipmapSize.height - (y_coordinate))
     99#define D3D_TO_OGL_Y_COORD(ptrSurface, y_coordinate)                (ptrSurface->paMipmapLevels[0].mipmapSize.height - (y_coordinate))
    100100#define D3D_TO_OGL_Y_COORD_MIPLEVEL(ptrMipLevel, y_coordinate)      (ptrMipLevel->size.height - (y_coordinate))
    101101
     
    21972197    else
    21982198    {
    2199         if (pSurface->pMipmapLevels[0].mipmapSize.depth > 1)
     2199        if (pSurface->paMipmapLevels[0].mipmapSize.depth > 1)
    22002200        {
    22012201            binding = GL_TEXTURE_BINDING_3D;
     
    22572257             * corruption issues (launchpad, background, search field, login).
    22582258             */
    2259             PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->pMipmapLevels[i];
     2259            PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[i];
    22602260
    22612261            LogFunc(("sync dirty 3D texture mipmap level %d (pitch %x) (dirty %d)\n",
     
    23022302            for (uint32_t i = 0; i < numMipLevels; ++i)
    23032303            {
    2304                 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->pMipmapLevels[iFace * numMipLevels + i];
     2304                PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[iFace * numMipLevels + i];
    23052305                Assert(pMipLevel->mipmapSize.width == pMipLevel->mipmapSize.height);
    23062306                Assert(pMipLevel->mipmapSize.depth == 1);
     
    23482348             * corruption issues (launchpad, background, search field, login).
    23492349             */
    2350             PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->pMipmapLevels[i];
     2350            PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[i];
    23512351            Assert(pMipLevel->mipmapSize.depth == 1);
    23522352
     
    46414641            pState->ext.glRenderbufferStorage(GL_RENDERBUFFER,
    46424642                                              pRenderTarget->internalFormatGL,
    4643                                               pRenderTarget->pMipmapLevels[0].mipmapSize.width,
    4644                                               pRenderTarget->pMipmapLevels[0].mipmapSize.height);
     4643                                              pRenderTarget->paMipmapLevels[0].mipmapSize.width,
     4644                                              pRenderTarget->paMipmapLevels[0].mipmapSize.height);
    46454645            VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
    46464646
     
    50155015
    50165016                    Log(("SVGA3D_TS_BIND_TEXTURE: stage %d, texture sid=%u (%d,%d) replacing sid=%u\n",
    5017                          currentStage, sid, pSurface->pMipmapLevels[0].mipmapSize.width,
    5018                          pSurface->pMipmapLevels[0].mipmapSize.height, pContext->aSidActiveTextures[currentStage]));
     5017                         currentStage, sid, pSurface->paMipmapLevels[0].mipmapSize.width,
     5018                         pSurface->paMipmapLevels[0].mipmapSize.height, pContext->aSidActiveTextures[currentStage]));
    50195019
    50205020                    if (pSurface->oglId.texture == OPENGL_INVALID_ID)
    50215021                    {
    50225022                        Log(("CreateTexture (%d,%d) levels=%d\n",
    5023                               pSurface->pMipmapLevels[0].mipmapSize.width, pSurface->pMipmapLevels[0].mipmapSize.height, pSurface->faces[0].numMipLevels));
     5023                              pSurface->paMipmapLevels[0].mipmapSize.width, pSurface->paMipmapLevels[0].mipmapSize.height, pSurface->faces[0].numMipLevels));
    50245024                        rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pSurface);
    50255025                        AssertRCReturn(rc, rc);
     
    58475847    if (pVertexSurface->oglId.buffer == OPENGL_INVALID_ID)
    58485848    {
    5849         Log(("vmsvga3dDrawPrimitives: create vertex buffer fDirty=%d size=%x bytes\n", pVertexSurface->fDirty, pVertexSurface->pMipmapLevels[0].cbSurface));
     5849        Log(("vmsvga3dDrawPrimitives: create vertex buffer fDirty=%d size=%x bytes\n", pVertexSurface->fDirty, pVertexSurface->paMipmapLevels[0].cbSurface));
    58505850        PVMSVGA3DCONTEXT pSavedCtx = pContext;
    58515851        pContext = &pState->SharedCtx;
     
    58615861        Assert(pVertexSurface->fDirty);
    58625862        /** @todo rethink usage dynamic/static */
    5863         pState->ext.glBufferData(GL_ARRAY_BUFFER, pVertexSurface->pMipmapLevels[0].cbSurface, pVertexSurface->pMipmapLevels[0].pSurfaceData, GL_DYNAMIC_DRAW);
     5863        pState->ext.glBufferData(GL_ARRAY_BUFFER, pVertexSurface->paMipmapLevels[0].cbSurface, pVertexSurface->paMipmapLevels[0].pSurfaceData, GL_DYNAMIC_DRAW);
    58645864        VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
    58655865
    5866         pVertexSurface->pMipmapLevels[0].fDirty = false;
     5866        pVertexSurface->paMipmapLevels[0].fDirty = false;
    58675867        pVertexSurface->fDirty = false;
    58685868
     
    62156215        {
    62166216            PVMSVGA3DSURFACE pRenderTarget = pState->papSurfaces[pContext->state.aRenderTargets[SVGA3D_RT_COLOR0]];
    6217             rtHeight = pRenderTarget->pMipmapLevels[0].mipmapSize.height;
     6217            rtHeight = pRenderTarget->paMipmapLevels[0].mipmapSize.height;
    62186218        }
    62196219
     
    62756275            if (pIndexSurface->oglId.buffer == OPENGL_INVALID_ID)
    62766276            {
    6277                 Log(("vmsvga3dDrawPrimitives: create index buffer fDirty=%d size=%x bytes\n", pIndexSurface->fDirty, pIndexSurface->pMipmapLevels[0].cbSurface));
     6277                Log(("vmsvga3dDrawPrimitives: create index buffer fDirty=%d size=%x bytes\n", pIndexSurface->fDirty, pIndexSurface->paMipmapLevels[0].cbSurface));
    62786278                pContext = &pState->SharedCtx;
    62796279                VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext);
     
    62896289
    62906290                /** @todo rethink usage dynamic/static */
    6291                 pState->ext.glBufferData(GL_ELEMENT_ARRAY_BUFFER, pIndexSurface->pMipmapLevels[0].cbSurface, pIndexSurface->pMipmapLevels[0].pSurfaceData, GL_DYNAMIC_DRAW);
     6291                pState->ext.glBufferData(GL_ELEMENT_ARRAY_BUFFER, pIndexSurface->paMipmapLevels[0].cbSurface, pIndexSurface->paMipmapLevels[0].pSurfaceData, GL_DYNAMIC_DRAW);
    62926292                VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
    62936293
    6294                 pIndexSurface->pMipmapLevels[0].fDirty = false;
     6294                pIndexSurface->paMipmapLevels[0].fDirty = false;
    62956295                pIndexSurface->fDirty = false;
    62966296
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-savedstate.cpp

    r82090 r82095  
    447447            for (uint32_t j = 0; j < pSurface->faces[0].numMipLevels * pSurface->cFaces; j++)
    448448            {
    449                 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->pMipmapLevels[j];
     449                PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[j];
    450450                bool fDataPresent = false;
    451451
     
    685685                {
    686686                    uint32_t idx = i + face * pSurface->faces[0].numMipLevels;
    687                     PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->pMipmapLevels[idx];
     687                    PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[idx];
    688688
    689689                    /* Save a copy of the mip map level struct. */
     
    699699                {
    700700                    uint32_t idx = i + face * pSurface->faces[0].numMipLevels;
    701                     PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->pMipmapLevels[idx];
     701                    PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[idx];
    702702
    703703                    Log(("Surface sid=%u: save mipmap level %d with %x bytes data.\n", sid, i, pMipmapLevel->cbSurface));
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-d3d9.cpp

    r81365 r82095  
    10211021        if (hr == D3D_OK)
    10221022        {
    1023             uint32_t const cWidth = pSurface->pMipmapLevels[0].mipmapSize.width;
    1024             uint32_t const cHeight = pSurface->pMipmapLevels[0].mipmapSize.height;
     1023            uint32_t const cWidth = pSurface->paMipmapLevels[0].mipmapSize.width;
     1024            uint32_t const cHeight = pSurface->paMipmapLevels[0].mipmapSize.height;
    10251025
    10261026            hr = setConversionState(pSourceTexture, cWidth, cHeight);
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp

    r82090 r82095  
    11901190    if (!pSharedSurface)
    11911191    {
    1192         const uint32_t cWidth = pSurface->pMipmapLevels[0].mipmapSize.width;
    1193         const uint32_t cHeight = pSurface->pMipmapLevels[0].mipmapSize.height;
    1194         const uint32_t cDepth = pSurface->pMipmapLevels[0].mipmapSize.depth;
     1192        const uint32_t cWidth = pSurface->paMipmapLevels[0].mipmapSize.width;
     1193        const uint32_t cHeight = pSurface->paMipmapLevels[0].mipmapSize.height;
     1194        const uint32_t cDepth = pSurface->paMipmapLevels[0].mipmapSize.depth;
    11951195        const uint32_t numMipLevels = pSurface->faces[0].numMipLevels;
    11961196
     
    18411841    Assert(pSurface->enmD3DResType == VMSVGA3D_D3DRESTYPE_NONE);
    18421842
    1843     const uint32_t cWidth = pSurface->pMipmapLevels[0].mipmapSize.width;
    1844     const uint32_t cHeight = pSurface->pMipmapLevels[0].mipmapSize.height;
    1845     const uint32_t cDepth = pSurface->pMipmapLevels[0].mipmapSize.depth;
     1843    const uint32_t cWidth = pSurface->paMipmapLevels[0].mipmapSize.width;
     1844    const uint32_t cHeight = pSurface->paMipmapLevels[0].mipmapSize.height;
     1845    const uint32_t cDepth = pSurface->paMipmapLevels[0].mipmapSize.depth;
    18461846    const uint32_t numMipLevels = pSurface->faces[0].numMipLevels;
    18471847
     
    20742074            AssertMsgBreak(hr == D3D_OK, ("LockBox failed with %x\n", hr));
    20752075
    2076             PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->pMipmapLevels[i];
     2076            PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[i];
    20772077
    20782078            LogFunc(("sync volume texture mipmap level %d (pitch row %x vs %x, slice %x vs %x)\n",
     
    21222122                AssertMsgBreak(hr == D3D_OK, ("LockRect failed with %x\n", hr));
    21232123
    2124                 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->pMipmapLevels[iFace * numMipLevels + i];
     2124                PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[iFace * numMipLevels + i];
    21252125
    21262126                LogFunc(("sync texture face %d mipmap level %d (pitch %x vs %x)\n",
     
    21752175            AssertMsgReturn(hr == D3D_OK, ("vmsvga3dBackCreateTexture: LockRect failed with %x\n", hr), VERR_INTERNAL_ERROR);
    21762176
    2177             LogFunc(("sync texture mipmap level %d (pitch %x vs %x)\n", i, LockedRect.Pitch, pSurface->pMipmapLevels[i].cbSurfacePitch));
     2177            LogFunc(("sync texture mipmap level %d (pitch %x vs %x)\n", i, LockedRect.Pitch, pSurface->paMipmapLevels[i].cbSurfacePitch));
    21782178
    21792179            uint8_t *pDest = (uint8_t *)LockedRect.pBits;
    2180             const uint8_t *pSrc = (uint8_t *)pSurface->pMipmapLevels[i].pSurfaceData;
    2181             for (uint32_t j = 0; j < pSurface->pMipmapLevels[i].cBlocksY; ++j)
     2180            const uint8_t *pSrc = (uint8_t *)pSurface->paMipmapLevels[i].pSurfaceData;
     2181            for (uint32_t j = 0; j < pSurface->paMipmapLevels[i].cBlocksY; ++j)
    21822182            {
    2183                 memcpy(pDest, pSrc, pSurface->pMipmapLevels[i].cbSurfacePitch);
     2183                memcpy(pDest, pSrc, pSurface->paMipmapLevels[i].cbSurfacePitch);
    21842184
    21852185                pDest += LockedRect.Pitch;
    2186                 pSrc  += pSurface->pMipmapLevels[i].cbSurfacePitch;
     2186                pSrc  += pSurface->paMipmapLevels[i].cbSurfacePitch;
    21872187            }
    21882188
     
    21902190            AssertMsgReturn(hr == D3D_OK, ("vmsvga3dBackCreateTexture: UnlockRect failed with %x\n", hr), VERR_INTERNAL_ERROR);
    21912191
    2192             pSurface->pMipmapLevels[i].fDirty = false;
     2192            pSurface->paMipmapLevels[i].fDirty = false;
    21932193        }
    21942194    }
     
    22102210        for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; i++)
    22112211        {
    2212             RTMemFree(pSurface->pMipmapLevels[i].pSurfaceData);
    2213             pSurface->pMipmapLevels[i].pSurfaceData = NULL;
     2212            RTMemFree(pSurface->paMipmapLevels[i].pSurfaceData);
     2213            pSurface->paMipmapLevels[i].pSurfaceData = NULL;
    22142214        }
    22152215
     
    24612461         * Therefore it should be possible to switch the buffer type on the fly.
    24622462         *
    2463          * Always save the data to the memory buffer in pSurface->pMipmapLevels and,
     2463         * Always save the data to the memory buffer in pSurface->paMipmapLevels and,
    24642464         * if necessary, recreate the corresponding D3D object with the data.
    24652465         */
     
    27032703                    {
    27042704                        uint32_t idx = i + face * pSurface->faces[0].numMipLevels;
    2705                         memcpy(&pMipLevelSize[idx], &pSurface->pMipmapLevels[idx].mipmapSize, sizeof(SVGA3dSize));
     2705                        memcpy(&pMipLevelSize[idx], &pSurface->paMipmapLevels[idx].mipmapSize, sizeof(SVGA3dSize));
    27062706                    }
    27072707                }
     
    28492849                    for (uint32_t i = 0; i < pSurface->cMipLevels; i++)
    28502850                    {
    2851                         PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->pMipmapLevels[i];
     2851                        PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[i];
    28522852
    28532853                        pMipmapLevel->pSurfaceData   = RTMemAllocZ(pMipmapLevel->cbSurface);
     
    39983998
    39993999                LogFunc(("DEPTH/STENCIL; cQualityLevels=%d\n", cQualityLevels));
    4000                 hr = pContext->pDevice->CreateDepthStencilSurface(pRenderTarget->pMipmapLevels[0].mipmapSize.width,
    4001                                                                   pRenderTarget->pMipmapLevels[0].mipmapSize.height,
     4000                hr = pContext->pDevice->CreateDepthStencilSurface(pRenderTarget->paMipmapLevels[0].mipmapSize.width,
     4001                                                                  pRenderTarget->paMipmapLevels[0].mipmapSize.height,
    40024002                                                                  pRenderTarget->formatD3D,
    40034003                                                                  pRenderTarget->multiSampleTypeD3D,
     
    40214021                for (uint32_t i = 0; i < pRenderTarget->faces[0].numMipLevels; i++)
    40224022                {
    4023                     if (pRenderTarget->pMipmapLevels[i].fDirty)
     4023                    if (pRenderTarget->paMipmapLevels[i].fDirty)
    40244024                    {
    40254025                        D3DLOCKED_RECT LockedRect;
     
    40314031                        AssertMsgReturn(hr == D3D_OK, ("vmsvga3dSetRenderTarget: LockRect failed with %x\n", hr), VERR_INTERNAL_ERROR);
    40324032
    4033                         Log(("vmsvga3dSetRenderTarget: sync dirty texture mipmap level %d (pitch %x vs %x)\n", i, LockedRect.Pitch, pRenderTarget->pMipmapLevels[i].cbSurfacePitch));
     4033                        Log(("vmsvga3dSetRenderTarget: sync dirty texture mipmap level %d (pitch %x vs %x)\n", i, LockedRect.Pitch, pRenderTarget->paMipmapLevels[i].cbSurfacePitch));
    40344034
    40354035                        uint8_t *pDest = (uint8_t *)LockedRect.pBits;
    4036                         uint8_t *pSrc  = (uint8_t *)pRenderTarget->pMipmapLevels[i].pSurfaceData;
    4037                         for (uint32_t j = 0; j < pRenderTarget->pMipmapLevels[i].size.height; j++)
     4036                        uint8_t *pSrc  = (uint8_t *)pRenderTarget->paMipmapLevels[i].pSurfaceData;
     4037                        for (uint32_t j = 0; j < pRenderTarget->paMipmapLevels[i].size.height; j++)
    40384038                        {
    4039                             memcpy(pDest, pSrc, pRenderTarget->pMipmapLevels[i].cbSurfacePitch);
     4039                            memcpy(pDest, pSrc, pRenderTarget->paMipmapLevels[i].cbSurfacePitch);
    40404040
    40414041                            pDest += LockedRect.Pitch;
    4042                             pSrc  += pRenderTarget->pMipmapLevels[i].cbSurfacePitch;
     4042                            pSrc  += pRenderTarget->paMipmapLevels[i].cbSurfacePitch;
    40434043                        }
    40444044
     
    40464046                        AssertMsgReturn(hr == D3D_OK, ("vmsvga3dSetRenderTarget: UnlockRect failed with %x\n", hr), VERR_INTERNAL_ERROR);
    40474047
    4048                         pRenderTarget->pMipmapLevels[i].fDirty = false;
     4048                        pRenderTarget->paMipmapLevels[i].fDirty = false;
    40494049                    }
    40504050                }
     
    41304130                LogFunc(("COLOR; cQualityLevels=%d\n", cQualityLevels));
    41314131                LogFunc(("Create rendertarget (%d,%d) formatD3D=%x multisample=%x\n",
    4132                          pRenderTarget->pMipmapLevels[0].mipmapSize.width, pRenderTarget->pMipmapLevels[0].mipmapSize.height, pRenderTarget->formatD3D, pRenderTarget->multiSampleTypeD3D));
    4133 
    4134                 hr = pContext->pDevice->CreateRenderTarget(pRenderTarget->pMipmapLevels[0].mipmapSize.width,
    4135                                                            pRenderTarget->pMipmapLevels[0].mipmapSize.height,
     4132                         pRenderTarget->paMipmapLevels[0].mipmapSize.width, pRenderTarget->paMipmapLevels[0].mipmapSize.height, pRenderTarget->formatD3D, pRenderTarget->multiSampleTypeD3D));
     4133
     4134                hr = pContext->pDevice->CreateRenderTarget(pRenderTarget->paMipmapLevels[0].mipmapSize.width,
     4135                                                           pRenderTarget->paMipmapLevels[0].mipmapSize.height,
    41364136                                                           pRenderTarget->formatD3D,
    41374137                                                           pRenderTarget->multiSampleTypeD3D,
     
    43504350                AssertRCReturn(rc, rc);
    43514351
    4352                 LogFunc(("SVGA3D_TS_BIND_TEXTURE: bind idxSampler=%d, texture sid=%u (%d,%d)\n", idxSampler, sid, pSurface->pMipmapLevels[0].mipmapSize.width, pSurface->pMipmapLevels[0].mipmapSize.height));
     4352                LogFunc(("SVGA3D_TS_BIND_TEXTURE: bind idxSampler=%d, texture sid=%u (%d,%d)\n", idxSampler, sid, pSurface->paMipmapLevels[0].mipmapSize.width, pSurface->paMipmapLevels[0].mipmapSize.height));
    43534353
    43544354                if (!pSurface->u.pTexture)
    43554355                {
    43564356                    Assert(pSurface->idAssociatedContext == SVGA3D_INVALID_ID);
    4357                     LogFunc(("CreateTexture (%d,%d) level=%d fUsage=%x format=%x\n", pSurface->pMipmapLevels[0].mipmapSize.width, pSurface->pMipmapLevels[0].mipmapSize.height, pSurface->faces[0].numMipLevels, pSurface->fUsageD3D, pSurface->formatD3D));
     4357                    LogFunc(("CreateTexture (%d,%d) level=%d fUsage=%x format=%x\n", pSurface->paMipmapLevels[0].mipmapSize.width, pSurface->paMipmapLevels[0].mipmapSize.height, pSurface->faces[0].numMipLevels, pSurface->fUsageD3D, pSurface->formatD3D));
    43584358                    rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pSurface);
    43594359                    AssertRCReturn(rc, rc);
     
    49134913
    49144914        const DWORD Usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY; /* possible severe performance penalty otherwise (according to d3d debug output */
    4915         hr = pContext->pDevice->CreateVertexBuffer(pVertexSurface->pMipmapLevels[0].cbSurface,
     4915        hr = pContext->pDevice->CreateVertexBuffer(pVertexSurface->paMipmapLevels[0].cbSurface,
    49164916                                                   Usage,
    49174917                                                   0, /* non-FVF */
     
    49364936        AssertMsgReturn(hr == D3D_OK, ("Lock vertex failed with %x\n", hr), VERR_INTERNAL_ERROR);
    49374937
    4938         memcpy(pvData, pVertexSurface->pMipmapLevels[0].pSurfaceData, pVertexSurface->pMipmapLevels[0].cbSurface);
     4938        memcpy(pvData, pVertexSurface->paMipmapLevels[0].pSurfaceData, pVertexSurface->paMipmapLevels[0].cbSurface);
    49394939
    49404940        hr = pVertexSurface->u.pVertexBuffer->Unlock();
     
    49694969        const DWORD Usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY; /* possible severe performance penalty otherwise (according to d3d debug output */
    49704970        const D3DFORMAT Format = (indexWidth == sizeof(uint16_t)) ? D3DFMT_INDEX16 : D3DFMT_INDEX32;
    4971         hr = pContext->pDevice->CreateIndexBuffer(pIndexSurface->pMipmapLevels[0].cbSurface,
     4971        hr = pContext->pDevice->CreateIndexBuffer(pIndexSurface->paMipmapLevels[0].cbSurface,
    49724972                                                  Usage,
    49734973                                                  Format,
     
    49924992        AssertMsgReturn(hr == D3D_OK, ("Lock index failed with %x\n", hr), VERR_INTERNAL_ERROR);
    49934993
    4994         memcpy(pvData, pIndexSurface->pMipmapLevels[0].pSurfaceData, pIndexSurface->pMipmapLevels[0].cbSurface);
     4994        memcpy(pvData, pIndexSurface->paMipmapLevels[0].pSurfaceData, pIndexSurface->paMipmapLevels[0].cbSurface);
    49954995
    49964996        hr = pIndexSurface->u.pIndexBuffer->Unlock();
     
    52575257                /* Range hint is not provided. */
    52585258                PVMSVGA3DSURFACE pVertexSurface = aVertexSurfaces[0];
    5259                 numVertices =   pVertexSurface->pMipmapLevels[0].cbSurface / strideVertex
     5259                numVertices =   pVertexSurface->paMipmapLevels[0].cbSurface / strideVertex
    52605260                              - pVertexDecl[0].array.offset / strideVertex
    52615261                              - pVertexDecl[0].rangeHint.first
     
    53105310            if (aVertexSurfaces[i])
    53115311            {
    5312                 aVertexSurfaces[i]->pMipmapLevels[0].fDirty = false;
     5312                aVertexSurfaces[i]->paMipmapLevels[0].fDirty = false;
    53135313                aVertexSurfaces[i]->fDirty = false;
    53145314            }
     
    53195319            if (aIndexSurfaces[i])
    53205320            {
    5321                 aIndexSurfaces[i]->pMipmapLevels[0].fDirty = false;
     5321                aIndexSurfaces[i]->paMipmapLevels[0].fDirty = false;
    53225322                aIndexSurfaces[i]->fDirty = false;
    53235323            }
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp

    r82090 r82095  
    218218    Assert(autogenFilter != SVGA3D_TEX_FILTER_GAUSSIANCUBIC);
    219219    pSurface->cMipmapLevels     = cMipLevels;
    220     pSurface->pMipmapLevels     = (PVMSVGA3DMIPMAPLEVEL)RTMemAllocZ(cMipLevels * sizeof(VMSVGA3DMIPMAPLEVEL));
    221     AssertReturn(pSurface->pMipmapLevels, VERR_NO_MEMORY);
     220    pSurface->paMipmapLevels    = (PVMSVGA3DMIPMAPLEVEL)RTMemAllocZ(cMipLevels * sizeof(VMSVGA3DMIPMAPLEVEL));
     221    AssertReturn(pSurface->paMipmapLevels, VERR_NO_MEMORY);
    222222
    223223    for (uint32_t i=0; i < cMipLevels; i++)
    224         pSurface->pMipmapLevels[i].mipmapSize = paMipLevelSizes[i];
     224        pSurface->paMipmapLevels[i].mipmapSize = paMipLevelSizes[i];
    225225
    226226    pSurface->cbBlock = vmsvga3dSurfaceFormatSize(format, &pSurface->cxBlock, &pSurface->cyBlock);
     
    268268    for (uint32_t i = 0; i < cMipLevels; ++i)
    269269    {
    270         PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->pMipmapLevels[i];
     270        PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[i];
    271271        LogFunc(("[%d] face %d mip level %d (%d,%d,%d) cbBlock=0x%x block %dx%d\n",
    272272                 i, i / pSurface->faces[0].numMipLevels, i % pSurface->faces[0].numMipLevels,
     
    361361    vmsvga3dBackSurfaceDestroy(pState, pSurface);
    362362
    363     if (pSurface->pMipmapLevels)
     363    if (pSurface->paMipmapLevels)
    364364    {
    365365        for (uint32_t i = 0; i < pSurface->cMipmapLevels; ++i)
    366             RTMemFree(pSurface->pMipmapLevels[i].pSurfaceData);
    367         RTMemFree(pSurface->pMipmapLevels);
     366            RTMemFree(pSurface->paMipmapLevels[i].pSurfaceData);
     367        RTMemFree(pSurface->paMipmapLevels);
    368368    }
    369369
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