cr_blitter.h revision 376cc6b4aa482ee01858b2df4bb35ed0a3077db4
/* $Id$ */
/** @file
* Blitter API
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___cr_blitter_h__
#define ___cr_blitter_h__
#include "cr_spu.h"
#include "cr_vreg.h"
#ifndef IN_RING0
#else
#endif
/* GLSL Cache */
typedef struct CR_GLSL_CACHE
{
int iGlVersion;
{
}
{
}
/* clients should set proper context before calling these funcs */
/* BLITTER */
typedef struct CR_BLITTER_BUFFER
{
typedef union CR_BLITTER_FLAGS
{
struct
{
};
struct CR_BLITTER;
typedef DECLCALLBACK(int) FNCRBLT_BLITTER(struct CR_BLITTER *pBlitter, const VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRect, const RTRECTSIZE *pDstSize, const RTRECT *paDstRect, uint32_t cRects, uint32_t fFlags);
typedef FNCRBLT_BLITTER *PFNCRBLT_BLITTER;
typedef struct CR_BLITTER_SPUITEM
{
int id;
typedef struct CR_BLITTER_CONTEXT
{
typedef struct CR_BLITTER_WINDOW
{
typedef struct CR_BLITTER_IMG
{
void *pvData;
typedef struct CR_BLITTER
{
const CR_GLSL_CACHE *pGlslCache;
} CR_BLITTER, *PCR_BLITTER;
{
}
VBOXBLITTERDECL(int) CrBltInit(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pCtxBase, bool fCreateNewCtx, bool fForceDrawBlt, const CR_GLSL_CACHE *pShaders, SPUDispatchTable *pDispatch);
{
}
{
}
{
}
{
}
{
}
VBOXBLITTERDECL(int) CrBltMuralSetCurrentInfo(PCR_BLITTER pBlitter, const CR_BLITTER_WINDOW *pMural);
{
return &pBlitter->CurrentMural;
}
VBOXBLITTERDECL(void) CrBltBlitTexMural(PCR_BLITTER pBlitter, bool fBb, const VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags);
VBOXBLITTERDECL(void) CrBltBlitTexTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, const RTRECT *pSrcRect, const VBOXVR_TEXTURE *pDst, const RTRECT *pDstRect, uint32_t cRects, uint32_t fFlags);
VBOXBLITTERDECL(int) CrBltImgGetTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, GLenum enmFormat, CR_BLITTER_IMG *pDst);
/* */
struct CR_TEXDATA;
typedef FNCRTEXDATA_RELEASED *PFNCRTEXDATA_RELEASED;
typedef union CR_TEXDATA_FLAGS
{
struct
{
};
typedef struct CR_TEXDATA
{
/* fields specific to texture data download */
/*dtor*/
struct CR_TEXDATA *pStretchedCache;
} CR_TEXDATA, *PCR_TEXDATA;
DECLINLINE(void) CrTdInit(PCR_TEXDATA pTex, const VBOXVR_TEXTURE *pVrTex, PCR_BLITTER pBlitter, PFNCRTEXDATA_RELEASED pfnTextureReleased)
{
}
{
}
{
}
{
int rc;
return VERR_INVALID_STATE;
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
}
{
{
WARN(("invalid Blt Leave"));
return;
}
}
/* the CrTdBltXxx calls are done with the entered blitter */
/* acquire the texture data, returns the cached data in case it is cached.
* the data remains cached in the CR_TEXDATA object until it is discarded with CrTdBltDataFree or CrTdBltDataCleanup.
* */
VBOXBLITTERDECL(int) CrTdBltDataAcquire(PCR_TEXDATA pTex, GLenum enmFormat, bool fInverted, const CR_BLITTER_IMG**ppImg);
VBOXBLITTERDECL(int) CrTdBltDataAcquireStretched(PCR_TEXDATA pTex, GLenum enmFormat, bool fInverted, uint32_t width, uint32_t height, const CR_BLITTER_IMG**ppImg);
/* release the texture data, the data remains cached in the CR_TEXDATA object until it is discarded with CrTdBltDataFree or CrTdBltDataCleanup */
/* discard the texture data cached with previous CrTdBltDataAcquire.
* Must be called wit data released (CrTdBltDataRelease) */
/* does same as CrTdBltDataFree, and in addition cleans up.
* this is kind of a texture destructor, which clients should call on texture object destruction, e.g. from the PFNCRTEXDATA_RELEASED callback */
{
}
{
if (!cRefs)
{
if (pTex->pfnTextureReleased)
else
}
return cRefs;
}
#endif /* #ifndef ___cr_blitter_h__ */