VirtualBox

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


Ignore:
Timestamp:
Sep 16, 2013 3:31:03 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: chrome fixes

Location:
trunk/src/VBox/GuestHost/OpenGL
Files:
9 edited

Legend:

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

    r46966 r48491  
    5252#include <iprt/cdefs.h>
    5353
    54 #ifndef IN_GUEST
    5554# include <VBox/vmm/ssm.h>
    5655# include <iprt/asm.h>
     
    6463# define CR_STATE_SHAREDOBJ_USAGE_GET_FIRST_USED_IDX(_pObj) (ASMBitFirstSet((_pObj)->ctxUsage, sizeof ((_pObj)->ctxUsage)<<3))
    6564# define CR_STATE_SHAREDOBJ_USAGE_GET_NEXT_USED_IDX(_pObj, _i) (ASMBitNextSet((_pObj)->ctxUsage, sizeof ((_pObj)->ctxUsage)<<3, (_i)))
    66 #else
    67 # define CR_STATE_SHAREDOBJ_USAGE_INIT(_pObj) do {} while (0)
    68 # define CR_STATE_SHAREDOBJ_USAGE_SET(_pObj, _pCtx) do {} while (0)
    69 # define CR_STATE_SHAREDOBJ_USAGE_IS_SET(_pObj, _pCtx) (false)
    70 # define CR_STATE_SHAREDOBJ_USAGE_CLEAR_IDX(_pObj, _i) do {} while (0)
    71 # define CR_STATE_SHAREDOBJ_USAGE_CLEAR(_pObj, _pCtx) do {} while (0)
    72 # define CR_STATE_SHAREDOBJ_USAGE_IS_USED(_pObj) (GL_FALSE)
    73 # define CR_STATE_SHAREDOBJ_USAGE_GET_FIRST_USED_IDX(_pObj) (-1)
    74 # define CR_STATE_SHAREDOBJ_USAGE_GET_NEXT_USED_IDX(_pObj, _i) (-1)
    75 #endif
     65
    7666# define CR_STATE_SHAREDOBJ_USAGE_FOREACH_USED_IDX(_pObj, _i) for ((_i) = CR_STATE_SHAREDOBJ_USAGE_GET_FIRST_USED_IDX(_pObj); ((int)(_i)) >= 0; (_i) = CR_STATE_SHAREDOBJ_USAGE_GET_NEXT_USED_IDX((_pObj), ((int)(_i))))
    7767
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_bufferobject.h

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

    r44529 r48491  
    4949#ifdef IN_GUEST
    5050    GLenum                  status;
    51 #else
     51#endif
    5252    /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
    5353    CRbitvalue             ctxUsage[CR_MAX_BITARRAY];
    54 #endif
    5554} CRFramebufferObject;
    5655
     
    6059    GLenum   internalformat;
    6160    GLuint   redBits, greenBits, blueBits, alphaBits, depthBits, stencilBits;
    62 #ifndef IN_GUEST
    6361    /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
    6462    CRbitvalue             ctxUsage[CR_MAX_BITARRAY];
    65 #endif
    6663} CRRenderbufferObject;
    6764
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_texture.h

    r46174 r48491  
    9797    CRbitvalue             imageBit[CR_MAX_BITARRAY];
    9898    CRbitvalue             paramsBit[CR_MAX_TEXTURE_UNITS][CR_MAX_BITARRAY];
    99 #ifndef IN_GUEST
    10099    /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
    101100    CRbitvalue             ctxUsage[CR_MAX_BITARRAY];
    102 #endif
    103101} CRTextureObj;
    104102
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c

    r44290 r48491  
    2323        b->access = GL_READ_WRITE_ARB;
    2424        b->bResyncOnRead = GL_FALSE;
    25 #ifndef IN_GUEST
    2625        CR_STATE_SHAREDOBJ_USAGE_INIT(b);
    27 #endif
    2826    }
    2927    return b;
     
    232230        }
    233231
    234 #ifndef IN_GUEST
    235232        CR_STATE_SHAREDOBJ_USAGE_SET(newObj, g);
    236 #endif
    237233    }
    238234
     
    347343#endif
    348344
    349 #ifndef IN_GUEST
    350345    CR_STATE_SHAREDOBJ_USAGE_CLEAR(obj, ctx);
    351 #endif
    352346}
    353347
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_framebuffer.c

    r44947 r48491  
    8080    crStateInitFrameBuffer(buffer);
    8181    crHashtableAdd(ctx->shared->fbTable, name, buffer);
    82 #ifndef IN_GUEST
    8382    CR_STATE_SHAREDOBJ_USAGE_INIT(buffer);
    84 #endif
    8583
    8684    return buffer;
     
    107105    buffer->internalformat = GL_RGBA;
    108106    crHashtableAdd(ctx->shared->rbTable, name, buffer);
    109 #ifndef IN_GUEST
    110107    CR_STATE_SHAREDOBJ_USAGE_INIT(buffer);
    111 #endif
    112108
    113109    return buffer;
     
    169165            fbo->renderbuffer = crStateRenderbufferAllocate(g, renderbuffer);
    170166        }
    171 #ifndef IN_GUEST
    172167        CR_STATE_SHAREDOBJ_USAGE_SET(fbo->renderbuffer, g);
    173 #endif
    174 
    175168    }
    176169    else fbo->renderbuffer = NULL;
     
    228221    crStateCheckFBOAttachments(fbo->drawFB, fboId, GL_DRAW_FRAMEBUFFER);
    229222
    230 #ifndef IN_GUEST
    231223    CR_STATE_SHAREDOBJ_USAGE_CLEAR(rbo, g);
    232 #endif
    233224}
    234225
     
    251242            if (rbo)
    252243            {
    253 #ifndef IN_GUEST
    254244                int j;
    255 #endif
     245
    256246                ctStateRenderbufferRefsCleanup(g, renderbuffers[i], rbo);
    257 #ifndef IN_GUEST
    258247                CR_STATE_SHAREDOBJ_USAGE_FOREACH_USED_IDX(rbo, j)
    259248                {
     
    276265                        CR_STATE_SHAREDOBJ_USAGE_CLEAR_IDX(rbo, j);
    277266                }
    278 #endif
    279267                crHashtableDelete(g->shared->rbTable, renderbuffers[i], crStateFreeRBO);
    280268            }
     
    402390        }
    403391
    404 #ifndef IN_GUEST
     392
    405393        CR_STATE_SHAREDOBJ_USAGE_SET(pFBO, g);
    406 #endif
    407394    }
    408395
     
    459446            if (fb)
    460447            {
    461 #ifndef IN_GUEST
    462448                int j;
    463 #endif
     449
    464450                ctStateFramebufferRefsCleanup(g, fb);
    465 #ifndef IN_GUEST
     451
    466452                CR_STATE_SHAREDOBJ_USAGE_FOREACH_USED_IDX(fb, j)
    467453                {
     
    487473                        CR_STATE_SHAREDOBJ_USAGE_CLEAR_IDX(fb, j);
    488474                }
    489 #endif
    490475                crHashtableDelete(g->shared->fbTable, framebuffers[i], crStateFreeFBO);
    491476            }
     
    656641    CRSTATE_CHECKERR(textarget!=GL_TEXTURE_1D, GL_INVALID_OPERATION, "textarget");
    657642
    658 #ifndef IN_GUEST
    659643    CR_STATE_SHAREDOBJ_USAGE_SET(tobj, g);
    660 #endif
    661644
    662645    for (i = 0; i < cap; ++i)
     
    692675    CRSTATE_CHECKERR(GL_TEXTURE_1D==textarget || GL_TEXTURE_3D==textarget, GL_INVALID_OPERATION, "textarget");
    693676
    694 #ifndef IN_GUEST
    695677    CR_STATE_SHAREDOBJ_USAGE_SET(tobj, g);
    696 #endif
    697678
    698679    for (i = 0; i < cap; ++i)
     
    733714    CRSTATE_CHECKERR(textarget!=GL_TEXTURE_3D, GL_INVALID_OPERATION, "textarget");
    734715
    735 #ifndef IN_GUEST
    736716    CR_STATE_SHAREDOBJ_USAGE_SET(tobj, g);
    737 #endif
    738717
    739718    for (i = 0; i < cap; ++i)
     
    794773    }
    795774
    796 #ifndef IN_GUEST
    797775    CR_STATE_SHAREDOBJ_USAGE_SET(rb, g);
    798 #endif
    799776
    800777    for (i = 0; i < cFBOs; ++i)
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c

    r47972 r48491  
    6262}
    6363
    64 #ifndef IN_GUEST
    6564typedef struct CR_STATE_RELEASEOBJ
    6665{
     
    104103        crHashtableDelete(pData->s->rbTable, key, crStateFreeRBO);
    105104}
    106 #endif
     105
    107106/**
    108107 * Decrement shared state's refcount and delete when it hits zero.
     
    125124        crFree(s);
    126125    }
    127 #ifndef IN_GUEST
    128126    else if (pContext)
    129127    {
     
    137135        crHashtableWalk(s->rbTable, ReleaseRBOCallback, &CbData);
    138136    }
    139 #endif
    140137}
    141138
     
    465462    /* Reset diff_api */
    466463    crMemZero(&diff_api, sizeof(SPUDispatchTable));
     464
     465    Assert(!gSharedState);
     466    gSharedState = NULL;
    467467
    468468    /* Allocate the default/NULL context */
     
    624624#ifdef CHROMIUM_THREADSAFE
    625625    VBoxTlsRefMarkDestroy(ctx);
     626# ifdef IN_GUEST
     627    if (VBoxTlsRefCountGet(ctx) > 1 && ctx->shared == gSharedState)
     628    {
     629        /* we always need to free the global shared state to prevent the situation when guest thinks the shared objects are still valid, while host destroys them */
     630        crStateFreeShared(ctx, ctx->shared);
     631        ctx->shared = crStateAllocShared();
     632    }
     633# endif
    626634    VBoxTlsRefRelease(ctx);
    627635#else
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_program.c

    r37304 r48491  
    268268    CRContext *g = GetCurrentContext();
    269269    CRProgramState *p = &(g->program);
    270     GLint start, i;
    271 
    272     if (g->current.inBeginEnd) {
    273         crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION,
    274                                  "glGenProgramsNV called in Begin/End");
    275         return;
    276     }
    277 
    278     if (n < 0) {
    279         crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glGenProgramsNV(n)");
    280         return;
    281     }
    282 
    283     start = crHashtableAllocKeys(p->programHash , n);
    284     for (i = 0; i < n; i++)
    285         ids[i] = (GLuint) (start + i);
    286 }
    287 
     270
     271    crStateGenNames(g, p->programHash, n, ids);
     272}
    288273
    289274void STATE_APIENTRY crStateGenProgramsARB(GLsizei n, GLuint *ids)
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_texture.c

    r46607 r48491  
    251251    }
    252252
    253 #ifndef IN_GUEST
    254253    CR_STATE_SHAREDOBJ_USAGE_INIT(tobj);
    255254    CR_STATE_SHAREDOBJ_USAGE_SET(tobj, ctx);
    256 #endif
    257255}
    258256
     
    10161014    }
    10171015
    1018 #ifndef IN_GUEST
    10191016    CR_STATE_SHAREDOBJ_USAGE_SET(tobj, g);
    1020 #endif
    10211017
    10221018    /* Check the targets */
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