Esempio n. 1
0
void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, struct VBOXVR_SCR_COMPOSITOR * pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry, int32_t i32MakeCurrentUserData )
{
    PCR_BLITTER pBlitter = renderspuVBoxPresentBlitterGetAndEnter(window, i32MakeCurrentUserData);
    if (!pBlitter)
        return;

    renderspuVBoxCompositorBlit(pCompositor, pBlitter);

    renderspu_SystemSwapBuffers(window, 0);

    CrBltLeave(pBlitter);
}
Esempio n. 2
0
int CrBltEnter(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pRestoreCtxInfo, const CR_BLITTER_WINDOW *pRestoreMural)
{
    if (!pBlitter->CurrentMural.Base.id && pBlitter->CtxInfo.Base.id)
    {
        crWarning("current mural not initialized!");
        return VERR_INVALID_STATE;
    }

    if (CrBltIsEntered(pBlitter))
    {
        crWarning("blitter is entered already!");
        return VERR_INVALID_STATE;
    }

    if (pBlitter->CurrentMural.Base.id) /* <- pBlitter->CurrentMural.Base.id can be null if the blitter is in a "no-context" mode (see comments to BltInit for detail)*/
    {
        if (pRestoreCtxInfo)
            pBlitter->pDispatch->Flush();
        pBlitter->pDispatch->MakeCurrent(pBlitter->CurrentMural.Base.id, pBlitter->i32MakeCurrentUserData, pBlitter->CtxInfo.Base.id);
    }
    else
    {
        if (pRestoreCtxInfo)
        {
            crWarning("pRestoreCtxInfo is not NULL for \"no-context\" blitter");
            pRestoreCtxInfo = NULL;
        }
    }

    if (pRestoreCtxInfo)
    {
        pBlitter->pRestoreCtxInfo = pRestoreCtxInfo;
        pBlitter->pRestoreMural = pRestoreMural;
    }
    else
    {
        pBlitter->pRestoreCtxInfo = &pBlitter->CtxInfo;
    }

    if (pBlitter->Flags.Initialized)
        return VINF_SUCCESS;

    int rc = crBltInitOnMakeCurent(pBlitter);
    if (RT_SUCCESS(rc))
    {
        pBlitter->Flags.Initialized = 1;
        return VINF_SUCCESS;
    }

    crWarning("crBltInitOnMakeCurent failed, rc %d", rc);
    CrBltLeave(pBlitter);
    return rc;
}
Esempio n. 3
0
PCR_BLITTER renderspuVBoxPresentBlitterEnsureCreated( WindowInfo *window, int32_t i32MakeCurrentUserData )
{
    if (!window->pBlitter)
    {
        struct VBOXVR_SCR_COMPOSITOR * pTmpCompositor;
        /* just use compositor lock to synchronize */
        pTmpCompositor = renderspuVBoxCompositorAcquire(window);
        CRASSERT(pTmpCompositor);
        if (pTmpCompositor)
        {
            PCR_BLITTER pBlitter = renderspuVBoxPresentBlitterGet( window );
            if (pBlitter)
            {
                if (!CrBltIsEverEntered(pBlitter))
                {
                    int rc = renderspuVBoxPresentBlitterEnter(pBlitter, i32MakeCurrentUserData);
                    if (RT_SUCCESS(rc))
                    {
                        CrBltLeave(pBlitter);
                    }
                    else
                    {
                        crWarning("renderspuVBoxPresentBlitterEnter failed rc %d", rc);
                    }
                }
            }
            else
            {
                crWarning("renderspuVBoxPresentBlitterGet failed");
            }

            renderspuVBoxCompositorRelease(window);
        }
        else
        {
            crWarning("renderspuVBoxCompositorAcquire failed");
        }
    }
    return window->pBlitter;
}
Esempio n. 4
0
VBOXBLITTERDECL(int) CrBltCleanup(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pRestoreCtxInfo, const CR_BLITTER_WINDOW *pRestoreMural)
{
    if (CrBltIsEntered(pBlitter))
    {
        crWarning("CrBltBlitTexTex: blitter is entered");
        return VERR_INVALID_STATE;
    }

    if (pBlitter->Flags.ShadersGloal || !CrGlslNeedsCleanup(&pBlitter->LocalGlslCache))
        return VINF_SUCCESS;

    int rc = CrBltEnter(pBlitter, pRestoreCtxInfo, pRestoreMural);
    if (!RT_SUCCESS(rc))
    {
        crWarning("CrBltEnter failed, rc %d", rc);
        return rc;
    }

    CrGlslCleanup(&pBlitter->LocalGlslCache);

    CrBltLeave(pBlitter);

    return VINF_SUCCESS;
}