Changeset 30657 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
- Timestamp:
- Jul 6, 2010 11:47:17 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 63409
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r30630 r30657 1061 1061 } 1062 1062 } 1063 return S_OK; 1064 } 1065 1066 static HRESULT vboxWddmRenderTargetUpdateSurface(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc, uint32_t iBBuf) 1067 { 1068 IDirect3DSurface9 *pD3D9Surf; 1069 HRESULT hr = pDevice->pDevice9If->GetBackBuffer(0 /*UINT iSwapChain*/, 1070 iBBuf, D3DBACKBUFFER_TYPE_MONO, &pD3D9Surf); 1071 Assert(hr == S_OK); 1072 if (hr == S_OK) 1073 { 1074 Assert(pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE); 1075 if (pAlloc->pD3DIf) 1076 pAlloc->pD3DIf->Release(); 1077 pAlloc->pD3DIf = pD3D9Surf; 1078 } 1079 return hr; 1080 } 1081 static HRESULT vboxWddmRenderTargetUpdate(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc, uint32_t iNewRTFB) 1082 { 1083 PVBOXWDDMDISP_ALLOCATION pAlloc; 1084 UINT iBBuf = 0; 1085 for (UINT i = iNewRTFB + 1; i < pRc->cAllocations; ++i, ++iBBuf) 1086 { 1087 pAlloc = &pRc->aAllocations[i]; 1088 Assert(i != iNewRTFB); 1089 HRESULT tmpHr = vboxWddmRenderTargetUpdateSurface(pDevice, pAlloc, iBBuf); 1090 Assert(tmpHr == S_OK); 1091 } 1092 1093 for (UINT i = 0; iBBuf < pRc->cAllocations-1; ++i, ++iBBuf) 1094 { 1095 Assert(i != iNewRTFB); 1096 pAlloc = &pRc->aAllocations[i]; 1097 HRESULT tmpHr = vboxWddmRenderTargetUpdateSurface(pDevice, pAlloc, iBBuf); 1098 Assert(tmpHr == S_OK); 1099 } 1100 1101 pAlloc = &pRc->aAllocations[iNewRTFB]; 1102 HRESULT tmpHr = vboxWddmRenderTargetUpdateSurface(pDevice, pAlloc, ~0UL /* <- for the frontbuffer */); 1103 Assert(tmpHr == S_OK); 1063 1104 return S_OK; 1064 1105 } … … 3262 3303 pDevice->pRenderTargetRc = pRc; 3263 3304 3264 IDirect3DSurface9* pD3D9Surf; 3265 hr = pDevice->pDevice9If->GetRenderTarget(0, &pD3D9Surf); 3305 for (UINT i = 0; i < pResource->SurfCount; ++i) 3306 { 3307 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 3308 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 3309 } 3310 3311 hr = vboxWddmRenderTargetUpdate(pDevice, pRc, 0); 3266 3312 Assert(hr == S_OK); 3267 3313 if (hr == S_OK) 3268 3314 { 3269 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 3270 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 3271 pAllocation->pD3DIf = pD3D9Surf; 3272 hr = vboxWddmSurfSynchMem(pRc, pAllocation); 3273 Assert(hr == S_OK); 3274 if (hr == S_OK) 3315 for (UINT i = 0; i < pResource->SurfCount; ++i) 3275 3316 { 3276 for (UINT i = 1; i < pResource->SurfCount; ++i) 3317 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 3318 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 3319 hr = vboxWddmSurfSynchMem(pRc, pAllocation); 3320 Assert(hr == S_OK); 3321 if (hr != S_OK) 3322 { 3323 break; 3324 } 3325 } 3326 3327 if (hr != S_OK) 3328 { 3329 for (UINT i = 0; i < pResource->SurfCount; ++i) 3277 3330 { 3278 3331 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 3279 hr = pDevice->pDevice9If->GetBackBuffer(0 /*UINT iSwapChain*/, 3280 i-1, D3DBACKBUFFER_TYPE_MONO, &pD3D9Surf); 3281 Assert(hr == S_OK); 3282 if (hr == S_OK) 3283 { 3284 Assert(pD3D9Surf); 3285 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 3286 pAllocation->pD3DIf = pD3D9Surf; 3287 hr = vboxWddmSurfSynchMem(pRc, pAllocation); 3288 Assert(hr == S_OK); 3289 if (hr == S_OK) 3290 { 3291 continue; 3292 } 3293 3294 /* Failure branch */ 3295 pD3D9Surf->Release(); 3296 } 3297 3298 for (UINT j = 1; j < i; ++j) 3299 { 3300 pRc->aAllocations[j].pD3DIf->Release(); 3301 } 3332 pAllocation->pD3DIf->Release(); 3302 3333 } 3303 3334 } 3304 3305 if (hr != S_OK)3306 pRc->aAllocations[0].pD3DIf->Release();3307 3335 } 3308 3336 … … 3551 3579 // DdiDm.PrivateDriverFormatAttribute = 0; 3552 3580 Assert(pDevice->pRenderTargetRc == pRc); 3581 Assert(pDevice->iRenderTargetFrontBuf == pData->SubResourceIndex); 3553 3582 3554 3583 #if 0 … … 3588 3617 #endif 3589 3618 { 3619 if (pData->Flags.Flip) 3620 { 3621 Assert(pData->hSrcResource); 3622 PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource; 3623 Assert(pDevice->pRenderTargetRc == pRc); 3624 Assert(pRc->cAllocations >= 2); 3625 Assert(pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE); 3626 Assert(pRc->RcDesc.fFlags.RenderTarget); 3627 uint32_t iNewRTFB = pDevice->iRenderTargetFrontBuf + 1; 3628 if (iNewRTFB >= pRc->cAllocations) 3629 iNewRTFB = 0; 3630 3631 Assert(pDevice->iRenderTargetFrontBuf != iNewRTFB); 3632 Assert(pData->SrcSubResourceIndex == iNewRTFB); 3633 3634 vboxWddmRenderTargetUpdate(pDevice, pRc, iNewRTFB); 3635 3636 /* assign a new frontbuffer index */ 3637 pDevice->iRenderTargetFrontBuf = iNewRTFB; 3638 } 3590 3639 D3DDDICB_PRESENT DdiPresent = {0}; 3591 3640 if (pData->hSrcResource) … … 4139 4188 HRESULT hr = S_OK; 4140 4189 IDirect3DSurface9 *pD3D9Surf; 4141 hr = vboxWddmSurfGet(pRc, pData->SubResourceIndex, &pD3D9Surf); 4142 Assert(hr == S_OK); 4190 if (pRc == pDevice->pRenderTargetRc && pRc->cAllocations == 1 && pData->RenderTargetIndex == 0) 4191 { 4192 /* work-around wine double-buffering for the case we have no backbuffers */ 4193 hr = pDevice->pDevice9If->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pD3D9Surf); 4194 Assert(hr == S_OK); 4195 Assert(pD3D9Surf); 4196 } 4197 else 4198 { 4199 hr = vboxWddmSurfGet(pRc, pData->SubResourceIndex, &pD3D9Surf); 4200 Assert(hr == S_OK); 4201 Assert(pD3D9Surf); 4202 } 4143 4203 if (hr == S_OK) 4144 4204 { -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
r30603 r30657 103 103 HWND hWnd; 104 104 struct VBOXWDDMDISP_RESOURCE *pRenderTargetRc; 105 uint32_t iRenderTargetFrontBuf; 105 106 /* number of StreamSources set */ 106 107 UINT cStreamSources; -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DCmn.h
r30554 r30657 63 63 } while (0) 64 64 #define vboxVDbgPrintR vboxVDbgPrint 65 #define vboxVDbgPrintF vboxVDbgPrint65 #define vboxVDbgPrintF(_m) do {} while (0) 66 66 #else 67 67 #define vboxVDbgBreak() do {} while (0)
Note:
See TracChangeset
for help on using the changeset viewer.