VirtualBox

Ignore:
Timestamp:
Aug 20, 2010 9:40:40 AM (14 years ago)
Author:
vboxsync
Message:

crOpenGL: resource sharing between contexts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_gentextures.c

    r25154 r31808  
    1414void SERVER_DISPATCH_APIENTRY crServerDispatchGenTextures( GLsizei n, GLuint *textures )
    1515{
    16     GLsizei i;
    17     GLuint *local_textures = (GLuint *) crAlloc( n*sizeof( *local_textures) );
     16    GLuint *local_textures = (GLuint *) crAlloc(n*sizeof(*local_textures));
    1817    (void) textures;
    19     cr_server.head_spu->dispatch_table.GenTextures( n, local_textures );
    2018
    21     /* This is somewhat hacky.
    22      * We have to make sure we're going to generate unique texture IDs.
    23      * That wasn't the case before snapshot loading, because we could just rely on host video drivers.
    24      * Now we could have a set of loaded texture IDs which aren't already reserved in the host driver.
    25      * Note: It seems, that it's easy to reserve ATI/NVidia IDs, by simply calling glGenTextures
    26      * with n==number of loaded textures. But it's really implementation dependant. So can't rely that it'll not change.
    27      */
    28     for (i=0; i<n; ++i)
    29     {
    30         /* translate the ID as it'd be done in glBindTexture call */
    31         GLuint tID = crServerTranslateTextureID(local_textures[i]);
    32         /* check if we have a texture with same ID loaded from snapshot */
    33         while (crStateIsTexture(tID))
    34         {
    35             /* request new ID */
    36             cr_server.head_spu->dispatch_table.GenTextures(1, &tID);
    37             local_textures[i] = tID;
    38             tID = crServerTranslateTextureID(tID);
    39         }
    40     }
     19    crStateGenTextures(n, local_textures);
    4120
    42     crServerReturnValue( local_textures, n*sizeof( *local_textures ) );
     21    crServerReturnValue(local_textures, n*sizeof(*local_textures));
    4322    crFree( local_textures );
    4423}
    45 
    4624
    4725void SERVER_DISPATCH_APIENTRY crServerDispatchGenProgramsNV( GLsizei n, GLuint * ids )
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