VirtualBox

Ignore:
Timestamp:
Jul 25, 2011 10:59:42 AM (14 years ago)
Author:
vboxsync
Message:

crogl: auto-flush on thread switch functionality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c

    r33988 r38143  
    213213}
    214214
     215#define PACK_FORCED_SYNC
    215216
    216217void PACKSPU_APIENTRY packspu_MakeCurrent( GLint window, GLint nativeWindow, GLint ctx )
     
    234235        newCtx = &pack_spu.context[slot];
    235236        CRASSERT(newCtx->clientState);  /* verify valid */
     237
     238        if (newCtx->fAutoFlush)
     239        {
     240            if (newCtx->currentThread && newCtx->currentThread != thread)
     241            {
     242                int writeback = 1;
     243                crLockMutex(&_PackMutex);
     244                /* do a flush for the previusly assigned thread
     245                 * to ensure all commands issued there are submitted */
     246                if (newCtx->currentThread
     247                    && newCtx->currentThread->inUse
     248                    && newCtx->currentThread->netServer.conn
     249                    && newCtx->currentThread->packer && newCtx->currentThread->packer->currentBuffer)
     250                {
     251#ifdef PACK_FORCED_SYNC
     252                    CRPackContext *pc = newCtx->currentThread->packer;
     253                    unsigned char *data_ptr;
     254
     255                    CR_GET_BUFFERED_POINTER( pc, 16 );
     256                    WRITE_DATA( 0, GLint, 16 );
     257                    WRITE_DATA( 4, GLenum, CR_WRITEBACK_EXTEND_OPCODE );
     258                    WRITE_NETWORK_POINTER( 8, (void *) &writeback );
     259                    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     260                    CR_UNLOCK_PACKER_CONTEXT(pc);
     261#endif
     262                    packspuFlush((void *) newCtx->currentThread);
     263
     264#ifdef PACK_FORCED_SYNC
     265                    while (writeback)
     266                        crNetRecv();
     267#endif
     268                }
     269                crUnlockMutex(&_PackMutex);
     270            }
     271            newCtx->currentThread = thread;
     272        }
    236273
    237274        thread->currentContext = newCtx;
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