Changeset 55684 in vbox for trunk/src/VBox/Devices/Graphics
- Timestamp:
- May 6, 2015 3:08:59 AM (10 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r55297 r55684 3095 3095 vmsvga3dSetUnpackParams(pState, pContext, pSurface, &SavedParams); 3096 3096 3097 /* Set the mipmap base and max level paramters. */ 3098 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); 3099 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 3100 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, pSurface->faces[0].numMipLevels); 3101 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 3102 3097 3103 if (pSurface->fDirty) 3098 {3099 3104 Log(("vmsvga3dCreateTexture: sync dirty texture\n")); 3100 for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; i++) 3101 { 3102 /* Paranoia: Always do level 0 here to mirror the non-dirty case. */ 3103 if (pSurface->pMipmapLevels[i].fDirty || i == 0) 3104 { 3105 if (pSurface->pMipmapLevels[i].fDirty) 3106 Log(("vmsvga3dCreateTexture: sync dirty texture mipmap level %d (pitch %x)\n", i, pSurface->pMipmapLevels[i].cbSurfacePitch)); 3107 3108 glTexImage2D(GL_TEXTURE_2D, 3109 i, 3110 pSurface->internalFormatGL, 3111 pSurface->pMipmapLevels[i].size.width, 3112 pSurface->pMipmapLevels[i].size.height, 3113 0, 3114 pSurface->formatGL, 3115 pSurface->typeGL, 3116 pSurface->pMipmapLevels[i].pSurfaceData); 3117 3118 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 3119 3120 pSurface->pMipmapLevels[i].fDirty = false; 3121 } 3122 } 3123 pSurface->fDirty = false; 3124 } 3125 else 3105 3106 /* Always allocate and initialize all mipmap levels; non-initialized mipmap levels used as render targets cause failures. */ 3107 for (uint32_t i = 0; i < pSurface->faces[0].numMipLevels; i++) 3126 3108 { 3127 3109 /* Allocate and initialize texture memory. Passing the zero filled pSurfaceData avoids 3128 exposing random host memory to the guest and helps a with the fedora 21 surface 3129 corruption issues (launchpad, background, search field, login). */ 3110 exposing random host memory to the guest and helps a with the fedora 21 surface 3111 corruption issues (launchpad, background, search field, login). */ 3112 if (pSurface->pMipmapLevels[i].fDirty) 3113 Log(("vmsvga3dCreateTexture: sync dirty texture mipmap level %d (pitch %x)\n", i, pSurface->pMipmapLevels[i].cbSurfacePitch)); 3114 3130 3115 glTexImage2D(GL_TEXTURE_2D, 3131 0, 3132 pSurface->internalFormatGL, 3133 pSurface->pMipmapLevels[0].size.width, 3134 pSurface->pMipmapLevels[0].size.height, 3135 0, 3136 pSurface->formatGL, 3137 pSurface->typeGL, 3138 pSurface->pMipmapLevels[0].pSurfaceData); 3139 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext); 3140 } 3116 i, 3117 pSurface->internalFormatGL, 3118 pSurface->pMipmapLevels[i].size.width, 3119 pSurface->pMipmapLevels[i].size.height, 3120 0, 3121 pSurface->formatGL, 3122 pSurface->typeGL, 3123 pSurface->pMipmapLevels[i].pSurfaceData); 3124 3125 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 3126 3127 pSurface->pMipmapLevels[i].fDirty = false; 3128 } 3129 pSurface->fDirty = false; 3141 3130 3142 3131 /* Restore unpacking parameters. */ … … 5773 5762 AssertReturn(type < SVGA3D_RT_MAX, VERR_INVALID_PARAMETER); 5774 5763 AssertReturn(target.face == 0, VERR_INVALID_PARAMETER); 5775 AssertReturn(target.mipmap == 0, VERR_INVALID_PARAMETER);5776 5764 5777 5765 Log(("vmsvga3dSetRenderTarget cid=%x type=%x surface id=%x\n", cid, type, target.sid)); … … 5827 5815 case SVGA3D_RT_DEPTH: 5828 5816 case SVGA3D_RT_STENCIL: 5817 AssertReturn(target.mipmap == 0, VERR_INVALID_PARAMETER); 5829 5818 if (pRenderTarget->oglId.texture == OPENGL_INVALID_ID) 5830 5819 { -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r55401 r55684 4271 4271 AssertReturn(type < SVGA3D_RT_MAX, VERR_INVALID_PARAMETER); 4272 4272 AssertReturn(target.face == 0, VERR_INVALID_PARAMETER); 4273 AssertReturn(target.mipmap == 0, VERR_INVALID_PARAMETER);4274 4273 4275 4274 Log(("vmsvga3dSetRenderTarget cid=%x type=%x surface id=%x\n", cid, type, target.sid)); … … 4350 4349 case SVGA3D_RT_DEPTH: 4351 4350 case SVGA3D_RT_STENCIL: 4351 AssertReturn(target.mipmap == 0, VERR_INVALID_PARAMETER); 4352 4352 if (!pRenderTarget->u.pSurface) 4353 4353 { … … 4495 4495 AssertReturn(pSharedSurface, VERR_INTERNAL_ERROR); 4496 4496 4497 hr = pSharedSurface->u.pTexture->GetSurfaceLevel( 0 /* Texture level 0 */,4497 hr = pSharedSurface->u.pTexture->GetSurfaceLevel(target.mipmap, 4498 4498 &pSurface); 4499 4499 … … 4502 4502 else 4503 4503 #endif 4504 hr = pRenderTarget->u.pTexture->GetSurfaceLevel( 0 /* Texture level 0 */,4504 hr = pRenderTarget->u.pTexture->GetSurfaceLevel(target.mipmap, 4505 4505 &pSurface); 4506 4506 … … 4509 4509 else 4510 4510 { 4511 AssertReturn(target.mipmap == 0, VERR_INVALID_PARAMETER); 4511 4512 if (!pRenderTarget->u.pSurface) 4512 4513 {
Note:
See TracChangeset
for help on using the changeset viewer.