Changeset 33836 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display
- Timestamp:
- Nov 8, 2010 1:01:19 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r33714 r33836 108 108 # include <stdio.h> 109 109 #endif 110 111 #define VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc) (((pRc)->cAllocations)/6) 112 #define VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, idx) ((D3DCUBEMAP_FACES)(D3DCUBEMAP_FACE_POSITIVE_X+(idx)/VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc))) 113 #define VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, idx) ((idx)%VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc)) 110 114 111 115 #define VBOXDISP_WITH_WINE_BB_WORKAROUND … … 1618 1622 Assert(pD3DIfTex); 1619 1623 hr = pD3DIfTex->GetSurfaceLevel(iAlloc, &pSurfaceLevel); 1624 Assert(hr == S_OK); 1625 if (hr == S_OK) 1626 { 1627 *ppSurf = pSurfaceLevel; 1628 } 1629 break; 1630 } 1631 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 1632 { 1633 Assert(0); 1634 IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pRc->aAllocations[0].pD3DIf; 1635 IDirect3DSurface9 *pSurfaceLevel; 1636 Assert(pD3DIfCubeTex); 1637 hr = pD3DIfCubeTex->GetCubeMapSurface(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, iAlloc), 1638 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, iAlloc), &pSurfaceLevel); 1620 1639 Assert(hr == S_OK); 1621 1640 if (hr == S_OK) … … 3410 3429 PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)hTexture; 3411 3430 // Assert(pRc); 3412 IDirect3D Texture9 *pD3DIfTex;3431 IDirect3DBaseTexture9 *pD3DIfTex; 3413 3432 if (pRc) 3414 3433 { 3415 Assert(pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE); 3416 pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf; 3434 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE) 3435 { 3436 pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf; 3417 3437 #ifdef DEBUG_misha 3418 bool bDo = false;3419 3420 if (bDo)3421 {3438 bool bDo = false; 3439 3440 if (bDo) 3441 { 3422 3442 vboxVDbgDumpSurfData((pDevice, "SetTexture:\n", pRc, 0 /* alloc index*/, NULL, NULL, "\n")); 3423 } 3424 #endif 3443 } 3444 #endif 3445 } 3446 else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE) 3447 { 3448 pD3DIfTex = (IDirect3DCubeTexture9*)pRc->aAllocations[0].pD3DIf; 3449 } 3450 else 3451 { 3452 Assert(0); 3453 } 3425 3454 } 3426 3455 else 3427 3456 pD3DIfTex = NULL; 3428 3457 3429 // Assert(pD3DIfTex);3430 3458 HRESULT hr = pDevice9If->SetTexture(Stage, pD3DIfTex); 3431 3459 Assert(hr == S_OK); … … 4113 4141 && pData->SrcRect.bottom - pData->SrcRect.top == pSrcRc->aAllocations[0].SurfDesc.height) 4114 4142 { 4115 IDirect3DTexture9 *pD3DIfSrcTex = (IDirect3DTexture9*)pSrcRc->aAllocations[0].pD3DIf; 4116 IDirect3DTexture9 *pD3DIfDstTex = (IDirect3DTexture9*)pDstRc->aAllocations[0].pD3DIf; 4143 Assert(pSrcRc->aAllocations[0].enmD3DIfType==VBOXDISP_D3DIFTYPE_TEXTURE 4144 || pSrcRc->aAllocations[0].enmD3DIfType==VBOXDISP_D3DIFTYPE_CUBE_TEXTURE); 4145 Assert(pDstRc->aAllocations[0].enmD3DIfType==VBOXDISP_D3DIFTYPE_TEXTURE 4146 || pDstRc->aAllocations[0].enmD3DIfType==VBOXDISP_D3DIFTYPE_CUBE_TEXTURE); 4147 IDirect3DBaseTexture9 *pD3DIfSrcTex = (IDirect3DBaseTexture9*)pSrcRc->aAllocations[0].pD3DIf; 4148 IDirect3DBaseTexture9 *pD3DIfDstTex = (IDirect3DBaseTexture9*)pDstRc->aAllocations[0].pD3DIf; 4117 4149 Assert(pD3DIfSrcTex); 4118 4150 Assert(pD3DIfDstTex); … … 4418 4450 // Assert(pRc != pScreen->pRenderTargetRc || pScreen->iRenderTargetFrontBuf != pData->SubResourceIndex); 4419 4451 4420 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE) 4452 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE 4453 || pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE) 4421 4454 { 4422 4455 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; … … 4424 4457 PVBOXWDDMDISP_ALLOCATION pLockAlloc = &pRc->aAllocations[pData->SubResourceIndex]; 4425 4458 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 4426 Assert(pD3DIfTex); 4459 IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pTexAlloc->pD3DIf; 4460 Assert(pTexAlloc->pD3DIf); 4427 4461 RECT *pRect = NULL; 4428 4462 bool bNeedResynch = false; … … 4439 4473 if (!pLockAlloc->LockInfo.cLocks) 4440 4474 { 4441 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 4442 &pLockAlloc->LockInfo.LockedRect, 4443 pRect, 4444 vboxDDI2D3DLockFlags(pData->Flags)); 4475 if (pTexAlloc->enmD3DIfType==VBOXDISP_D3DIFTYPE_TEXTURE) 4476 { 4477 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 4478 &pLockAlloc->LockInfo.LockedRect, 4479 pRect, 4480 vboxDDI2D3DLockFlags(pData->Flags)); 4481 } 4482 else /*VBOXDISP_D3DIFTYPE_CUBE_TEXTURE*/ 4483 { 4484 hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4485 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex), 4486 &pLockAlloc->LockInfo.LockedRect, 4487 pRect, 4488 vboxDDI2D3DLockFlags(pData->Flags)); 4489 } 4445 4490 Assert(hr == S_OK); 4446 4491 if (hr == S_OK) … … 4488 4533 (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly)) 4489 4534 { 4490 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 4535 if (pTexAlloc->enmD3DIfType==VBOXDISP_D3DIFTYPE_TEXTURE) 4536 { 4537 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 4538 } 4539 else /*VBOXDISP_D3DIFTYPE_CUBE_TEXTURE*/ 4540 { 4541 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4542 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex)); 4543 } 4491 4544 Assert(hr == S_OK); 4492 4545 if (hr == S_OK) 4493 4546 { 4494 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 4495 &pLockAlloc->LockInfo.LockedRect, 4496 pRect, 4497 vboxDDI2D3DLockFlags(pData->Flags)); 4547 if (pTexAlloc->enmD3DIfType==VBOXDISP_D3DIFTYPE_TEXTURE) 4548 { 4549 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 4550 &pLockAlloc->LockInfo.LockedRect, 4551 pRect, 4552 vboxDDI2D3DLockFlags(pData->Flags)); 4553 } 4554 else /*VBOXDISP_D3DIFTYPE_CUBE_TEXTURE*/ 4555 { 4556 hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4557 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex), 4558 &pLockAlloc->LockInfo.LockedRect, 4559 pRect, 4560 vboxDDI2D3DLockFlags(pData->Flags)); 4561 } 4498 4562 Assert(hr == S_OK); 4499 4563 pLockAlloc->LockInfo.fFlags.ReadOnly = 0; … … 4811 4875 if (VBOXDISPMODE_IS_3D(pDevice->pAdapter)) 4812 4876 { 4813 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE) 4877 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE 4878 || pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE) 4814 4879 { 4815 4880 Assert(pData->SubResourceIndex < pRc->cAllocations); … … 4823 4888 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; 4824 4889 // Assert(!pLockAlloc->LockInfo.cLocks); 4825 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 4826 Assert(pD3DIfTex); 4890 Assert(pTexAlloc->pD3DIf); 4827 4891 /* this is a sysmem texture, update */ 4828 4892 #if 0 … … 4834 4898 } 4835 4899 #endif 4836 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 4900 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE) 4901 { 4902 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 4903 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 4904 } 4905 else 4906 { 4907 IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pTexAlloc->pD3DIf; 4908 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4909 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex)); 4910 } 4837 4911 Assert(hr == S_OK); 4838 4912 } … … 5229 5303 IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice); 5230 5304 5305 if (!pResource->Flags.CubeMap) 5306 { 5231 5307 #ifdef DEBUG 5232 {5233 uint32_t tstW = pResource->pSurfList[0].Width;5234 uint32_t tstH = pResource->pSurfList[0].Height;5235 for (UINT i = 1; i < pResource->SurfCount; ++i)5236 5308 { 5237 tstW /= 2; 5238 tstH /= 2; 5239 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 5240 Assert((pSurf->Width == tstW) || (!tstW && (pSurf->Width==1))); 5241 Assert((pSurf->Height == tstH) || (!tstH && (pSurf->Height==1))); 5309 uint32_t tstW = pResource->pSurfList[0].Width; 5310 uint32_t tstH = pResource->pSurfList[0].Height; 5311 for (UINT i = 1; i < pResource->SurfCount; ++i) 5312 { 5313 tstW /= 2; 5314 tstH /= 2; 5315 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 5316 Assert((pSurf->Width == tstW) || (!tstW && (pSurf->Width==1))); 5317 Assert((pSurf->Height == tstH) || (!tstH && (pSurf->Height==1))); 5318 } 5242 5319 } 5243 }5244 5320 #endif 5245 5321 … … 5247 5323 // bIssueCreateResource = true; 5248 5324 5249 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 5250 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0]; 5251 IDirect3DTexture9 *pD3DIfTex; 5252 HANDLE hSharedHandle = NULL; 5253 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 5254 { 5255 Assert(pSurf->pSysMem); 5256 Assert(pSurf->SysMemPitch); 5257 UINT bpp = vboxWddmCalcBitsPerPixel(pResource->Format); 5258 Assert(bpp); 5259 if (bpp) 5325 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 5326 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0]; 5327 IDirect3DTexture9 *pD3DIfTex; 5328 HANDLE hSharedHandle = NULL; 5329 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 5260 5330 { 5261 pAllocation->D3DWidth = ((pSurf->SysMemPitch << 3) / bpp); 5262 if ((pSurf->SysMemPitch << 3) % bpp) 5331 Assert(pSurf->pSysMem); 5332 Assert(pSurf->SysMemPitch); 5333 UINT bpp = vboxWddmCalcBitsPerPixel(pResource->Format); 5334 Assert(bpp); 5335 if (bpp) 5263 5336 { 5264 Assert(0); 5265 ++pAllocation->D3DWidth; 5337 pAllocation->D3DWidth = ((pSurf->SysMemPitch << 3) / bpp); 5338 if ((pSurf->SysMemPitch << 3) % bpp) 5339 { 5340 Assert(0); 5341 ++pAllocation->D3DWidth; 5342 } 5343 Assert(pAllocation->D3DWidth >= pSurf->Width); 5266 5344 } 5267 Assert(pAllocation->D3DWidth >= pSurf->Width);5268 5345 } 5269 }5270 5346 #if 0 5271 hr = pDevice9If->CreateTexture(pSurf->Width,5272 pAllocation->D3DWidth,5273 pResource->SurfCount,5274 vboxDDI2D3DUsage(pResource->Flags),5275 vboxDDI2D3DFormat(pResource->Format),5276 vboxDDI2D3DPool(pResource->Pool),5277 &pD3DIfTex,5278 NULL /* HANDLE* pSharedHandle */5279 );5347 hr = pDevice9If->CreateTexture(pSurf->Width, 5348 pAllocation->D3DWidth, 5349 pResource->SurfCount, 5350 vboxDDI2D3DUsage(pResource->Flags), 5351 vboxDDI2D3DFormat(pResource->Format), 5352 vboxDDI2D3DPool(pResource->Pool), 5353 &pD3DIfTex, 5354 NULL /* HANDLE* pSharedHandle */ 5355 ); 5280 5356 #else 5281 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If,5282 pAllocation->D3DWidth,5283 pSurf->Height,5284 pResource->SurfCount,5285 vboxDDI2D3DUsage(pResource->Flags),5286 vboxDDI2D3DFormat(pResource->Format),5287 vboxDDI2D3DPool(pResource->Pool),5288 &pD3DIfTex,5289 pResource->Flags.SharedResource ? &hSharedHandle : NULL,5290 pResource->Pool == D3DDDIPOOL_SYSTEMMEM ? pRc->aAllocations[0].pvMem : NULL);5291 #endif 5292 Assert(hr == S_OK);5293 if (hr == S_OK)5294 {5295 Assert(pD3DIfTex);5296 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;5297 pAllocation->pD3DIf = pD3DIfTex;5298 Assert(!!(pResource->Flags.SharedResource) == !!(hSharedHandle));5299 pAllocation->hSharedHandle = hSharedHandle;5357 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If, 5358 pAllocation->D3DWidth, 5359 pSurf->Height, 5360 pResource->SurfCount, 5361 vboxDDI2D3DUsage(pResource->Flags), 5362 vboxDDI2D3DFormat(pResource->Format), 5363 vboxDDI2D3DPool(pResource->Pool), 5364 &pD3DIfTex, 5365 pResource->Flags.SharedResource ? &hSharedHandle : NULL, 5366 pResource->Pool == D3DDDIPOOL_SYSTEMMEM ? pRc->aAllocations[0].pvMem : NULL); 5367 #endif 5368 Assert(hr == S_OK); 5369 if (hr == S_OK) 5370 { 5371 Assert(pD3DIfTex); 5372 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE; 5373 pAllocation->pD3DIf = pD3DIfTex; 5374 Assert(!!(pResource->Flags.SharedResource) == !!(hSharedHandle)); 5375 pAllocation->hSharedHandle = hSharedHandle; 5300 5376 #if 0 5301 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 5377 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 5378 { 5379 for (UINT i = 0; i < pResource->SurfCount; ++i) 5380 { 5381 D3DLOCKED_RECT lockInfo; 5382 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 5383 Assert(pAllocation->pvMem); 5384 hr = pD3DIfTex->LockRect(i, &lockInfo, NULL, D3DLOCK_DISCARD); 5385 Assert(hr == S_OK); 5386 if (hr == S_OK) 5387 { 5388 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/); 5389 HRESULT tmpHr = pD3DIfTex->UnlockRect(i); 5390 Assert(tmpHr == S_OK); 5391 } 5392 else 5393 { 5394 pD3DIfTex->Release(); 5395 break; 5396 } 5397 } 5398 } 5399 #endif 5400 } 5401 #ifdef DEBUG 5402 else 5302 5403 { 5303 5404 for (UINT i = 0; i < pResource->SurfCount; ++i) 5304 5405 { 5305 D3DLOCKED_RECT lockInfo;5306 5406 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 5307 Assert(pAllocation->pvMem); 5308 hr = pD3DIfTex->LockRect(i, &lockInfo, NULL, D3DLOCK_DISCARD); 5309 Assert(hr == S_OK); 5310 if (hr == S_OK) 5311 { 5312 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/); 5313 HRESULT tmpHr = pD3DIfTex->UnlockRect(i); 5314 Assert(tmpHr == S_OK); 5315 } 5316 else 5317 { 5318 pD3DIfTex->Release(); 5319 break; 5320 } 5407 Assert(!pAllocation->pvMem); 5321 5408 } 5322 5409 } 5323 5410 #endif 5324 5411 } 5325 #ifdef DEBUG 5326 else 5327 { 5328 for (UINT i = 0; i < pResource->SurfCount; ++i) 5412 else /*pResource->Flags.CubeMap*/ 5413 { 5414 IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice); 5415 5416 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 5417 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0]; 5418 IDirect3DCubeTexture9 *pD3DIfCubeTex; 5419 HANDLE hSharedHandle = NULL; 5420 5421 if ( (pAllocation->SurfDesc.width!=pAllocation->SurfDesc.height) 5422 || (pResource->SurfCount%6!=0)) 5329 5423 { 5330 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 5331 Assert(!pAllocation->pvMem); 5424 Assert(0); 5425 hr = E_INVALIDARG; 5426 } 5427 else 5428 { 5429 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If, 5430 pAllocation->SurfDesc.width, 5431 VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc), 5432 vboxDDI2D3DUsage(pResource->Flags), 5433 vboxDDI2D3DFormat(pResource->Format), 5434 vboxDDI2D3DPool(pResource->Pool), 5435 &pD3DIfCubeTex, 5436 pResource->Flags.SharedResource ? &hSharedHandle : NULL, 5437 pResource->Pool == D3DDDIPOOL_SYSTEMMEM ? pRc->aAllocations[0].pvMem : NULL); 5438 } 5439 5440 Assert(hr == S_OK); 5441 if (hr == S_OK) 5442 { 5443 Assert(pD3DIfCubeTex); 5444 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_CUBE_TEXTURE; 5445 pAllocation->pD3DIf = pD3DIfCubeTex; 5446 Assert(!!(pResource->Flags.SharedResource) == !!(hSharedHandle)); 5447 pAllocation->hSharedHandle = hSharedHandle; 5332 5448 } 5333 5449 } 5334 #endif5335 5450 } 5336 5451 else if (pResource->Flags.RenderTarget) … … 6301 6416 break; 6302 6417 } 6418 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 6419 { 6420 IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pRc->aAllocations[0].pD3DIf; 6421 Assert(pD3DIfCubeTex); 6422 hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, iAlloc), 6423 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, iAlloc), pLockedRect, pRect, fLockFlags); 6424 Assert(hr == S_OK); 6425 break; 6426 } 6303 6427 default: 6304 6428 Assert(0); … … 6307 6431 return hr; 6308 6432 } 6433 6309 6434 static HRESULT vboxWddmUnlockRect(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc) 6310 6435 { … … 6326 6451 Assert(pD3DIfTex); 6327 6452 hr = pD3DIfTex->UnlockRect(iAlloc); 6453 Assert(hr == S_OK); 6454 break; 6455 } 6456 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 6457 { 6458 IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pRc->aAllocations[0].pD3DIf; 6459 Assert(pD3DIfCubeTex); 6460 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, iAlloc), 6461 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, iAlloc)); 6328 6462 Assert(hr == S_OK); 6329 6463 break; … … 6509 6643 && (pSrcRc->RcDesc.fFlags.Texture || pSrcRc->RcDesc.fFlags.Value == 0)) 6510 6644 { 6511 IDirect3D Texture9 *pD3DIfSrcTex = (IDirect3DTexture9*)pSrcAlloc->pD3DIf;6512 IDirect3D Texture9 *pD3DIfDstTex = (IDirect3DTexture9*)pDstAlloc->pD3DIf;6645 IDirect3DBaseTexture9 *pD3DIfSrcTex = (IDirect3DBaseTexture9*)pSrcAlloc->pD3DIf; 6646 IDirect3DBaseTexture9 *pD3DIfDstTex = (IDirect3DBaseTexture9*)pDstAlloc->pD3DIf; 6513 6647 Assert(pD3DIfSrcTex); 6514 6648 Assert(pD3DIfDstTex); … … 7424 7558 IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice); 7425 7559 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 7426 IDirect3DTexture9 *pD3DIfTex;7427 7560 HANDLE hSharedHandle = pAllocation->hSharedHandle; 7428 7561 Assert(pAllocation->hSharedHandle); 7429 7562 7430 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If, 7431 pAllocation->SurfDesc.width, 7432 pAllocation->SurfDesc.height, 7433 pRc->cAllocations, 7434 vboxDDI2D3DUsage(pRc->RcDesc.fFlags), 7435 vboxDDI2D3DFormat(pRc->RcDesc.enmFormat), 7436 vboxDDI2D3DPool(pRc->RcDesc.enmPool), 7437 &pD3DIfTex, 7438 &hSharedHandle, 7439 NULL); 7440 Assert(hr == S_OK); 7441 if (hr == S_OK) 7563 if (!pRc->RcDesc.fFlags.CubeMap) 7442 7564 { 7443 Assert(pD3DIfTex); 7444 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE; 7445 pAllocation->pD3DIf = pD3DIfTex; 7446 Assert(pAllocation->hSharedHandle == hSharedHandle); 7447 Assert(pAllocation->hSharedHandle); 7565 IDirect3DTexture9 *pD3DIfTex; 7566 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If, 7567 pAllocation->SurfDesc.width, 7568 pAllocation->SurfDesc.height, 7569 pRc->cAllocations, 7570 vboxDDI2D3DUsage(pRc->RcDesc.fFlags), 7571 vboxDDI2D3DFormat(pRc->RcDesc.enmFormat), 7572 vboxDDI2D3DPool(pRc->RcDesc.enmPool), 7573 &pD3DIfTex, 7574 &hSharedHandle, 7575 NULL); 7576 Assert(hr == S_OK); 7577 if (hr == S_OK) 7578 { 7579 Assert(pD3DIfTex); 7580 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE; 7581 pAllocation->pD3DIf = pD3DIfTex; 7582 Assert(pAllocation->hSharedHandle == hSharedHandle); 7583 Assert(pAllocation->hSharedHandle); 7584 } 7585 } 7586 else 7587 { 7588 IDirect3DCubeTexture9 *pD3DIfCubeTex; 7589 7590 if ( (pAllocation->SurfDesc.width!=pAllocation->SurfDesc.height) 7591 || (pRc->cAllocations%6!=0)) 7592 { 7593 Assert(0); 7594 hr = E_INVALIDARG; 7595 } 7596 7597 hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If, 7598 pAllocation->SurfDesc.width, 7599 VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc), 7600 vboxDDI2D3DUsage(pRc->RcDesc.fFlags), 7601 vboxDDI2D3DFormat(pRc->RcDesc.enmFormat), 7602 vboxDDI2D3DPool(pRc->RcDesc.enmPool), 7603 &pD3DIfCubeTex, 7604 &hSharedHandle, 7605 NULL); 7606 Assert(hr == S_OK); 7607 if (hr == S_OK) 7608 { 7609 Assert(pD3DIfCubeTex); 7610 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_CUBE_TEXTURE; 7611 pAllocation->pD3DIf = pD3DIfCubeTex; 7612 Assert(pAllocation->hSharedHandle == hSharedHandle); 7613 Assert(pAllocation->hSharedHandle); 7614 } 7615 7448 7616 } 7449 7617 } -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
r33306 r33836 208 208 VBOXDISP_D3DIFTYPE_SURFACE, 209 209 VBOXDISP_D3DIFTYPE_TEXTURE, 210 VBOXDISP_D3DIFTYPE_CUBE_TEXTURE, 210 211 VBOXDISP_D3DIFTYPE_VERTEXBUFFER, 211 212 VBOXDISP_D3DIFTYPE_INDEXBUFFER -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DIf.cpp
r33540 r33836 39 39 if (pD3D->pfnVBoxWineExD3DDev9CreateTexture) 40 40 { 41 pD3D->pfnVBoxWineExD3DDev9 Flush = (PFNVBOXWINEEXD3DDEV9_FLUSH)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Flush");42 Assert(pD3D->pfnVBoxWineExD3DDev9 Flush);43 if (pD3D->pfnVBoxWineExD3DDev9 Flush)41 pD3D->pfnVBoxWineExD3DDev9CreateCubeTexture = (PFNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9CreateCubeTexture"); 42 Assert(pD3D->pfnVBoxWineExD3DDev9CreateCubeTexture); 43 if (pD3D->pfnVBoxWineExD3DDev9CreateCubeTexture) 44 44 { 45 pD3D->pfnVBoxWineExD3DDev9 Update = (PFNVBOXWINEEXD3DDEV9_UPDATE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Update");46 Assert(pD3D->pfnVBoxWineExD3DDev9 Update);47 if (pD3D->pfnVBoxWineExD3DDev9 Update)45 pD3D->pfnVBoxWineExD3DDev9Flush = (PFNVBOXWINEEXD3DDEV9_FLUSH)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Flush"); 46 Assert(pD3D->pfnVBoxWineExD3DDev9Flush); 47 if (pD3D->pfnVBoxWineExD3DDev9Flush) 48 48 { 49 return S_OK; 49 pD3D->pfnVBoxWineExD3DDev9Update = (PFNVBOXWINEEXD3DDEV9_UPDATE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Update"); 50 Assert(pD3D->pfnVBoxWineExD3DDev9Update); 51 if (pD3D->pfnVBoxWineExD3DDev9Update) 52 { 53 return S_OK; 54 } 50 55 } 51 56 } -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DIf.h
r32281 r33836 34 34 35 35 PFNVBOXWINEEXD3DDEV9_CREATETEXTURE pfnVBoxWineExD3DDev9CreateTexture; 36 37 PFNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE pfnVBoxWineExD3DDev9CreateCubeTexture; 36 38 37 39 PFNVBOXWINEEXD3DDEV9_FLUSH pfnVBoxWineExD3DDev9Flush;
Note:
See TracChangeset
for help on using the changeset viewer.