Changeset 87110 in vbox for trunk/src/VBox/Devices/Graphics
- Timestamp:
- Dec 21, 2020 1:29:10 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 141976
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
r86905 r87110 92 92 93 93 RT_ZERO(*pSurface); 94 pSurface->id = sid;94 pSurface->id = SVGA3D_INVALID_ID; /* Keep this value until the surface init completes */ 95 95 #ifdef VMSVGA3D_OPENGL 96 96 pSurface->idWeakContextAssociation = SVGA3D_INVALID_ID; … … 204 204 uint32_t cbMemRemaining = SVGA3D_MAX_SURFACE_MEM_SIZE; /* Do not allow more than this for a surface. */ 205 205 SVGA3dSize mipmapSize = *pMipLevel0Size; 206 int rc = VINF_SUCCESS; 207 206 208 for (uint32_t i = 0; i < numMipLevels; ++i) 207 209 { … … 230 232 } 231 233 232 Assert Return(cBlocksX > 0 && cBlocksY > 0 && mipmapSize.depth > 0,VERR_INVALID_PARAMETER);234 AssertBreakStmt(cBlocksX > 0 && cBlocksY > 0 && mipmapSize.depth > 0, rc = VERR_INVALID_PARAMETER); 233 235 234 236 const uint32_t cMaxBlocksX = cbMemRemaining / pSurface->cbBlock; 235 if (cBlocksX > cMaxBlocksX)236 return VERR_INVALID_PARAMETER; 237 AssertBreakStmt(cBlocksX < cMaxBlocksX, rc = VERR_INVALID_PARAMETER); 238 237 239 const uint32_t cbSurfacePitch = pSurface->cbBlock * cBlocksX; 238 240 LogFunc(("cbSurfacePitch=0x%x\n", cbSurfacePitch)); 239 241 240 242 const uint32_t cMaxBlocksY = cbMemRemaining / cbSurfacePitch; 241 if (cBlocksY > cMaxBlocksY)242 return VERR_INVALID_PARAMETER; 243 AssertBreakStmt(cBlocksY < cMaxBlocksY, rc = VERR_INVALID_PARAMETER); 244 243 245 const uint32_t cbSurfacePlane = cbSurfacePitch * cBlocksY; 244 246 245 247 const uint32_t cMaxDepth = cbMemRemaining / cbSurfacePlane; 246 if (mipmapSize.depth > cMaxDepth)247 return VERR_INVALID_PARAMETER; 248 AssertBreakStmt(mipmapSize.depth < cMaxDepth, rc = VERR_INVALID_PARAMETER); 249 248 250 const uint32_t cbSurface = cbSurfacePlane * mipmapSize.depth; 249 251 … … 261 263 } 262 264 265 AssertRCBreak(rc); 266 263 267 mipmapSize.width >>= 1; 264 268 if (mipmapSize.width == 0) mipmapSize.width = 1; … … 268 272 if (mipmapSize.depth == 0) mipmapSize.depth = 1; 269 273 } 274 275 AssertLogRelRCReturnStmt(rc, RTMemFree(pSurface->paMipmapLevels), rc); 270 276 271 277 #ifdef VMSVGA3D_DIRECT3D … … 315 321 AssertReturn(pMipmapLevel->pSurfaceData, VERR_NO_MEMORY); 316 322 } 323 324 pSurface->id = sid; 317 325 return VINF_SUCCESS; 318 326 }
Note:
See TracChangeset
for help on using the changeset viewer.