Changeset 38884 in vbox for trunk/src/VBox
- Timestamp:
- Sep 27, 2011 9:59:15 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r38660 r38884 2014 2014 } 2015 2015 #endif 2016 static PVBOXWDDMDISP_SWAPCHAIN vboxWddmSwapchainFindCreate(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pBbAlloc )2016 static PVBOXWDDMDISP_SWAPCHAIN vboxWddmSwapchainFindCreate(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pBbAlloc, BOOL *pbNeedPresent) 2017 2017 { 2018 2018 PVBOXWDDMDISP_SWAPCHAIN pSwapchain = pBbAlloc->pSwapchain; … … 2023 2023 if (pRt->pAlloc != pBbAlloc) 2024 2024 { 2025 if (pBbAlloc == vboxWddmSwapchainGetFb(pSwapchain)->pAlloc) 2026 { 2027 /* the current front-buffer present is requested, don't do anything */ 2028 *pbNeedPresent = FALSE; 2029 return pSwapchain; 2030 } 2025 2031 /* bad, @todo: correct the swapchain by either removing the Rt and adding it to another swapchain 2026 2032 * or by removing the pBbAlloc out of it */ … … 2028 2034 } 2029 2035 } 2036 2037 *pbNeedPresent = TRUE; 2038 2030 2039 if (!pSwapchain) 2031 2040 { … … 2121 2130 PVBOXWDDMDISP_ALLOCATION pAlloc = pRt->pAlloc; 2122 2131 Assert(pD3D9Surf); 2123 Assert(pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE); 2132 Assert(pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE 2133 || pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE); 2124 2134 if (pAlloc->pD3DIf) 2125 2135 { 2126 2136 if (pSwapchain->fFlags.bChanged) 2127 2137 { 2128 IDirect3DSurface9 *pD3D9OldSurf = (IDirect3DSurface9*)pAlloc->pD3DIf; 2138 IDirect3DSurface9 *pD3D9OldSurf = NULL; 2139 if (pAlloc->pD3DIf) 2140 { 2141 /* since this can be texture, need to do the vboxWddmSurfGet magic */ 2142 hr = vboxWddmSurfGet(pAlloc->pRc, pAlloc->iAlloc, &pD3D9OldSurf); 2143 if (FAILED(hr)) 2144 { 2145 WARN(("vboxWddmSurfGet failed, hr (0x%x)",hr)); 2146 pD3D9Surf->Release(); 2147 return hr; 2148 } 2149 } 2150 2129 2151 if (pD3D9OldSurf && pD3D9OldSurf != pD3D9Surf) 2130 2152 { … … 2153 2175 } 2154 2176 } 2177 2178 if (pD3D9OldSurf) 2179 { 2180 pD3D9OldSurf->Release(); 2181 } 2182 } 2183 else 2184 { 2185 Assert(pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE); 2155 2186 } 2156 2187 pAlloc->pD3DIf->Release(); 2157 2188 } 2158 2189 2190 pAlloc->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 2159 2191 pAlloc->pD3DIf = pD3D9Surf; 2160 2192 pRt->fFlags.Value = 0; … … 2351 2383 if (!pRT->pAlloc->pD3DIf) 2352 2384 continue; 2353 IDirect3DSurface9* pD3D9OldSurf = (IDirect3DSurface9*)pRT->pAlloc->pD3DIf;2385 IDirect3DSurface9* pD3D9OldSurf = NULL; 2354 2386 VOID *pvSwapchain = NULL; 2387 /* since this can be texture, need to do the vboxWddmSurfGet magic */ 2388 hr = vboxWddmSurfGet(pRT->pAlloc->pRc, pRT->pAlloc->iAlloc, &pD3D9OldSurf); 2389 Assert(hr == S_OK); 2355 2390 tmpHr = pD3D9OldSurf->GetContainer(IID_IDirect3DSwapChain9, &pvSwapchain); 2356 2391 if (tmpHr == S_OK) … … 2394 2429 continue; 2395 2430 2431 pRT->pAlloc->pD3DIf->Release(); 2396 2432 pRT->pAlloc->pD3DIf = pD3D9NewSurf; 2397 2433 pD3D9OldSurf->Release(); … … 2466 2502 if (hr == S_OK) 2467 2503 { 2504 #ifdef DEBUG 2468 2505 for (UINT i = 0; i < cSurfs; ++i) 2469 2506 { 2470 2507 PVBOXWDDMDISP_RENDERTGT pRt = &pSwapchain->aRTs[i]; 2471 pRt->pAlloc->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 2472 } 2473 2508 Assert(pRt->pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE 2509 || pRt->pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE); 2510 } 2511 #endif 2474 2512 hr = vboxWddmSwapchainSynch(pDevice, pSwapchain); 2475 2513 Assert(hr == S_OK); … … 2655 2693 static HRESULT vboxWddmSwapchainPresent(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pBbAlloc) 2656 2694 { 2657 BOOL b Changed = FALSE;2658 PVBOXWDDMDISP_SWAPCHAIN pSwapchain = vboxWddmSwapchainFindCreate(pDevice, pBbAlloc );2695 BOOL bNeedPresent; 2696 PVBOXWDDMDISP_SWAPCHAIN pSwapchain = vboxWddmSwapchainFindCreate(pDevice, pBbAlloc, &bNeedPresent); 2659 2697 Assert(pSwapchain); 2698 if (!bNeedPresent) 2699 return S_OK; 2660 2700 if (pSwapchain) 2661 2701 { … … 2744 2784 { 2745 2785 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i]; 2786 pAlloc->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 2746 2787 pAlloc->SurfDesc.width = 0x4; 2747 2788 pAlloc->SurfDesc.height = 0x4; … … 3731 3772 PVBOXWDDMDISP_RESOURCE pSrcRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource; 3732 3773 /* requirements for D3DDevice9::UpdateTexture */ 3774 Assert(pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE); 3775 Assert(pSrcRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE); 3733 3776 Assert(pSrcRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 3734 3777 Assert(pDstRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM); … … 5090 5133 bCreateSwapchain = true; 5091 5134 Assert(bIssueCreateResource); 5135 for (UINT i = 0; i < pRc->cAllocations; ++i) 5136 { 5137 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 5138 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 5139 } 5092 5140 } 5093 5141 else
Note:
See TracChangeset
for help on using the changeset viewer.