Changeset 27091 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Mar 5, 2010 2:13:31 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/common/crOpenGL/pack
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c
r21382 r27091 11 11 #include "packspu_proto.h" 12 12 13 static void packspu_GetHostBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data ) 14 { 15 GET_THREAD(thread); 16 int writeback = 1; 17 18 crPackGetBufferSubDataARB(target, offset, size, data, &writeback); 19 20 packspuFlush((void *) thread); 21 22 while (writeback) 23 crNetRecv(); 24 } 13 25 14 26 void * PACKSPU_APIENTRY … … 17 29 GET_CONTEXT(ctx); 18 30 void *buffer; 19 #if 0 20 CRBufferObject *bufObj; 21 GLint size = -1; 31 CRBufferObject *pBufObj; 22 32 23 (void) crStateMapBufferARB( target, access ); 33 CRASSERT(GL_TRUE == ctx->clientState->bufferobject.retainBufferData); 34 buffer = crStateMapBufferARB(target, access); 24 35 25 crStateGetBufferParameterivARB(target, GL_BUFFER_SIZE_ARB, &size); 26 if (size <= 0) 27 return NULL; 36 #ifdef CR_ARB_pixel_buffer_object 37 if (buffer) 38 { 39 pBufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject); 40 CRASSERT(pBufObj); 28 41 29 if (crStateGetError()) { 30 /* something may have gone wrong already */ 31 return NULL; 42 if (pBufObj->bResyncOnRead && 43 access != GL_WRITE_ONLY_ARB) 44 { 45 /*fetch data from host side*/ 46 packspu_GetHostBufferSubDataARB(target, 0, pBufObj->size, buffer); 47 } 32 48 } 33 34 /* allocate buffer space */35 buffer = crAlloc(size);36 if (!buffer) {37 return NULL;38 }39 40 /* update state tracker info */41 if (target == GL_ARRAY_BUFFER_ARB) {42 bufObj = ctx->clientState->bufferobject.arrayBuffer;43 }44 else {45 CRASSERT(target == GL_ELEMENT_ARRAY_BUFFER_ARB);46 bufObj = ctx->clientState->bufferobject.elementsBuffer;47 }48 bufObj->pointer = buffer;49 50 /* Get current buffer data from server.51 * Ideally, if we could detect that the entire buffer was being52 * rewritten, we wouldn't have to fetch the current data here.53 */54 packspu_GetBufferSubDataARB(target, 0, bufObj->size, buffer);55 #else56 CRASSERT(GL_TRUE == ctx->clientState->bufferobject.retainBufferData);57 buffer = crStateMapBufferARB(target, access);58 49 #endif 59 50 … … 63 54 void PACKSPU_APIENTRY packspu_GetBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data ) 64 55 { 56 GET_CONTEXT(ctx); 57 58 #ifdef CR_ARB_pixel_buffer_object 59 CRBufferObject *pBufObj; 60 61 pBufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject); 62 63 if (pBufObj && pBufObj->bResyncOnRead) 64 { 65 packspu_GetHostBufferSubDataARB(target, offset, size, data); 66 return; 67 } 68 #endif 69 65 70 crStateGetBufferSubDataARB(target, offset, size, data); 66 71 } … … 75 80 CRBufferObject *bufObj; 76 81 77 if (target == GL_ARRAY_BUFFER_ARB) { 78 bufObj = ctx->clientState->bufferobject.arrayBuffer; 79 } 80 else { 81 CRASSERT(target == GL_ELEMENT_ARRAY_BUFFER_ARB); 82 bufObj = ctx->clientState->bufferobject.elementsBuffer; 83 } 82 bufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject); 84 83 85 84 /* send new buffer contents to server */ … … 124 123 } 125 124 126 127 125 /* 128 126 * Need to update our local state for vertex arrays. -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
r24815 r27091 240 240 return return_val; 241 241 } 242 243 void PACKSPU_APIENTRY packspu_GetPolygonStipple( GLubyte * mask ) 244 { 245 GET_THREAD(thread); 246 int writeback = 1; 247 248 if (pack_spu.swap) 249 { 250 crPackGetPolygonStippleSWAP( mask, &writeback ); 251 } 252 else 253 { 254 crPackGetPolygonStipple( mask, &writeback ); 255 } 256 257 #ifdef CR_ARB_pixel_buffer_object 258 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 259 #endif 260 { 261 packspuFlush( (void *) thread ); 262 while (writeback) 263 crNetRecv(); 264 } 265 } 266 267 void PACKSPU_APIENTRY packspu_GetPixelMapfv( GLenum map, GLfloat * values ) 268 { 269 GET_THREAD(thread); 270 int writeback = 1; 271 272 if (pack_spu.swap) 273 { 274 crPackGetPixelMapfvSWAP( map, values, &writeback ); 275 } 276 else 277 { 278 crPackGetPixelMapfv( map, values, &writeback ); 279 } 280 281 #ifdef CR_ARB_pixel_buffer_object 282 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 283 #endif 284 { 285 packspuFlush( (void *) thread ); 286 while (writeback) 287 crNetRecv(); 288 } 289 } 290 291 void PACKSPU_APIENTRY packspu_GetPixelMapuiv( GLenum map, GLuint * values ) 292 { 293 GET_THREAD(thread); 294 int writeback = 1; 295 296 if (pack_spu.swap) 297 { 298 crPackGetPixelMapuivSWAP( map, values, &writeback ); 299 } 300 else 301 { 302 crPackGetPixelMapuiv( map, values, &writeback ); 303 } 304 305 #ifdef CR_ARB_pixel_buffer_object 306 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 307 #endif 308 { 309 packspuFlush( (void *) thread ); 310 while (writeback) 311 crNetRecv(); 312 } 313 } 314 315 void PACKSPU_APIENTRY packspu_GetPixelMapusv( GLenum map, GLushort * values ) 316 { 317 GET_THREAD(thread); 318 int writeback = 1; 319 320 if (pack_spu.swap) 321 { 322 crPackGetPixelMapusvSWAP( map, values, &writeback ); 323 } 324 else 325 { 326 crPackGetPixelMapusv( map, values, &writeback ); 327 } 328 329 #ifdef CR_ARB_pixel_buffer_object 330 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 331 #endif 332 { 333 packspuFlush( (void *) thread ); 334 while (writeback) 335 crNetRecv(); 336 } 337 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c
r26407 r27091 184 184 ContextInfo *ctx = thread->currentContext; 185 185 CRClientState *clientState = &(ctx->clientState->client); 186 int writeback; 187 pack_spu.ReadPixels++; 188 if (pack_spu.swap) 189 crPackReadPixelsSWAP( x, y, width, height, format, type, pixels, 190 &(clientState->pack), &writeback ); 191 else 192 crPackReadPixels( x, y, width, height, format, type, pixels, 193 &(clientState->pack), &writeback ); 194 packspuFlush( (void *) thread ); 195 while (pack_spu.ReadPixels) 196 crNetRecv(); 186 int writeback; 187 188 if (pack_spu.swap) 189 { 190 crPackReadPixelsSWAP(x, y, width, height, format, type, pixels, 191 &(clientState->pack), &writeback); 192 } 193 else 194 { 195 crPackReadPixels(x, y, width, height, format, type, pixels, 196 &(clientState->pack), &writeback); 197 } 198 199 #ifdef CR_ARB_pixel_buffer_object 200 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 201 #endif 202 { 203 pack_spu.ReadPixels++; 204 205 packspuFlush((void *) thread); 206 while (pack_spu.ReadPixels) 207 crNetRecv(); 208 } 197 209 } 198 210 … … 225 237 if (!packspu_CheckTexImageParams(internalformat, format, type)) 226 238 { 227 if (pixels )239 if (pixels || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 228 240 { 229 241 crWarning("packspu_TexImage1D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type); … … 248 260 if (!packspu_CheckTexImageParams(internalformat, format, type)) 249 261 { 250 if (pixels )262 if (pixels || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 251 263 { 252 264 crWarning("packspu_TexImage2D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type); … … 359 371 else 360 372 crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback ); 361 packspuFlush( (void *) thread ); 362 while (writeback) 363 crNetRecv(); 364 } 373 374 #ifdef CR_ARB_pixel_buffer_object 375 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 376 #endif 377 { 378 packspuFlush( (void *) thread ); 379 while (writeback) 380 crNetRecv(); 381 } 382 } 383 384 void PACKSPU_APIENTRY packspu_GetCompressedTexImageARB( GLenum target, GLint level, GLvoid * img ) 385 { 386 GET_THREAD(thread); 387 int writeback = 1; 388 389 if (pack_spu.swap) 390 { 391 crPackGetCompressedTexImageARBSWAP( target, level, img, &writeback ); 392 } 393 else 394 { 395 crPackGetCompressedTexImageARB( target, level, img, &writeback ); 396 } 397 398 #ifdef CR_ARB_pixel_buffer_object 399 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 400 #endif 401 { 402 packspuFlush( (void *) thread ); 403 while (writeback) 404 crNetRecv(); 405 } 406 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_special
r26407 r27091 96 96 BindTexture 97 97 DeleteTextures 98 GetPolygonStipple 99 GetPixelMapfv 100 GetPixelMapuiv 101 GetPixelMapusv 102 GetCompressedTexImageARB
Note:
See TracChangeset
for help on using the changeset viewer.