Changeset 20083 in vbox
- Timestamp:
- May 27, 2009 1:21:13 PM (16 years ago)
- Location:
- trunk/src/VBox/Additions/common/crOpenGL/pack
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/pack/pack.py
r15532 r20083 30 30 static void __fillin( int offset, char *name, SPUGenericFunction func ) 31 31 { 32 33 32 _cr_pack_table[offset].name = crStrdup( name ); 33 _cr_pack_table[offset].fn = func; 34 34 }""" 35 35 … … 37 37 38 38 for func_name in keys: 39 40 41 42 43 39 if ("get" in apiutil.Properties(func_name) or 40 apiutil.FindSpecial( "packspu", func_name ) or 41 apiutil.FindSpecial( "packspu_flush", func_name ) or 42 apiutil.FindSpecial( "packspu_vertex", func_name )): 43 pack_specials.append( func_name ) 44 44 45 45 print '\nvoid packspuCreateFunctions( void )' 46 46 print '{' 47 47 for index in range(len(keys)): 48 49 50 51 52 53 54 48 func_name = keys[index] 49 if apiutil.FindSpecial( "packspu_unimplemented", func_name ): 50 continue 51 if func_name in pack_specials: 52 print '\t__fillin( %3d, "%s", (SPUGenericFunction) packspu_%s );' % (index, func_name, func_name ) 53 else: 54 print '\t__fillin( %3d, "%s", (SPUGenericFunction) (pack_spu.swap ? crPack%sSWAP : crPack%s) );' % (index, func_name, func_name, func_name ) 55 55 print '\t__fillin( %3d, NULL, NULL );' % num_funcs 56 56 print '}' -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py
r15532 r20083 19 19 void PACKSPU_APIENTRY packspu_Begin( GLenum mode ) 20 20 { 21 22 21 GET_THREAD(thread); 22 CRPackBuffer *buf = &thread->BeginEndBuffer; 23 23 24 25 24 /* XXX comparing mode >= 0 here is not needed since mode is unsigned */ 25 CRASSERT( mode >= GL_POINTS && mode <= GL_POLYGON ); 26 26 27 28 29 30 31 32 33 34 27 if (pack_spu.swap) 28 { 29 crPackBeginSWAP( mode ); 30 } 31 else 32 { 33 crPackBegin( mode ); 34 } 35 35 36 37 38 39 40 41 36 if ( thread->netServer.conn->Barf ) { 37 thread->BeginEndMode = mode; 38 thread->BeginEndState = -1; 39 if ( mode == GL_LINES || mode == GL_TRIANGLES || mode == GL_QUADS || mode == GL_POLYGON ) 40 { 41 CRASSERT(!buf->pack); 42 42 43 44 45 46 47 48 43 crPackReleaseBuffer( thread->packer ); 44 buf->pack = crNetAlloc( thread->netServer.conn ); 45 crPackInitBuffer( buf, buf->pack, thread->netServer.conn->buffer_size, thread->netServer.conn->mtu ); 46 buf->holds_BeginEnd = 1; 47 buf->in_BeginEnd = 1; 48 crPackSetBuffer( thread->packer, buf ); 49 49 50 51 52 50 thread->BeginEndState = 0; 51 } 52 } 53 53 } 54 54 55 55 void PACKSPU_APIENTRY packspu_End( void ) 56 56 { 57 58 57 GET_THREAD(thread); 58 CRPackBuffer *buf = &thread->BeginEndBuffer; 59 59 60 61 62 63 64 65 66 60 if ( thread->netServer.conn->Barf && 61 (thread->BeginEndMode == GL_LINES 62 || thread->BeginEndMode == GL_TRIANGLES 63 || thread->BeginEndMode == GL_QUADS 64 || thread->BeginEndMode == GL_POLYGON ) ) 65 { 66 CRASSERT(buf->pack); 67 67 68 69 70 71 68 crPackReleaseBuffer( thread->packer ); 69 crPackSetBuffer( thread->packer, &thread->normBuffer ); 70 if ( !crPackCanHoldBuffer( buf ) ) 71 packspuFlush( (void *) thread ); 72 72 73 74 75 76 73 crPackAppendBuffer( buf ); 74 crNetFree( thread->netServer.conn, buf->pack ); 75 buf->pack = NULL; 76 } 77 77 78 79 80 81 82 83 84 85 78 if (pack_spu.swap) 79 { 80 crPackEndSWAP(); 81 } 82 else 83 { 84 crPackEnd(); 85 } 86 86 } 87 87 88 88 static void DoVertex( void ) 89 89 { 90 91 92 93 94 90 GET_THREAD(thread); 91 CRPackBuffer *buf = &thread->BeginEndBuffer; 92 CRPackBuffer *gbuf = &thread->normBuffer; 93 int num_data; 94 int num_opcode; 95 95 96 97 98 99 100 101 102 103 96 /*crDebug( "really doing Vertex" );*/ 97 crPackReleaseBuffer( thread->packer ); 98 num_data = buf->data_current - buf->data_start; 99 num_opcode = buf->opcode_start - buf->opcode_current; 100 crPackSetBuffer( thread->packer, gbuf ); 101 if ( !crPackCanHoldBuffer( buf ) ) 102 /* doesn't hold, first flush gbuf*/ 103 packspuFlush( (void *) thread ); 104 104 105 106 107 108 105 crPackAppendBuffer( buf ); 106 crPackReleaseBuffer( thread->packer ); 107 crPackSetBuffer( thread->packer, buf ); 108 crPackResetPointers(thread->packer); 109 109 } 110 110 111 111 static void RunState( void ) 112 112 { 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 113 GET_THREAD(thread); 114 if (! thread->netServer.conn->Barf ) return; 115 if (thread->BeginEndState == -1) return; 116 switch(thread->BeginEndMode) { 117 case GL_POLYGON: 118 return; 119 case GL_LINES: 120 thread->BeginEndState = (thread->BeginEndState + 1) % 2; 121 if (thread->BeginEndState) 122 return; 123 break; 124 case GL_TRIANGLES: 125 thread->BeginEndState = (thread->BeginEndState + 1) % 3; 126 if (thread->BeginEndState) 127 return; 128 break; 129 case GL_QUADS: 130 thread->BeginEndState = (thread->BeginEndState + 1) % 4; 131 if (thread->BeginEndState) 132 return; 133 break; 134 } 135 DoVertex(); 136 136 } 137 137 """ … … 140 140 141 141 for func_name in apiutil.AllSpecials( "packspu_vertex" ): 142 143 144 145 146 147 148 149 150 151 152 153 154 142 params = apiutil.Parameters(func_name) 143 print 'void PACKSPU_APIENTRY packspu_%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params) ) 144 print '{' 145 print '\tif (pack_spu.swap)' 146 print '\t{' 147 print '\t\tcrPack%sSWAP( %s );' % ( func_name, apiutil.MakeCallString( params ) ) 148 print '\t}' 149 print '\telse' 150 print '\t{' 151 print '\t\tcrPack%s( %s );' % ( func_name, apiutil.MakeCallString( params ) ) 152 print '\t}' 153 print '\tRunState();' 154 print '}' -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c
r15532 r20083 15 15 packspu_MapBufferARB( GLenum target, GLenum access ) 16 16 { 17 18 19 20 17 GLint size = -1; 18 GET_CONTEXT(ctx); 19 void *buffer; 20 CRBufferObject *bufObj; 21 21 22 22 (void) crStateMapBufferARB( target, access ); 23 23 24 25 26 24 crStateGetBufferParameterivARB(target, GL_BUFFER_SIZE_ARB, &size); 25 if (size <= 0) 26 return NULL; 27 27 28 29 30 31 28 if (crStateGetError()) { 29 /* something may have gone wrong already */ 30 return NULL; 31 } 32 32 33 34 35 36 37 33 /* allocate buffer space */ 34 buffer = crAlloc(size); 35 if (!buffer) { 36 return NULL; 37 } 38 38 39 40 41 42 43 44 45 46 47 39 /* update state tracker info */ 40 if (target == GL_ARRAY_BUFFER_ARB) { 41 bufObj = ctx->clientState->bufferobject.arrayBuffer; 42 } 43 else { 44 CRASSERT(target == GL_ELEMENT_ARRAY_BUFFER_ARB); 45 bufObj = ctx->clientState->bufferobject.elementsBuffer; 46 } 47 bufObj->pointer = buffer; 48 48 49 50 51 52 53 49 /* Get current buffer data from server. 50 * Ideally, if we could detect that the entire buffer was being 51 * rewritten, we wouldn't have to fetch the current data here. 52 */ 53 packspu_GetBufferSubDataARB(target, 0, bufObj->size, buffer); 54 54 55 55 return buffer; 56 56 } 57 57 … … 60 60 packspu_UnmapBufferARB( GLenum target ) 61 61 { 62 63 62 CRBufferObject *bufObj; 63 GET_CONTEXT(ctx); 64 64 65 66 67 68 69 70 71 65 if (target == GL_ARRAY_BUFFER_ARB) { 66 bufObj = ctx->clientState->bufferobject.arrayBuffer; 67 } 68 else { 69 CRASSERT(target == GL_ELEMENT_ARRAY_BUFFER_ARB); 70 bufObj = ctx->clientState->bufferobject.elementsBuffer; 71 } 72 72 73 74 73 /* send new buffer contents to server */ 74 crPackBufferDataARB( target, bufObj->size, bufObj->pointer, bufObj->usage ); 75 75 76 77 76 /* free the buffer / unmap it */ 77 crFree(bufObj->pointer); 78 78 79 79 crStateUnmapBufferARB( target ); 80 80 81 81 return GL_TRUE; 82 82 } 83 83 … … 85 85 void PACKSPU_APIENTRY 86 86 packspu_BufferDataARB( GLenum target, GLsizeiptrARB size, 87 87 const GLvoid * data, GLenum usage ) 88 88 { 89 90 89 crStateBufferDataARB(target, size, data, usage); 90 crPackBufferDataARB(target, size, data, usage); 91 91 } 92 92 … … 95 95 packspu_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) 96 96 { 97 97 crStateGetBufferPointervARB( target, pname, params ); 98 98 } 99 99 … … 102 102 packspu_GetBufferParameterivARB( GLenum target, GLenum pname, GLint * params ) 103 103 { 104 104 crStateGetBufferParameterivARB( target, pname, params ); 105 105 } 106 106 … … 112 112 packspu_BindBufferARB( GLenum target, GLuint buffer ) 113 113 { 114 115 114 crStateBindBufferARB(target, buffer); 115 crPackBindBufferARB(target, buffer); 116 116 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c
r15532 r20083 13 13 { 14 14 #if CR_ARB_vertex_buffer_object 15 16 17 18 19 20 21 22 #endif 23 15 GET_CONTEXT(ctx); 16 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 17 if (pack_spu.swap) 18 crPackFogCoordPointerEXTSWAP( type, stride, pointer ); 19 else 20 crPackFogCoordPointerEXT( type, stride, pointer ); 21 } 22 #endif 23 crStateFogCoordPointerEXT( type, stride, pointer ); 24 24 } 25 25 … … 27 27 { 28 28 #if CR_ARB_vertex_buffer_object 29 30 31 32 33 34 35 36 #endif 37 29 GET_CONTEXT(ctx); 30 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 31 if (pack_spu.swap) 32 crPackColorPointerSWAP( size, type, stride, pointer ); 33 else 34 crPackColorPointer( size, type, stride, pointer ); 35 } 36 #endif 37 crStateColorPointer( size, type, stride, pointer ); 38 38 } 39 39 … … 41 41 { 42 42 #if CR_ARB_vertex_buffer_object 43 44 45 46 47 48 49 50 #endif 51 43 GET_CONTEXT(ctx); 44 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 45 if (pack_spu.swap) 46 crPackSecondaryColorPointerEXTSWAP( size, type, stride, pointer ); 47 else 48 crPackSecondaryColorPointerEXT( size, type, stride, pointer ); 49 } 50 #endif 51 crStateSecondaryColorPointerEXT( size, type, stride, pointer ); 52 52 } 53 53 … … 55 55 { 56 56 #if CR_ARB_vertex_buffer_object 57 58 59 60 61 62 63 64 65 #endif 66 57 GET_CONTEXT(ctx); 58 CRASSERT(ctx->clientState->extensions.ARB_vertex_buffer_object); 59 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 60 if (pack_spu.swap) 61 crPackVertexPointerSWAP( size, type, stride, pointer ); 62 else 63 crPackVertexPointer( size, type, stride, pointer ); 64 } 65 #endif 66 crStateVertexPointer( size, type, stride, pointer ); 67 67 } 68 68 … … 70 70 { 71 71 #if CR_ARB_vertex_buffer_object 72 73 74 75 76 77 78 79 #endif 80 72 GET_CONTEXT(ctx); 73 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 74 if (pack_spu.swap) 75 crPackTexCoordPointerSWAP( size, type, stride, pointer ); 76 else 77 crPackTexCoordPointer( size, type, stride, pointer ); 78 } 79 #endif 80 crStateTexCoordPointer( size, type, stride, pointer ); 81 81 } 82 82 … … 84 84 { 85 85 #if CR_ARB_vertex_buffer_object 86 87 88 89 90 91 92 93 #endif 94 86 GET_CONTEXT(ctx); 87 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 88 if (pack_spu.swap) 89 crPackNormalPointerSWAP( type, stride, pointer ); 90 else 91 crPackNormalPointer( type, stride, pointer ); 92 } 93 #endif 94 crStateNormalPointer( type, stride, pointer ); 95 95 } 96 96 … … 98 98 { 99 99 #if CR_ARB_vertex_buffer_object 100 101 102 103 104 105 106 107 #endif 108 100 GET_CONTEXT(ctx); 101 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 102 if (pack_spu.swap) 103 crPackEdgeFlagPointerSWAP( stride, pointer ); 104 else 105 crPackEdgeFlagPointer( stride, pointer ); 106 } 107 #endif 108 crStateEdgeFlagPointer( stride, pointer ); 109 109 } 110 110 … … 112 112 { 113 113 #if CR_ARB_vertex_buffer_object 114 115 116 117 118 119 120 121 #endif 122 114 GET_CONTEXT(ctx); 115 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 116 if (pack_spu.swap) 117 crPackVertexAttribPointerARBSWAP( index, size, type, normalized, stride, pointer ); 118 else 119 crPackVertexAttribPointerARB( index, size, type, normalized, stride, pointer ); 120 } 121 #endif 122 crStateVertexAttribPointerARB( index, size, type, normalized, stride, pointer ); 123 123 } 124 124 … … 126 126 { 127 127 #if CR_ARB_vertex_buffer_object 128 129 130 131 132 133 134 135 #endif 136 128 GET_CONTEXT(ctx); 129 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 130 if (pack_spu.swap) 131 crPackVertexAttribPointerNVSWAP( index, size, type, stride, pointer ); 132 else 133 crPackVertexAttribPointerNV( index, size, type, stride, pointer ); 134 } 135 #endif 136 crStateVertexAttribPointerNV( index, size, type, stride, pointer ); 137 137 } 138 138 139 139 void PACKSPU_APIENTRY packspu_GetPointerv( GLenum pname, GLvoid **params ) 140 140 { 141 141 crStateGetPointerv( pname, params ); 142 142 } 143 143 … … 145 145 { 146 146 #if CR_ARB_vertex_buffer_object 147 148 149 150 151 152 153 154 #endif 155 147 GET_CONTEXT(ctx); 148 if (ctx->clientState->extensions.ARB_vertex_buffer_object) { 149 if (pack_spu.swap) 150 crPackInterleavedArraysSWAP( format, stride, pointer ); 151 else 152 crPackInterleavedArrays( format, stride, pointer ); 153 } 154 #endif 155 crStateInterleavedArrays( format, stride, pointer ); 156 156 } 157 157 … … 160 160 packspu_ArrayElement( GLint index ) 161 161 { 162 163 164 #if CR_ARB_vertex_buffer_object 165 166 167 168 #endif 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 162 GLboolean serverArrays = GL_FALSE; 163 164 #if CR_ARB_vertex_buffer_object 165 GET_CONTEXT(ctx); 166 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 167 serverArrays = crStateUseServerArrays(); 168 #endif 169 170 if (serverArrays) { 171 /* Send the DrawArrays command over the wire */ 172 if (pack_spu.swap) 173 crPackArrayElementSWAP( index ); 174 else 175 crPackArrayElement( index ); 176 } 177 else { 178 /* evaluate locally */ 179 GET_CONTEXT(ctx); 180 CRClientState *clientState = &(ctx->clientState->client); 181 if (pack_spu.swap) 182 crPackExpandArrayElementSWAP( index, clientState ); 183 else 184 crPackExpandArrayElement( index, clientState ); 185 } 186 186 } 187 187 … … 190 190 packspu_DrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) 191 191 { 192 193 194 #if CR_ARB_vertex_buffer_object 195 196 197 198 #endif 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 192 GLboolean serverArrays = GL_FALSE; 193 194 #if CR_ARB_vertex_buffer_object 195 GET_CONTEXT(ctx); 196 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 197 serverArrays = crStateUseServerArrays(); 198 #endif 199 200 if (serverArrays) { 201 /* Send the DrawArrays command over the wire */ 202 if (pack_spu.swap) 203 crPackDrawElementsSWAP( mode, count, type, indices ); 204 else 205 crPackDrawElements( mode, count, type, indices ); 206 } 207 else { 208 /* evaluate locally */ 209 GET_CONTEXT(ctx); 210 CRClientState *clientState = &(ctx->clientState->client); 211 if (pack_spu.swap) 212 crPackExpandDrawElementsSWAP( mode, count, type, indices, clientState ); 213 else 214 crPackExpandDrawElements( mode, count, type, indices, clientState ); 215 } 216 216 } 217 217 … … 220 220 packspu_DrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) 221 221 { 222 223 224 #if CR_ARB_vertex_buffer_object 225 226 227 228 #endif 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 222 GLboolean serverArrays = GL_FALSE; 223 224 #if CR_ARB_vertex_buffer_object 225 GET_CONTEXT(ctx); 226 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 227 serverArrays = crStateUseServerArrays(); 228 #endif 229 230 if (serverArrays) { 231 /* Send the DrawRangeElements command over the wire */ 232 if (pack_spu.swap) 233 crPackDrawRangeElementsSWAP( mode, start, end, count, type, indices ); 234 else 235 crPackDrawRangeElements( mode, start, end, count, type, indices ); 236 } 237 else { 238 /* evaluate locally */ 239 GET_CONTEXT(ctx); 240 CRClientState *clientState = &(ctx->clientState->client); 241 if (pack_spu.swap) 242 crPackExpandDrawRangeElementsSWAP( mode, start, end, count, type, indices, clientState ); 243 else 244 crPackExpandDrawRangeElements( mode, start, end, count, type, indices, clientState ); 245 } 246 246 } 247 247 … … 250 250 packspu_DrawArrays( GLenum mode, GLint first, GLsizei count ) 251 251 { 252 253 254 #if CR_ARB_vertex_buffer_object 255 256 257 258 #endif 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 252 GLboolean serverArrays = GL_FALSE; 253 254 #if CR_ARB_vertex_buffer_object 255 GET_CONTEXT(ctx); 256 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 257 serverArrays = crStateUseServerArrays(); 258 #endif 259 260 if (serverArrays) { 261 /* Send the DrawArrays command over the wire */ 262 if (pack_spu.swap) 263 crPackDrawArraysSWAP( mode, first, count ); 264 else 265 crPackDrawArrays( mode, first, count ); 266 } 267 else { 268 /* evaluate locally */ 269 GET_CONTEXT(ctx); 270 CRClientState *clientState = &(ctx->clientState->client); 271 if (pack_spu.swap) 272 crPackExpandDrawArraysSWAP( mode, first, count, clientState ); 273 else 274 crPackExpandDrawArrays( mode, first, count, clientState ); 275 } 276 276 } 277 277 … … 280 280 void PACKSPU_APIENTRY packspu_MultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count, GLsizei primcount ) 281 281 { 282 283 284 285 286 287 282 GLint i; 283 for (i = 0; i < primcount; i++) { 284 if (count[i] > 0) { 285 packspu_DrawArrays(mode, first[i], count[i]); 286 } 287 } 288 288 } 289 289 290 290 void PACKSPU_APIENTRY packspu_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount ) 291 291 { 292 293 294 295 296 297 292 GLint i; 293 for (i = 0; i < primcount; i++) { 294 if (count[i] > 0) { 295 packspu_DrawElements(mode, count[i], type, indices[i]); 296 } 297 } 298 298 } 299 299 #endif … … 302 302 void PACKSPU_APIENTRY packspu_EnableClientState( GLenum array ) 303 303 { 304 304 crStateEnableClientState( array ); 305 305 } 306 306 307 307 void PACKSPU_APIENTRY packspu_DisableClientState( GLenum array ) 308 308 { 309 309 crStateDisableClientState( array ); 310 310 } 311 311 312 312 void PACKSPU_APIENTRY packspu_ClientActiveTextureARB( GLenum texUnit ) 313 313 { 314 315 314 crStateClientActiveTextureARB( texUnit ); 315 /* XXX also send to server for texcoord arrays? */ 316 316 } 317 317 … … 319 319 void PACKSPU_APIENTRY packspu_Enable( GLenum cap ) 320 320 { 321 322 323 324 325 326 327 328 329 321 switch (cap) { 322 case GL_VERTEX_ARRAY: 323 case GL_NORMAL_ARRAY: 324 case GL_COLOR_ARRAY: 325 case GL_INDEX_ARRAY: 326 case GL_TEXTURE_COORD_ARRAY: 327 case GL_EDGE_FLAG_ARRAY: 328 case GL_FOG_COORDINATE_ARRAY_EXT: 329 case GL_SECONDARY_COLOR_ARRAY_EXT: 330 330 #if CR_NV_vertex_program 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 331 case GL_VERTEX_ATTRIB_ARRAY0_NV: 332 case GL_VERTEX_ATTRIB_ARRAY1_NV: 333 case GL_VERTEX_ATTRIB_ARRAY2_NV: 334 case GL_VERTEX_ATTRIB_ARRAY3_NV: 335 case GL_VERTEX_ATTRIB_ARRAY4_NV: 336 case GL_VERTEX_ATTRIB_ARRAY5_NV: 337 case GL_VERTEX_ATTRIB_ARRAY6_NV: 338 case GL_VERTEX_ATTRIB_ARRAY7_NV: 339 case GL_VERTEX_ATTRIB_ARRAY8_NV: 340 case GL_VERTEX_ATTRIB_ARRAY9_NV: 341 case GL_VERTEX_ATTRIB_ARRAY10_NV: 342 case GL_VERTEX_ATTRIB_ARRAY11_NV: 343 case GL_VERTEX_ATTRIB_ARRAY12_NV: 344 case GL_VERTEX_ATTRIB_ARRAY13_NV: 345 case GL_VERTEX_ATTRIB_ARRAY14_NV: 346 case GL_VERTEX_ATTRIB_ARRAY15_NV: 347 347 #endif /* CR_NV_vertex_program */ 348 349 350 351 352 353 354 355 356 357 348 crStateEnableClientState(cap); 349 break; 350 default: 351 ; 352 } 353 354 if (pack_spu.swap) 355 crPackEnableSWAP(cap); 356 else 357 crPackEnable(cap); 358 358 } 359 359 … … 361 361 void PACKSPU_APIENTRY packspu_Disable( GLenum cap ) 362 362 { 363 364 365 366 367 368 369 370 371 363 switch (cap) { 364 case GL_VERTEX_ARRAY: 365 case GL_NORMAL_ARRAY: 366 case GL_COLOR_ARRAY: 367 case GL_INDEX_ARRAY: 368 case GL_TEXTURE_COORD_ARRAY: 369 case GL_EDGE_FLAG_ARRAY: 370 case GL_FOG_COORDINATE_ARRAY_EXT: 371 case GL_SECONDARY_COLOR_ARRAY_EXT: 372 372 #if CR_NV_vertex_program 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 373 case GL_VERTEX_ATTRIB_ARRAY0_NV: 374 case GL_VERTEX_ATTRIB_ARRAY1_NV: 375 case GL_VERTEX_ATTRIB_ARRAY2_NV: 376 case GL_VERTEX_ATTRIB_ARRAY3_NV: 377 case GL_VERTEX_ATTRIB_ARRAY4_NV: 378 case GL_VERTEX_ATTRIB_ARRAY5_NV: 379 case GL_VERTEX_ATTRIB_ARRAY6_NV: 380 case GL_VERTEX_ATTRIB_ARRAY7_NV: 381 case GL_VERTEX_ATTRIB_ARRAY8_NV: 382 case GL_VERTEX_ATTRIB_ARRAY9_NV: 383 case GL_VERTEX_ATTRIB_ARRAY10_NV: 384 case GL_VERTEX_ATTRIB_ARRAY11_NV: 385 case GL_VERTEX_ATTRIB_ARRAY12_NV: 386 case GL_VERTEX_ATTRIB_ARRAY13_NV: 387 case GL_VERTEX_ATTRIB_ARRAY14_NV: 388 case GL_VERTEX_ATTRIB_ARRAY15_NV: 389 389 #endif /* CR_NV_vertex_program */ 390 391 392 393 394 395 396 397 398 399 390 crStateDisableClientState(cap); 391 break; 392 default: 393 ; 394 } 395 396 if (pack_spu.swap) 397 crPackDisableSWAP(cap); 398 else 399 crPackDisable(cap); 400 400 } 401 401 … … 403 403 void PACKSPU_APIENTRY packspu_PushClientAttrib( GLbitfield mask ) 404 404 { 405 405 crStatePushClientAttrib(mask); 406 406 } 407 407 408 408 void PACKSPU_APIENTRY packspu_PopClientAttrib( void ) 409 409 { 410 411 } 410 crStatePopClientAttrib(); 411 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py
r15532 r20083 26 26 27 27 for func_name in apiutil.AllSpecials( "packspu_flush" ): 28 29 30 31 32 33 34 35 36 37 38 39 40 41 28 params = apiutil.Parameters(func_name) 29 print 'void PACKSPU_APIENTRY packspu_%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params)) 30 print '{' 31 print '\tGET_THREAD(thread);' 32 print '\tif (pack_spu.swap)' 33 print '\t{' 34 print '\t\tcrPack%sSWAP( %s );' % ( func_name, apiutil.MakeCallString( params ) ) 35 print '\t}' 36 print '\telse' 37 print '\t{' 38 print '\t\tcrPack%s( %s );' % ( func_name, apiutil.MakeCallString( params ) ) 39 print '\t}' 40 print '\tpackspuFlush( (void *) thread );' 41 print '}\n' -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
r15532 r20083 23 23 24 24 easy_swaps = { 25 26 27 25 'GenTextures': '(unsigned int) n', 26 'GetClipPlane': '4', 27 'GetPolygonStipple': '0' 28 28 } 29 29 30 30 simple_funcs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ] 31 31 simple_swaps = [ 'SWAP32', 'SWAPFLOAT', 'SWAPDOUBLE', '(GLboolean) SWAP32' ] 32 32 33 33 hard_funcs = { 34 35 36 37 38 39 40 41 42 43 44 45 46 34 'GetLightfv': 'SWAPFLOAT', 35 'GetLightiv': 'SWAP32', 36 'GetMaterialfv': 'SWAPFLOAT', 37 'GetMaterialiv': 'SWAP32', 38 'GetTexEnvfv': 'SWAPFLOAT', 39 'GetTexEnviv': 'SWAP32', 40 'GetTexGendv': 'SWAPDOUBLE', 41 'GetTexGenfv': 'SWAPFLOAT', 42 'GetTexGeniv': 'SWAP32', 43 'GetTexLevelParameterfv': 'SWAPFLOAT', 44 'GetTexLevelParameteriv': 'SWAP32', 45 'GetTexParameterfv': 'SWAPFLOAT', 46 'GetTexParameteriv': 'SWAP32' } 47 47 48 48 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 49 49 50 50 for func_name in keys: 51 52 53 54 51 params = apiutil.Parameters(func_name) 52 return_type = apiutil.ReturnType(func_name) 53 if apiutil.FindSpecial( "packspu", func_name ): 54 continue 55 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 56 if "get" in apiutil.Properties(func_name): 57 print '%s PACKSPU_APIENTRY packspu_%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString( params ) ) 58 print '{' 59 print '\tGET_THREAD(thread);' 60 print '\tint writeback = 1;' 61 if return_type != 'void': 62 print '\t%s return_val = (%s) 0;' % (return_type, return_type) 63 params.append( ("&return_val", "foo", 0) ) 64 if (func_name in easy_swaps.keys() and easy_swaps[func_name] != '0') or func_name in simple_funcs or func_name in hard_funcs.keys(): 65 print '\tunsigned int i;' 66 print '\tif (!(pack_spu.thread[0].netServer.conn->actual_network))' 67 print '\t{' 68 print '\t\tcrError( "packspu_%s doesn\'t work when there\'s no actual network involved!\\nTry using the simplequery SPU in your chain!" );' % func_name 69 print '\t}' 70 if func_name in simple_funcs: 71 print '\tif (pname == GL_UNPACK_ALIGNMENT ||' 72 print '\t\tpname == GL_UNPACK_ROW_LENGTH ||' 73 print '\t\tpname == GL_UNPACK_SKIP_PIXELS ||' 74 print '\t\tpname == GL_UNPACK_LSB_FIRST ||' 75 print '\t\tpname == GL_UNPACK_SWAP_BYTES ||' 76 print '#ifdef CR_OPENGL_VERSION_1_2' 77 print '\t\tpname == GL_UNPACK_IMAGE_HEIGHT ||' 78 print '#endif' 79 print '\t\tpname == GL_UNPACK_SKIP_ROWS ||' 80 print '\t\tpname == GL_PACK_ALIGNMENT ||' 81 print '\t\tpname == GL_PACK_ROW_LENGTH ||' 82 print '\t\tpname == GL_PACK_SKIP_PIXELS ||' 83 print '\t\tpname == GL_PACK_LSB_FIRST ||' 84 print '\t\tpname == GL_PACK_SWAP_BYTES ||' 85 print '#ifdef CR_OPENGL_VERSION_1_2' 86 print '\t\tpname == GL_PACK_IMAGE_HEIGHT ||' 87 print '#endif' 88 print '\t\tpname == GL_PACK_SKIP_ROWS) {' 89 print '\t\t\tcrState%s( pname, params );' % func_name 90 print '\t\t\treturn;' 91 print '\t}' 92 params.append( ("&writeback", "foo", 0) ) 93 print '\tif (pack_spu.swap)' 94 print '\t{' 95 print '\t\tcrPack%sSWAP( %s );' % (func_name, apiutil.MakeCallString( params ) ) 96 print '\t}' 97 print '\telse' 98 print '\t{' 99 print '\t\tcrPack%s( %s );' % (func_name, apiutil.MakeCallString( params ) ) 100 print '\t}' 101 print '\tpackspuFlush( (void *) thread );' 102 print '\twhile (writeback)' 103 print '\t\tcrNetRecv();' 104 lastParamName = params[-2][0] 105 if return_type != 'void': 106 print '\tif (pack_spu.swap)' 107 print '\t{' 108 print '\t\treturn_val = (%s) SWAP32(return_val);' % return_type 109 print '\t}' 110 print '\treturn return_val;' 111 if func_name in easy_swaps.keys() and easy_swaps[func_name] != '0': 112 limit = easy_swaps[func_name] 113 print '\tif (pack_spu.swap)' 114 print '\t{' 115 print '\t\tfor (i = 0 ; i < %s ; i++)' % limit 116 print '\t\t{' 117 if params[-2][1].find( "double" ) > -1: 118 print '\t\t\t%s[i] = SWAPDOUBLE(%s[i]);' % (lastParamName, lastParamName) 119 else: 120 print '\t\t\t%s[i] = SWAP32(%s[i]);' % (lastParamName, lastParamName) 121 print '\t\t}' 122 print '\t}' 123 for index in range(len(simple_funcs)): 124 if simple_funcs[index] == func_name: 125 print '\tif (pack_spu.swap)' 126 print '\t{' 127 print '\t\tfor (i = 0 ; i < __numValues( pname ) ; i++)' 128 print '\t\t{' 129 if simple_swaps[index] == 'SWAPDOUBLE': 130 print '\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName) 131 else: 132 print '\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName) 133 print '\t\t}' 134 print '\t}' 135 if func_name in hard_funcs.keys(): 136 print '\tif (pack_spu.swap)' 137 print '\t{' 138 print '\t\tfor (i = 0 ; i < lookupComponents(pname) ; i++)' 139 print '\t\t{' 140 if hard_funcs[func_name] == 'SWAPDOUBLE': 141 print '\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName) 142 else: 143 print '\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName) 144 print '\t\t}' 145 print '\t}' 146 print '}\n' -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c
r15532 r20083 14 14 GetExtensions(void) 15 15 { 16 17 18 19 16 GLubyte return_value[10*1000]; 17 const GLubyte *extensions, *ext; 18 GET_THREAD(thread); 19 int writeback = 1; 20 20 21 22 23 24 25 26 27 28 29 21 if (pack_spu.swap) 22 { 23 crPackGetStringSWAP( GL_EXTENSIONS, return_value, &writeback ); 24 } 25 else 26 { 27 crPackGetString( GL_EXTENSIONS, return_value, &writeback ); 28 } 29 packspuFlush( (void *) thread ); 30 30 31 32 31 while (writeback) 32 crNetRecv(); 33 33 34 34 CRASSERT(crStrlen((char *)return_value) < 10*1000); 35 35 36 37 38 39 40 41 36 /* OK, we got the result from the server. Now we have to 37 * intersect is with the set of extensions that Chromium understands 38 * and tack on the Chromium-specific extensions. 39 */ 40 extensions = return_value; 41 ext = crStateMergeExtensions(1, &extensions); 42 42 43 43 return ext; /* XXX we should return a static string here! */ 44 44 } 45 45 … … 48 48 GetVersionString(void) 49 49 { 50 51 52 53 50 GLubyte return_value[100]; 51 GET_THREAD(thread); 52 int writeback = 1; 53 GLfloat version; 54 54 55 56 57 58 59 55 if (pack_spu.swap) 56 crPackGetStringSWAP( GL_VERSION, return_value, &writeback ); 57 else 58 crPackGetString( GL_VERSION, return_value, &writeback ); 59 packspuFlush( (void *) thread ); 60 60 61 62 61 while (writeback) 62 crNetRecv(); 63 63 64 64 CRASSERT(crStrlen((char *)return_value) < 100); 65 65 66 67 66 version = crStrToFloat((char *) return_value); 67 version = crStateComputeVersion(version); 68 68 69 69 return version; 70 70 } 71 71 … … 73 73 const GLubyte * PACKSPU_APIENTRY packspu_GetString( GLenum name ) 74 74 { 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 75 GET_CONTEXT(ctx); 76 if (name == GL_EXTENSIONS) 77 { 78 return GetExtensions(); 79 } 80 else if (name == GL_VERSION) 81 { 82 float version = GetVersionString(); 83 sprintf(ctx->glVersion, "%g Chromium %s", version, CR_VERSION_STRING); 84 return (const GLubyte *) ctx->glVersion; 85 } 86 else 87 { 88 return crStateGetString(name); 89 } 90 90 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
r15532 r20083 15 15 16 16 SPUFunctions pack_functions = { 17 18 19 17 NULL, /* CHILD COPY */ 18 NULL, /* DATA */ 19 _cr_pack_table /* THE ACTUAL FUNCTIONS */ 20 20 }; 21 21 … … 29 29 static SPUFunctions * 30 30 packSPUInit( int id, SPU *child, SPU *self, 31 32 31 unsigned int context_id, 32 unsigned int num_contexts ) 33 33 { 34 34 ThreadInfo *thread; 35 35 36 37 38 39 36 (void) context_id; 37 (void) num_contexts; 38 (void) child; 39 (void) self; 40 40 41 41 #ifdef CHROMIUM_THREADSAFE 42 42 crInitMutex(&_PackMutex); 43 43 #endif 44 44 45 45 pack_spu.id = id; 46 46 47 47 packspuSetVBoxConfiguration( child ); 48 48 49 50 49 /* This connects to the server, sets up the packer, etc. */ 50 thread = packspuNewThread( crThreadID() ); 51 51 52 53 54 55 52 if (!thread) { 53 return NULL; 54 } 55 CRASSERT( thread == &(pack_spu.thread[0]) ); 56 56 57 58 57 packspuCreateFunctions(); 58 crStateInit(); 59 59 60 60 return &pack_functions; 61 61 } 62 62 … … 64 64 packSPUSelfDispatch(SPUDispatchTable *self) 65 65 { 66 66 (void)self; 67 67 } 68 68 … … 70 70 packSPUCleanup(void) 71 71 { 72 72 return 1; 73 73 } 74 74 … … 76 76 77 77 int SPULoad( char **name, char **super, SPUInitFuncPtr *init, 78 79 78 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, 79 SPUOptionsPtr *options, int *flags ) 80 80 { 81 82 83 84 85 86 87 81 *name = "pack"; 82 *super = NULL; 83 *init = packSPUInit; 84 *self = packSPUSelfDispatch; 85 *cleanup = packSPUCleanup; 86 *options = packSPUOptions; 87 *flags = (SPU_HAS_PACKER|SPU_IS_TERMINAL|SPU_MAX_SERVERS_ONE); 88 88 89 89 return 1; 90 90 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
r15532 r20083 12 12 { 13 13 14 15 16 17 14 CRMessage msg; 15 int len; 16 17 GET_THREAD(thread); 18 18 19 20 21 22 23 24 19 20 switch(target) 21 { 22 case GL_GATHER_PACK_CR: 23 /* flush the current pack buffer */ 24 packspuFlush( (void *) thread ); 25 25 26 27 28 29 30 31 32 33 34 35 36 37 38 26 /* the connection is thread->server.conn */ 27 msg.header.type = CR_MESSAGE_GATHER; 28 msg.gather.offset = 69; 29 len = sizeof(CRMessageGather); 30 crNetSend(thread->netServer.conn, NULL, &msg, len); 31 break; 32 33 default: 34 if (pack_spu.swap) 35 crPackChromiumParametervCRSWAP(target, type, count, values); 36 else 37 crPackChromiumParametervCR(target, type, count, values); 38 } 39 39 40 40 … … 43 43 void PACKSPU_APIENTRY packspu_Finish( void ) 44 44 { 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 45 GET_THREAD(thread); 46 GLint writeback = pack_spu.thread[0].netServer.conn->actual_network; 47 if (pack_spu.swap) 48 { 49 crPackFinishSWAP( ); 50 if (writeback) 51 crPackWritebackSWAP( &writeback ); 52 } 53 else 54 { 55 crPackFinish( ); 56 if (writeback) 57 crPackWriteback( &writeback ); 58 } 59 packspuFlush( (void *) thread ); 60 while (writeback) 61 crNetRecv(); 62 62 } 63 63 … … 65 65 GLint PACKSPU_APIENTRY packspu_WindowCreate( const char *dpyName, GLint visBits ) 66 66 { 67 68 69 67 static int num_calls = 0; 68 int writeback = pack_spu.thread[0].netServer.conn->actual_network; 69 GLint return_val = (GLint) 0; 70 70 71 72 73 74 75 71 /* WindowCreate is special - just like CreateContext. 72 * GET_THREAD(thread) doesn't work as the thread won't have called 73 * MakeCurrent yet, so we've got to use the first thread's packer 74 * buffer. 75 */ 76 76 77 77 crPackSetContext( pack_spu.thread[0].packer ); 78 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 79 if (pack_spu.swap) 80 { 81 crPackWindowCreateSWAP( dpyName, visBits, &return_val, &writeback ); 82 } 83 else 84 { 85 crPackWindowCreate( dpyName, visBits, &return_val, &writeback ); 86 } 87 packspuFlush( &pack_spu.thread[0] ); 88 if (!(pack_spu.thread[0].netServer.conn->actual_network)) 89 { 90 return num_calls++; 91 } 92 else 93 { 94 while (writeback) 95 crNetRecv(); 96 if (pack_spu.swap) 97 { 98 return_val = (GLint) SWAP32(return_val); 99 } 100 return return_val; 101 } 102 102 } 103 103 … … 106 106 GLboolean PACKSPU_APIENTRY 107 107 packspu_AreTexturesResident( GLsizei n, const GLuint * textures, 108 108 GLboolean * residences ) 109 109 { 110 111 112 113 110 GET_THREAD(thread); 111 int writeback = 1; 112 GLboolean return_val = GL_TRUE; 113 GLsizei i; 114 114 115 116 117 118 115 if (!(pack_spu.thread[0].netServer.conn->actual_network)) 116 { 117 crError( "packspu_AreTexturesResident doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 118 } 119 119 120 121 122 123 124 125 126 127 128 120 if (pack_spu.swap) 121 { 122 crPackAreTexturesResidentSWAP( n, textures, residences, &return_val, &writeback ); 123 } 124 else 125 { 126 crPackAreTexturesResident( n, textures, residences, &return_val, &writeback ); 127 } 128 packspuFlush( (void *) thread ); 129 129 130 131 130 while (writeback) 131 crNetRecv(); 132 132 133 134 135 136 137 138 139 140 141 133 /* Since the Chromium packer/unpacker can't return both 'residences' 134 * and the function's return value, compute the return value here. 135 */ 136 for (i = 0; i < n; i++) { 137 if (!residences[i]) { 138 return_val = GL_FALSE; 139 break; 140 } 141 } 142 142 143 143 return return_val; 144 144 } 145 145 … … 147 147 GLboolean PACKSPU_APIENTRY 148 148 packspu_AreProgramsResidentNV( GLsizei n, const GLuint * ids, 149 149 GLboolean * residences ) 150 150 { 151 152 153 154 151 GET_THREAD(thread); 152 int writeback = 1; 153 GLboolean return_val = GL_TRUE; 154 GLsizei i; 155 155 156 157 158 159 160 161 162 163 164 165 166 167 168 156 if (!(pack_spu.thread[0].netServer.conn->actual_network)) 157 { 158 crError( "packspu_AreProgramsResidentNV doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 159 } 160 if (pack_spu.swap) 161 { 162 crPackAreProgramsResidentNVSWAP( n, ids, residences, &return_val, &writeback ); 163 } 164 else 165 { 166 crPackAreProgramsResidentNV( n, ids, residences, &return_val, &writeback ); 167 } 168 packspuFlush( (void *) thread ); 169 169 170 171 170 while (writeback) 171 crNetRecv(); 172 172 173 174 175 176 177 178 179 180 181 173 /* Since the Chromium packer/unpacker can't return both 'residences' 174 * and the function's return value, compute the return value here. 175 */ 176 for (i = 0; i < n; i++) { 177 if (!residences[i]) { 178 return_val = GL_FALSE; 179 break; 180 } 181 } 182 182 183 183 return return_val; 184 184 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c
r15532 r20083 3 3 4 4 See the file LICENSE.txt for information on redistributing this software. */ 5 5 6 6 #include "cr_packfunctions.h" 7 7 #include "cr_glstate.h" … … 13 13 void PACKSPU_APIENTRY packspu_PixelStoref( GLenum pname, GLfloat param ) 14 14 { 15 16 17 18 19 20 15 /* NOTE: we do not send pixel store parameters to the server! 16 * When we pack a glDrawPixels or glTexImage2D image we interpret 17 * the user's pixel store parameters at that time and pack the 18 * image in a canonical layout (see util/pixel.c). 19 */ 20 crStatePixelStoref( pname, param ); 21 21 } 22 22 23 23 void PACKSPU_APIENTRY packspu_PixelStorei( GLenum pname, GLint param ) 24 24 { 25 25 crStatePixelStorei( pname, param ); 26 26 } 27 27 28 28 void PACKSPU_APIENTRY packspu_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) 29 29 { 30 31 32 33 34 35 36 30 GET_THREAD(thread); 31 ContextInfo *ctx = thread->currentContext; 32 CRClientState *clientState = &(ctx->clientState->client); 33 if (pack_spu.swap) 34 crPackDrawPixelsSWAP( width, height, format, type, pixels, &(clientState->unpack) ); 35 else 36 crPackDrawPixels( width, height, format, type, pixels, &(clientState->unpack) ); 37 37 } 38 38 39 39 void PACKSPU_APIENTRY packspu_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) 40 40 { 41 42 43 44 45 46 47 48 49 50 51 52 53 54 41 GET_THREAD(thread); 42 ContextInfo *ctx = thread->currentContext; 43 CRClientState *clientState = &(ctx->clientState->client); 44 int writeback; 45 pack_spu.ReadPixels++; 46 if (pack_spu.swap) 47 crPackReadPixelsSWAP( x, y, width, height, format, type, pixels, 48 &(clientState->pack), &writeback ); 49 else 50 crPackReadPixels( x, y, width, height, format, type, pixels, 51 &(clientState->pack), &writeback ); 52 packspuFlush( (void *) thread ); 53 while (pack_spu.ReadPixels) 54 crNetRecv(); 55 55 } 56 56 57 57 void PACKSPU_APIENTRY packspu_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) 58 58 { 59 60 61 62 63 64 65 59 GET_THREAD(thread); 60 if (pack_spu.swap) 61 crPackCopyPixelsSWAP( x, y, width, height, type ); 62 else 63 crPackCopyPixels( x, y, width, height, type ); 64 /* XXX why flush here? */ 65 packspuFlush( (void *) thread ); 66 66 } 67 67 68 68 void PACKSPU_APIENTRY packspu_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ) 69 69 { 70 71 72 73 74 75 70 GET_CONTEXT(ctx); 71 CRClientState *clientState = &(ctx->clientState->client); 72 if (pack_spu.swap) 73 crPackBitmapSWAP( width, height, xorig, yorig, xmove, ymove, bitmap, &(clientState->unpack) ); 74 else 75 crPackBitmap( width, height, xorig, yorig, xmove, ymove, bitmap, &(clientState->unpack) ); 76 76 } 77 77 78 78 void PACKSPU_APIENTRY packspu_TexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) 79 79 { 80 81 82 83 84 85 80 GET_CONTEXT(ctx); 81 CRClientState *clientState = &(ctx->clientState->client); 82 if (pack_spu.swap) 83 crPackTexImage1DSWAP( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) ); 84 else 85 crPackTexImage1D( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) ); 86 86 } 87 87 88 88 void PACKSPU_APIENTRY packspu_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) 89 89 { 90 91 92 93 94 95 90 GET_CONTEXT(ctx); 91 CRClientState *clientState = &(ctx->clientState->client); 92 if (pack_spu.swap) 93 crPackTexImage2DSWAP( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) ); 94 else 95 crPackTexImage2D( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) ); 96 96 } 97 97 … … 99 99 void PACKSPU_APIENTRY packspu_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) 100 100 { 101 102 103 104 105 106 101 GET_CONTEXT(ctx); 102 CRClientState *clientState = &(ctx->clientState->client); 103 if (pack_spu.swap) 104 crPackTexImage3DEXTSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) ); 105 else 106 crPackTexImage3DEXT( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) ); 107 107 } 108 108 #endif … … 111 111 void PACKSPU_APIENTRY packspu_TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) 112 112 { 113 114 115 116 117 118 113 GET_CONTEXT(ctx); 114 CRClientState *clientState = &(ctx->clientState->client); 115 if (pack_spu.swap) 116 crPackTexImage3DSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) ); 117 else 118 crPackTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) ); 119 119 } 120 120 #endif /* CR_OPENGL_VERSION_1_2 */ … … 122 122 void PACKSPU_APIENTRY packspu_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels ) 123 123 { 124 125 126 127 128 129 124 GET_CONTEXT(ctx); 125 CRClientState *clientState = &(ctx->clientState->client); 126 if (pack_spu.swap) 127 crPackTexSubImage1DSWAP( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) ); 128 else 129 crPackTexSubImage1D( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) ); 130 130 } 131 131 132 132 void PACKSPU_APIENTRY packspu_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) 133 133 { 134 135 136 137 138 139 134 GET_CONTEXT(ctx); 135 CRClientState *clientState = &(ctx->clientState->client); 136 if (pack_spu.swap) 137 crPackTexSubImage2DSWAP( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) ); 138 else 139 crPackTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) ); 140 140 } 141 141 … … 143 143 void PACKSPU_APIENTRY packspu_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels ) 144 144 { 145 146 147 148 149 150 145 GET_CONTEXT(ctx); 146 CRClientState *clientState = &(ctx->clientState->client); 147 if (pack_spu.swap) 148 crPackTexSubImage3DSWAP( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) ); 149 else 150 crPackTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) ); 151 151 } 152 152 #endif /* CR_OPENGL_VERSION_1_2 */ … … 154 154 void PACKSPU_APIENTRY packspu_ZPixCR( GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum ztype, GLint zparm, GLint length, const GLvoid *pixels ) 155 155 { 156 157 158 159 160 161 156 GET_CONTEXT(ctx); 157 CRClientState *clientState = &(ctx->clientState->client); 158 if (pack_spu.swap) 159 crPackZPixCRSWAP( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) ); 160 else 161 crPackZPixCR( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) ); 162 162 } 163 163 164 164 void PACKSPU_APIENTRY packspu_GetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels) 165 165 { 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 166 GET_THREAD(thread); 167 ContextInfo *ctx = thread->currentContext; 168 CRClientState *clientState = &(ctx->clientState->client); 169 int writeback = 1; 170 /* XXX note: we're not observing the pixel pack parameters here. 171 * To do so, we'd have to allocate a temporary image buffer (how large???) 172 * and copy the image to the user's buffer using the pixel pack params. 173 */ 174 if (pack_spu.swap) 175 crPackGetTexImageSWAP( target, level, format, type, pixels, &(clientState->pack), &writeback ); 176 else 177 crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback ); 178 packspuFlush( (void *) thread ); 179 while (writeback) 180 crNetRecv(); 181 181 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_proto.py
r15532 r20083 30 30 # make list of special functions 31 31 for func_name in keys: 32 33 34 35 36 32 if ("get" in apiutil.Properties(func_name) or 33 apiutil.FindSpecial( "packspu", func_name ) or 34 apiutil.FindSpecial( "packspu_flush", func_name ) or 35 apiutil.FindSpecial( "packspu_vertex", func_name )): 36 pack_specials.append( func_name ) 37 37 38 38 for func_name in keys: 39 40 41 42 43 44 39 if apiutil.FindSpecial( "packspu_unimplemented", func_name ): 40 continue 41 if func_name in pack_specials: 42 return_type = apiutil.ReturnType(func_name) 43 params = apiutil.Parameters(func_name) 44 print 'extern %s PACKSPU_APIENTRY packspu_%s( %s );' % ( return_type, func_name, apiutil.MakeDeclarationString(params) ) 45 45 46 46 -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_swapbuf.c
r15532 r20083 15 15 void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags ) 16 16 { 17 18 19 20 21 22 23 24 25 26 17 GET_THREAD(thread); 18 if (pack_spu.swap) 19 { 20 crPackSwapBuffersSWAP( window, flags ); 21 } 22 else 23 { 24 crPackSwapBuffers( window, flags ); 25 } 26 packspuFlush( (void *) thread ); 27 27 } 28 28 … … 32 32 void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags ) 33 33 { 34 34 GET_THREAD(thread); 35 35 36 37 38 39 40 41 42 43 44 36 if (pack_spu.swap) 37 { 38 crPackSwapBuffersSWAP( window, flags ); 39 } 40 else 41 { 42 crPackSwapBuffers( window, flags ); 43 } 44 packspuFlush( (void *) thread ); 45 45 46 47 48 49 50 46 if (!(thread->netServer.conn->actual_network)) 47 { 48 /* no synchronization needed */ 49 return; 50 } 51 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 52 if (pack_spu.swapbuffer_sync) { 53 /* This won't block unless there has been more than 1 frame 54 * since we received a writeback acknowledgement. In the 55 * normal case there's no performance penalty for doing this 56 * (beyond the cost of packing the writeback request into the 57 * stream and receiving the reply), but it eliminates the 58 * problem of runaway rendering that can occur, eg when 59 * rendering frames consisting of a single large display list 60 * in a tight loop. 61 * 62 * Note that this is *not* the same as doing a sync after each 63 * swapbuffers, which would force a round-trip 'bubble' into 64 * the network stream under normal conditions. 65 * 66 * This is complicated because writeback in the pack spu is 67 * overriden to always set the value to zero when the 68 * reply is received, rather than decrementing it: 69 */ 70 switch( thread->writeback ) { 71 case 0: 72 /* Request writeback. 73 */ 74 thread->writeback = 1; 75 if (pack_spu.swap) 76 { 77 crPackWritebackSWAP( (GLint *) &thread->writeback ); 78 } 79 else 80 { 81 crPackWriteback( (GLint *) &thread->writeback ); 82 } 83 break; 84 case 1: 85 /* Make sure writeback from previous frame has been received. 86 */ 87 while (thread->writeback) 88 { 89 crNetRecv(); 90 } 91 break; 92 } 93 } 94 94 95 96 97 98 99 100 101 102 95 /* want to emit a parameteri here */ 96 if (pack_spu.emit_GATHER_POST_SWAPBUFFERS) 97 { 98 if (pack_spu.swap) 99 crPackChromiumParameteriCRSWAP(GL_GATHER_POST_SWAPBUFFERS_CR, 1); 100 else 101 crPackChromiumParameteriCR(GL_GATHER_POST_SWAPBUFFERS_CR, 1); 102 } 103 103 } 104 104
Note:
See TracChangeset
for help on using the changeset viewer.