Changeset 32703 in vbox for trunk/src/VBox
- Timestamp:
- Sep 22, 2010 10:21:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r32699 r32703 36 36 #endif 37 37 38 #define VBOX WDDMDISP_WITH_TMPWORKAROUND 138 #define VBOXDISP_WITH_WINE_BB_WORKAROUND 39 39 40 40 static VBOXSCREENMONRUNNER g_VBoxScreenMonRunner; … … 1159 1159 else 1160 1160 { 1161 #ifndef VBOXDISP_WITH_WINE_BB_WORKAROUND 1162 # error "port me!" 1163 #endif 1161 1164 /* work-around wine backbuffer for devices w/o backbuffers */ 1162 1165 HRESULT tmpHr = vboxWddmRenderTargetUpdateSurface(pDevice, pAlloc, 0); … … 1823 1826 { 1824 1827 IDirect3DSurface9 *pD3D9Surf; 1828 #ifdef VBOXDISP_WITH_WINE_BB_WORKAROUND 1829 if (pSwapchain->cRTs == 1) 1830 { 1831 iBb = 0; 1832 } 1833 #endif 1825 1834 UINT iRt = vboxWddmSwapchainIdxBb2Rt(pSwapchain, iBb); 1826 1835 Assert(iRt < pSwapchain->cRTs); … … 1854 1863 { 1855 1864 Assert(0); 1865 if (iBb == (~0)) 1866 { 1867 pD3D9Surf->Release(); 1868 hr = pSwapchain->pSwapChainIf->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pD3D9Surf); 1869 Assert(hr == S_OK); 1870 } 1856 1871 hr = pDevice->pDevice9If->StretchRect(pD3D9OldSurf, NULL, pD3D9Surf, NULL, D3DTEXF_NONE); 1857 1872 Assert(hr == S_OK); 1873 if (iBb == (~0)) 1874 { 1875 pD3D9Surf->Release(); 1876 hr = pSwapchain->pSwapChainIf->Present(NULL, NULL, NULL, NULL, 0); 1877 Assert(hr == S_OK); 1878 hr = pSwapchain->pSwapChainIf->GetBackBuffer(~0, D3DBACKBUFFER_TYPE_MONO, &pD3D9Surf); 1879 Assert(hr == S_OK); 1880 } 1858 1881 } 1859 1882 } … … 1882 1905 { 1883 1906 HRESULT hr = S_OK; 1884 if (pSwapchain->cRTs > 1) 1885 { 1886 for (int iBb = -1; iBb < int(pSwapchain->cRTs - 1); ++iBb) 1887 { 1888 hr = vboxWddmSwapchainRtSynch(pDevice, pSwapchain, (UINT)iBb); 1889 Assert(hr == S_OK); 1890 } 1891 } 1892 else 1893 { 1894 /* work-around wine backbuffer */ 1895 hr = vboxWddmSwapchainRtSynch(pDevice, pSwapchain, 0); 1907 for (int iBb = -1; iBb < int(pSwapchain->cRTs - 1); ++iBb) 1908 { 1909 hr = vboxWddmSwapchainRtSynch(pDevice, pSwapchain, (UINT)iBb); 1896 1910 Assert(hr == S_OK); 1897 1911 } 1898 1899 1912 if (pSwapchain->fFlags.bChanged) 1900 1913 { … … 1910 1923 static VOID vboxWddmSwapchainFillParams(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, D3DPRESENT_PARAMETERS *pParams) 1911 1924 { 1925 Assert(pSwapchain->cRTs); 1926 Assert(pSwapchain->cRTs <= 2); 1912 1927 memset(pParams, 0, sizeof (D3DPRESENT_PARAMETERS)); 1913 1928 PVBOXWDDMDISP_RENDERTGT pRt = vboxWddmSwapchainGetBb(pSwapchain); … … 1919 1934 pParams->MultiSampleType = vboxDDI2D3DMultiSampleType(pRc->RcDesc.enmMultisampleType); 1920 1935 pParams->MultiSampleQuality = pRc->RcDesc.MultisampleQuality; 1936 #ifdef VBOXDISP_WITH_WINE_BB_WORKAROUND 1937 if (pSwapchain->cRTs == 1) 1938 pParams->SwapEffect = D3DSWAPEFFECT_COPY; 1939 else 1940 #endif 1921 1941 if (pRc->RcDesc.fFlags.DiscardRenderTarget) 1922 1942 pParams->SwapEffect = D3DSWAPEFFECT_DISCARD; … … 1932 1952 BOOL bReuseSwapchain = FALSE; 1933 1953 D3DPRESENT_PARAMETERS Params; 1954 D3DPRESENT_PARAMETERS OldParams; 1934 1955 vboxWddmSwapchainFillParams(pSwapchain, &Params); 1935 1956 /* check if we need to re-create the swapchain */ 1936 1957 if (pOldIf) 1937 1958 { 1938 D3DPRESENT_PARAMETERS OldParams;1939 1959 hr = pOldIf->GetPresentParameters(&OldParams); 1940 1960 Assert(hr == S_OK); 1941 1961 if (hr == S_OK) 1942 1962 { 1943 if (OldParams.BackBufferCount == Params.BackBufferCount) 1963 if (OldParams.BackBufferCount == Params.BackBufferCount 1964 && OldParams.SwapEffect == Params.SwapEffect) 1944 1965 { 1945 1966 bReuseSwapchain = TRUE; … … 2002 2023 { 2003 2024 pDevice9If = pDevice->pDevice9If; 2025 if (pOldIf) 2026 { 2027 Assert(0); 2028 /* copy current rt data to offscreen render targets */ 2029 IDirect3DSurface9* pD3D9OldFb = NULL; 2030 HRESULT tmpHr = pOldIf->GetBackBuffer(~0, D3DBACKBUFFER_TYPE_MONO, &pD3D9OldFb); 2031 Assert(tmpHr == S_OK); 2032 if (tmpHr == S_OK) 2033 { 2034 /* just need a pointer to match */ 2035 pD3D9OldFb->Release(); 2036 } 2037 UINT cOldRts = OldParams.SwapEffect == D3DSWAPEFFECT_COPY ? 1 : OldParams.BackBufferCount + 1; 2038 for (UINT i = 0; i < pSwapchain->cRTs; ++i) 2039 { 2040 PVBOXWDDMDISP_RENDERTGT pRT = &pSwapchain->aRTs[i]; 2041 if (!pRT->pAlloc->pD3DIf) 2042 continue; 2043 IDirect3DSurface9* pD3D9OldSurf = (IDirect3DSurface9*)pRT->pAlloc->pD3DIf; 2044 VOID *pvSwapchain = NULL; 2045 tmpHr = pD3D9OldSurf->GetContainer(IID_IDirect3DSwapChain9, &pvSwapchain); 2046 if (tmpHr == S_OK) 2047 { 2048 Assert(pvSwapchain); 2049 ((IDirect3DSwapChain9 *)pvSwapchain)->Release(); 2050 } 2051 else 2052 { 2053 Assert(!pvSwapchain); 2054 } 2055 if (pvSwapchain != pOldIf) 2056 continue; 2057 2058 IDirect3DSurface9* pD3D9NewSurf; 2059 tmpHr = pDevice9If->CreateRenderTarget( 2060 Params.BackBufferWidth, Params.BackBufferHeight, 2061 Params.BackBufferFormat, 2062 Params.MultiSampleType, 2063 Params.MultiSampleQuality, 2064 TRUE, /*bLockable*/ 2065 &pD3D9NewSurf, 2066 NULL /* HANDLE* pSharedHandle */ 2067 ); 2068 Assert(tmpHr == S_OK); 2069 if (tmpHr != S_OK) 2070 continue; 2071 2072 if (pD3D9OldSurf != pD3D9OldFb && cOldRts != 1) 2073 { 2074 tmpHr = pDevice9If->StretchRect(pD3D9OldSurf, NULL, pD3D9NewSurf, NULL, D3DTEXF_NONE); 2075 Assert(tmpHr == S_OK); 2076 } 2077 else 2078 { 2079 tmpHr = pOldIf->GetFrontBufferData(pD3D9NewSurf); 2080 Assert(tmpHr == S_OK); 2081 } 2082 2083 if (tmpHr != S_OK) 2084 continue; 2085 2086 pRT->pAlloc->pD3DIf = pD3D9NewSurf; 2087 pD3D9OldSurf->Release(); 2088 } 2089 } 2090 2004 2091 hr = pDevice->pDevice9If->CreateAdditionalSwapChain(&Params, &pNewIf); 2005 2092 Assert(hr == S_OK); … … 2517 2604 HRESULT hr = S_OK; 2518 2605 IDirect3DSurface9 *pD3D9Surf; 2606 if (!bOnSwapchainSynch && pSwapchain) 2607 { 2608 /* work-around wine double-buffering for the case we have no backbuffers */ 2609 Assert(!pSwapchain->fFlags.bChanged); 2610 Assert(pSwapchain->pSwapChainIf); 2611 vboxWddmSwapchainChkCreateIf(pDevice, pSwapchain); 2612 } 2613 2614 #ifdef VBOXDISP_WITH_WINE_BB_WORKAROUND 2519 2615 if (pSwapchain && vboxWddmSwapchainNumRTs(pSwapchain) == 1 && iRt == 0) 2520 2616 { 2521 /* work-around wine double-buffering for the case we have no backbuffers */2522 Assert((!pSwapchain->fFlags.bChanged || bOnSwapchainSynch) && pSwapchain->pSwapChainIf);2523 if (!bOnSwapchainSynch)2524 {2525 vboxWddmSwapchainChkCreateIf(pDevice, pSwapchain);2526 }2527 2617 hr = pSwapchain->pSwapChainIf->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pD3D9Surf); 2528 2618 Assert(hr == S_OK); … … 2530 2620 } 2531 2621 else 2622 #endif 2532 2623 { 2533 2624 hr = vboxWddmSurfGet(pAlloc->pRc, pAlloc->iAlloc, &pD3D9Surf); … … 5788 5879 && pSrcSwapchain->pRenderTargetFbCopy 5789 5880 && vboxWddmSwapchainGetFb(pSrcSwapchain)->pAlloc == pSrcAlloc 5790 && vboxWddmSwapchainNumRTs(pSrcSwapchain) > 1) /* work-around wine backbuffer */ 5881 #ifdef VBOXDISP_WITH_WINE_BB_WORKAROUND 5882 && vboxWddmSwapchainNumRTs(pSrcSwapchain) > 1 /* work-around wine backbuffer */ 5883 #endif 5884 ) 5791 5885 { 5792 5886 // Assert(pSrcAlloc->SurfDesc.width == pDstAlloc->SurfDesc.width);
Note:
See TracChangeset
for help on using the changeset viewer.