Changeset 34939 in vbox for trunk/src/VBox
- Timestamp:
- Dec 10, 2010 9:53:02 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r34917 r34939 2137 2137 if (pvSwapchain != pSwapchain->pSwapChainIf) 2138 2138 { 2139 #ifdef DEBUG_misha 2140 /* @todo: we can not generally update the render target directly, implement */ 2139 2141 Assert(iBb != (~0)); 2140 // Assert(0);2141 #if 0 //def DEBUG_misha2142 vboxVDbgDumpAllocSurfData((pDevice, "Synch Src:\n", pAlloc, pD3D9OldSurf, NULL, "\n"));2143 vboxVDbgDumpAllocData((pDevice, "Synch ALLOC:\n", pAlloc, NULL, "\n"));2144 2142 #endif 2145 2143 hr = pDevice->pDevice9If->StretchRect(pD3D9OldSurf, NULL, pD3D9Surf, NULL, D3DTEXF_NONE); 2146 2144 Assert(hr == S_OK); 2147 #if 0 //def DEBUG_misha2148 vboxVDbgDumpAllocSurfData((pDevice, "Synch Dst:\n", pAlloc, pD3D9Surf, NULL, "\n"));2149 #endif2150 2145 if (pSwapchain->cRTs == 1) 2151 2146 { … … 2210 2205 { 2211 2206 Assert(pSwapchain->cRTs); 2207 #ifdef DEBUG_misha 2208 /* not supported by wine properly, need to use offscreen render targets and blit their data to swapchain RTs*/ 2212 2209 Assert(pSwapchain->cRTs <= 2); 2210 #endif 2213 2211 memset(pParams, 0, sizeof (D3DPRESENT_PARAMETERS)); 2214 2212 PVBOXWDDMDISP_RENDERTGT pRt = vboxWddmSwapchainGetBb(pSwapchain); … … 2312 2310 if (pOldIf) 2313 2311 { 2314 Assert(0);2315 2312 /* copy current rt data to offscreen render targets */ 2316 2313 IDirect3DSurface9* pD3D9OldFb = NULL; … … 3365 3362 // VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice); 3366 3363 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 3364 #ifdef DEBUG_misha 3365 /* @todo: check if it's ok to always return success */ 3366 vboxVDbgPrint((__FUNCTION__": @todo: check if it's ok to always return success\n")); 3367 3367 Assert(0); 3368 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 3369 return E_FAIL; 3368 #endif 3369 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 3370 return S_OK; 3370 3371 } 3371 3372 … … 4406 4407 4407 4408 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE 4408 || pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE) 4409 || pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE 4410 || pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE) 4409 4411 { 4410 4412 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; … … 4413 4415 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 4414 4416 IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pTexAlloc->pD3DIf; 4417 IDirect3DSurface9 *pD3DIfSurface = (IDirect3DSurface9*)pTexAlloc->pD3DIf; 4415 4418 Assert(pTexAlloc->pD3DIf); 4416 4419 RECT *pRect = NULL; … … 4425 4428 /* else - we lock the entire texture, pRect == NULL */ 4426 4429 4427 // Assert(!pLockAlloc->LockInfo.cLocks);4428 4430 if (!pLockAlloc->LockInfo.cLocks) 4429 4431 { 4430 if (pTexAlloc->enmD3DIfType==VBOXDISP_D3DIFTYPE_TEXTURE) 4431 { 4432 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 4433 &pLockAlloc->LockInfo.LockedRect, 4434 pRect, 4435 vboxDDI2D3DLockFlags(pData->Flags)); 4436 } 4437 else /*VBOXDISP_D3DIFTYPE_CUBE_TEXTURE*/ 4438 { 4439 hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4440 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex), 4441 &pLockAlloc->LockInfo.LockedRect, 4442 pRect, 4443 vboxDDI2D3DLockFlags(pData->Flags)); 4432 switch (pTexAlloc->enmD3DIfType) 4433 { 4434 case VBOXDISP_D3DIFTYPE_TEXTURE: 4435 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 4436 &pLockAlloc->LockInfo.LockedRect, 4437 pRect, 4438 vboxDDI2D3DLockFlags(pData->Flags)); 4439 break; 4440 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 4441 hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4442 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex), 4443 &pLockAlloc->LockInfo.LockedRect, 4444 pRect, 4445 vboxDDI2D3DLockFlags(pData->Flags)); 4446 break; 4447 case VBOXDISP_D3DIFTYPE_SURFACE: 4448 hr = pD3DIfSurface->LockRect(&pLockAlloc->LockInfo.LockedRect, 4449 pRect, 4450 vboxDDI2D3DLockFlags(pData->Flags)); 4451 break; 4452 default: 4453 Assert(0); 4454 break; 4444 4455 } 4445 4456 Assert(hr == S_OK); 4446 4457 if (hr == S_OK) 4447 4458 { 4448 4449 // Assert(pLockAlloc->LockInfo.fFlags.Value == 0);4450 4459 pLockAlloc->LockInfo.fFlags = pData->Flags; 4451 4460 if (pRect) … … 4453 4462 pLockAlloc->LockInfo.Area = *pRect; 4454 4463 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 1); 4455 // pLockAlloc->LockInfo.fFlags.AreaValid = 1;4456 4464 } 4457 4465 else 4458 4466 { 4459 4467 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 0); 4460 // pLockAlloc->LockInfo.fFlags.AreaValid = 0;4461 4468 } 4462 4469 … … 4466 4473 else 4467 4474 { 4468 // Assert(pLockAlloc->LockInfo.fFlags.Value == pData->Flags.Value);4469 // if (pLockAlloc->LockInfo.fFlags.Value != pData->Flags.Value)4470 // {4471 // }4472 4475 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == pData->Flags.AreaValid); 4473 4476 if (pLockAlloc->LockInfo.fFlags.AreaValid && pData->Flags.AreaValid) … … 4484 4487 Assert(!bNeedResynch); 4485 4488 4486 if (/*(pLockAlloc->LockInfo.fFlags.Discard && !pData->Flags.Discard) 4487 || */ 4488 (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly)) 4489 { 4490 if (pTexAlloc->enmD3DIfType==VBOXDISP_D3DIFTYPE_TEXTURE) 4489 if (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly) 4490 { 4491 switch (pTexAlloc->enmD3DIfType) 4491 4492 { 4492 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 4493 } 4494 else /*VBOXDISP_D3DIFTYPE_CUBE_TEXTURE*/ 4495 { 4496 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4497 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex)); 4493 case VBOXDISP_D3DIFTYPE_TEXTURE: 4494 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 4495 break; 4496 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 4497 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4498 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex)); 4499 break; 4500 case VBOXDISP_D3DIFTYPE_SURFACE: 4501 hr = pD3DIfSurface->UnlockRect(); 4502 break; 4503 default: 4504 Assert(0); 4505 break; 4498 4506 } 4499 4507 Assert(hr == S_OK); 4500 4508 if (hr == S_OK) 4501 4509 { 4502 if (pTexAlloc->enmD3DIfType==VBOXDISP_D3DIFTYPE_TEXTURE)4510 switch (pTexAlloc->enmD3DIfType) 4503 4511 { 4504 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 4505 &pLockAlloc->LockInfo.LockedRect, 4506 pRect, 4507 vboxDDI2D3DLockFlags(pData->Flags)); 4508 } 4509 else /*VBOXDISP_D3DIFTYPE_CUBE_TEXTURE*/ 4510 { 4511 hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4512 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex), 4513 &pLockAlloc->LockInfo.LockedRect, 4514 pRect, 4515 vboxDDI2D3DLockFlags(pData->Flags)); 4512 case VBOXDISP_D3DIFTYPE_TEXTURE: 4513 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 4514 &pLockAlloc->LockInfo.LockedRect, 4515 pRect, 4516 vboxDDI2D3DLockFlags(pData->Flags)); 4517 break; 4518 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 4519 hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4520 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex), 4521 &pLockAlloc->LockInfo.LockedRect, 4522 pRect, 4523 vboxDDI2D3DLockFlags(pData->Flags)); 4524 break; 4525 case VBOXDISP_D3DIFTYPE_SURFACE: 4526 hr = pD3DIfSurface->LockRect(&pLockAlloc->LockInfo.LockedRect, 4527 pRect, 4528 vboxDDI2D3DLockFlags(pData->Flags)); 4529 break; 4530 default: 4531 Assert(0); 4532 break; 4516 4533 } 4517 4534 Assert(hr == S_OK); … … 4537 4554 Assert(pLockAlloc->pvMem); 4538 4555 Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 4539 #if 04540 if (bNeedResynch)4541 vboxWddmLockUnlockMemSynch(pLockAlloc, &pLockAlloc->LockInfo.LockedRect, pRect, false /*bool bToLockInfo*/);4542 #endif4543 4556 } 4544 4557 } … … 4561 4574 /* else - we lock the entire vertex buffer, pRect == NULL */ 4562 4575 4563 Assert(!pAlloc->LockInfo.cLocks);4564 4576 if (!pAlloc->LockInfo.cLocks) 4565 4577 { … … 4594 4606 else 4595 4607 { 4596 // Assert(pAlloc->LockInfo.fFlags.Value == pData->Flags.Value);4597 // if (pAlloc->LockInfo.fFlags.Value != pData->Flags.Value)4598 // {4599 // }4600 4608 Assert(pAlloc->LockInfo.fFlags.RangeValid == pData->Flags.RangeValid); 4601 4609 if (pAlloc->LockInfo.fFlags.RangeValid && pData->Flags.RangeValid) … … 4658 4666 /* else - we lock the entire vertex buffer, pRect == NULL */ 4659 4667 4660 Assert(!pAlloc->LockInfo.cLocks);4661 4668 if (!pAlloc->LockInfo.cLocks) 4662 4669 { … … 4691 4698 else 4692 4699 { 4693 // Assert(pAlloc->LockInfo.fFlags.Value == pData->Flags.Value);4694 // if (pAlloc->LockInfo.fFlags.Value != pData->Flags.Value)4695 // {4696 // }4697 4700 Assert(pAlloc->LockInfo.fFlags.RangeValid == pData->Flags.RangeValid); 4698 4701 if (pAlloc->LockInfo.fFlags.RangeValid && pData->Flags.RangeValid) … … 4831 4834 { 4832 4835 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE 4833 || pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE) 4836 || pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE 4837 || pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE) 4834 4838 { 4835 4839 Assert(pData->SubResourceIndex < pRc->cAllocations); … … 4838 4842 --pLockAlloc->LockInfo.cLocks; 4839 4843 Assert(pLockAlloc->LockInfo.cLocks < UINT32_MAX); 4840 // pLockAlloc->LockInfo.cLocks = 0;4841 4844 if (!pLockAlloc->LockInfo.cLocks) 4842 4845 { 4843 4846 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; 4844 // Assert(!pLockAlloc->LockInfo.cLocks);4845 4847 Assert(pTexAlloc->pD3DIf); 4846 /* this is a sysmem texture, update */ 4847 #if 0 4848 if (pLockAlloc->pvMem && !pLockAlloc->LockInfo.fFlags.ReadOnly) 4849 { 4850 vboxWddmLockUnlockMemSynch(pLockAlloc, &pLockAlloc->LockInfo.LockedRect, 4851 pLockAlloc->LockInfo.fFlags.AreaValid ? &pLockAlloc->LockInfo.Area : NULL, 4852 true /*bool bToLockInfo*/); 4853 } 4854 #endif 4855 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE) 4856 { 4857 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 4858 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 4859 } 4860 else 4861 { 4862 IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pTexAlloc->pD3DIf; 4863 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4864 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex)); 4848 switch (pRc->aAllocations[0].enmD3DIfType) 4849 { 4850 case VBOXDISP_D3DIFTYPE_TEXTURE: 4851 { 4852 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 4853 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 4854 break; 4855 } 4856 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 4857 { 4858 IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pTexAlloc->pD3DIf; 4859 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 4860 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex)); 4861 break; 4862 } 4863 case VBOXDISP_D3DIFTYPE_SURFACE: 4864 { 4865 IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pTexAlloc->pD3DIf; 4866 hr = pD3DIfSurf->UnlockRect(); 4867 break; 4868 } 4869 default: 4870 Assert(0); 4871 break; 4865 4872 } 4866 4873 Assert(hr == S_OK); … … 7348 7355 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 7349 7356 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice; 7350 // Assert(pDevice); 7351 // VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice); 7352 7353 Assert(0); 7357 7354 7358 HRESULT hr = S_OK; 7359 /* @todo check residency for the "real" allocations */ 7355 7360 #if 0 7356 7361 for (UINT i = 0; i < pData->NumResources; ++i)
Note:
See TracChangeset
for help on using the changeset viewer.