Changeset 84259 in vbox for trunk/src/VBox
- Timestamp:
- May 11, 2020 4:14:27 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r84136 r84259 2679 2679 LogFunc(("Remove all dependencies for surface sid=%u\n", sid)); 2680 2680 2681 uint32_t surfaceFlags = pSurface->surfaceFlags; 2682 SVGA3dSurfaceFormat format = pSurface->format; 2683 SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES]; 2684 uint32_t multisampleCount = pSurface->multiSampleCount; 2685 SVGA3dTextureFilter autogenFilter = pSurface->autogenFilter; 2686 SVGA3dSize *pMipLevelSize; 2687 uint32_t cFaces = pSurface->cFaces; 2688 2689 pMipLevelSize = (SVGA3dSize *)RTMemAllocZ(pSurface->faces[0].numMipLevels * pSurface->cFaces * sizeof(SVGA3dSize)); 2681 uint32_t const surfaceFlags = pSurface->surfaceFlags; 2682 SVGA3dSurfaceFormat const format = pSurface->format; 2683 uint32_t const multisampleCount = pSurface->multiSampleCount; 2684 SVGA3dTextureFilter const autogenFilter = pSurface->autogenFilter; 2685 uint32_t const cFaces = pSurface->cFaces; 2686 uint32_t const cMipLevels = pSurface->faces[0].numMipLevels; 2687 2688 SVGA3dSize *pMipLevelSize = (SVGA3dSize *)RTMemAllocZ(cMipLevels * cFaces * sizeof(SVGA3dSize)); 2690 2689 AssertReturn(pMipLevelSize, VERR_NO_MEMORY); 2691 2690 2692 for (uint32_t face =0; face < pSurface->cFaces; face++)2691 for (uint32_t face = 0; face < pSurface->cFaces; face++) 2693 2692 { 2694 for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; i++)2693 for (uint32_t i = 0; i < cMipLevels; i++) 2695 2694 { 2696 uint32_t idx = i + face * pSurface->faces[0].numMipLevels;2695 uint32_t idx = i + face * cMipLevels; 2697 2696 memcpy(&pMipLevelSize[idx], &pSurface->paMipmapLevels[idx].mipmapSize, sizeof(SVGA3dSize)); 2698 2697 } 2699 2698 } 2700 memcpy(face, pSurface->faces, sizeof(pSurface->faces)); 2699 2700 SVGA3dSurfaceFace aFaces[SVGA3D_MAX_SURFACE_FACES]; 2701 AssertCompile(sizeof(aFaces) == sizeof(pSurface->faces)); 2702 memcpy(aFaces, pSurface->faces, sizeof(pSurface->faces)); 2701 2703 2702 2704 /* Recreate the surface with the original settings; destroys the contents, but that seems fairly safe since the context is also destroyed. */ … … 2709 2711 AssertRC(rc); 2710 2712 2711 rc = vmsvga3dSurfaceDefine(pThisCC, sid, surfaceFlags, format, face, multisampleCount, autogenFilter,2712 face[0].numMipLevels * cFaces, pMipLevelSize);2713 rc = vmsvga3dSurfaceDefine(pThisCC, sid, surfaceFlags, format, aFaces, multisampleCount, autogenFilter, 2714 cMipLevels * cFaces, pMipLevelSize); 2713 2715 AssertRC(rc); 2714 2716 … … 3985 3987 { 3986 3988 LogFunc(("Creating stencil surface as texture!\n")); 3987 int rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget);3988 AssertRC(rc ); /* non-fatal, will use CreateDepthStencilSurface */3989 int rc2 = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget); 3990 AssertRC(rc2); /* non-fatal, will use CreateDepthStencilSurface */ 3989 3991 } 3990 3992 … … 4099 4101 { 4100 4102 LogFunc(("Create texture to be used as render target; sid=%u type=%d format=%d -> create texture\n", target.sid, pRenderTarget->surfaceFlags, pRenderTarget->format)); 4101 intrc = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget);4103 rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget); 4102 4104 AssertRCReturn(rc, rc); 4103 4105 } … … 5189 5191 { 5190 5192 /* Create and set the vertex declaration. */ 5191 IDirect3DVertexDeclaration9 *pVertexDecl ;5192 hr = pContext->pDevice->CreateVertexDeclaration(&aVertexElements[0], &pVertexDecl );5193 IDirect3DVertexDeclaration9 *pVertexDecl0; 5194 hr = pContext->pDevice->CreateVertexDeclaration(&aVertexElements[0], &pVertexDecl0); 5193 5195 AssertMsgReturn(hr == D3D_OK, ("CreateVertexDeclaration failed with %x\n", hr), VERR_INTERNAL_ERROR); 5194 5196 5195 hr = pContext->pDevice->SetVertexDeclaration(pVertexDecl );5197 hr = pContext->pDevice->SetVertexDeclaration(pVertexDecl0); 5196 5198 AssertMsgReturnStmt(hr == D3D_OK, ("SetVertexDeclaration failed with %x\n", hr), 5197 D3D_RELEASE(pVertexDecl ),5199 D3D_RELEASE(pVertexDecl0), 5198 5200 VERR_INTERNAL_ERROR); 5199 5201 … … 5202 5204 5203 5205 /* Remember the new vertext declaration. */ 5204 pContext->d3dState.pVertexDecl = pVertexDecl ;5206 pContext->d3dState.pVertexDecl = pVertexDecl0; 5205 5207 pContext->d3dState.cVertexElements = numVertexDecls + 1; 5206 5208 memcpy(pContext->d3dState.aVertexElements,
Note:
See TracChangeset
for help on using the changeset viewer.