VirtualBox

Changeset 82650 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 24, 2019 12:19:23 PM (5 years ago)
Author:
vboxsync
Message:

Devices/Graphics: Cleanup all vertex streams and the vertex declaration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp

    r82609 r82650  
    26612661
    26622662        /* Cleanup the device runtime state. */
     2663        if (pContext->pDevice)
     2664            pContext->pDevice->SetVertexDeclaration(NULL);
    26632665        D3D_RELEASE(pContext->d3dState.pVertexDecl);
    26642666
     
    29382940#endif /* #ifdef VMSVGA3D_DIRECT3D9_RESET */
    29392941
     2942            AssertReturn(pContext->pDevice, VERR_INTERNAL_ERROR);
     2943
    29402944            /* Cleanup the device runtime state. */
     2945            pContext->pDevice->SetVertexDeclaration(NULL);
    29412946            D3D_RELEASE(pContext->d3dState.pVertexDecl);
    29422947
    2943             AssertReturn(pContext->pDevice, VERR_INTERNAL_ERROR);
    29442948            hr = pContext->pDevice->GetViewport(&viewportOrg);
    29452949            AssertMsgReturn(hr == D3D_OK, ("vmsvga3dChangeMode: GetViewport failed with %x\n", hr), VERR_INTERNAL_ERROR);
     
    51805184    else
    51815185    {
     5186        /* Create and set the vertex declaration. */
     5187        IDirect3DVertexDeclaration9 *pVertexDecl;
     5188        hr = pContext->pDevice->CreateVertexDeclaration(&aVertexElements[0], &pVertexDecl);
     5189        AssertMsgReturn(hr == D3D_OK, ("CreateVertexDeclaration failed with %x\n", hr), VERR_INTERNAL_ERROR);
     5190
     5191        hr = pContext->pDevice->SetVertexDeclaration(pVertexDecl);
     5192        AssertMsgReturnStmt(hr == D3D_OK, ("SetVertexDeclaration failed with %x\n", hr),
     5193                            D3D_RELEASE(pVertexDecl),
     5194                            VERR_INTERNAL_ERROR);
     5195
     5196        /* The new vertex declaration has been successfully set. Delete the old one. */
    51825197        D3D_RELEASE(pContext->d3dState.pVertexDecl);
    51835198
     5199        /* Remember the new vertext declaration. */
     5200        pContext->d3dState.pVertexDecl = pVertexDecl;
    51845201        pContext->d3dState.cVertexElements = numVertexDecls + 1;
    51855202        memcpy(pContext->d3dState.aVertexElements,
    51865203               aVertexElements,
    51875204               pContext->d3dState.cVertexElements * sizeof(aVertexElements[0]));
    5188 
    5189         /* Create and set the vertex declaration. */
    5190         hr = pContext->pDevice->CreateVertexDeclaration(&aVertexElements[0], &pContext->d3dState.pVertexDecl);
    5191         AssertMsgReturn(hr == D3D_OK, ("CreateVertexDeclaration failed with %x\n", hr), VERR_INTERNAL_ERROR);
    5192 
    5193         hr = pContext->pDevice->SetVertexDeclaration(pContext->d3dState.pVertexDecl);
    5194         AssertMsgReturnStmt(hr == D3D_OK, ("SetVertexDeclaration failed with %x\n", hr),
    5195                             D3D_RELEASE(pContext->d3dState.pVertexDecl),
    5196                             VERR_INTERNAL_ERROR);
    51975205    }
    51985206
     
    53005308    /* Cleanup. */
    53015309    uint32_t i;
    5302     /* Clear streams above 1 as they might accidentally be reused in the future. */
    5303     for (i = 1; i < iCurrentStreamId; ++i)
     5310    /* Clear all streams, because they are set at the beginning of this function anyway.
     5311     * Now the vertex buffers can be safely deleted/recreated if necessary.
     5312     */
     5313    for (i = 0; i < iCurrentStreamId; ++i)
    53045314    {
    53055315        LogFunc(("clear stream %d\n", i));
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