VirtualBox

Ignore:
Timestamp:
Sep 12, 2012 4:42:23 PM (12 years ago)
Author:
vboxsync
Message:

wddm/3d: DrawIndexedPrimitive2 impl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp

    r43269 r43314  
    25842584            VBOXWDDMDISP_LOCKINFO *pLock = &pDevice->aStreamSource[stream]->LockInfo;
    25852585
    2586             if (pDevice->aStreamSource[stream]->LockInfo.cLocks)
     2586            if (pLock->cLocks)
    25872587            {
    25882588//                vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
     
    26272627    PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;
    26282628    Assert(pDevice);
    2629     VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
    2630     Assert(0);
     2629    IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice);
     2630    HRESULT hr = S_OK;
     2631    VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
     2632    const uint8_t *pvVertexBuffer = NULL;
     2633    DWORD cbVertexStride = 0;
     2634
     2635    if (dwIndicesSize != 2 && dwIndicesSize != 4)
     2636        WARN(("unsupported dwIndicesSize %d", dwIndicesSize));
     2637
     2638    if (pDevice->aStreamSourceUm[0].pvBuffer)
     2639    {
     2640        Assert(pDevice->aStreamSourceUm[0].cbStride);
     2641
     2642        pvVertexBuffer = (const uint8_t *)pDevice->aStreamSourceUm[0].pvBuffer;
     2643        cbVertexStride = pDevice->aStreamSourceUm[0].cbStride;
     2644    }
     2645    else if (pDevice->aStreamSource[0])
     2646    {
     2647        PVBOXWDDMDISP_ALLOCATION pAlloc = pDevice->aStreamSource[0];
     2648        if (pAlloc->pvMem)
     2649        {
     2650            Assert(pDevice->StreamSourceInfo[0].uiStride);
     2651            pvVertexBuffer = ((const uint8_t *)pAlloc->pvMem) + pDevice->StreamSourceInfo[0].uiOffset;
     2652            cbVertexStride = pDevice->StreamSourceInfo[0].uiStride;
     2653        }
     2654        else
     2655        {
     2656            WARN(("unsupported!!"));
     2657            hr = E_FAIL;
     2658        }
     2659    }
     2660    else
     2661    {
     2662        WARN(("not expected!"));
     2663        hr = E_FAIL;
     2664    }
     2665
     2666    if (SUCCEEDED(hr))
     2667    {
     2668        pvVertexBuffer = pvVertexBuffer + pData->BaseVertexOffset /*  * cbVertexStride */;
     2669
     2670        hr = pDevice9If->DrawIndexedPrimitiveUP(pData->PrimitiveType,
     2671                        pData->MinIndex,
     2672                        pData->NumVertices,
     2673                        pData->PrimitiveCount,
     2674                        ((uint8_t*)pIndexBuffer) + dwIndicesSize * pData->StartIndexOffset,
     2675                        dwIndicesSize == 2 ? D3DFMT_INDEX16 : D3DFMT_INDEX32,
     2676                        pvVertexBuffer,
     2677                        cbVertexStride);
     2678        if(SUCCEEDED(hr))
     2679            hr = S_OK;
     2680        else
     2681            WARN(("DrawIndexedPrimitiveUP failed hr = 0x%x", hr));
     2682
     2683        if (pDevice->aStreamSource[0])
     2684        {
     2685            HRESULT tmpHr = pDevice9If->SetStreamSource(0, (IDirect3DVertexBuffer9*)pDevice->aStreamSource[0]->pD3DIf, pDevice->StreamSourceInfo[0].uiOffset, pDevice->StreamSourceInfo[0].uiStride);
     2686            if(!SUCCEEDED(tmpHr))
     2687                WARN(("SetStreamSource failed hr = 0x%x", tmpHr));
     2688        }
     2689
     2690        if (pDevice->pIndicesAlloc)
     2691        {
     2692            HRESULT tmpHr = pDevice9If->SetIndices((IDirect3DIndexBuffer9*)pDevice->pIndicesAlloc->pD3DIf);
     2693            if(!SUCCEEDED(tmpHr))
     2694                WARN(("SetIndices failed hr = 0x%x", tmpHr));
     2695        }
     2696    }
     2697
    26312698    vboxWddmDalCheckAddRtsSamplers(pDevice);
    26322699    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice));
    2633     return E_FAIL;
     2700    return hr;
    26342701}
    26352702
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette