VirtualBox

Ignore:
Timestamp:
Jul 1, 2009 2:25:14 PM (16 years ago)
Author:
vboxsync
Message:

crOpenGL: fix window/context management for multithreaded apps

Location:
trunk/src/VBox/Additions/common/crOpenGL/pack
Files:
2 edited

Legend:

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

    r15758 r21127  
    8282packspu_CreateContext( const char *dpyName, GLint visual, GLint shareCtx )
    8383{
     84    GET_THREAD(thread);
    8485    int writeback = 1;
    8586    GLint serverCtx = (GLint) -1;
     
    8990    crLockMutex(&_PackMutex);
    9091#endif
     92
     93    if (!thread) {
     94        thread = packspuNewThread(crThreadID());
     95    }
     96    CRASSERT(thread);
     97    CRASSERT(thread->packer);
    9198
    9299    if (shareCtx > 0) {
     
    98105    }
    99106
    100     crPackSetContext( pack_spu.thread[0].packer );
     107    crPackSetContext( thread->packer );
    101108
    102109    /* Pack the command */
     
    107114
    108115    /* Flush buffer and get return value */
    109     packspuFlush( &(pack_spu.thread[0]) );
    110     if (!(pack_spu.thread[0].netServer.conn->actual_network))
     116    packspuFlush(thread);
     117    if (!(thread->netServer.conn->actual_network))
    111118    {
    112119        /* HUMUNGOUS HACK TO MATCH SERVER NUMBERING
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c

    r20148 r21127  
    112112GLint PACKSPU_APIENTRY packspu_WindowCreate( const char *dpyName, GLint visBits )
    113113{
     114    GET_THREAD(thread);
    114115    static int num_calls = 0;
    115116    int writeback = pack_spu.thread[0].netServer.conn->actual_network;
    116117    GLint return_val = (GLint) 0;
    117118
    118     /* WindowCreate is special - just like CreateContext.
    119      * GET_THREAD(thread) doesn't work as the thread won't have called
    120      * MakeCurrent yet, so we've got to use the first thread's packer
    121      * buffer.
    122      */
    123 
    124     crPackSetContext( pack_spu.thread[0].packer );
     119    if (!thread) {
     120        thread = packspuNewThread( crThreadID() );
     121    }
     122    CRASSERT(thread);
     123    CRASSERT(thread->packer);
     124
     125    crPackSetContext(thread->packer);
    125126
    126127    if (pack_spu.swap)
     
    132133        crPackWindowCreate( dpyName, visBits, &return_val, &writeback );
    133134    }
    134     packspuFlush( &pack_spu.thread[0] );
    135     if (!(pack_spu.thread[0].netServer.conn->actual_network))
     135    packspuFlush(thread);
     136    if (!(thread->netServer.conn->actual_network))
    136137    {
    137138        return num_calls++;
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