VirtualBox

Ignore:
Timestamp:
Apr 25, 2012 7:34:43 PM (13 years ago)
Author:
vboxsync
Message:

crOpenGL: fix gl resource leaking (server part)

Location:
trunk/src/VBox/GuestHost/OpenGL/include
Files:
6 edited

Legend:

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

    r15532 r41057  
    6565}
    6666
     67static INLINE int CHECKBIT( const unsigned int *b, const unsigned int bit )
     68{
     69    unsigned int node32 = bit >> 5;
     70    unsigned int node = bit & 0x1f;
     71
     72    return !!(b[node32] & (1 < node));
     73}
     74
     75static INLINE void CLEARBIT( unsigned int *b, const unsigned int bit )
     76{
     77    unsigned int node32 = bit >> 5;
     78    unsigned int node = bit & 0x1f;
     79
     80    b[node32] &=  ~(1 << node);
     81}
     82
     83static INLINE void SETBIT( unsigned int *b, const unsigned int bit )
     84{
     85    unsigned int node32 = bit >> 5;
     86    unsigned int node = bit & 0x1f;
     87
     88    b[node32] |=  (1 << node);
     89}
     90
     91static INLINE int HASBITS( const unsigned int *b )
     92{
     93    int j;
     94
     95    for (j=0;j<CR_MAX_BITARRAY;j++)
     96        if (b[j])
     97            return 1;
     98
     99    return 0;
     100}
     101
     102static INLINE void CLEARBITS( unsigned int *b )
     103{
     104    int j;
     105
     106    for (j=0;j<CR_MAX_BITARRAY;j++)
     107        b[j] = 0;
     108}
     109
     110
    67111#ifdef __cplusplus
    68112}
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h

    r40691 r41057  
    116116} CRSharedState;
    117117
     118#define CR_STATE_SHAREDOBJ_USAGE_INIT(_pObj) (CLEARBITS((_pObj)->ctxUsage))
     119#define CR_STATE_SHAREDOBJ_USAGE_SET(_pObj, _pCtx) (SETBIT((_pObj)->ctxUsage, (_pCtx)->id))
     120#define CR_STATE_SHAREDOBJ_USAGE_CLEAR(_pObj, _pCtx) (CLEARBIT((_pObj)->ctxUsage, (_pCtx)->id))
     121#define CR_STATE_SHAREDOBJ_USAGE_IS_USED(_pObj) (HASBITS((_pObj)->ctxUsage))
    118122
    119123/**
     
    231235typedef FNCRSTATE_CONTEXT_GET *PFNCRSTATE_CONTEXT_GET;
    232236DECLEXPORT(int32_t) crStateLoadContext(CRContext *pContext, CRHashTable * pCtxTable, PFNCRSTATE_CONTEXT_GET pfnCtxGet, PSSMHANDLE pSSM);
    233 DECLEXPORT(void)    crStateFreeShared(CRSharedState *s);
     237DECLEXPORT(void)    crStateFreeShared(CRContext *pContext, CRSharedState *s);
    234238#endif
    235239
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h

    r40691 r41057  
    3131#endif
    3232
    33 #define SHCROGL_SSM_VERSION 28
     33#define SHCROGL_SSM_VERSION 29
    3434
    3535#define CR_MAX_WINDOWS 100
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_bufferobject.h

    r34107 r41057  
    4242        CRbitvalue dirty[CR_MAX_BITARRAY];  /* dirty data or state */
    4343        GLintptrARB dirtyStart, dirtyLength; /* dirty region */
     44#ifndef IN_GUEST
     45    /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
     46    CRbitvalue             ctxUsage[CR_MAX_BITARRAY];
     47#endif
    4448} CRBufferObject;
    4549
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_framebuffer.h

    r39815 r41057  
    4949#ifdef IN_GUEST
    5050    GLenum                  status;
     51#else
     52    /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
     53    CRbitvalue             ctxUsage[CR_MAX_BITARRAY];
    5154#endif
    5255} CRFramebufferObject;
     
    5760    GLenum   internalformat;
    5861    GLuint   redBits, greenBits, blueBits, alphaBits, depthBits, stencilBits;
     62#ifndef IN_GUEST
     63    /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
     64    CRbitvalue             ctxUsage[CR_MAX_BITARRAY];
     65#endif
    5966} CRRenderbufferObject;
    6067
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_texture.h

    r34107 r41057  
    9797    CRbitvalue             imageBit[CR_MAX_BITARRAY];
    9898    CRbitvalue             paramsBit[CR_MAX_TEXTURE_UNITS][CR_MAX_BITARRAY];
     99#ifndef IN_GUEST
     100    /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
     101    CRbitvalue             ctxUsage[CR_MAX_BITARRAY];
     102#endif
    99103} CRTextureObj;
    100104
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