- Timestamp:
- Sep 18, 2012 11:13:49 AM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r43334 r43340 1094 1094 continue; 1095 1095 BOOL fHasSurf = pRT->pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE ? 1096 !!pRT->pAlloc->p Rc->aAllocations[i].pD3DIf1096 !!pRT->pAlloc->pD3DIf 1097 1097 : 1098 1098 !!pRT->pAlloc->pRc->aAllocations[0].pD3DIf; … … 2312 2312 Assert(pData->Stream < RT_ELEMENTS(pDevice->aStreamSourceUm)); 2313 2313 PVBOXWDDMDISP_STREAMSOURCEUM pStrSrcUm = &pDevice->aStreamSourceUm[pData->Stream]; 2314 if (pStrSrcUm->pvBuffer && !pUMBuffer) 2315 { 2316 --pDevice->cStreamSourcesUm; 2317 Assert(pDevice->cStreamSourcesUm < UINT32_MAX/2); 2318 } 2319 else if (!pStrSrcUm->pvBuffer && pUMBuffer) 2320 { 2321 ++pDevice->cStreamSourcesUm; 2322 Assert(pDevice->cStreamSourcesUm <= RT_ELEMENTS(pDevice->aStreamSourceUm)); 2323 } 2324 2314 2325 pStrSrcUm->pvBuffer = pUMBuffer; 2315 2326 pStrSrcUm->cbStride = pData->Stride; … … 2351 2362 if (hr == S_OK) 2352 2363 { 2353 pDevice-> pIndicesAlloc = pAlloc;2364 pDevice->IndiciesInfo.pIndicesAlloc = pAlloc; 2354 2365 pDevice->IndiciesInfo.uiStride = pData->Stride; 2366 pDevice->IndiciesInfo.pvIndicesUm = NULL; 2355 2367 } 2356 2368 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); … … 2366 2378 VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice); 2367 2379 2380 IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice); 2381 2368 2382 HRESULT hr = S_OK; 2369 pDevice->IndiciesUm.pvBuffer = pUMBuffer; 2370 pDevice->IndiciesUm.cbSize = IndexSize; 2383 if (pDevice->IndiciesInfo.pIndicesAlloc) 2384 { 2385 hr = pDevice9If->SetIndices(NULL); 2386 } 2387 2388 if (SUCCEEDED(hr)) 2389 { 2390 pDevice->IndiciesInfo.pvIndicesUm = pUMBuffer; 2391 pDevice->IndiciesInfo.uiStride = IndexSize; 2392 pDevice->IndiciesInfo.pIndicesAlloc = NULL; 2393 hr = S_OK; 2394 } 2395 else 2396 { 2397 WARN(("SetIndices failed hr 0x%x", hr)); 2398 } 2399 2371 2400 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); 2372 2401 return hr; … … 2465 2494 VBOXVDBG_DUMP_DRAWPRIM_ENTER(pDevice); 2466 2495 2496 2467 2497 #ifdef DEBUG 2498 uint32_t cStreams = 0; 2499 for (UINT i = 0; i < RT_ELEMENTS(pDevice->aStreamSourceUm); ++i) 2500 { 2501 if(pDevice->aStreamSourceUm[i].pvBuffer) 2502 ++cStreams; 2503 } 2504 2505 Assert(cStreams == pDevice->cStreamSourcesUm); 2506 2507 cStreams = 0; 2508 2509 for (UINT i = 0; i < RT_ELEMENTS(pDevice->aStreamSource); ++i) 2510 { 2511 if (pDevice->aStreamSource[i]) 2512 { 2513 ++cStreams; 2514 Assert(!pDevice->aStreamSource[i]->LockInfo.cLocks); 2515 } 2516 } 2517 2518 Assert(cStreams == pDevice->cStreamSources); 2519 #endif 2520 2521 HRESULT hr; 2522 2523 if (pDevice->cStreamSources) 2524 { 2525 Assert(pDevice->IndiciesInfo.pIndicesAlloc); 2526 Assert(!pDevice->IndiciesInfo.pvIndicesUm); 2527 Assert(!pDevice->IndiciesInfo.pIndicesAlloc->LockInfo.cLocks); 2528 Assert(!pDevice->cStreamSourcesUm); 2529 2530 hr = pDevice9If->DrawIndexedPrimitive( 2531 pData->PrimitiveType, 2532 pData->BaseVertexIndex, 2533 pData->MinIndex, 2534 pData->NumVertices, 2535 pData->StartIndex, 2536 pData->PrimitiveCount); 2537 2538 if(SUCCEEDED(hr)) 2539 hr = S_OK; 2540 else 2541 WARN(("DrawIndexedPrimitive failed hr = 0x%x", hr)); 2542 } 2543 else 2544 { 2545 Assert(pDevice->cStreamSourcesUm == 1); 2546 Assert(pDevice->IndiciesInfo.uiStride == 2 || pDevice->IndiciesInfo.uiStride == 4); 2547 const uint8_t * pvIndexBuffer; 2548 hr = S_OK; 2549 2550 if (pDevice->IndiciesInfo.pIndicesAlloc) 2551 { 2552 Assert(!pDevice->IndiciesInfo.pvIndicesUm); 2553 if (pDevice->IndiciesInfo.pIndicesAlloc->pvMem) 2554 pvIndexBuffer = (const uint8_t*)pDevice->IndiciesInfo.pIndicesAlloc->pvMem; 2555 else 2556 { 2557 WARN(("not expected!")); 2558 hr = E_FAIL; 2559 pvIndexBuffer = NULL; 2560 } 2561 } 2562 else 2563 { 2564 pvIndexBuffer = (const uint8_t*)pDevice->IndiciesInfo.pvIndicesUm; 2565 if (!pvIndexBuffer) 2566 { 2567 WARN(("not expected!")); 2568 hr = E_FAIL; 2569 } 2570 } 2571 2572 if (SUCCEEDED(hr)) 2573 { 2468 2574 for (UINT i = 0; i < RT_ELEMENTS(pDevice->aStreamSourceUm); ++i) 2469 2575 { 2470 Assert(!pDevice->aStreamSourceUm[i].pvBuffer);2471 }2472 2473 Assert(pDevice->pIndicesAlloc);2474 Assert(!pDevice->pIndicesAlloc->LockInfo.cLocks);2475 2476 uint32_t cStreams = 0;2477 for (UINT i = 0; i < RT_ELEMENTS(pDevice->aStreamSource); ++i)2478 {2479 if (pDevice->aStreamSource[i])2480 {2481 ++cStreams;2482 Assert(!pDevice->aStreamSource[i]->LockInfo.cLocks);2483 }2484 }2485 2486 Assert(cStreams);2487 Assert(cStreams == pDevice->cStreamSources);2488 #endif 2489 2490 HRESULT hr = pDevice9If->DrawIndexedPrimitive(2491 pData->PrimitiveType,2492 pData->BaseVertexIndex,2493 pData->MinIndex,2494 pData->NumVertices,2495 pData->StartIndex,2496 pData->PrimitiveCount);2497 Assert(hr == S_OK);2576 if(pDevice->aStreamSourceUm[i].pvBuffer) 2577 { 2578 hr = pDevice9If->DrawIndexedPrimitiveUP(pData->PrimitiveType, 2579 pData->MinIndex, 2580 pData->NumVertices, 2581 pData->PrimitiveCount, 2582 pvIndexBuffer + pDevice->IndiciesInfo.uiStride * pData->StartIndex, 2583 pDevice->IndiciesInfo.uiStride == 2 ? D3DFMT_INDEX16 : D3DFMT_INDEX32, 2584 pDevice->aStreamSourceUm[i].pvBuffer, 2585 pDevice->aStreamSourceUm[i].cbStride); 2586 if(SUCCEEDED(hr)) 2587 { 2588 if (pDevice->IndiciesInfo.pIndicesAlloc) 2589 { 2590 HRESULT tmpHr = pDevice9If->SetIndices((IDirect3DIndexBuffer9*)pDevice->IndiciesInfo.pIndicesAlloc->pD3DIf); 2591 if(!SUCCEEDED(tmpHr)) 2592 WARN(("SetIndices failed hr = 0x%x", tmpHr)); 2593 } 2594 2595 hr = S_OK; 2596 } 2597 else 2598 WARN(("DrawIndexedPrimitiveUP failed hr = 0x%x", hr)); 2599 break; 2600 } 2601 } 2602 } 2603 } 2498 2604 2499 2605 vboxWddmDalCheckAddRtsSamplers(pDevice); … … 2695 2801 } 2696 2802 2697 if (pDevice-> pIndicesAlloc)2698 { 2699 HRESULT tmpHr = pDevice9If->SetIndices((IDirect3DIndexBuffer9*)pDevice-> pIndicesAlloc->pD3DIf);2803 if (pDevice->IndiciesInfo.pIndicesAlloc) 2804 { 2805 HRESULT tmpHr = pDevice9If->SetIndices((IDirect3DIndexBuffer9*)pDevice->IndiciesInfo.pIndicesAlloc->pD3DIf); 2700 2806 if(!SUCCEEDED(tmpHr)) 2701 2807 WARN(("SetIndices failed hr = 0x%x", tmpHr)); … … 4630 4736 4631 4737 PVBOXWDDMDISP_STREAMSOURCEUM pStrSrcUm = &pDevice->aStreamSourceUm[pData->Stream]; 4632 pStrSrcUm->pvBuffer = NULL; 4633 pStrSrcUm->cbStride = 0; 4738 if (pStrSrcUm->pvBuffer) 4739 { 4740 --pDevice->cStreamSourcesUm; 4741 Assert(pDevice->cStreamSourcesUm < UINT32_MAX/2); 4742 pStrSrcUm->pvBuffer = NULL; 4743 pStrSrcUm->cbStride = 0; 4744 } 4634 4745 } 4635 4746 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h
r43334 r43340 118 118 typedef struct VBOXWDDMDISP_INDICES_INFO 119 119 { 120 UINT uiStride; 120 struct VBOXWDDMDISP_ALLOCATION *pIndicesAlloc; 121 const void *pvIndicesUm; 122 UINT uiStride; 121 123 } VBOXWDDMDISP_INDICES_INFO; 122 124 … … 192 194 /* number of StreamSources set */ 193 195 UINT cStreamSources; 196 UINT cStreamSourcesUm; 194 197 VBOXWDDMDISP_STREAMSOURCEUM aStreamSourceUm[VBOXWDDMDISP_MAX_VERTEX_STREAMS]; 195 198 struct VBOXWDDMDISP_ALLOCATION *aStreamSource[VBOXWDDMDISP_MAX_VERTEX_STREAMS]; 196 199 VBOXWDDMDISP_STREAM_SOURCE_INFO StreamSourceInfo[VBOXWDDMDISP_MAX_VERTEX_STREAMS]; 197 VBOXWDDMDISP_INDICIESUM IndiciesUm;198 struct VBOXWDDMDISP_ALLOCATION *pIndicesAlloc;199 200 VBOXWDDMDISP_INDICES_INFO IndiciesInfo; 200 201 /* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
Note:
See TracChangeset
for help on using the changeset viewer.