VirtualBox

Ignore:
Timestamp:
May 3, 2019 9:51:02 PM (6 years ago)
Author:
vboxsync
Message:

Additions/common/crOpengl,GuestHost/OpenGL,HostServices/SharedOpenGL: Eliminate all global variables from the state tracker library (state_tracker) in preparation of the SPU DLL merging, bugref:9435

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h

    r78341 r78375  
    192192#endif
    193193
     194    /** The state tracker the context is attached to. */
     195    PCRStateTracker    pStateTracker;
     196
    194197    /** For buffering vertices for selection/feedback */
    195198    /*@{*/
     
    202205
    203206
    204 DECLEXPORT(void) crStateInit(void);
    205 DECLEXPORT(void) crStateDestroy(void);
    206 DECLEXPORT(void) crStateVBoxDetachThread(void);
    207 DECLEXPORT(void) crStateVBoxAttachThread(void);
    208 DECLEXPORT(CRContext *) crStateCreateContext(const CRLimitsState *limits, GLint visBits, CRContext *share);
    209 DECLEXPORT(CRContext *) crStateCreateContextEx(const CRLimitsState *limits, GLint visBits, CRContext *share, GLint presetID);
    210 DECLEXPORT(void) crStateMakeCurrent(CRContext *ctx);
    211 DECLEXPORT(void) crStateSetCurrent(CRContext *ctx);
    212 DECLEXPORT(void) crStateCleanupCurrent(void);
    213 DECLEXPORT(CRContext *) crStateGetCurrent(void);
    214 DECLEXPORT(void) crStateDestroyContext(CRContext *ctx);
    215 DECLEXPORT(GLboolean) crStateEnableDiffOnMakeCurrent(GLboolean fEnable);
     207/**
     208 * CR state tracker.
     209 */
     210typedef struct CRStateTracker
     211{
     212    bool             fContextTLSInit;
     213    CRtsd            contextTSD;
     214    CRStateBits      *pCurrentBits;
     215    CRContext        *apAvailableContexts[CR_MAX_CONTEXTS];
     216    uint32_t         cContexts;
     217    CRSharedState    *pSharedState;
     218    CRContext        *pDefaultContext;
     219    GLboolean        fVBoxEnableDiffOnMakeCurrent;
     220    SPUDispatchTable diff_api;
     221} CRStateTracker;
     222/** Pointer to a state tracker state. */
     223typedef CRStateTracker *PCRStateTracker;
     224
     225DECLEXPORT(void) crStateInit(PCRStateTracker pState);
     226DECLEXPORT(void) crStateDestroy(PCRStateTracker pState);
     227DECLEXPORT(void) crStateVBoxDetachThread(PCRStateTracker pState);
     228DECLEXPORT(void) crStateVBoxAttachThread(PCRStateTracker pState);
     229DECLEXPORT(CRContext *) crStateCreateContext(PCRStateTracker pState, const CRLimitsState *limits, GLint visBits, CRContext *share);
     230DECLEXPORT(CRContext *) crStateCreateContextEx(PCRStateTracker pState, const CRLimitsState *limits, GLint visBits, CRContext *share, GLint presetID);
     231DECLEXPORT(void) crStateMakeCurrent(PCRStateTracker pState, CRContext *ctx);
     232DECLEXPORT(void) crStateSetCurrent(PCRStateTracker pState, CRContext *ctx);
     233DECLEXPORT(void) crStateCleanupCurrent(PCRStateTracker pState);
     234DECLEXPORT(CRContext *) crStateGetCurrent(PCRStateTracker pState);
     235DECLEXPORT(void) crStateDestroyContext(PCRStateTracker pState, CRContext *ctx);
     236DECLEXPORT(GLboolean) crStateEnableDiffOnMakeCurrent(PCRStateTracker pState, GLboolean fEnable);
    216237
    217238void crStateSwitchPrepare(CRContext *toCtx, CRContext *fromCtx, GLuint idDrawFBO, GLuint idReadFBO);
     
    219240
    220241void crStateSyncHWErrorState(CRContext *ctx);
    221 GLenum crStateCleanHWErrorState(void);
    222 
    223 #define CR_STATE_CLEAN_HW_ERR_WARN(_s) do {\
    224             GLenum _err = crStateCleanHWErrorState(); \
     242GLenum crStateCleanHWErrorState(PCRStateTracker pState);
     243
     244#define CR_STATE_CLEAN_HW_ERR_WARN(a_pState, _s) do {\
     245            GLenum _err = crStateCleanHWErrorState((a_pState)); \
    225246            if (_err != GL_NO_ERROR) { \
    226247                static int _cErrPrints = 0; \
     
    232253        } while (0)
    233254
    234 DECLEXPORT(void) crStateFlushFunc( CRStateFlushFunc ff );
    235 DECLEXPORT(void) crStateFlushArg( void *arg );
    236 DECLEXPORT(void) crStateDiffAPI( SPUDispatchTable *api );
    237 DECLEXPORT(void) crStateUpdateColorBits( void );
    238 
    239 DECLEXPORT(void) crStateSetCurrentPointers( CRContext *ctx, CRCurrentStatePointers *current );
    240 DECLEXPORT(void) crStateResetCurrentPointers( CRCurrentStatePointers *current );
    241 
    242 DECLEXPORT(void) crStateSetExtensionString( CRContext *ctx, const GLubyte *extensions );
    243 
    244 DECLEXPORT(void) crStateDiffContext( CRContext *from, CRContext *to );
    245 DECLEXPORT(void) crStateSwitchContext( CRContext *from, CRContext *to );
    246 
    247 DECLEXPORT(unsigned int) crStateHlpComponentsCount( GLenum pname );
     255DECLEXPORT(void) crStateFlushFunc(PCRStateTracker pState, CRStateFlushFunc ff);
     256DECLEXPORT(void) crStateFlushArg(PCRStateTracker pState, void *arg );
     257DECLEXPORT(void) crStateDiffAPI(PCRStateTracker pState, SPUDispatchTable *api);
     258DECLEXPORT(void) crStateUpdateColorBits(PCRStateTracker pState);
     259
     260DECLEXPORT(void) crStateSetCurrentPointers(CRContext *ctx, CRCurrentStatePointers *current);
     261DECLEXPORT(void) crStateResetCurrentPointers(CRCurrentStatePointers *current);
     262
     263DECLEXPORT(void) crStateSetExtensionString(CRContext *ctx, const GLubyte *extensions);
     264
     265DECLEXPORT(void) crStateDiffContext(CRContext *from, CRContext *to);
     266DECLEXPORT(void) crStateSwitchContext(CRContext *from, CRContext *to);
     267
     268DECLEXPORT(unsigned int) crStateHlpComponentsCount(GLenum pname);
    248269
    249270typedef struct CRFBDataElement
     
    277298
    278299DECLEXPORT(void) crStateGetTextureObjectAndImage(CRContext *g, GLenum texTarget, GLint level,
    279                                      CRTextureObj **obj, CRTextureLevel **img);
     300                                                 CRTextureObj **obj, CRTextureLevel **img);
    280301
    281302
     
    287308typedef FNCRSTATE_CONTEXT_GET *PFNCRSTATE_CONTEXT_GET;
    288309DECLEXPORT(int32_t) crStateLoadContext(CRContext *pContext, CRHashTable * pCtxTable, PFNCRSTATE_CONTEXT_GET pfnCtxGet, PSSMHANDLE pSSM, uint32_t u32Version);
    289 DECLEXPORT(void) crStateFreeShared(CRContext *pContext, CRSharedState *s);
    290 
    291 DECLEXPORT(int32_t) crStateLoadGlobals(PSSMHANDLE pSSM, uint32_t u32Version);
    292 DECLEXPORT(int32_t) crStateSaveGlobals(PSSMHANDLE pSSM);
    293 
    294 DECLEXPORT(CRSharedState *) crStateGlobalSharedAcquire(void);
    295 DECLEXPORT(void) crStateGlobalSharedRelease(void);
    296 #endif
    297 
    298 DECLEXPORT(void) crStateSetTextureUsed(GLuint texture, GLboolean used);
    299 DECLEXPORT(void) crStatePinTexture(GLuint texture, GLboolean pin);
    300 DECLEXPORT(void) crStateDeleteTextureCallback(void *texObj);
     310DECLEXPORT(void) crStateFreeShared(PCRStateTracker pState, CRContext *pContext, CRSharedState *s);
     311
     312DECLEXPORT(int32_t) crStateLoadGlobals(PCRStateTracker pState, PSSMHANDLE pSSM, uint32_t u32Version);
     313DECLEXPORT(int32_t) crStateSaveGlobals(PCRStateTracker pState, PSSMHANDLE pSSM);
     314
     315DECLEXPORT(CRSharedState *) crStateGlobalSharedAcquire(PCRStateTracker pState);
     316DECLEXPORT(void) crStateGlobalSharedRelease(PCRStateTracker pState);
     317#endif
     318
     319DECLEXPORT(void) crStateSetTextureUsed(PCRStateTracker pState, GLuint texture, GLboolean used);
     320DECLEXPORT(void) crStatePinTexture(PCRStateTracker pState, GLuint texture, GLboolean pin);
     321DECLEXPORT(void) crStateDeleteTextureCallback(void *texObj, void *pvUser);
    301322
    302323   /* XXX move these! */
    303324
    304 DECLEXPORT(void) STATE_APIENTRY
    305 crStateChromiumParameteriCR( GLenum target, GLint value );
    306 
    307 DECLEXPORT(void) STATE_APIENTRY
    308 crStateChromiumParameterfCR( GLenum target, GLfloat value );
    309 
    310 DECLEXPORT(void) STATE_APIENTRY
    311 crStateChromiumParametervCR( GLenum target, GLenum type, GLsizei count, const GLvoid *values );
    312 
    313 DECLEXPORT(void) STATE_APIENTRY
    314 crStateGetChromiumParametervCR( GLenum target, GLuint index, GLenum type,
    315                                 GLsizei count, GLvoid *values );
    316 
    317 DECLEXPORT(void) STATE_APIENTRY
    318 crStateReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
    319                    GLenum format, GLenum type, GLvoid *pixels );
    320 
    321 DECLEXPORT(void) STATE_APIENTRY crStateShareContext(GLboolean value);
     325DECLEXPORT(void) STATE_APIENTRY crStateChromiumParameteriCR(PCRStateTracker pState, GLenum target, GLint value );
     326DECLEXPORT(void) STATE_APIENTRY crStateChromiumParameterfCR(PCRStateTracker pState, GLenum target, GLfloat value );
     327DECLEXPORT(void) STATE_APIENTRY crStateChromiumParametervCR(PCRStateTracker pState, GLenum target, GLenum type, GLsizei count, const GLvoid *values );
     328DECLEXPORT(void) STATE_APIENTRY crStateGetChromiumParametervCR(PCRStateTracker pState, GLenum target, GLuint index, GLenum type,
     329                                                               GLsizei count, GLvoid *values );
     330DECLEXPORT(void) STATE_APIENTRY crStateReadPixels(PCRStateTracker pState, GLint x, GLint y, GLsizei width, GLsizei height,
     331                                                  GLenum format, GLenum type, GLvoid *pixels );
     332DECLEXPORT(void) STATE_APIENTRY crStateShareContext(PCRStateTracker pState, GLboolean value);
    322333DECLEXPORT(void) STATE_APIENTRY crStateShareLists(CRContext *pContext1, CRContext *pContext2);
    323334DECLEXPORT(void) STATE_APIENTRY crStateSetSharedContext(CRContext *pCtx);
    324335DECLEXPORT(GLboolean) STATE_APIENTRY crStateContextIsShared(CRContext *pCtx);
    325 
    326 DECLEXPORT(void) STATE_APIENTRY crStateQueryHWState(GLuint fbFbo, GLuint bbFbo);
     336DECLEXPORT(void) STATE_APIENTRY crStateQueryHWState(PCRStateTracker pState, GLuint fbFbo, GLuint bbFbo);
    327337#ifdef __cplusplus
    328338}
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