//-------------------------------------------------------------------------------------------------
ALVR_RESULT WaitForCompletion(bool bLeft)
{
    ALVR_RESULT res = g_pLvrDevice->SubmitFence(bLeft ? 0 : 1, g_pFenceD3D11);
    CHECK_ALVR_ERROR_RETURN(res, L"SubmitFence() failed");
    res = g_pFenceD3D11->Wait(2000);
    CHECK_ALVR_ERROR_RETURN(res, L"g_pFenceD3D11->Wait() failed");

    return ALVR_OK;
}