Changeset 75751 in vbox
- Timestamp:
- Nov 26, 2018 7:38:38 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r75715 r75751 1550 1550 1551 1551 hr = pContextDst->pDevice->StretchRect(pSrc, &RectSrc, pDest, &RectDest, D3DTEXF_NONE); 1552 if (hr != D3D_OK) 1553 { 1554 /* This can happen for compressed texture formats. */ 1555 LogFunc(("StretchRect failed with %x. Try a slow path.\n", hr)); 1556 if ( pSurfaceSrc->bounce.pTexture 1557 && (pSurfaceSrc->fUsageD3D & D3DUSAGE_RENDERTARGET)) 1558 { 1559 /* Copy the texture mipmap level to the bounce texture. */ 1560 1561 /* Source is the texture, destination is the corresponding bounce texture. */ 1562 IDirect3DSurface9 *pBounceSurf; 1563 rc = vmsvga3dGetD3DSurface(pState, pContextDst, pSurfaceSrc, src.face, src.mipmap, true, &pBounceSurf); 1564 AssertRC(rc); 1565 if (RT_SUCCESS(rc)) 1566 { 1567 Assert(pSrc != pBounceSurf); 1568 1569 hr = pContextDst->pDevice->GetRenderTargetData(pSrc, pBounceSurf); 1570 Assert(hr == D3D_OK); 1571 if (SUCCEEDED(hr)) 1572 { 1573 POINT pointDest; 1574 pointDest.x = clipBox.x; 1575 pointDest.y = clipBox.y; 1576 1577 hr = pContextDst->pDevice->UpdateSurface(pBounceSurf, &RectSrc, pDest, &pointDest); 1578 Assert(hr == D3D_OK); 1579 } 1580 1581 D3D_RELEASE(pBounceSurf); 1582 } 1583 } 1584 else if ( (pSurfaceSrc->fUsageD3D & D3DUSAGE_RENDERTARGET) == 0 1585 && (pSurfaceDest->fUsageD3D & D3DUSAGE_RENDERTARGET) == 0) 1586 { 1587 /* Can lock both. */ 1588 vmsvga3dSurfaceFlush(pThis, pSurfaceSrc); 1589 vmsvga3dSurfaceFlush(pThis, pSurfaceDest); 1590 1591 D3DLOCKED_RECT LockedSrcRect; 1592 hr = pSrc->LockRect(&LockedSrcRect, &RectSrc, D3DLOCK_READONLY); 1593 Assert(hr == D3D_OK); 1594 if (SUCCEEDED(hr)) 1595 { 1596 D3DLOCKED_RECT LockedDestRect; 1597 hr = pDest->LockRect(&LockedDestRect, &RectDest, 0); 1598 Assert(hr == D3D_OK); 1599 if (SUCCEEDED(hr)) 1600 { 1601 uint32_t cBlocksX = (clipBox.w + pSurfaceSrc->cxBlock - 1) / pSurfaceSrc->cxBlock; 1602 uint32_t cBlocksY = (clipBox.h + pSurfaceSrc->cyBlock - 1) / pSurfaceSrc->cyBlock; 1603 1604 uint32_t cbToCopy = cBlocksX * pSurfaceSrc->cbBlock; 1605 cbToCopy = RT_MIN(cbToCopy, (uint32_t)RT_ABS(LockedDestRect.Pitch)); 1606 cbToCopy = RT_MIN(cbToCopy, (uint32_t)RT_ABS(LockedSrcRect.Pitch)); 1607 1608 uint8_t *pu8Dst = (uint8_t *)LockedDestRect.pBits; 1609 const uint8_t *pu8Src = (uint8_t *)LockedSrcRect.pBits; 1610 for (uint32_t j = 0; j < cBlocksY; ++j) 1611 { 1612 memcpy(pu8Dst, pu8Src, cbToCopy); 1613 pu8Dst += LockedDestRect.Pitch; 1614 pu8Src += LockedSrcRect.Pitch; 1615 } 1616 1617 hr = pDest->UnlockRect(); 1618 Assert(hr == D3D_OK); 1619 } 1620 1621 hr = pSrc->UnlockRect(); 1622 Assert(hr == D3D_OK); 1623 } 1624 } 1625 } 1552 1626 AssertMsgReturnStmt(hr == D3D_OK, 1553 1627 ("StretchRect failed with %x\n", hr), … … 1739 1813 HRESULT hr; 1740 1814 1815 LogFunc(("sid=%x\n", pSurface->id)); 1816 1741 1817 Assert(pSurface->hSharedObject == NULL); 1742 1818 Assert(pSurface->u.pTexture == NULL); … … 1797 1873 } 1798 1874 else if ( pSurface->formatD3D == D3DFMT_D24S8 1799 || pSurface->formatD3D == D3DFMT_D24X8) 1875 || pSurface->formatD3D == D3DFMT_D24X8 1876 || pSurface->formatD3D == D3DFMT_D32 1877 || pSurface->formatD3D == D3DFMT_D16) 1800 1878 { 1801 1879 Assert(pSurface->cFaces == 1); … … 3899 3977 && pRenderTarget->multiSampleTypeD3D == D3DMULTISAMPLE_NONE 3900 3978 && ( pRenderTarget->formatD3D == D3DFMT_D24S8 3901 || pRenderTarget->formatD3D == D3DFMT_D24X8)) 3979 || pRenderTarget->formatD3D == D3DFMT_D24X8 3980 || pRenderTarget->formatD3D == D3DFMT_D32 3981 || pRenderTarget->formatD3D == D3DFMT_D16)) 3902 3982 { 3903 3983 LogFunc(("Creating stencil surface as texture!\n"));
Note:
See TracChangeset
for help on using the changeset viewer.