- Timestamp:
- Nov 22, 2019 8:09:37 AM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 8 edited
-
DevVGA-SVGA3d-glHlp.cpp (modified) (1 diff)
-
DevVGA-SVGA3d-info.cpp (modified) (7 diffs)
-
DevVGA-SVGA3d-internal.h (modified) (3 diffs)
-
DevVGA-SVGA3d-ogl.cpp (modified) (12 diffs)
-
DevVGA-SVGA3d-savedstate.cpp (modified) (3 diffs)
-
DevVGA-SVGA3d-win-d3d9.cpp (modified) (1 diff)
-
DevVGA-SVGA3d-win.cpp (modified) (23 diffs)
-
DevVGA-SVGA3d.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glHlp.cpp
r81770 r82095 650 650 AssertReturnVoid(pProgram); 651 651 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; 654 658 655 659 /* Use the shared context, where all textures are created. */ -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp
r82090 r82095 289 289 { 290 290 Assert(pSurface->faces[iFace].numMipLevels <= pSurface->faces[0].numMipLevels); 291 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->p MipmapLevels[iFace * pSurface->faces[0].numMipLevels];291 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[iFace * pSurface->faces[0].numMipLevels]; 292 292 for (uint32_t i = 0; i < pSurface->faces[iFace].numMipLevels; i++, pMipmapLevel++) 293 293 { … … 1928 1928 for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; ++i) 1929 1929 { 1930 if (!pSurface->p MipmapLevels[i].pSurfaceData)1930 if (!pSurface->paMipmapLevels[i].pSurfaceData) 1931 1931 continue; 1932 1932 … … 1938 1938 const uint32_t cbPixel = vmsvga3dSurfaceFormatSize(pSurface->format, NULL, NULL); 1939 1939 int rc = vmsvga3dInfoBmpWrite(szFilepath, 1940 pSurface->p MipmapLevels[i].pSurfaceData,1941 pSurface->p MipmapLevels[i].mipmapSize.width,1942 pSurface->p MipmapLevels[i].mipmapSize.height,1940 pSurface->paMipmapLevels[i].pSurfaceData, 1941 pSurface->paMipmapLevels[i].mipmapSize.width, 1942 pSurface->paMipmapLevels[i].mipmapSize.height, 1943 1943 cbPixel, 0xFFFFFFFF); 1944 1944 if (RT_SUCCESS(rc)) … … 1962 1962 pszPath, pszNamePrefix, u32Seq, pSurface->id, pszNameSuffix); 1963 1963 vmsvga3dInfoBmpWrite(szFilepath, 1964 pSurface->p MipmapLevels[0].pSurfaceData,1965 pSurface->p MipmapLevels[0].mipmapSize.width,1966 pSurface->p MipmapLevels[0].mipmapSize.height,1964 pSurface->paMipmapLevels[0].pSurfaceData, 1965 pSurface->paMipmapLevels[0].mipmapSize.width, 1966 pSurface->paMipmapLevels[0].mipmapSize.height, 1967 1967 cbPixel, 0xFF000000); 1968 1968 #endif … … 1998 1998 pHlp->pfnPrintf(pHlp, "Face #%u, mipmap #%u[%u]:%s cx=%u, cy=%u, cz=%u, cbSurface=%#x, cbPitch=%#x", 1999 1999 iFace, iLevel, iMipmap, iMipmap < 10 ? " " : "", 2000 pSurface->p MipmapLevels[iMipmap].mipmapSize.width,2001 pSurface->p MipmapLevels[iMipmap].mipmapSize.height,2002 pSurface->p MipmapLevels[iMipmap].mipmapSize.depth,2003 pSurface->p MipmapLevels[iMipmap].cbSurface,2004 pSurface->p MipmapLevels[iMipmap].cbSurfacePitch);2005 if (pSurface->p MipmapLevels[iMipmap].pSurfaceData)2006 pHlp->pfnPrintf(pHlp, " pvData=%p", pSurface->p MipmapLevels[iMipmap].pSurfaceData);2007 if (pSurface->p MipmapLevels[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) 2008 2008 pHlp->pfnPrintf(pHlp, " dirty"); 2009 2009 pHlp->pfnPrintf(pHlp, "\n"); … … 2048 2048 uint32_t iMipmap = iFace * pSurface->faces[0].numMipLevels; 2049 2049 for (uint32_t iLevel = 0; iLevel < pSurface->faces[iFace].numMipLevels; iLevel++, iMipmap++) 2050 if (pSurface->p MipmapLevels[iMipmap].pSurfaceData)2050 if (pSurface->paMipmapLevels[iMipmap].pSurfaceData) 2051 2051 { 2052 if (ASMMemIsZero(pSurface->p MipmapLevels[iMipmap].pSurfaceData,2053 pSurface->p MipmapLevels[iMipmap].cbSurface))2052 if (ASMMemIsZero(pSurface->paMipmapLevels[iMipmap].pSurfaceData, 2053 pSurface->paMipmapLevels[iMipmap].cbSurface)) 2054 2054 pHlp->pfnPrintf(pHlp, "--- Face #%u, mipmap #%u[%u]: all zeros ---\n", iFace, iLevel, iMipmap); 2055 2055 else … … 2057 2057 pHlp->pfnPrintf(pHlp, "--- Face #%u, mipmap #%u[%u]: cx=%u, cy=%u, cz=%u ---\n", 2058 2058 iFace, iLevel, iMipmap, 2059 pSurface->p MipmapLevels[iMipmap].mipmapSize.width,2060 pSurface->p MipmapLevels[iMipmap].mipmapSize.height,2061 pSurface->p MipmapLevels[iMipmap].mipmapSize.depth);2059 pSurface->paMipmapLevels[iMipmap].mipmapSize.width, 2060 pSurface->paMipmapLevels[iMipmap].mipmapSize.height, 2061 pSurface->paMipmapLevels[iMipmap].mipmapSize.depth); 2062 2062 vmsvga3dAsciiPrint(vmsvga3dAsciiPrintlnInfo, (void *)pHlp, 2063 pSurface->p MipmapLevels[iMipmap].pSurfaceData,2064 pSurface->p MipmapLevels[iMipmap].cbSurface,2065 pSurface->p MipmapLevels[iMipmap].mipmapSize.width,2066 pSurface->p MipmapLevels[iMipmap].mipmapSize.height,2067 pSurface->p MipmapLevels[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, 2068 2068 pSurface->format, 2069 2069 fInvY, -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h
r82090 r82095 569 569 uint32_t cFaces; 570 570 uint32_t cMipmapLevels; 571 PVMSVGA3DMIPMAPLEVEL p MipmapLevels;571 PVMSVGA3DMIPMAPLEVEL paMipmapLevels; 572 572 uint32_t multiSampleCount; 573 573 SVGA3dTextureFilter autogenFilter; … … 647 647 SSMFIELD_ENTRY( VMSVGA3DSURFACE, faces), 648 648 SSMFIELD_ENTRY( VMSVGA3DSURFACE, cFaces), 649 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DSURFACE, p MipmapLevels),649 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA3DSURFACE, paMipmapLevels), 650 650 SSMFIELD_ENTRY( VMSVGA3DSURFACE, multiSampleCount), 651 651 SSMFIELD_ENTRY( VMSVGA3DSURFACE, autogenFilter), … … 1262 1262 VERR_INVALID_PARAMETER); 1263 1263 1264 *ppMipmapLevel = &pSurface->p MipmapLevels[face * numMipLevels + mipmap];1264 *ppMipmapLevel = &pSurface->paMipmapLevels[face * numMipLevels + mipmap]; 1265 1265 return VINF_SUCCESS; 1266 1266 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r82090 r82095 97 97 98 98 /* Invert y-coordinate for OpenGL's bottom left origin. */ 99 #define D3D_TO_OGL_Y_COORD(ptrSurface, y_coordinate) (ptrSurface->p MipmapLevels[0].mipmapSize.height - (y_coordinate))99 #define D3D_TO_OGL_Y_COORD(ptrSurface, y_coordinate) (ptrSurface->paMipmapLevels[0].mipmapSize.height - (y_coordinate)) 100 100 #define D3D_TO_OGL_Y_COORD_MIPLEVEL(ptrMipLevel, y_coordinate) (ptrMipLevel->size.height - (y_coordinate)) 101 101 … … 2197 2197 else 2198 2198 { 2199 if (pSurface->p MipmapLevels[0].mipmapSize.depth > 1)2199 if (pSurface->paMipmapLevels[0].mipmapSize.depth > 1) 2200 2200 { 2201 2201 binding = GL_TEXTURE_BINDING_3D; … … 2257 2257 * corruption issues (launchpad, background, search field, login). 2258 2258 */ 2259 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->p MipmapLevels[i];2259 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[i]; 2260 2260 2261 2261 LogFunc(("sync dirty 3D texture mipmap level %d (pitch %x) (dirty %d)\n", … … 2302 2302 for (uint32_t i = 0; i < numMipLevels; ++i) 2303 2303 { 2304 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->p MipmapLevels[iFace * numMipLevels + i];2304 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[iFace * numMipLevels + i]; 2305 2305 Assert(pMipLevel->mipmapSize.width == pMipLevel->mipmapSize.height); 2306 2306 Assert(pMipLevel->mipmapSize.depth == 1); … … 2348 2348 * corruption issues (launchpad, background, search field, login). 2349 2349 */ 2350 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->p MipmapLevels[i];2350 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[i]; 2351 2351 Assert(pMipLevel->mipmapSize.depth == 1); 2352 2352 … … 4641 4641 pState->ext.glRenderbufferStorage(GL_RENDERBUFFER, 4642 4642 pRenderTarget->internalFormatGL, 4643 pRenderTarget->p MipmapLevels[0].mipmapSize.width,4644 pRenderTarget->p MipmapLevels[0].mipmapSize.height);4643 pRenderTarget->paMipmapLevels[0].mipmapSize.width, 4644 pRenderTarget->paMipmapLevels[0].mipmapSize.height); 4645 4645 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 4646 4646 … … 5015 5015 5016 5016 Log(("SVGA3D_TS_BIND_TEXTURE: stage %d, texture sid=%u (%d,%d) replacing sid=%u\n", 5017 currentStage, sid, pSurface->p MipmapLevels[0].mipmapSize.width,5018 pSurface->p MipmapLevels[0].mipmapSize.height, pContext->aSidActiveTextures[currentStage]));5017 currentStage, sid, pSurface->paMipmapLevels[0].mipmapSize.width, 5018 pSurface->paMipmapLevels[0].mipmapSize.height, pContext->aSidActiveTextures[currentStage])); 5019 5019 5020 5020 if (pSurface->oglId.texture == OPENGL_INVALID_ID) 5021 5021 { 5022 5022 Log(("CreateTexture (%d,%d) levels=%d\n", 5023 pSurface->p MipmapLevels[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)); 5024 5024 rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pSurface); 5025 5025 AssertRCReturn(rc, rc); … … 5847 5847 if (pVertexSurface->oglId.buffer == OPENGL_INVALID_ID) 5848 5848 { 5849 Log(("vmsvga3dDrawPrimitives: create vertex buffer fDirty=%d size=%x bytes\n", pVertexSurface->fDirty, pVertexSurface->p MipmapLevels[0].cbSurface));5849 Log(("vmsvga3dDrawPrimitives: create vertex buffer fDirty=%d size=%x bytes\n", pVertexSurface->fDirty, pVertexSurface->paMipmapLevels[0].cbSurface)); 5850 5850 PVMSVGA3DCONTEXT pSavedCtx = pContext; 5851 5851 pContext = &pState->SharedCtx; … … 5861 5861 Assert(pVertexSurface->fDirty); 5862 5862 /** @todo rethink usage dynamic/static */ 5863 pState->ext.glBufferData(GL_ARRAY_BUFFER, pVertexSurface->p MipmapLevels[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); 5864 5864 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 5865 5865 5866 pVertexSurface->p MipmapLevels[0].fDirty = false;5866 pVertexSurface->paMipmapLevels[0].fDirty = false; 5867 5867 pVertexSurface->fDirty = false; 5868 5868 … … 6215 6215 { 6216 6216 PVMSVGA3DSURFACE pRenderTarget = pState->papSurfaces[pContext->state.aRenderTargets[SVGA3D_RT_COLOR0]]; 6217 rtHeight = pRenderTarget->p MipmapLevels[0].mipmapSize.height;6217 rtHeight = pRenderTarget->paMipmapLevels[0].mipmapSize.height; 6218 6218 } 6219 6219 … … 6275 6275 if (pIndexSurface->oglId.buffer == OPENGL_INVALID_ID) 6276 6276 { 6277 Log(("vmsvga3dDrawPrimitives: create index buffer fDirty=%d size=%x bytes\n", pIndexSurface->fDirty, pIndexSurface->p MipmapLevels[0].cbSurface));6277 Log(("vmsvga3dDrawPrimitives: create index buffer fDirty=%d size=%x bytes\n", pIndexSurface->fDirty, pIndexSurface->paMipmapLevels[0].cbSurface)); 6278 6278 pContext = &pState->SharedCtx; 6279 6279 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); … … 6289 6289 6290 6290 /** @todo rethink usage dynamic/static */ 6291 pState->ext.glBufferData(GL_ELEMENT_ARRAY_BUFFER, pIndexSurface->p MipmapLevels[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); 6292 6292 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 6293 6293 6294 pIndexSurface->p MipmapLevels[0].fDirty = false;6294 pIndexSurface->paMipmapLevels[0].fDirty = false; 6295 6295 pIndexSurface->fDirty = false; 6296 6296 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-savedstate.cpp
r82090 r82095 447 447 for (uint32_t j = 0; j < pSurface->faces[0].numMipLevels * pSurface->cFaces; j++) 448 448 { 449 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->p MipmapLevels[j];449 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[j]; 450 450 bool fDataPresent = false; 451 451 … … 685 685 { 686 686 uint32_t idx = i + face * pSurface->faces[0].numMipLevels; 687 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->p MipmapLevels[idx];687 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[idx]; 688 688 689 689 /* Save a copy of the mip map level struct. */ … … 699 699 { 700 700 uint32_t idx = i + face * pSurface->faces[0].numMipLevels; 701 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->p MipmapLevels[idx];701 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[idx]; 702 702 703 703 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 1021 1021 if (hr == D3D_OK) 1022 1022 { 1023 uint32_t const cWidth = pSurface->p MipmapLevels[0].mipmapSize.width;1024 uint32_t const cHeight = pSurface->p MipmapLevels[0].mipmapSize.height;1023 uint32_t const cWidth = pSurface->paMipmapLevels[0].mipmapSize.width; 1024 uint32_t const cHeight = pSurface->paMipmapLevels[0].mipmapSize.height; 1025 1025 1026 1026 hr = setConversionState(pSourceTexture, cWidth, cHeight); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r82090 r82095 1190 1190 if (!pSharedSurface) 1191 1191 { 1192 const uint32_t cWidth = pSurface->p MipmapLevels[0].mipmapSize.width;1193 const uint32_t cHeight = pSurface->p MipmapLevels[0].mipmapSize.height;1194 const uint32_t cDepth = pSurface->p MipmapLevels[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; 1195 1195 const uint32_t numMipLevels = pSurface->faces[0].numMipLevels; 1196 1196 … … 1841 1841 Assert(pSurface->enmD3DResType == VMSVGA3D_D3DRESTYPE_NONE); 1842 1842 1843 const uint32_t cWidth = pSurface->p MipmapLevels[0].mipmapSize.width;1844 const uint32_t cHeight = pSurface->p MipmapLevels[0].mipmapSize.height;1845 const uint32_t cDepth = pSurface->p MipmapLevels[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; 1846 1846 const uint32_t numMipLevels = pSurface->faces[0].numMipLevels; 1847 1847 … … 2074 2074 AssertMsgBreak(hr == D3D_OK, ("LockBox failed with %x\n", hr)); 2075 2075 2076 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->p MipmapLevels[i];2076 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[i]; 2077 2077 2078 2078 LogFunc(("sync volume texture mipmap level %d (pitch row %x vs %x, slice %x vs %x)\n", … … 2122 2122 AssertMsgBreak(hr == D3D_OK, ("LockRect failed with %x\n", hr)); 2123 2123 2124 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->p MipmapLevels[iFace * numMipLevels + i];2124 PVMSVGA3DMIPMAPLEVEL pMipLevel = &pSurface->paMipmapLevels[iFace * numMipLevels + i]; 2125 2125 2126 2126 LogFunc(("sync texture face %d mipmap level %d (pitch %x vs %x)\n", … … 2175 2175 AssertMsgReturn(hr == D3D_OK, ("vmsvga3dBackCreateTexture: LockRect failed with %x\n", hr), VERR_INTERNAL_ERROR); 2176 2176 2177 LogFunc(("sync texture mipmap level %d (pitch %x vs %x)\n", i, LockedRect.Pitch, pSurface->p MipmapLevels[i].cbSurfacePitch));2177 LogFunc(("sync texture mipmap level %d (pitch %x vs %x)\n", i, LockedRect.Pitch, pSurface->paMipmapLevels[i].cbSurfacePitch)); 2178 2178 2179 2179 uint8_t *pDest = (uint8_t *)LockedRect.pBits; 2180 const uint8_t *pSrc = (uint8_t *)pSurface->p MipmapLevels[i].pSurfaceData;2181 for (uint32_t j = 0; j < pSurface->p MipmapLevels[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) 2182 2182 { 2183 memcpy(pDest, pSrc, pSurface->p MipmapLevels[i].cbSurfacePitch);2183 memcpy(pDest, pSrc, pSurface->paMipmapLevels[i].cbSurfacePitch); 2184 2184 2185 2185 pDest += LockedRect.Pitch; 2186 pSrc += pSurface->p MipmapLevels[i].cbSurfacePitch;2186 pSrc += pSurface->paMipmapLevels[i].cbSurfacePitch; 2187 2187 } 2188 2188 … … 2190 2190 AssertMsgReturn(hr == D3D_OK, ("vmsvga3dBackCreateTexture: UnlockRect failed with %x\n", hr), VERR_INTERNAL_ERROR); 2191 2191 2192 pSurface->p MipmapLevels[i].fDirty = false;2192 pSurface->paMipmapLevels[i].fDirty = false; 2193 2193 } 2194 2194 } … … 2210 2210 for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; i++) 2211 2211 { 2212 RTMemFree(pSurface->p MipmapLevels[i].pSurfaceData);2213 pSurface->p MipmapLevels[i].pSurfaceData = NULL;2212 RTMemFree(pSurface->paMipmapLevels[i].pSurfaceData); 2213 pSurface->paMipmapLevels[i].pSurfaceData = NULL; 2214 2214 } 2215 2215 … … 2461 2461 * Therefore it should be possible to switch the buffer type on the fly. 2462 2462 * 2463 * Always save the data to the memory buffer in pSurface->p MipmapLevels and,2463 * Always save the data to the memory buffer in pSurface->paMipmapLevels and, 2464 2464 * if necessary, recreate the corresponding D3D object with the data. 2465 2465 */ … … 2703 2703 { 2704 2704 uint32_t idx = i + face * pSurface->faces[0].numMipLevels; 2705 memcpy(&pMipLevelSize[idx], &pSurface->p MipmapLevels[idx].mipmapSize, sizeof(SVGA3dSize));2705 memcpy(&pMipLevelSize[idx], &pSurface->paMipmapLevels[idx].mipmapSize, sizeof(SVGA3dSize)); 2706 2706 } 2707 2707 } … … 2849 2849 for (uint32_t i = 0; i < pSurface->cMipLevels; i++) 2850 2850 { 2851 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->p MipmapLevels[i];2851 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[i]; 2852 2852 2853 2853 pMipmapLevel->pSurfaceData = RTMemAllocZ(pMipmapLevel->cbSurface); … … 3998 3998 3999 3999 LogFunc(("DEPTH/STENCIL; cQualityLevels=%d\n", cQualityLevels)); 4000 hr = pContext->pDevice->CreateDepthStencilSurface(pRenderTarget->p MipmapLevels[0].mipmapSize.width,4001 pRenderTarget->p MipmapLevels[0].mipmapSize.height,4000 hr = pContext->pDevice->CreateDepthStencilSurface(pRenderTarget->paMipmapLevels[0].mipmapSize.width, 4001 pRenderTarget->paMipmapLevels[0].mipmapSize.height, 4002 4002 pRenderTarget->formatD3D, 4003 4003 pRenderTarget->multiSampleTypeD3D, … … 4021 4021 for (uint32_t i = 0; i < pRenderTarget->faces[0].numMipLevels; i++) 4022 4022 { 4023 if (pRenderTarget->p MipmapLevels[i].fDirty)4023 if (pRenderTarget->paMipmapLevels[i].fDirty) 4024 4024 { 4025 4025 D3DLOCKED_RECT LockedRect; … … 4031 4031 AssertMsgReturn(hr == D3D_OK, ("vmsvga3dSetRenderTarget: LockRect failed with %x\n", hr), VERR_INTERNAL_ERROR); 4032 4032 4033 Log(("vmsvga3dSetRenderTarget: sync dirty texture mipmap level %d (pitch %x vs %x)\n", i, LockedRect.Pitch, pRenderTarget->p MipmapLevels[i].cbSurfacePitch));4033 Log(("vmsvga3dSetRenderTarget: sync dirty texture mipmap level %d (pitch %x vs %x)\n", i, LockedRect.Pitch, pRenderTarget->paMipmapLevels[i].cbSurfacePitch)); 4034 4034 4035 4035 uint8_t *pDest = (uint8_t *)LockedRect.pBits; 4036 uint8_t *pSrc = (uint8_t *)pRenderTarget->p MipmapLevels[i].pSurfaceData;4037 for (uint32_t j = 0; j < pRenderTarget->p MipmapLevels[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++) 4038 4038 { 4039 memcpy(pDest, pSrc, pRenderTarget->p MipmapLevels[i].cbSurfacePitch);4039 memcpy(pDest, pSrc, pRenderTarget->paMipmapLevels[i].cbSurfacePitch); 4040 4040 4041 4041 pDest += LockedRect.Pitch; 4042 pSrc += pRenderTarget->p MipmapLevels[i].cbSurfacePitch;4042 pSrc += pRenderTarget->paMipmapLevels[i].cbSurfacePitch; 4043 4043 } 4044 4044 … … 4046 4046 AssertMsgReturn(hr == D3D_OK, ("vmsvga3dSetRenderTarget: UnlockRect failed with %x\n", hr), VERR_INTERNAL_ERROR); 4047 4047 4048 pRenderTarget->p MipmapLevels[i].fDirty = false;4048 pRenderTarget->paMipmapLevels[i].fDirty = false; 4049 4049 } 4050 4050 } … … 4130 4130 LogFunc(("COLOR; cQualityLevels=%d\n", cQualityLevels)); 4131 4131 LogFunc(("Create rendertarget (%d,%d) formatD3D=%x multisample=%x\n", 4132 pRenderTarget->p MipmapLevels[0].mipmapSize.width, pRenderTarget->pMipmapLevels[0].mipmapSize.height, pRenderTarget->formatD3D, pRenderTarget->multiSampleTypeD3D));4133 4134 hr = pContext->pDevice->CreateRenderTarget(pRenderTarget->p MipmapLevels[0].mipmapSize.width,4135 pRenderTarget->p MipmapLevels[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, 4136 4136 pRenderTarget->formatD3D, 4137 4137 pRenderTarget->multiSampleTypeD3D, … … 4350 4350 AssertRCReturn(rc, rc); 4351 4351 4352 LogFunc(("SVGA3D_TS_BIND_TEXTURE: bind idxSampler=%d, texture sid=%u (%d,%d)\n", idxSampler, sid, pSurface->p MipmapLevels[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)); 4353 4353 4354 4354 if (!pSurface->u.pTexture) 4355 4355 { 4356 4356 Assert(pSurface->idAssociatedContext == SVGA3D_INVALID_ID); 4357 LogFunc(("CreateTexture (%d,%d) level=%d fUsage=%x format=%x\n", pSurface->p MipmapLevels[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)); 4358 4358 rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pSurface); 4359 4359 AssertRCReturn(rc, rc); … … 4913 4913 4914 4914 const DWORD Usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY; /* possible severe performance penalty otherwise (according to d3d debug output */ 4915 hr = pContext->pDevice->CreateVertexBuffer(pVertexSurface->p MipmapLevels[0].cbSurface,4915 hr = pContext->pDevice->CreateVertexBuffer(pVertexSurface->paMipmapLevels[0].cbSurface, 4916 4916 Usage, 4917 4917 0, /* non-FVF */ … … 4936 4936 AssertMsgReturn(hr == D3D_OK, ("Lock vertex failed with %x\n", hr), VERR_INTERNAL_ERROR); 4937 4937 4938 memcpy(pvData, pVertexSurface->p MipmapLevels[0].pSurfaceData, pVertexSurface->pMipmapLevels[0].cbSurface);4938 memcpy(pvData, pVertexSurface->paMipmapLevels[0].pSurfaceData, pVertexSurface->paMipmapLevels[0].cbSurface); 4939 4939 4940 4940 hr = pVertexSurface->u.pVertexBuffer->Unlock(); … … 4969 4969 const DWORD Usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY; /* possible severe performance penalty otherwise (according to d3d debug output */ 4970 4970 const D3DFORMAT Format = (indexWidth == sizeof(uint16_t)) ? D3DFMT_INDEX16 : D3DFMT_INDEX32; 4971 hr = pContext->pDevice->CreateIndexBuffer(pIndexSurface->p MipmapLevels[0].cbSurface,4971 hr = pContext->pDevice->CreateIndexBuffer(pIndexSurface->paMipmapLevels[0].cbSurface, 4972 4972 Usage, 4973 4973 Format, … … 4992 4992 AssertMsgReturn(hr == D3D_OK, ("Lock index failed with %x\n", hr), VERR_INTERNAL_ERROR); 4993 4993 4994 memcpy(pvData, pIndexSurface->p MipmapLevels[0].pSurfaceData, pIndexSurface->pMipmapLevels[0].cbSurface);4994 memcpy(pvData, pIndexSurface->paMipmapLevels[0].pSurfaceData, pIndexSurface->paMipmapLevels[0].cbSurface); 4995 4995 4996 4996 hr = pIndexSurface->u.pIndexBuffer->Unlock(); … … 5257 5257 /* Range hint is not provided. */ 5258 5258 PVMSVGA3DSURFACE pVertexSurface = aVertexSurfaces[0]; 5259 numVertices = pVertexSurface->p MipmapLevels[0].cbSurface / strideVertex5259 numVertices = pVertexSurface->paMipmapLevels[0].cbSurface / strideVertex 5260 5260 - pVertexDecl[0].array.offset / strideVertex 5261 5261 - pVertexDecl[0].rangeHint.first … … 5310 5310 if (aVertexSurfaces[i]) 5311 5311 { 5312 aVertexSurfaces[i]->p MipmapLevels[0].fDirty = false;5312 aVertexSurfaces[i]->paMipmapLevels[0].fDirty = false; 5313 5313 aVertexSurfaces[i]->fDirty = false; 5314 5314 } … … 5319 5319 if (aIndexSurfaces[i]) 5320 5320 { 5321 aIndexSurfaces[i]->p MipmapLevels[0].fDirty = false;5321 aIndexSurfaces[i]->paMipmapLevels[0].fDirty = false; 5322 5322 aIndexSurfaces[i]->fDirty = false; 5323 5323 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
r82090 r82095 218 218 Assert(autogenFilter != SVGA3D_TEX_FILTER_GAUSSIANCUBIC); 219 219 pSurface->cMipmapLevels = cMipLevels; 220 pSurface->p MipmapLevels= (PVMSVGA3DMIPMAPLEVEL)RTMemAllocZ(cMipLevels * sizeof(VMSVGA3DMIPMAPLEVEL));221 AssertReturn(pSurface->p MipmapLevels, VERR_NO_MEMORY);220 pSurface->paMipmapLevels = (PVMSVGA3DMIPMAPLEVEL)RTMemAllocZ(cMipLevels * sizeof(VMSVGA3DMIPMAPLEVEL)); 221 AssertReturn(pSurface->paMipmapLevels, VERR_NO_MEMORY); 222 222 223 223 for (uint32_t i=0; i < cMipLevels; i++) 224 pSurface->p MipmapLevels[i].mipmapSize = paMipLevelSizes[i];224 pSurface->paMipmapLevels[i].mipmapSize = paMipLevelSizes[i]; 225 225 226 226 pSurface->cbBlock = vmsvga3dSurfaceFormatSize(format, &pSurface->cxBlock, &pSurface->cyBlock); … … 268 268 for (uint32_t i = 0; i < cMipLevels; ++i) 269 269 { 270 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->p MipmapLevels[i];270 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[i]; 271 271 LogFunc(("[%d] face %d mip level %d (%d,%d,%d) cbBlock=0x%x block %dx%d\n", 272 272 i, i / pSurface->faces[0].numMipLevels, i % pSurface->faces[0].numMipLevels, … … 361 361 vmsvga3dBackSurfaceDestroy(pState, pSurface); 362 362 363 if (pSurface->p MipmapLevels)363 if (pSurface->paMipmapLevels) 364 364 { 365 365 for (uint32_t i = 0; i < pSurface->cMipmapLevels; ++i) 366 RTMemFree(pSurface->p MipmapLevels[i].pSurfaceData);367 RTMemFree(pSurface->p MipmapLevels);366 RTMemFree(pSurface->paMipmapLevels[i].pSurfaceData); 367 RTMemFree(pSurface->paMipmapLevels); 368 368 } 369 369
Note:
See TracChangeset
for help on using the changeset viewer.

