Changeset 54576 in vbox for trunk/src/VBox
- Timestamp:
- Mar 2, 2015 12:10:21 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r54572 r54576 2596 2596 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 2597 2597 } 2598 else 2599 { 2600 /* Pick any active context; we need something here */ 2598 /* If there is a GL buffer or something associated with the surface, we 2599 really need something here, so pick any active context. */ 2600 else if (pSurface->oglId.buffer != OPENGL_INVALID_ID) 2601 { 2601 2602 for (cid = 0; cid < pState->cContexts; cid++) 2602 2603 { … … 2608 2609 } 2609 2610 } 2610 AssertReturn(pContext, VERR_INTERNAL_ERROR); /* otherwise crashes/fails*/2611 AssertReturn(pContext, VERR_INTERNAL_ERROR); /* otherwise crashes/fails; create temp context if this ever triggers! */ 2611 2612 } 2612 2613 … … 2710 2711 2711 2712 /* Create D3D texture object for the specified surface. */ 2712 static int vmsvga3dCreateTexture(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, uint32_t idAssociatedContext, PVMSVGA3DSURFACE pSurface) 2713 static int vmsvga3dCreateTexture(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, uint32_t idAssociatedContext, 2714 PVMSVGA3DSURFACE pSurface) 2713 2715 { 2714 2716 GLint activeTexture = 0; … … 2877 2879 } 2878 2880 2879 int vmsvga3dSurfaceDMA(PVGASTATE pThis, SVGA3dGuestImage guest, SVGA3dSurfaceImageId host, SVGA3dTransferType transfer, uint32_t cCopyBoxes, SVGA3dCopyBox *pBoxes) 2881 int vmsvga3dSurfaceDMA(PVGASTATE pThis, SVGA3dGuestImage guest, SVGA3dSurfaceImageId host, SVGA3dTransferType transfer, 2882 uint32_t cCopyBoxes, SVGA3dCopyBox *pBoxes) 2880 2883 { 2881 2884 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState; … … 3143 3146 if (RT_LIKELY(pbData != NULL)) 3144 3147 { 3148 #if defined(VBOX_STRICT) && defined(RT_OS_DARWIN) 3149 GLint cbStrictBufSize; 3150 glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &cbStrictBufSize); 3151 Assert(VMSVGA3D_GL_IS_SUCCESS(pContext)); 3152 AssertMsg(cbStrictBufSize >= (int32_t)pMipLevel->cbSurface, 3153 ("cbStrictBufSize=%#x cbSurface=%#x isAssociatedContext=%#x pContext->id=%#x\n", 3154 (uint32_t)cbStrictBufSize, pMipLevel->cbSurface, pSurface->idAssociatedContext, pContext->id)); 3155 #endif 3156 3145 3157 unsigned offDst = pBoxes[i].x * pSurface->cbBlock + pBoxes[i].y * pMipLevel->cbSurfacePitch; 3146 3158 if (RT_LIKELY( offDst + pBoxes[i].w * pSurface->cbBlock + (pBoxes[i].h - 1) * pMipLevel->cbSurfacePitch … … 3966 3978 AssertRC(rc); 3967 3979 } 3980 3981 #if 1 /* This is done on windows - prevents various assertions at runtime, as well as shutdown & reset assertions when destroying surfaces. */ 3982 /* Check for all surfaces that are associated with this context to remove all dependencies */ 3983 for (uint32_t sid = 0; sid < pState->cSurfaces; sid++) 3984 { 3985 PVMSVGA3DSURFACE pSurface = &pState->paSurface[sid]; 3986 if ( pSurface->idAssociatedContext == cid 3987 && pSurface->id == sid) 3988 { 3989 int rc; 3990 3991 Log(("vmsvga3dContextDestroy: remove all dependencies for surface %x\n", sid)); 3992 3993 uint32_t surfaceFlags = pSurface->flags; 3994 SVGA3dSurfaceFormat format = pSurface->format; 3995 SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES]; 3996 uint32_t multisampleCount = pSurface->multiSampleCount; 3997 SVGA3dTextureFilter autogenFilter = pSurface->autogenFilter; 3998 SVGA3dSize *pMipLevelSize; 3999 uint32_t cFaces = pSurface->cFaces; 4000 4001 pMipLevelSize = (SVGA3dSize *)RTMemAllocZ(pSurface->faces[0].numMipLevels * pSurface->cFaces * sizeof(SVGA3dSize)); 4002 AssertReturn(pMipLevelSize, VERR_NO_MEMORY); 4003 4004 for (uint32_t iFace = 0; iFace < pSurface->cFaces; iFace++) 4005 { 4006 for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; i++) 4007 { 4008 uint32_t idx = i + iFace * pSurface->faces[0].numMipLevels; 4009 memcpy(&pMipLevelSize[idx], &pSurface->pMipmapLevels[idx].size, sizeof(SVGA3dSize)); 4010 } 4011 } 4012 memcpy(face, pSurface->faces, sizeof(pSurface->faces)); 4013 4014 /* Recreate the surface with the original settings; destroys the contents, but that seems fairly safe since the context is also destroyed. */ 4015 rc = vmsvga3dSurfaceDestroy(pThis, sid); 4016 AssertRC(rc); 4017 4018 rc = vmsvga3dSurfaceDefine(pThis, sid, surfaceFlags, format, face, multisampleCount, autogenFilter, face[0].numMipLevels * cFaces, pMipLevelSize); 4019 AssertRC(rc); 4020 } 4021 } 4022 #endif 3968 4023 3969 4024 if (pContext->idFramebuffer != OPENGL_INVALID_ID)
Note:
See TracChangeset
for help on using the changeset viewer.