VirtualBox

Changeset 73097 in vbox for trunk/src/VBox/GuestHost/OpenGL


Ignore:
Timestamp:
Jul 12, 2018 9:06:33 PM (6 years ago)
Author:
vboxsync
Message:

*: Made RT_UOFFSETOF, RT_OFFSETOF, RT_UOFFSETOF_ADD and RT_OFFSETOF_ADD work like builtin_offsetof() and require compile time resolvable requests, adding RT_UOFFSETOF_DYN for the dynamic questions that can only be answered at runtime.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c

    r69500 r73097  
    6363
    6464#define SHCROGL_GET_STRUCT_PART(_pPtr, _type, _from, _to) do { \
    65             rc = SSMR3GetMem(pSSM, &(_pPtr)->_from, RT_OFFSETOF(_type, _to) - RT_OFFSETOF(_type, _from)); \
     65            rc = SSMR3GetMem(pSSM, &(_pPtr)->_from, RT_UOFFSETOF(_type, _to) - RT_UOFFSETOF(_type, _from)); \
    6666            AssertRCReturn(rc, rc); \
    6767        } while (0)
    6868
    6969#define SHCROGL_GET_STRUCT_TAIL(_pPtr, _type, _from) do { \
    70             rc = SSMR3GetMem(pSSM, &(_pPtr)->_from, sizeof (_type) - RT_OFFSETOF(_type, _from)); \
     70            rc = SSMR3GetMem(pSSM, &(_pPtr)->_from, sizeof (_type) - RT_UOFFSETOF(_type, _from)); \
    7171            AssertRCReturn(rc, rc); \
    7272        } while (0)
    7373
    7474#define SHCROGL_GET_STRUCT_HEAD(_pPtr, _type, _to) do { \
    75             rc = SSMR3GetMem(pSSM, (_pPtr), RT_OFFSETOF(_type, _to)); \
     75            rc = SSMR3GetMem(pSSM, (_pPtr), RT_UOFFSETOF(_type, _to)); \
    7676            AssertRCReturn(rc, rc); \
    7777        } while (0)
    7878
    79 #define SHCROGL_CUT_FIELD_ALIGNMENT_SIZE(_type, _prevField, _field) (RT_OFFSETOF(_type, _field) - RT_OFFSETOF(_type, _prevField) - RT_SIZEOFMEMB(_type, _prevField))
     79#define SHCROGL_CUT_FIELD_ALIGNMENT_SIZE(_type, _prevField, _field) (RT_UOFFSETOF(_type, _field) - RT_UOFFSETOF(_type, _prevField) - RT_SIZEOFMEMB(_type, _prevField))
    8080#define SHCROGL_CUT_FIELD_ALIGNMENT(_type, _prevField, _field) do { \
    8181            const int32_t cbAlignment = SHCROGL_CUT_FIELD_ALIGNMENT_SIZE(_type, _prevField, _field) ; \
     
    8888#define SHCROGL_ROUNDBOUND(_v, _b) (((_v) + ((_b) - 1)) & ~((_b) - 1))
    8989#define SHCROGL_ALIGNTAILSIZE(_v, _b) (SHCROGL_ROUNDBOUND((_v),(_b)) - (_v))
    90 #define SHCROGL_CUT_FOR_OLD_TYPE_TO_ENSURE_ALIGNMENT_SIZE(_type, _field, _oldFieldType, _nextFieldAllignment) (SHCROGL_ALIGNTAILSIZE(((RT_OFFSETOF(_type, _field) + sizeof (_oldFieldType))), (_nextFieldAllignment)))
     90#define SHCROGL_CUT_FOR_OLD_TYPE_TO_ENSURE_ALIGNMENT_SIZE(_type, _field, _oldFieldType, _nextFieldAllignment) (SHCROGL_ALIGNTAILSIZE(((RT_UOFFSETOF(_type, _field) + sizeof (_oldFieldType))), (_nextFieldAllignment)))
    9191#define SHCROGL_CUT_FOR_OLD_TYPE_TO_ENSURE_ALIGNMENT(_type, _field, _oldFieldType, _nextFieldAllignment)  do { \
    9292        const int32_t cbAlignment = SHCROGL_CUT_FOR_OLD_TYPE_TO_ENSURE_ALIGNMENT_SIZE(_type, _field, _oldFieldType, _nextFieldAllignment); \
     
    9898
    9999
    100 #define SHCROGL_CUT_TAIL_ALIGNMENT_SIZE(_type, _lastField) (sizeof (_type) - RT_OFFSETOF(_type, _lastField) - RT_SIZEOFMEMB(_type, _lastField))
     100#define SHCROGL_CUT_TAIL_ALIGNMENT_SIZE(_type, _lastField) (sizeof (_type) - RT_UOFFSETOF(_type, _lastField) - RT_SIZEOFMEMB(_type, _lastField))
    101101#define SHCROGL_CUT_TAIL_ALIGNMENT(_type, _lastField) do { \
    102102            const int32_t cbAlignment = SHCROGL_CUT_TAIL_ALIGNMENT_SIZE(_type, _lastField); \
     
    110110{
    111111    int32_t rc;
    112     uint32_t cbObj = RT_OFFSETOF(CRTextureObj, ctxUsage);
     112    uint32_t cbObj = RT_UOFFSETOF(CRTextureObj, ctxUsage);
    113113    cbObj = ((cbObj + sizeof (void*) - 1) & ~(sizeof (void*) - 1));
    114114    rc = SSMR3GetMem(pSSM, pTexture, cbObj);
     
    338338    if (u32Version == SHCROGL_SSM_VERSION_BEFORE_CTXUSAGE_BITS)
    339339    {
    340         uint32_t cbObj = RT_OFFSETOF(CRBufferObject, ctxUsage);
     340        uint32_t cbObj = RT_UOFFSETOF(CRBufferObject, ctxUsage);
    341341        cbObj = ((cbObj + sizeof (void*) - 1) & ~(sizeof (void*) - 1));
    342342        rc = SSMR3GetMem(pSSM, pBufferObj, cbObj);
     
    359359    if (u32Version == SHCROGL_SSM_VERSION_BEFORE_CTXUSAGE_BITS)
    360360    {
    361         uint32_t cbObj = RT_OFFSETOF(CRFramebufferObject, ctxUsage);
     361        uint32_t cbObj = RT_UOFFSETOF(CRFramebufferObject, ctxUsage);
    362362        cbObj = ((cbObj + sizeof (void*) - 1) & ~(sizeof (void*) - 1));
    363363        rc = SSMR3GetMem(pSSM, pFBO, cbObj);
     
    380380    if (u32Version == SHCROGL_SSM_VERSION_BEFORE_CTXUSAGE_BITS)
    381381    {
    382         uint32_t cbObj = RT_OFFSETOF(CRRenderbufferObject, ctxUsage);
     382        uint32_t cbObj = RT_UOFFSETOF(CRRenderbufferObject, ctxUsage);
    383383        cbObj = ((cbObj + sizeof (void*) - 1) & ~(sizeof (void*) - 1));
    384384        rc = SSMR3GetMem(pSSM, pRBO, cbObj);
     
    19121912
    19131913            ui = VBOXTLSREFDATA_OFFSET(CRContext) + VBOXTLSREFDATA_SIZE() + sizeof (pTmpContext->bitid) + sizeof (pTmpContext->neg_bitid);
    1914             ui = RT_OFFSETOF(CRContext, shared) - ui;
     1914            ui = RT_UOFFSETOF(CRContext, shared) - ui;
    19151915        }
    19161916        else
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