Changeset 39044 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm
- Timestamp:
- Oct 19, 2011 5:41:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r38988 r39044 1631 1631 } 1632 1632 1633 static HRESULT vboxWddmMemsetAlloc(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc, char c) 1634 { 1635 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[iAlloc]; 1636 IDirect3DSurface9 *pD3D9Surf = NULL; 1637 HRESULT hr = vboxWddmSurfGet(pRc, iAlloc, &pD3D9Surf); 1638 if (SUCCEEDED(hr)) 1639 { 1640 PVBOXWDDMDISP_DEVICE pDevice = pRc->pDevice; 1641 hr = pRc->pDevice->pDevice9If->ColorFill(pD3D9Surf, NULL, D3DCOLOR_ARGB(c,c,c,c)); 1642 pD3D9Surf->Release(); 1643 if (SUCCEEDED(hr)) 1644 { 1645 return hr; 1646 } 1647 1648 WARN(("ColorFill failed, hr 0x%x", hr)); 1649 /* fallback to lock-memset-unlock */ 1650 } 1651 1652 /* unless this is a fallback */ 1653 Assert(pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_VERTEXBUFFER 1654 || pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_INDEXBUFFER); 1655 1656 D3DLOCKED_RECT Rect; 1657 hr = vboxWddmLockRect(pRc, iAlloc, &Rect, NULL, D3DLOCK_DISCARD); 1658 if (FAILED(hr)) 1659 { 1660 WARN(("vboxWddmLockRect failed, hr(0x%x)", hr)); 1661 return hr; 1662 } 1663 1664 UINT cbAllocPitch = pAlloc->SurfDesc.pitch; 1665 if(Rect.Pitch == cbAllocPitch) 1666 { 1667 memset(Rect.pBits, 0, Rect.Pitch * pAlloc->SurfDesc.height); 1668 } 1669 else 1670 { 1671 Assert(0); 1672 Assert(cbAllocPitch < (UINT)Rect.Pitch); 1673 uint8_t *pData = (uint8_t*)Rect.pBits; 1674 for (UINT j = 0; j < pAlloc->SurfDesc.height; ++j) 1675 { 1676 memset(Rect.pBits, c, cbAllocPitch); 1677 pData += Rect.Pitch; 1678 } 1679 } 1680 1681 hr = vboxWddmUnlockRect(pRc, iAlloc); 1682 Assert(SUCCEEDED(hr)); 1683 1684 return S_OK; 1685 } 1686 1633 1687 static HRESULT vboxWddmMemsetRc(PVBOXWDDMDISP_RESOURCE pRc, char c) 1634 1688 { 1689 HRESULT hr = S_OK; 1635 1690 for (UINT i = 0; i < pRc->cAllocations; ++i) 1636 1691 { 1637 D3DLOCKED_RECT Rect; 1638 HRESULT hr = vboxWddmLockRect(pRc, i, &Rect, NULL, D3DLOCK_DISCARD); 1692 hr = vboxWddmMemsetAlloc(pRc, i, c); 1639 1693 if (FAILED(hr)) 1640 1694 { 1641 WARN(("vboxWddm LockRectfailed, hr(0x%x)", hr));1695 WARN(("vboxWddmMemsetAlloc failed, hr(0x%x)", hr)); 1642 1696 return hr; 1643 1697 } 1644 1645 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i];1646 UINT cbAllocPitch = pAlloc->SurfDesc.pitch;1647 if(Rect.Pitch == cbAllocPitch)1648 {1649 memset(Rect.pBits, 0, Rect.Pitch * pAlloc->SurfDesc.height);1650 }1651 else1652 {1653 Assert(0);1654 Assert(cbAllocPitch < (UINT)Rect.Pitch);1655 uint8_t *pData = (uint8_t*)Rect.pBits;1656 for (UINT j = 0; j < pAlloc->SurfDesc.height; ++j)1657 {1658 memset(Rect.pBits, c, cbAllocPitch);1659 pData += Rect.Pitch;1660 }1661 }1662 1663 hr = vboxWddmUnlockRect(pRc, i);1664 Assert(SUCCEEDED(hr));1665 1698 } 1666 1699 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.