Changeset 30043 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Jun 4, 2010 5:36:21 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r30042 r30043 866 866 /* @todo: check they are all equal */ 867 867 return (D3DMULTISAMPLE_TYPE)enmType; 868 } 869 870 D3DPOOL vboxDDI2D3DPool(D3DDDI_POOL enmPool) 871 { 872 /* @todo: check they are all equal */ 873 switch (enmPool) 874 { 875 case D3DDDIPOOL_SYSTEMMEM: 876 return D3DPOOL_SYSTEMMEM; 877 case D3DDDIPOOL_VIDEOMEMORY: 878 case D3DDDIPOOL_LOCALVIDMEM: 879 case D3DDDIPOOL_NONLOCALVIDMEM: 880 /* @todo: what would be propper here? */ 881 return D3DPOOL_DEFAULT; 882 default: 883 AssertBreakpoint(); 884 } 885 return D3DPOOL_DEFAULT; 886 } 887 888 DWORD vboxDDI2D3DUsage(D3DDDI_RESOURCEFLAGS fFlags) 889 { 890 DWORD fUsage = 0; 891 if (fFlags.Dynamic) 892 fUsage |= D3DUSAGE_DYNAMIC; 893 if (fFlags.AutogenMipmap) 894 fUsage |= D3DUSAGE_AUTOGENMIPMAP; 895 if (fFlags.DMap) 896 fUsage |= D3DUSAGE_DMAP; 897 if (fFlags.WriteOnly) 898 fUsage |= D3DUSAGE_WRITEONLY; 899 if (fFlags.NPatches) 900 fUsage |= D3DUSAGE_NPATCHES; 901 if (fFlags.Points) 902 fUsage |= D3DUSAGE_POINTS; 903 if (fFlags.RenderTarget) 904 fUsage |= D3DUSAGE_RENDERTARGET; 905 if (fFlags.RtPatches) 906 fUsage |= D3DUSAGE_RTPATCHES; 907 if (fFlags.TextApi) 908 fUsage |= D3DUSAGE_TEXTAPI; 909 if (fFlags.WriteOnly) 910 fUsage |= D3DUSAGE_WRITEONLY; 911 //below are wddm 1.1-specific 912 // if (fFlags.RestrictedContent) 913 // fUsage |= D3DUSAGE_RESTRICTED_CONTENT; 914 // if (fFlags.RestrictSharedAccess) 915 // fUsage |= D3DUSAGE_RESTRICT_SHARED_RESOURCE; 916 return fUsage; 868 917 } 869 918 … … 1690 1739 Assert(pD3D9Surf); 1691 1740 pAllocation->pD3DIf = pD3D9Surf; 1741 } 1742 else 1743 { 1744 for (UINT j = 0; j < i; ++j) 1745 { 1746 pRc->aAllocations[j].pD3DIf->Release(); 1747 } 1748 break; 1749 } 1750 } 1751 } 1752 else if (pResource->Flags.VertexBuffer) 1753 { 1754 Assert(pDevice->pDevice9If); 1755 for (UINT i = 0; i < pResource->SurfCount; ++i) 1756 { 1757 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 1758 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 1759 IDirect3DVertexBuffer9 *pD3D9VBuf; 1760 hr = pDevice->pDevice9If->CreateVertexBuffer(pSurf->Width, 1761 vboxDDI2D3DUsage(pResource->Flags), 1762 pResource->Fvf, 1763 vboxDDI2D3DPool(pResource->Pool), 1764 &pD3D9VBuf, 1765 NULL /*HANDLE* pSharedHandle*/); 1766 Assert(hr == S_OK); 1767 if (hr == S_OK) 1768 { 1769 Assert(pD3D9VBuf); 1770 pAllocation->pD3DIf = pD3D9VBuf; 1771 } 1772 else 1773 { 1774 for (UINT j = 0; j < i; ++j) 1775 { 1776 pRc->aAllocations[j].pD3DIf->Release(); 1777 } 1778 break; 1779 } 1780 } 1781 } 1782 else if (pResource->Flags.IndexBuffer) 1783 { 1784 Assert(pDevice->pDevice9If); 1785 for (UINT i = 0; i < pResource->SurfCount; ++i) 1786 { 1787 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 1788 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 1789 IDirect3DIndexBuffer9 *pD3D9IBuf; 1790 hr = pDevice->pDevice9If->CreateIndexBuffer(pSurf->Width, 1791 vboxDDI2D3DUsage(pResource->Flags), 1792 vboxDDI2D3DFormat(pResource->Format), 1793 vboxDDI2D3DPool(pResource->Pool), 1794 &pD3D9IBuf, 1795 NULL /*HANDLE* pSharedHandle*/ 1796 ); 1797 Assert(hr == S_OK); 1798 if (hr == S_OK) 1799 { 1800 Assert(pD3D9IBuf); 1801 pAllocation->pD3DIf = pD3D9IBuf; 1692 1802 } 1693 1803 else
Note:
See TracChangeset
for help on using the changeset viewer.