Changeset 31808 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_gentextures.c
- Timestamp:
- Aug 20, 2010 9:40:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_gentextures.c
r25154 r31808 14 14 void SERVER_DISPATCH_APIENTRY crServerDispatchGenTextures( GLsizei n, GLuint *textures ) 15 15 { 16 GLsizei i; 17 GLuint *local_textures = (GLuint *) crAlloc( n*sizeof( *local_textures) ); 16 GLuint *local_textures = (GLuint *) crAlloc(n*sizeof(*local_textures)); 18 17 (void) textures; 19 cr_server.head_spu->dispatch_table.GenTextures( n, local_textures );20 18 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); 41 20 42 crServerReturnValue( local_textures, n*sizeof( *local_textures ));21 crServerReturnValue(local_textures, n*sizeof(*local_textures)); 43 22 crFree( local_textures ); 44 23 } 45 46 24 47 25 void SERVER_DISPATCH_APIENTRY crServerDispatchGenProgramsNV( GLsizei n, GLuint * ids )
Note:
See TracChangeset
for help on using the changeset viewer.