- Timestamp:
- Jun 8, 2010 5:33:24 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r30096 r30097 1711 1711 Assert(pData->SubResourceIndex < pRc->cAllocations); 1712 1712 PVBOXWDDMDISP_ALLOCATION pLockAlloc = &pRc->aAllocations[pData->SubResourceIndex]; 1713 Assert(!pLockAlloc->LockInfo.cLocks);1714 1713 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 1715 1714 Assert(pD3DIfTex); 1716 D3DLOCKED_RECT LockInfo;1717 1715 RECT *pRect = NULL; 1718 1716 if (pData->Flags.AreaValid) … … 1729 1727 } 1730 1728 /* else - we lock the entire texture, pRect == NULL */ 1731 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 1732 &LockInfo, 1733 pRect, 1734 vboxDDI2D3DLockFlags(pData->Flags)); 1735 Assert(hr == S_OK); 1736 if (hr == S_OK) 1737 { 1738 Assert(!pLockAlloc->LockInfo.cLocks); 1739 if (pLockAlloc->LockInfo.cLocks) 1740 { 1741 // Assert(pLockAlloc->LockInfo.fFlags.AreaValid || pLockAlloc->LockInfo.fFlags.Value == 0); 1742 /* else the entire texture is locked already - nothing to be done */ 1743 1744 AssertBreakpoint(); 1745 /* @todo: merge flags */ 1746 pLockAlloc->LockInfo.fFlags.Value &= pData->Flags.Value; 1747 1748 if (pLockAlloc->LockInfo.fFlags.AreaValid) 1749 { 1750 Assert(pRect); 1751 vboxWddmRectUnited(&pLockAlloc->LockInfo.Area, pRect); 1752 } 1753 1754 Assert(pLockAlloc->LockInfo.LockedRect.pBits); 1755 if (pLockAlloc->LockInfo.LockedRect.pBits) 1756 { 1757 Assert(pLockAlloc->LockInfo.LockedRect.Pitch == LockInfo.Pitch); 1758 pLockAlloc->LockInfo.LockedRect.pBits = RT_MIN(pLockAlloc->LockInfo.LockedRect.pBits, LockInfo.pBits); 1759 } 1760 else 1761 pLockAlloc->LockInfo.LockedRect = LockInfo; 1762 } 1763 else 1764 { 1729 1730 // Assert(!pLockAlloc->LockInfo.cLocks); 1731 if (!pLockAlloc->LockInfo.cLocks) 1732 { 1733 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 1734 &pLockAlloc->LockInfo.LockedRect, 1735 pRect, 1736 vboxDDI2D3DLockFlags(pData->Flags)); 1737 Assert(hr == S_OK); 1738 if (hr == S_OK) 1739 { 1740 1765 1741 // Assert(pLockAlloc->LockInfo.fFlags.Value == 0); 1766 1742 pLockAlloc->LockInfo.fFlags = pData->Flags; … … 1777 1753 } 1778 1754 1779 pLockAlloc->LockInfo.LockedRect = LockInfo;1755 ++pLockAlloc->LockInfo.cLocks; 1780 1756 } 1781 ++pLockAlloc->LockInfo.cLocks; 1782 1783 if (!pData->Flags.NotifyOnly) 1784 { 1785 pData->pSurfData = LockInfo.pBits; 1786 pData->Pitch = LockInfo.Pitch; 1787 pData->SlicePitch = 0; 1788 Assert(pLockAlloc->SurfDesc.slicePitch == 0); 1789 Assert(!pLockAlloc->pvMem); 1757 } 1758 else 1759 { 1760 Assert(pLockAlloc->LockInfo.fFlags.Value == pData->Flags.Value); 1761 // if (pLockAlloc->LockInfo.fFlags.Value != pData->Flags.Value) 1762 // { 1763 // } 1764 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == pData->Flags.AreaValid); 1765 if (pLockAlloc->LockInfo.fFlags.AreaValid && pData->Flags.AreaValid) 1766 { 1767 Assert(pLockAlloc->LockInfo.Area.left == pData->Area.left); 1768 Assert(pLockAlloc->LockInfo.Area.top == pData->Area.top); 1769 Assert(pLockAlloc->LockInfo.Area.right == pData->Area.right); 1770 Assert(pLockAlloc->LockInfo.Area.bottom == pData->Area.bottom); 1790 1771 } 1791 else 1792 { 1793 Assert(pLockAlloc->pvMem); 1794 Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 1795 if (/* !pData->Flags.WriteOnly && */ !pData->Flags.Discard) 1796 vboxWddmLockUnlockMemSynch(pLockAlloc, &LockInfo, pRect, false /*bool bToLockInfo*/); 1797 } 1772 Assert(pLockAlloc->LockInfo.LockedRect.pBits); 1773 } 1774 1775 1776 ++pLockAlloc->LockInfo.cLocks; 1777 1778 if (!pData->Flags.NotifyOnly) 1779 { 1780 pData->pSurfData = pLockAlloc->LockInfo.LockedRect.pBits; 1781 pData->Pitch = pLockAlloc->LockInfo.LockedRect.Pitch; 1782 pData->SlicePitch = 0; 1783 Assert(pLockAlloc->SurfDesc.slicePitch == 0); 1784 Assert(!pLockAlloc->pvMem); 1785 } 1786 else 1787 { 1788 Assert(pLockAlloc->pvMem); 1789 Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 1790 if (/* !pData->Flags.WriteOnly && */ !pData->Flags.Discard) 1791 vboxWddmLockUnlockMemSynch(pLockAlloc, &pLockAlloc->LockInfo.LockedRect, pRect, false /*bool bToLockInfo*/); 1798 1792 } 1799 1793 } … … 1854 1848 } 1855 1849 1856 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p) \n", hDevice));1850 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(%d)\n", hDevice, hr)); 1857 1851 return hr; 1858 1852 } … … 1872 1866 if (pRc->RcDesc.fFlags.Texture) 1873 1867 { 1874 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0];1875 1868 Assert(pData->SubResourceIndex < pRc->cAllocations); 1876 1869 PVBOXWDDMDISP_ALLOCATION pLockAlloc = &pRc->aAllocations[pData->SubResourceIndex]; 1877 Assert(pLockAlloc->LockInfo.cLocks); 1878 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 1879 Assert(pD3DIfTex); 1880 /* this is a sysmem texture, update */ 1881 if (pLockAlloc->pvMem && !pLockAlloc->LockInfo.fFlags.ReadOnly) 1882 { 1883 vboxWddmLockUnlockMemSynch(pLockAlloc, &pLockAlloc->LockInfo.LockedRect, 1884 pLockAlloc->LockInfo.fFlags.AreaValid ? &pLockAlloc->LockInfo.Area : NULL, 1885 true /*bool bToLockInfo*/); 1886 } 1887 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 1888 Assert(hr == S_OK); 1889 if (hr == S_OK) 1890 { 1891 --pLockAlloc->LockInfo.cLocks; 1870 1871 --pLockAlloc->LockInfo.cLocks; 1872 if (!pLockAlloc->LockInfo.cLocks) 1873 { 1874 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; 1875 Assert(pLockAlloc->LockInfo.cLocks); 1876 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pTexAlloc->pD3DIf; 1877 Assert(pD3DIfTex); 1878 /* this is a sysmem texture, update */ 1879 if (pLockAlloc->pvMem && !pLockAlloc->LockInfo.fFlags.ReadOnly) 1880 { 1881 vboxWddmLockUnlockMemSynch(pLockAlloc, &pLockAlloc->LockInfo.LockedRect, 1882 pLockAlloc->LockInfo.fFlags.AreaValid ? &pLockAlloc->LockInfo.Area : NULL, 1883 true /*bool bToLockInfo*/); 1884 } 1885 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 1886 Assert(hr == S_OK); 1887 } 1888 else 1889 { 1892 1890 Assert(pLockAlloc->LockInfo.cLocks < UINT32_MAX); 1893 1891 }
Note:
See TracChangeset
for help on using the changeset viewer.