Changeset 31808 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Timestamp:
- Aug 20, 2010 9:40:40 AM (14 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/get_components.py
r20916 r31808 104 104 'GL_BUFFER_ACCESS_ARB': (1, 'CR_ARB_vertex_buffer_object'), 105 105 'GL_BUFFER_MAPPED_ARB': (1, 'CR_ARB_vertex_buffer_object'), 106 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING ': (4, 'CR_ARB_vertex_buffer_object'),106 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB': (1, 'CR_ARB_vertex_buffer_object'), 107 107 'GL_QUERY_COUNTER_BITS_ARB': (1, 'CR_ARB_occlusion_query'), 108 108 'GL_QUERY_RESULT_AVAILABLE_ARB': (1, 'CR_ARB_occlusion_query'), -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r27889 r31808 87 87 GLint crServerSPUWindowID(GLint serverWindow); 88 88 89 GLuint crServerTranslateTextureID(GLuint id);90 89 GLuint crServerTranslateProgramID(GLuint id); 91 90 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_bufferobject.c
r22155 r31808 59 59 } 60 60 } 61 62 void SERVER_DISPATCH_APIENTRY 63 crServerDispatchBindBufferARB(GLenum target, GLuint buffer) 64 { 65 crStateBindBufferARB(target, buffer); 66 cr_server.head_spu->dispatch_table.BindBufferARB(target, crStateGetBufferHWID(buffer)); 67 } 68 69 GLboolean SERVER_DISPATCH_APIENTRY 70 crServerDispatchIsBufferARB(GLuint buffer) 71 { 72 GLboolean retval; 73 retval = cr_server.head_spu->dispatch_table.IsBufferARB(crStateGetBufferHWID(buffer)); 74 crServerReturnValue( &retval, sizeof(retval) ); 75 return retval; /* WILL PROBABLY BE IGNORED */ 76 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_framebuffer.c
r28800 r31808 46 46 void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 47 47 { 48 if (texture)49 {50 texture = crServerTranslateTextureID(texture);51 }52 53 48 crStateFramebufferTexture1DEXT(target, attachment, textarget, texture, level); 54 cr_server.head_spu->dispatch_table.FramebufferTexture1DEXT(target, attachment, textarget, texture, level);49 cr_server.head_spu->dispatch_table.FramebufferTexture1DEXT(target, attachment, textarget, crStateGetTextureHWID(texture), level); 55 50 } 56 51 57 52 void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 58 53 { 59 if (texture)60 {61 texture = crServerTranslateTextureID(texture);62 }63 64 54 crStateFramebufferTexture2DEXT(target, attachment, textarget, texture, level); 65 cr_server.head_spu->dispatch_table.FramebufferTexture2DEXT(target, attachment, textarget, texture, level);55 cr_server.head_spu->dispatch_table.FramebufferTexture2DEXT(target, attachment, textarget, crStateGetTextureHWID(texture), level); 66 56 } 67 57 68 58 void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) 69 59 { 70 if (texture)71 {72 texture = crServerTranslateTextureID(texture);73 }74 75 60 crStateFramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset); 76 cr_server.head_spu->dispatch_table.FramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset);61 cr_server.head_spu->dispatch_table.FramebufferTexture3DEXT(target, attachment, textarget, crStateGetTextureHWID(texture), level, zoffset); 77 62 } 78 63 … … 121 106 crStateGetFramebufferAttachmentParameterivEXT(target, attachment, pname, local_params); 122 107 123 if (GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT==pname)124 {125 GLint type;126 crStateGetFramebufferAttachmentParameterivEXT(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT, &type);127 if (GL_TEXTURE==type)128 {129 /*todo, add reverse of crServerTranslateTextureID*/130 if (!cr_server.sharedTextureObjects && local_params[0])131 {132 int client = cr_server.curClient->number;133 local_params[0] = local_params[0] - client * 100000;134 }135 }136 }137 138 108 crServerReturnValue(&(local_params[0]), 1*sizeof(GLint)); 139 109 } 110 111 GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsFramebufferEXT( GLuint framebuffer ) 112 { 113 GLboolean retval; 114 retval = cr_server.head_spu->dispatch_table.IsFramebufferEXT(crStateGetFramebufferHWID(framebuffer)); 115 crServerReturnValue( &retval, sizeof(retval) ); 116 return retval; /* WILL PROBABLY BE IGNORED */ 117 } 118 119 GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsRenderbufferEXT( GLuint renderbuffer ) 120 { 121 GLboolean retval; 122 retval = cr_server.head_spu->dispatch_table.IsRenderbufferEXT(crStateGetRenderbufferHWID(renderbuffer)); 123 crServerReturnValue( &retval, sizeof(retval) ); 124 return retval; /* WILL PROBABLY BE IGNORED */ 125 } -
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 ) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_get.py
r22155 r31808 100 100 ]; 101 101 102 convert_bufferid = [ 103 'GetVertexAttribdvARB', 104 'GetVertexAttribdvNV', 105 'GetVertexAttribfvARB', 106 'GetVertexAttribfvNV', 107 'GetVertexAttribivARB', 108 'GetVertexAttribivNV' 109 ]; 110 102 111 from get_components import *; 103 112 … … 125 134 126 135 print '\tcr_server.head_spu->dispatch_table.%s( %s );' % ( func_name, apiutil.MakeCallString(params) ) 136 137 if func_name in convert_bufferid: 138 print '\tif (pname==GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB){' 139 print '\t\tlocal_params[0]=(%s)crStateBufferHWIDtoID((GLint)local_params[0]);' % (local_argtype); 140 print '\t}' 141 127 142 if func_name in no_pnames: 128 143 print '\tcrServerReturnValue( &(%s[0]), %d*sizeof(%s) );' % (local_argname, max_components[func_name], local_argtype ); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c
r28800 r31808 104 104 } 105 105 106 GLint SERVER_DISPATCH_APIENTRY crServerDispatchGetAttribLocation( GLuint program, const char * name ) 107 { 108 GLint retval; 109 retval = cr_server.head_spu->dispatch_table.GetAttribLocation(crStateGetProgramHWID(program), name ); 110 crServerReturnValue( &retval, sizeof(retval) ); 111 return retval; /* WILL PROBABLY BE IGNORED */ 112 } 113 114 GLhandleARB SERVER_DISPATCH_APIENTRY crServerDispatchGetHandleARB( GLenum pname ) 115 { 116 GLhandleARB retval; 117 retval = cr_server.head_spu->dispatch_table.GetHandleARB(pname); 118 if (pname==GL_PROGRAM_OBJECT_ARB) 119 { 120 retval = crStateGLSLProgramHWIDtoID(retval); 121 } 122 crServerReturnValue( &retval, sizeof(retval) ); 123 return retval; /* WILL PROBABLY BE IGNORED */ 124 } 125 126 GLint SERVER_DISPATCH_APIENTRY crServerDispatchGetUniformLocation(GLuint program, const char * name) 127 { 128 GLint retval; 129 retval = cr_server.head_spu->dispatch_table.GetUniformLocation(crStateGetProgramHWID(program), name); 130 crServerReturnValue( &retval, sizeof(retval) ); 131 return retval; /* WILL PROBABLY BE IGNORED */ 132 } 133 106 134 #endif /* #ifdef CR_OPENGL_VERSION_2_0 */ -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_lists.c
r27889 r31808 41 41 { 42 42 if (!cr_server.sharedDisplayLists) { 43 int client = cr_server.curClient->number;44 return id + client * 100000;45 }46 return id;47 }48 49 50 GLuint crServerTranslateTextureID( GLuint id )51 {52 if (!cr_server.sharedTextureObjects && id) {53 43 int client = cr_server.curClient->number; 54 44 return id + client * 100000; … … 248 238 void SERVER_DISPATCH_APIENTRY crServerDispatchBindTexture( GLenum target, GLuint texture ) 249 239 { 250 texture = crServerTranslateTextureID( texture );251 240 crStateBindTexture( target, texture ); 252 cr_server.head_spu->dispatch_table.BindTexture( target, texture ); 253 } 254 241 cr_server.head_spu->dispatch_table.BindTexture(target, crStateGetTextureHWID(texture)); 242 } 255 243 256 244 void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteTextures( GLsizei n, const GLuint *textures) 257 245 { 258 if (!cr_server.sharedTextureObjects) { 259 GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint)); 260 GLint i; 261 if (!newTextures) { 262 crError("crServerDispatchDeleteTextures: out of memory"); 263 return; 264 } 265 for (i = 0; i < n; i++) { 266 newTextures[i] = crServerTranslateTextureID( textures[i] ); 267 } 268 crStateDeleteTextures( n, newTextures ); 269 cr_server.head_spu->dispatch_table.DeleteTextures( n, newTextures ); 270 crFree(newTextures); 271 } 272 else { 273 crStateDeleteTextures( n, textures ); 274 cr_server.head_spu->dispatch_table.DeleteTextures( n, textures ); 275 } 246 GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint)); 247 GLint i; 248 249 if (!newTextures) 250 { 251 crError("crServerDispatchDeleteTextures: out of memory"); 252 return; 253 } 254 255 for (i = 0; i < n; i++) 256 { 257 newTextures[i] = crStateGetTextureHWID(textures[i]); 258 } 259 260 crStateDeleteTextures(n, textures); 261 cr_server.head_spu->dispatch_table.DeleteTextures(n, newTextures); 262 crFree(newTextures); 276 263 } 277 264 278 265 void SERVER_DISPATCH_APIENTRY crServerDispatchPrioritizeTextures( GLsizei n, const GLuint * textures, const GLclampf * priorities ) 279 266 { 280 if (!cr_server.sharedTextureObjects) 267 GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint)); 268 GLint i; 269 270 if (!newTextures) 281 271 { 282 GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint)); 283 GLint i; 284 if (!newTextures) { 285 crError("crServerDispatchDeleteTextures: out of memory"); 286 return; 287 } 288 for (i = 0; i < n; i++) { 289 newTextures[i] = crServerTranslateTextureID( textures[i] ); 290 } 291 crStatePrioritizeTextures(n, newTextures, priorities); 292 cr_server.head_spu->dispatch_table.PrioritizeTextures(n, newTextures, priorities); 293 crFree(newTextures); 294 } 295 else 272 crError("crServerDispatchDeleteTextures: out of memory"); 273 return; 274 } 275 276 for (i = 0; i < n; i++) 296 277 { 297 crStatePrioritizeTextures(n, textures, priorities); 298 cr_server.head_spu->dispatch_table.PrioritizeTextures(n, textures, priorities); 299 } 278 newTextures[i] = crStateGetTextureHWID(textures[i]); 279 } 280 281 crStatePrioritizeTextures(n, textures, priorities); 282 cr_server.head_spu->dispatch_table.PrioritizeTextures(n, newTextures, priorities); 283 crFree(newTextures); 300 284 } 301 285 … … 320 304 { 321 305 GLboolean retval; 322 texture = crServerTranslateTextureID( texture ); 323 retval = cr_server.head_spu->dispatch_table.IsTexture( texture ); 306 retval = cr_server.head_spu->dispatch_table.IsTexture(crStateGetTextureHWID(texture)); 324 307 crServerReturnValue( &retval, sizeof(retval) ); 325 308 return retval; /* WILL PROBABLY BE IGNORED */ … … 330 313 { 331 314 GLboolean retval; 332 program = crServerTranslate TextureID(program);315 program = crServerTranslateProgramID(program); 333 316 retval = cr_server.head_spu->dispatch_table.IsProgramARB( program ); 334 317 crServerReturnValue( &retval, sizeof(retval) ); … … 349 332 GLuint *textures2 = (GLuint *) crAlloc(n * sizeof(GLuint)); 350 333 for (i = 0; i < n; i++) 351 textures2[i] = crS erverTranslateTextureID(textures[i]);334 textures2[i] = crStateGetTextureHWID(textures[i]); 352 335 retval = cr_server.head_spu->dispatch_table.AreTexturesResident(n, textures2, res); 353 336 crFree(textures2); 354 }355 else {356 retval = cr_server.head_spu->dispatch_table.AreTexturesResident(n, textures, res);357 337 } 358 338 crServerReturnValue(res, n * sizeof(GLboolean)); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r30440 r31808 793 793 char psz[200]; 794 794 GLint ctxID; 795 CRContext* pContext; 795 796 796 797 rc = SSMR3GetMem(pSSM, &key, sizeof(key)); … … 808 809 ctxID = crServerDispatchCreateContextEx(createInfo.pszDpyName, createInfo.visualBits, 0, key, createInfo.internalID); 809 810 CRASSERT((int64_t)ctxID == (int64_t)key); 811 812 pContext = (CRContext*) crHashtableSearch(cr_server.contextTable, key); 813 CRASSERT(pContext); 814 pContext->shared->id=-1; 810 815 } 811 816 … … 821 826 CRASSERT(pContext); 822 827 823 rc = crStateLoadContext(pContext, pSSM);828 rc = crStateLoadContext(pContext, cr_server.contextTable, pSSM); 824 829 AssertRCReturn(rc, rc); 825 830 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r27889 r31808 216 216 { 217 217 switch (target) { 218 case GL_SHARE_CONTEXT_RESOURCES_CR: 219 crStateShareContext(value); 220 break; 218 221 case GL_SHARED_DISPLAY_LISTS_CR: 219 222 cr_server.sharedDisplayLists = value; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r28800 r31808 229 229 230 230 /*Restore gl state*/ 231 uid = ctx->texture.unit[ctx->texture.curTextureUnit].currentTexture2D-> name;231 uid = ctx->texture.unit[ctx->texture.curTextureUnit].currentTexture2D->hwid; 232 232 cr_server.head_spu->dispatch_table.BindTexture(GL_TEXTURE_2D, uid); 233 233 … … 330 330 cr_server.head_spu->dispatch_table.BindTexture(GL_TEXTURE_2D, mural->idColorTex); 331 331 cr_server.head_spu->dispatch_table.GetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels); 332 uid = ctx->texture.unit[ctx->texture.curTextureUnit].currentTexture2D-> name;332 uid = ctx->texture.unit[ctx->texture.curTextureUnit].currentTexture2D->hwid; 333 333 cr_server.head_spu->dispatch_table.BindTexture(GL_TEXTURE_2D, uid); 334 334 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py
r27889 r31808 61 61 CRASSERT(tablesize/sizeof(%s)==1); 62 62 texid = (GLuint) *get_values; 63 if (texid) 64 { 65 *get_values = (%s) (texid - cr_server.curClient->number * 100000); 66 } 63 *get_values = (%s) crStateTextureHWIDtoID(texid); 67 64 } 68 65 else if (GL_CURRENT_PROGRAM==pname) … … 93 90 *get_values = (%s) crStateRBOHWIDtoID(rbid); 94 91 } 95 """ % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index]) 92 else if (GL_ARRAY_BUFFER_BINDING_ARB==pname 93 || GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB==pname 94 || GL_VERTEX_ARRAY_BUFFER_BINDING_ARB==pname 95 || GL_NORMAL_ARRAY_BUFFER_BINDING_ARB==pname 96 || GL_COLOR_ARRAY_BUFFER_BINDING_ARB==pname 97 || GL_INDEX_ARRAY_BUFFER_BINDING_ARB==pname 98 || GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB==pname 99 || GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB==pname 100 || GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB==pname 101 || GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB==pname 102 || GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB==pname) 103 { 104 GLuint bufid; 105 CRASSERT(tablesize/sizeof(%s)==1); 106 bufid = (GLuint) *get_values; 107 *get_values = (%s) crStateBufferHWIDtoID(bufid); 108 } 109 """ % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index]) 96 110 print '\tcrServerReturnValue( get_values, tablesize );' 97 111 print '\tcrFree(get_values);' -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
r29856 r31808 235 235 TexImage2D 236 236 TexImage3D 237 BindBufferARB 238 IsBufferARB 239 IsFramebufferEXT 240 IsRenderbufferEXT 241 GetAttribLocation 242 GetHandleARB 243 GetUniformLocation
Note:
See TracChangeset
for help on using the changeset viewer.