Changeset 30167 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display
- Timestamp:
- Jun 11, 2010 4:52:04 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r30161 r30167 35 35 #endif 36 36 37 /*#define VBOXWDDMDISP_WITH_TMPWORKAROUND 1*/ 37 #define VBOXWDDMDISP_WITH_TMPWORKAROUND 1 38 38 39 39 static FORMATOP gVBoxFormatOps3D[] = { … … 1848 1848 Assert(pDevice); 1849 1849 Assert(pDevice->pDevice9If); 1850 HRESULT hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset, pData->PrimitiveCount); 1850 HRESULT hr; 1851 1852 #if 0 1853 int stream; 1854 for (stream=0; stream<VBOXWDDMDISP_MAX_VERTEX_STREAMS; ++stream) 1855 { 1856 if (pDevice->aStreamSource[stream] && pDevice->aStreamSource[stream]->LockInfo.cLocks) 1857 { 1858 VBOXWDDMDISP_LOCKINFO *pLock = &pDevice->aStreamSource[stream]->LockInfo; 1859 if (pLock->fFlags.MightDrawFromLocked && (pLock->fFlags.Discard || pLock->fFlags.NoOverwrite)) 1860 { 1861 IDirect3DVertexBuffer9 *pD3D9VBuf = (IDirect3DVertexBuffer9*)pDevice->aStreamSource[stream]->pD3DIf; 1862 Assert(pLock->fFlags.RangeValid); 1863 pD3D9VBuf->Lock(pLock->Range.Offset, pLock->Range.Size, 1864 &pLock->LockedRect.pBits, 1865 vboxDDI2D3DLockFlags(pLock->fFlags)); 1866 RECT r; 1867 r.top = 0; 1868 r.left = pLock->Range.Offset; 1869 r.bottom = 1; 1870 r.right = pLock->Range.Offset + pLock->Range.Size; 1871 1872 vboxWddmLockUnlockMemSynch(pDevice->aStreamSource[stream], &pLock->LockedRect, &r, true /*bool bToLockInfo*/); 1873 1874 pD3D9VBuf->Unlock(); 1875 } 1876 } 1877 } 1878 1879 hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset, pData->PrimitiveCount); 1880 #else 1881 int stream; 1882 for (stream=0; stream<VBOXWDDMDISP_MAX_VERTEX_STREAMS; ++stream) 1883 { 1884 if (pDevice->aStreamSource[stream]) 1885 { 1886 Assert(stream==0); /*only stream 0 should be accessed here*/ 1887 Assert(pDevice->StreamSourceInfo[stream].uiStride!=0); 1888 VBOXWDDMDISP_LOCKINFO *pLock = &pDevice->aStreamSource[stream]->LockInfo; 1889 1890 if (pDevice->aStreamSource[stream]->LockInfo.cLocks) 1891 { 1892 Assert(pLock->fFlags.MightDrawFromLocked && (pLock->fFlags.Discard || pLock->fFlags.NoOverwrite)); 1893 hr = pDevice->pDevice9If->DrawPrimitiveUP(pData->PrimitiveType, pData->PrimitiveCount, 1894 (void*)((uintptr_t)pDevice->aStreamSource[stream]->pvMem+pDevice->StreamSourceInfo[stream].uiOffset+pData->FirstVertexOffset), 1895 pDevice->StreamSourceInfo[stream].uiStride); 1896 Assert(hr == S_OK); 1897 hr = pDevice->pDevice9If->SetStreamSource(stream, (IDirect3DVertexBuffer9*)pDevice->aStreamSource[stream]->pD3DIf, pDevice->StreamSourceInfo[stream].uiOffset, pDevice->StreamSourceInfo[stream].uiStride); 1898 } 1899 else 1900 { 1901 hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset/pDevice->StreamSourceInfo[stream].uiStride, pData->PrimitiveCount); 1902 } 1903 } 1904 } 1905 #endif 1906 1851 1907 Assert(hr == S_OK); 1852 1908 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); … … 2204 2260 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->SubResourceIndex]; 2205 2261 IDirect3DVertexBuffer9 *pD3D9VBuf = (IDirect3DVertexBuffer9*)pAlloc->pD3DIf; 2262 BOOL bLocked = false; 2206 2263 Assert(pD3D9VBuf); 2207 2264 Assert(!pData->Flags.AreaValid); … … 2218 2275 if (!pAlloc->LockInfo.cLocks) 2219 2276 { 2220 hr = pD3D9VBuf->Lock(pRange ? pRange->Offset : 0, 2221 pRange ? pRange->Size : 0, 2222 &pAlloc->LockInfo.LockedRect.pBits, 2223 vboxDDI2D3DLockFlags(pData->Flags)); 2224 #ifdef VBOXWDDMDISP_WITH_TMPWORKAROUND 2225 if (pData->Flags.MightDrawFromLocked) 2226 { 2227 RECT r, *pr; 2228 if (pRange) 2229 { 2230 r.top = 0; 2231 r.left = pRange->Offset; 2232 r.bottom = 1; 2233 r.right = pRange->Offset + pRange->Size; 2234 pr = &r; 2235 } 2236 else 2237 pr = NULL; 2238 2239 pAlloc->LockInfo.LockedRect.Pitch = pAlloc->SurfDesc.width; 2240 2241 vboxWddmLockUnlockMemSynch(pAlloc, &pAlloc->LockInfo.LockedRect, pr, true /*bool bToLockInfo*/); 2242 pD3D9VBuf->Unlock(); 2277 if (!pData->Flags.MightDrawFromLocked || (!pData->Flags.Discard && !pData->Flags.NoOverwrite)) 2278 { 2279 hr = pD3D9VBuf->Lock(pRange ? pRange->Offset : 0, 2280 pRange ? pRange->Size : 0, 2281 &pAlloc->LockInfo.LockedRect.pBits, 2282 vboxDDI2D3DLockFlags(pData->Flags)); 2283 bLocked = true; 2243 2284 } 2244 #endif 2285 2245 2286 Assert(hr == S_OK); 2246 2287 if (hr == S_OK) … … 2293 2334 Assert(pAlloc->pvMem); 2294 2335 Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 2295 if ( /* !pData->Flags.WriteOnly && */!pData->Flags.Discard)2336 if (bLocked && !pData->Flags.Discard) 2296 2337 { 2297 2338 RECT r, *pr; … … 2419 2460 --pAlloc->LockInfo.cLocks; 2420 2461 Assert(pAlloc->LockInfo.cLocks < UINT32_MAX); 2421 // pAlloc->LockInfo.cLocks = 0; 2422 #ifdef VBOXWDDMDISP_WITH_TMPWORKAROUND 2423 if (!pAlloc->LockInfo.cLocks && !pAlloc->LockInfo.fFlags.MightDrawFromLocked) 2424 #else 2425 if (!pAlloc->LockInfo.cLocks) 2426 #endif 2462 if (!pAlloc->LockInfo.cLocks 2463 && (!pAlloc->LockInfo.fFlags.MightDrawFromLocked 2464 || (!pAlloc->LockInfo.fFlags.Discard && !pAlloc->LockInfo.fFlags.NoOverwrite))) 2427 2465 { 2428 2466 // Assert(!pAlloc->LockInfo.cLocks); … … 3049 3087 Assert(pDevice); 3050 3088 Assert(pDevice->pDevice9If); 3089 #if 0 3051 3090 HRESULT hr = pDevice->pDevice9If->Present(NULL, /* CONST RECT * pSourceRect */ 3052 3091 NULL, /* CONST RECT * pDestRect */ … … 3055 3094 ); 3056 3095 Assert(hr == S_OK); 3096 #else 3097 HRESULT hr = S_OK; 3098 #endif 3057 3099 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); 3058 3100 return hr; … … 3217 3259 IDirect3DVertexBuffer9 *pStreamData = (IDirect3DVertexBuffer9*)pAlloc->pD3DIf; 3218 3260 HRESULT hr = pDevice->pDevice9If->SetStreamSource(pData->Stream, pStreamData, pData->Offset, pData->Stride); 3261 Assert(pData->Stream<VBOXWDDMDISP_MAX_VERTEX_STREAMS); 3262 pDevice->aStreamSource[pData->Stream] = pAlloc; 3263 pDevice->StreamSourceInfo[pData->Stream].uiOffset = pData->Offset; 3264 pDevice->StreamSourceInfo[pData->Stream].uiStride = pData->Stride; 3219 3265 Assert(hr == S_OK); 3220 3266 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
r30162 r30167 20 20 21 21 #include <iprt/cdefs.h> 22 23 #define VBOXWDDMDISP_MAX_VERTEX_STREAMS 16 22 24 23 25 #ifdef VBOX_WITH_VIDEOHWACCEL … … 68 70 } VBOXWDDMDISP_STREAMSOURCEUM, *PVBOXWDDMDISP_STREAMSOURCEUM; 69 71 72 struct VBOXWDDMDISP_ALLOCATION; 73 74 typedef struct VBOXWDDMDISP_STREAM_SOURCE_INFO 75 { 76 UINT uiOffset; 77 UINT uiStride; 78 } VBOXWDDMDISP_STREAM_SOURCE_INFO; 79 70 80 typedef struct VBOXWDDMDISP_DEVICE 71 81 { … … 81 91 /* number of StreamSources set */ 82 92 UINT cStreamSources; 83 VBOXWDDMDISP_STREAMSOURCEUM aStreamSourceUm[16]; 93 VBOXWDDMDISP_STREAMSOURCEUM aStreamSourceUm[VBOXWDDMDISP_MAX_VERTEX_STREAMS]; 94 VBOXWDDMDISP_ALLOCATION *aStreamSource[VBOXWDDMDISP_MAX_VERTEX_STREAMS]; 95 VBOXWDDMDISP_STREAM_SOURCE_INFO StreamSourceInfo[VBOXWDDMDISP_MAX_VERTEX_STREAMS]; 84 96 IDirect3DDevice9 *pDevice9If; 85 97 /* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
Note:
See TracChangeset
for help on using the changeset viewer.