third_party/virtualbox/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
/* Inject a query event into the D3D pipeline so we can check when usage of this surface has finished.
 * (D3D does not synchronize shared surface usage)
 */
Inject a query event into the D3D pipeline so we can check when usage of this surface has finished.
(D3D does not synchronize shared surface usage)
Inject a query event into the D3D pipeline so we can check when usage of this surface has finished . ( D3D does not synchronize shared surface usage )
static int vmsvga3dSurfaceTrackUsage(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, PVMSVGA3DSURFACE pSurface)
{
    RT_NOREF(pState);
#ifndef VBOX_VMSVGA3D_WITH_WINE_OPENGL
    Assert(pSurface->id != SVGA3D_INVALID_ID);
    if (pSurface->pSharedObjectTree == NULL)
        return VINF_SUCCESS;
    LogFunc(("track usage of sid=%x (cid=%d) for cid=%d, pQuery %p\n", pSurface->id, pSurface->idAssociatedContext, pContext->id, pSurface->pQuery));
    D3D_RELEASE(pSurface->pQuery);
    HRESULT hr = pContext->pDevice->CreateQuery(D3DQUERYTYPE_EVENT, &pSurface->pQuery);
    AssertMsgReturn(hr == D3D_OK, ("vmsvga3dSurfaceTrackUsage: CreateQuery failed with %x\n", hr), VERR_INTERNAL_ERROR);
    hr = pSurface->pQuery->Issue(D3DISSUE_END);
    AssertMsgReturn(hr == D3D_OK, ("vmsvga3dSurfaceTrackUsage: Issue failed with %x\n", hr), VERR_INTERNAL_ERROR);
#endif 
    return VINF_SUCCESS;
}
static int vmsvga3dSurfaceTrackUsage ( PVMSVGA3DSTATE pState , PVMSVGA3DCONTEXT pContext , PVMSVGA3DSURFACE pSurface ) { RT_NOREF ( pState ) ; #ifndef VBOX_VMSVGA3D_WITH_WINE_OPENGL Assert ( pSurface -> id != SVGA3D_INVALID_ID ) ; if ( pSurface -> pSharedObjectTree == NULL ) return VINF_SUCCESS ; LogFunc ( ( " \n " , pSurface -> id , pSurface -> idAssociatedContext , pContext -> id , pSurface -> pQuery ) ) ; D3D_RELEASE ( pSurface -> pQuery ) ; HRESULT hr = pContext -> pDevice -> CreateQuery ( D3DQUERYTYPE_EVENT , & pSurface -> pQuery ) ; AssertMsgReturn ( hr == D3D_OK , ( " \n " , hr ) , VERR_INTERNAL_ERROR ) ; hr = pSurface -> pQuery -> Issue ( D3DISSUE_END ) ; AssertMsgReturn ( hr == D3D_OK , ( " \n " , hr ) , VERR_INTERNAL_ERROR ) ; #endif return VINF_SUCCESS ; }
Inject a query event into the D3D pipeline so we can check when usage of this surface has finished.
Inject a query event into the D3D pipeline so we can check when usage of this surface has finished .
/* Nothing to do if this surface hasn't been shared. */ /* Release the previous query object. */ /* !VBOX_VMSVGA3D_WITH_WINE_OPENGL */