Changeset 32327 in vbox for trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c
- Timestamp:
- Sep 8, 2010 4:08:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c
r26565 r32327 228 228 #if CR_ARB_vertex_buffer_object 229 229 GET_CONTEXT(ctx); 230 GLboolean lockedArrays = GL_FALSE; 231 CRBufferObject *elementsBuffer = crStateGetCurrent()->bufferobject.elementsBuffer; 230 232 /*crDebug("DrawElements count=%d, indices=%p", count, indices);*/ 231 233 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 232 234 serverArrays = crStateUseServerArrays(); 235 236 if (!serverArrays && !ctx->clientState->client.array.locked && (count>3) 237 && (!elementsBuffer || !elementsBuffer->id)) 238 { 239 GLuint min, max; 240 GLsizei i; 241 242 switch (type) 243 { 244 case GL_UNSIGNED_BYTE: 245 { 246 GLubyte *pIdx = (GLubyte *)indices; 247 min = max = pIdx[0]; 248 for (i=0; i<count; ++i) 249 { 250 if (pIdx[i]<min) min = pIdx[i]; 251 else if (pIdx[i]>max) max = pIdx[i]; 252 } 253 break; 254 } 255 case GL_UNSIGNED_SHORT: 256 { 257 GLushort *pIdx = (GLushort *)indices; 258 min = max = pIdx[0]; 259 for (i=0; i<count; ++i) 260 { 261 if (pIdx[i]<min) min = pIdx[i]; 262 else if (pIdx[i]>max) max = pIdx[i]; 263 } 264 break; 265 } 266 case GL_UNSIGNED_INT: 267 { 268 GLuint *pIdx = (GLuint *)indices; 269 min = max = pIdx[0]; 270 for (i=0; i<count; ++i) 271 { 272 if (pIdx[i]<min) min = pIdx[i]; 273 else if (pIdx[i]>max) max = pIdx[i]; 274 } 275 break; 276 } 277 default: crError("Unknown type 0x%x", type); 278 } 279 280 if ((max-min)<(GLuint)(2*count)) 281 { 282 crStateLockArraysEXT(min, max-min+1); 283 284 serverArrays = crStateUseServerArrays(); 285 if (serverArrays) 286 { 287 lockedArrays = GL_TRUE; 288 } 289 else 290 { 291 crStateUnlockArraysEXT(); 292 } 293 } 294 } 233 295 #endif 234 296 … … 243 305 clientState->array.synced = GL_TRUE; 244 306 } 245 246 307 /* Send the DrawArrays command over the wire */ 247 308 if (pack_spu.swap) … … 263 324 } 264 325 } 326 327 #if CR_ARB_vertex_buffer_object 328 if (lockedArrays) 329 { 330 packspu_UnlockArraysEXT(); 331 } 332 #endif 265 333 } 266 334 … … 316 384 #if CR_ARB_vertex_buffer_object 317 385 GET_CONTEXT(ctx); 386 GLboolean lockedArrays = GL_FALSE; 318 387 /*crDebug("DrawArrays count=%d", count);*/ 319 388 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 320 389 serverArrays = crStateUseServerArrays(); 321 #endif 322 323 if (serverArrays) { 390 391 if (!serverArrays && !ctx->clientState->client.array.locked && (count>3)) 392 { 393 crStateLockArraysEXT(first, count); 394 serverArrays = crStateUseServerArrays(); 395 if (serverArrays) 396 { 397 lockedArrays = GL_TRUE; 398 } 399 else 400 { 401 crStateUnlockArraysEXT(); 402 } 403 } 404 #endif 405 406 if (serverArrays) 407 { 324 408 GET_CONTEXT(ctx); 325 409 CRClientState *clientState = &(ctx->clientState->client); … … 338 422 crPackDrawArrays( mode, first, count ); 339 423 } 340 else { 424 else 425 { 341 426 /* evaluate locally */ 342 427 GET_CONTEXT(ctx); … … 347 432 crPackExpandDrawArrays( mode, first, count, clientState ); 348 433 } 434 435 #if CR_ARB_vertex_buffer_object 436 if (lockedArrays) 437 { 438 packspu_UnlockArraysEXT(); 439 } 440 #endif 349 441 } 350 442
Note:
See TracChangeset
for help on using the changeset viewer.