Changeset 51313 in vbox
- Timestamp:
- May 20, 2014 7:12:20 PM (10 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 22 edited
-
Additions/WINNT/Graphics/Wine_new/Makefile.kmk (modified) (1 diff)
-
Additions/WINNT/Graphics/Wine_new/wined3d/context.c (modified) (1 diff)
-
Additions/WINNT/Graphics/Wine_new/wined3d/device.c (modified) (1 diff)
-
Additions/WINNT/Graphics/Wine_new/wined3d/state.c (modified) (2 diffs)
-
Additions/WINNT/Graphics/Wine_new/wined3d/wined3d_gl.h (modified) (1 diff)
-
Additions/common/crOpenGL/pack/packspu.h (modified) (3 diffs)
-
Additions/common/crOpenGL/pack/packspu_client.c (modified) (22 diffs)
-
Additions/common/crOpenGL/pack/packspu_context.c (modified) (2 diffs)
-
Additions/common/crOpenGL/pack/packspu_get.py (modified) (3 diffs)
-
Additions/common/crOpenGL/pack/packspu_init.c (modified) (1 diff)
-
Additions/common/crOpenGL/pack/packspu_misc.c (modified) (2 diffs)
-
Additions/common/crOpenGL/pack/packspu_net.c (modified) (1 diff)
-
GuestHost/OpenGL/include/chromium.h (modified) (1 diff)
-
GuestHost/OpenGL/include/state/cr_current.h (modified) (2 diffs)
-
GuestHost/OpenGL/packer/pack_client.c (modified) (13 diffs)
-
GuestHost/OpenGL/packer/pack_currentheader.py (modified) (1 diff)
-
GuestHost/OpenGL/packer/pack_currenttypes.py (modified) (1 diff)
-
GuestHost/OpenGL/packer/pack_program.c (modified) (11 diffs)
-
GuestHost/OpenGL/packer/packer.py (modified) (1 diff)
-
GuestHost/OpenGL/state_tracker/state_client.c (modified) (2 diffs)
-
GuestHost/OpenGL/state_tracker/state_current.c (modified) (1 diff)
-
GuestHost/OpenGL/state_tracker/state_current.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/Makefile.kmk
r51270 r51313 176 176 VBOX_WITH_WINE_FIX_SURFUPDATA \ 177 177 VBOX_WITH_WINE_FIX_CURVBO \ 178 VBOX_WITH_WINE_FIX_ZEROVERTATTR \179 178 VBOX_WITH_WINE_FIX_FTOA \ 180 179 VBOX_WITH_WINE_DBG -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/context.c
r51270 r51313 1919 1919 * this is a kinda hack, but it is needed since our ogl driver currently does not support ShareLists */ 1920 1920 pglChromiumParameteriCR(GL_SHARE_CONTEXT_RESOURCES_CR, GL_TRUE); 1921 pglChromiumParameteriCR(GL_CHECK_ZERO_VERT_ARRT, GL_TRUE); 1921 1922 # if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1922 1923 pglChromiumParameteriCR(GL_FLUSH_ON_THREAD_SWITCH_CR, GL_TRUE); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/device.c
r51270 r51313 1341 1341 gl_info = context->gl_info; 1342 1342 1343 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 1343 1344 zv_destroy(device); 1345 #endif 1344 1346 1345 1347 if (device->logo_surface) -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/state.c
r51270 r51313 4136 4136 #endif 4137 4137 { 4138 #ifdef DEBUG_misha 4139 Assert(i); 4140 #endif 4138 4141 4139 4142 if (context->numbered_array_mask & (1 << i)) … … 4225 4228 #endif 4226 4229 { 4230 #ifdef DEBUG_misha 4231 Assert(i); 4232 #endif 4227 4233 4228 4234 if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d_gl.h
r51270 r51313 189 189 /*configures host to create windows initially hidden*/ 190 190 #define GL_HOST_WND_CREATED_HIDDEN_CR 0x8B2B 191 192 /* enable zero vertex attribute generation to work around wine bug */ 193 #define GL_CHECK_ZERO_VERT_ARRT 0x8B30 191 194 192 195 typedef void (WINE_GLAPI *PGLFNCHROMIUMPARAMETERUCR)(GLenum param, GLint value); -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h
r51200 r51313 28 28 typedef struct thread_info_t ThreadInfo; 29 29 typedef struct context_info_t ContextInfo; 30 typedef struct zvabuffer_info_t ZvaBufferInfo; 31 32 struct zvabuffer_info_t 33 { 34 /* GL_ARRAY_BUFFER_ARB buffer */ 35 GLuint idBuffer; 36 /* buffer length */ 37 GLuint cbBuffer; 38 /* number of values stored in the buffer currently */ 39 GLuint cValues; 40 /* current buffer value */ 41 union 42 { 43 GLfloat f[4]; 44 GLuint ui[4]; 45 GLubyte ub[4]; 46 GLshort s[4]; 47 GLushort us[4]; 48 } Value; 49 }; 30 50 31 51 struct thread_info_t { … … 48 68 GLint serverCtx; /* context ID returned by server */ 49 69 GLboolean fAutoFlush; 70 GLboolean fCheckZerroVertAttr; 50 71 ThreadInfo *currentThread; 72 ZvaBufferInfo zvaBufferInfo; 51 73 GLubyte glVersion[100]; /* GL_VERSION string */ 52 74 GLubyte pszRealVendor[100]; … … 76 98 #endif 77 99 78 #ifdef VBOX_WITH_CRPACKSPU_DUMPER79 100 SPUDispatchTable self; 80 101 102 #ifdef VBOX_WITH_CRPACKSPU_DUMPER 81 103 CR_RECORDER Recorder; 82 104 CR_DBGPRINT_DUMPER Dumper; -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c
r47079 r51313 9 9 #include "cr_glstate.h" 10 10 #include "packspu_proto.h" 11 #include "cr_mem.h" 11 12 12 13 void PACKSPU_APIENTRY packspu_FogCoordPointerEXT( GLenum type, GLsizei stride, const GLvoid *pointer ) … … 173 174 } 174 175 176 #ifdef DEBUG_misha 177 /* debugging */ 178 //# define CR_FORCE_ZVA_SERVER_ARRAY 179 #endif 180 # define CR_FORCE_ZVA_EXPAND 181 182 183 GLboolean packspuZvaCreate(ContextInfo *pCtx, const GLfloat *pValue, GLuint cValues) 184 { 185 ZvaBufferInfo *pInfo = &pCtx->zvaBufferInfo; 186 GLuint cbValue = 4 * sizeof (*pValue); 187 GLuint cbValues = cValues * cbValue; 188 GLfloat *pBuffer; 189 uint8_t *pu8Buf; 190 GLuint i; 191 192 /* quickly sort out if we can use the current value */ 193 if (pInfo->idBuffer 194 && pInfo->cValues >= cValues 195 && !memcmp(pValue, &pInfo->Value, cbValue)) 196 return GL_FALSE; 197 198 pBuffer = (GLfloat*)crAlloc(cbValues); 199 if (!pBuffer) 200 { 201 WARN(("crAlloc for pBuffer failed")); 202 return GL_FALSE; 203 } 204 205 pu8Buf = (uint8_t *)pBuffer; 206 for (i = 0; i < cValues; ++i) 207 { 208 memcpy(pu8Buf, pValue, cbValue); 209 pu8Buf += cbValue; 210 } 211 212 /* */ 213 if (!pInfo->idBuffer) 214 { 215 pack_spu.self.GenBuffersARB(1, &pInfo->idBuffer); 216 Assert(pInfo->idBuffer); 217 } 218 219 pack_spu.self.BindBufferARB(GL_ARRAY_BUFFER_ARB, pInfo->idBuffer); 220 221 if (pInfo->cbBuffer < cbValues) 222 { 223 pack_spu.self.BufferDataARB(GL_ARRAY_BUFFER_ARB, cbValues, pBuffer, GL_DYNAMIC_DRAW_ARB); 224 pInfo->cbBuffer = cbValues; 225 } 226 else 227 { 228 pack_spu.self.BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, cbValues, pBuffer); 229 } 230 231 pInfo->cValues = cValues; 232 memcpy(&pInfo->Value, pValue, cbValue); 233 234 crFree(pBuffer); 235 236 return GL_TRUE; 237 } 238 239 typedef struct 240 { 241 ContextInfo *pCtx; 242 GLuint idBuffer; 243 CRClientPointer cp; 244 } CR_ZVA_RESTORE_CTX; 245 246 void packspuZvaEnable(ContextInfo *pCtx, const GLfloat *pValue, GLuint cValues, CR_ZVA_RESTORE_CTX *pRestoreCtx) 247 { 248 CRContext *g = pCtx->clientState; 249 250 Assert(0); 251 252 #ifdef DEBUG 253 { 254 CRContext *pCurState = crStateGetCurrent(); 255 256 Assert(g == pCurState); 257 } 258 #endif 259 260 pRestoreCtx->pCtx = pCtx; 261 pRestoreCtx->idBuffer = g->bufferobject.arrayBuffer ? g->bufferobject.arrayBuffer->id : 0; 262 pRestoreCtx->cp = g->client.array.a[0]; 263 264 Assert(!pRestoreCtx->cp.enabled); 265 266 /* buffer ref count mechanism does not work actually atm, 267 * still ensure the buffer does not get destroyed if we fix it in the future */ 268 if (pRestoreCtx->cp.buffer) 269 pRestoreCtx->cp.buffer->refCount++; 270 271 packspuZvaCreate(pCtx, pValue, cValues); 272 273 pack_spu.self.BindBufferARB(GL_ARRAY_BUFFER_ARB, pCtx->zvaBufferInfo.idBuffer); 274 275 pack_spu.self.VertexAttribPointerARB(0, 4, GL_FLOAT, 276 GL_FALSE, /*normalized*/ 277 0, /*stride*/ 278 NULL /*addr*/); 279 280 pack_spu.self.EnableVertexAttribArrayARB(0); 281 } 282 283 void packspuZvaDisable(CR_ZVA_RESTORE_CTX *pRestoreCtx) 284 { 285 if (pRestoreCtx->cp.buffer) 286 pack_spu.self.BindBufferARB(GL_ARRAY_BUFFER_ARB, pRestoreCtx->cp.buffer->id); 287 else 288 pack_spu.self.BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); 289 290 pack_spu.self.VertexAttribPointerARB(0, pRestoreCtx->cp.size, pRestoreCtx->cp.type, 291 pRestoreCtx->cp.normalized, /*normalized*/ 292 pRestoreCtx->cp.stride, /*stride*/ 293 pRestoreCtx->cp.p); 294 295 if (pRestoreCtx->cp.enabled) 296 pack_spu.self.EnableVertexAttribArrayARB(0); 297 else 298 pack_spu.self.DisableVertexAttribArrayARB(0); 299 300 if (pRestoreCtx->cp.buffer) 301 { 302 if (pRestoreCtx->cp.buffer->id != pRestoreCtx->idBuffer) 303 pack_spu.self.BindBufferARB(GL_ARRAY_BUFFER_ARB, pRestoreCtx->idBuffer); 304 305 /* we have increased the refcount above, decrease it back */ 306 pRestoreCtx->cp.buffer->refCount--; 307 } 308 else 309 { 310 if (pRestoreCtx->idBuffer) 311 pack_spu.self.BindBufferARB(GL_ARRAY_BUFFER_ARB, pRestoreCtx->idBuffer); 312 } 313 314 #ifdef DEBUG 315 { 316 CRContext *g = pRestoreCtx->pCtx->clientState; 317 CRContext *pCurState = crStateGetCurrent(); 318 319 Assert(g == pCurState); 320 321 Assert(pRestoreCtx->cp.p == g->client.array.a[0].p); 322 Assert(pRestoreCtx->cp.size == g->client.array.a[0].size); 323 Assert(pRestoreCtx->cp.type == g->client.array.a[0].type); 324 Assert(pRestoreCtx->cp.stride == g->client.array.a[0].stride); 325 Assert(pRestoreCtx->cp.enabled == g->client.array.a[0].enabled); 326 Assert(pRestoreCtx->cp.normalized == g->client.array.a[0].normalized); 327 Assert(pRestoreCtx->cp.bytesPerIndex == g->client.array.a[0].bytesPerIndex); 328 # ifdef CR_ARB_vertex_buffer_object 329 Assert(pRestoreCtx->cp.buffer == g->client.array.a[0].buffer); 330 # endif 331 # ifdef CR_EXT_compiled_vertex_array 332 Assert(pRestoreCtx->cp.locked == g->client.array.a[0].locked); 333 # endif 334 Assert(pRestoreCtx->idBuffer == (g->bufferobject.arrayBuffer ? g->bufferobject.arrayBuffer->id : 0)); 335 } 336 #endif 337 } 175 338 176 339 void PACKSPU_APIENTRY … … 180 343 #if 1 181 344 GLboolean serverArrays = GL_FALSE; 345 GLuint cZvaValues = 0; 346 GLfloat aAttrib[4]; 182 347 183 348 #if CR_ARB_vertex_buffer_object … … 185 350 /*crDebug("packspu_ArrayElement index:%i", index);*/ 186 351 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 352 { 187 353 serverArrays = crStateUseServerArrays(); 188 #endif 189 190 if (serverArrays) { 354 if (ctx->fCheckZerroVertAttr) 355 cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib); 356 } 357 #endif 358 359 if (serverArrays 360 #ifdef CR_FORCE_ZVA_EXPAND 361 && !cZvaValues 362 #endif 363 ) { 364 CR_ZVA_RESTORE_CTX RestoreCtx; 191 365 GET_CONTEXT(ctx); 192 366 CRClientState *clientState = &(ctx->clientState->client); 367 368 Assert(cZvaValues < UINT32_MAX/2); 193 369 194 370 /* LockArraysEXT can not be executed between glBegin/glEnd pair, it also … … 198 374 CRASSERT(!clientState->array.locked || clientState->array.synced); 199 375 376 if (cZvaValues) 377 packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx); 378 200 379 /* Send the DrawArrays command over the wire */ 201 380 if (pack_spu.swap) … … 203 382 else 204 383 crPackArrayElement( index ); 384 385 if (cZvaValues) 386 packspuZvaDisable(&RestoreCtx); 205 387 } 206 388 else { … … 208 390 GET_CONTEXT(ctx); 209 391 CRClientState *clientState = &(ctx->clientState->client); 210 if (pack_spu.swap) 211 crPackExpandArrayElementSWAP( index, clientState ); 212 else 213 crPackExpandArrayElement( index, clientState ); 392 393 #ifdef CR_FORCE_ZVA_SERVER_ARRAY 394 CR_ZVA_RESTORE_CTX RestoreCtx; 395 396 if (cZvaValues && cZvaValues < UINT32_MAX/2) 397 packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx); 398 #endif 399 400 if (pack_spu.swap) 401 crPackExpandArrayElementSWAP( index, clientState, cZvaValues ? aAttrib : NULL ); 402 else 403 crPackExpandArrayElement( index, clientState, cZvaValues ? aAttrib : NULL ); 404 405 #ifdef CR_FORCE_ZVA_SERVER_ARRAY 406 if (cZvaValues && cZvaValues < UINT32_MAX/2) 407 packspuZvaDisable(&RestoreCtx); 408 #endif 214 409 } 215 410 #else 216 411 GET_CONTEXT(ctx); 217 412 CRClientState *clientState = &(ctx->clientState->client); 218 crPackExpandArrayElement(index, clientState );413 crPackExpandArrayElement(index, clientState, NULL); 219 414 #endif 220 415 } 221 416 222 417 /*#define CR_USE_LOCKARRAYS*/ 418 #ifdef CR_USE_LOCKARRAYS 419 # error "check Zero Vertex Attrib hack is supported properly!" 420 #endif 223 421 224 422 void PACKSPU_APIENTRY … … 226 424 { 227 425 GLboolean serverArrays = GL_FALSE; 426 GLuint cZvaValues = 0; 427 GLfloat aAttrib[4]; 228 428 229 429 #if CR_ARB_vertex_buffer_object … … 233 433 /*crDebug("DrawElements count=%d, indices=%p", count, indices);*/ 234 434 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 435 { 235 436 serverArrays = crStateUseServerArrays(); 437 if (ctx->fCheckZerroVertAttr) 438 cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib); 439 } 236 440 237 441 # ifdef CR_USE_LOCKARRAYS … … 298 502 #endif 299 503 300 if (serverArrays) { 504 if (serverArrays 505 #ifdef CR_FORCE_ZVA_EXPAND 506 && !cZvaValues 507 #endif 508 ) { 509 CR_ZVA_RESTORE_CTX RestoreCtx; 301 510 GET_CONTEXT(ctx); 302 511 CRClientState *clientState = &(ctx->clientState->client); 303 512 513 Assert(cZvaValues < UINT32_MAX/2); 514 515 if (cZvaValues) 516 packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx); 517 304 518 /*Note the comment in packspu_LockArraysEXT*/ 305 519 if (clientState->array.locked && !clientState->array.synced) … … 308 522 clientState->array.synced = GL_TRUE; 309 523 } 524 310 525 /* Send the DrawArrays command over the wire */ 311 526 if (pack_spu.swap) … … 313 528 else 314 529 crPackDrawElements( mode, count, type, indices ); 530 531 if (cZvaValues) 532 packspuZvaDisable(&RestoreCtx); 315 533 } 316 534 else { … … 318 536 GET_CONTEXT(ctx); 319 537 CRClientState *clientState = &(ctx->clientState->client); 320 if (pack_spu.swap) 321 crPackExpandDrawElementsSWAP( mode, count, type, indices, clientState ); 538 539 #ifdef CR_FORCE_ZVA_SERVER_ARRAY 540 CR_ZVA_RESTORE_CTX RestoreCtx; 541 542 if (cZvaValues && cZvaValues < UINT32_MAX/2) 543 packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx); 544 #endif 545 546 if (pack_spu.swap) 547 crPackExpandDrawElementsSWAP( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL ); 322 548 else 323 549 { 324 550 //packspu_Begin(mode); 325 crPackExpandDrawElements( mode, count, type, indices, clientState );551 crPackExpandDrawElements( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL ); 326 552 //packspu_End(); 327 553 } 554 555 #ifdef CR_FORCE_ZVA_SERVER_ARRAY 556 if (cZvaValues && cZvaValues < UINT32_MAX/2) 557 packspuZvaDisable(&RestoreCtx); 558 #endif 328 559 } 329 560 … … 341 572 { 342 573 GLboolean serverArrays = GL_FALSE; 574 GLuint cZvaValues = 0; 575 GLfloat aAttrib[4]; 343 576 344 577 #if CR_ARB_vertex_buffer_object … … 346 579 /*crDebug("DrawRangeElements count=%d", count);*/ 347 580 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 581 { 348 582 serverArrays = crStateUseServerArrays(); 349 #endif 350 351 if (serverArrays) { 583 if (ctx->fCheckZerroVertAttr) 584 cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib); 585 } 586 #endif 587 588 if (serverArrays 589 #ifdef CR_FORCE_ZVA_EXPAND 590 && !cZvaValues 591 #endif 592 ) { 593 CR_ZVA_RESTORE_CTX RestoreCtx; 352 594 GET_CONTEXT(ctx); 353 595 CRClientState *clientState = &(ctx->clientState->client); 354 596 597 Assert(cZvaValues < UINT32_MAX/2); 598 599 if (cZvaValues) 600 packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx); 601 355 602 /*Note the comment in packspu_LockArraysEXT*/ 356 603 if (clientState->array.locked && !clientState->array.synced) … … 365 612 else 366 613 crPackDrawRangeElements( mode, start, end, count, type, indices ); 614 615 if (cZvaValues) 616 packspuZvaDisable(&RestoreCtx); 367 617 } 368 618 else { … … 370 620 GET_CONTEXT(ctx); 371 621 CRClientState *clientState = &(ctx->clientState->client); 372 if (pack_spu.swap) 373 crPackExpandDrawRangeElementsSWAP( mode, start, end, count, type, indices, clientState ); 374 else 375 { 376 crPackExpandDrawRangeElements( mode, start, end, count, type, indices, clientState ); 377 } 622 #ifdef CR_FORCE_ZVA_SERVER_ARRAY 623 CR_ZVA_RESTORE_CTX RestoreCtx; 624 625 if (cZvaValues && cZvaValues < UINT32_MAX/2) 626 packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx); 627 #endif 628 629 if (pack_spu.swap) 630 crPackExpandDrawRangeElementsSWAP( mode, start, end, count, type, indices, clientState, cZvaValues ? aAttrib : NULL ); 631 else 632 { 633 crPackExpandDrawRangeElements( mode, start, end, count, type, indices, clientState, cZvaValues ? aAttrib : NULL ); 634 } 635 636 #ifdef CR_FORCE_ZVA_SERVER_ARRAY 637 if (cZvaValues && cZvaValues < UINT32_MAX/2) 638 packspuZvaDisable(&RestoreCtx); 639 #endif 378 640 } 379 641 } … … 384 646 { 385 647 GLboolean serverArrays = GL_FALSE; 648 GLuint cZvaValues = 0; 649 GLfloat aAttrib[4]; 386 650 387 651 #if CR_ARB_vertex_buffer_object … … 390 654 /*crDebug("DrawArrays count=%d", count);*/ 391 655 if (ctx->clientState->extensions.ARB_vertex_buffer_object) 656 { 392 657 serverArrays = crStateUseServerArrays(); 658 if (ctx->fCheckZerroVertAttr) 659 cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib); 660 } 393 661 394 662 # ifdef CR_USE_LOCKARRAYS … … 409 677 #endif 410 678 411 if (serverArrays) 412 { 679 if (serverArrays 680 #ifdef CR_FORCE_ZVA_EXPAND 681 && !cZvaValues 682 #endif 683 ) 684 { 685 CR_ZVA_RESTORE_CTX RestoreCtx; 413 686 GET_CONTEXT(ctx); 414 687 CRClientState *clientState = &(ctx->clientState->client); 415 688 689 Assert(cZvaValues < UINT32_MAX/2); 690 691 if (cZvaValues) 692 packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx); 693 416 694 /*Note the comment in packspu_LockArraysEXT*/ 417 695 if (clientState->array.locked && !clientState->array.synced) … … 426 704 else 427 705 crPackDrawArrays( mode, first, count ); 706 707 if (cZvaValues) 708 packspuZvaDisable(&RestoreCtx); 428 709 } 429 710 else … … 432 713 GET_CONTEXT(ctx); 433 714 CRClientState *clientState = &(ctx->clientState->client); 434 if (pack_spu.swap) 435 crPackExpandDrawArraysSWAP( mode, first, count, clientState ); 436 else 437 crPackExpandDrawArrays( mode, first, count, clientState ); 715 #ifdef CR_FORCE_ZVA_SERVER_ARRAY 716 CR_ZVA_RESTORE_CTX RestoreCtx; 717 718 if (cZvaValues && cZvaValues < UINT32_MAX/2) 719 packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx); 720 #endif 721 722 if (pack_spu.swap) 723 crPackExpandDrawArraysSWAP( mode, first, count, clientState, cZvaValues ? aAttrib : NULL ); 724 else 725 crPackExpandDrawArrays( mode, first, count, clientState, cZvaValues ? aAttrib : NULL ); 726 727 #ifdef CR_FORCE_ZVA_SERVER_ARRAY 728 if (cZvaValues && cZvaValues < UINT32_MAX/2) 729 packspuZvaDisable(&RestoreCtx); 730 #endif 731 438 732 } 439 733 -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
r49260 r51313 419 419 context->serverCtx = 0; 420 420 context->currentThread = NULL; 421 422 memset (&context->zvaBufferInfo, 0, sizeof (context->zvaBufferInfo)); 421 423 422 424 if (curContext == context) … … 500 502 } 501 503 504 if (thread->currentContext && newCtx != thread->currentContext && thread->currentContext->fCheckZerroVertAttr) 505 { 506 crStateCurrentRecoverNew(thread->currentContext->clientState, &thread->packer->current); 507 crStateResetCurrentPointers(&thread->packer->current); 508 } 502 509 thread->currentContext = newCtx; 503 510 crPackSetContext( thread->packer ); -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
r51202 r51313 58 58 simple_funcs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ] 59 59 simple_swaps = [ 'SWAP32', 'SWAPFLOAT', 'SWAPDOUBLE', '(GLboolean) SWAP32' ] 60 61 vertattr_get_funcs = [ 'GetVertexAttribdv' 'GetVertexAttribfv' 'GetVertexAttribiv' ] 60 62 61 63 hard_funcs = { … … 122 124 || pname == GL_DRAW_FRAMEBUFFER_BINDING_EXT 123 125 #endif 126 || pname == GL_ARRAY_BUFFER_BINDING 127 || pname == GL_ELEMENT_ARRAY_BUFFER_BINDING 128 || pname == GL_PIXEL_PACK_BUFFER_BINDING 129 || pname == GL_PIXEL_UNPACK_BUFFER_BINDING 124 130 ) 125 131 { … … 157 163 } 158 164 """ % (params[-1][1], params[-1][1], func_name, func_name, apiutil.MakeCallString(params), func_name, func_name) 165 166 if func_name in vertattr_get_funcs: 167 print """ 168 if (pname != GL_CURRENT_VERTEX_ATTRIB_ARB) 169 { 170 #ifdef DEBUG 171 %s localparams; 172 localparams = (%s) crAlloc(__numValues(pname) * sizeof(*localparams)); 173 crState%s(index, pname, localparams); 174 crPack%s(index, %s, &writeback); 175 packspuFlush( (void *) thread ); 176 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 177 for (i=0; i<crStateHlpComponentsCount(pname); ++i) 178 { 179 if (localparams[i] != params[i]) 180 { 181 crWarning("Incorrect local state in %s for %%x param %%i", pname, i); 182 crWarning("Expected %%i but got %%i", (int)localparams[i], (int)params[i]); 183 } 184 } 185 crFree(localparams); 186 #else 187 crState%s(pname, params); 188 #endif 189 return; 190 } 191 """ % (params[-1][1], params[-1][1], func_name, func_name, apiutil.MakeCallString(params), func_name, func_name) 192 159 193 params.append( ("&writeback", "foo", 0) ) 160 194 print '\tif (pack_spu.swap)' -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
r49264 r51313 80 80 packSPUSelfDispatch(SPUDispatchTable *self) 81 81 { 82 #ifdef VBOX_WITH_CRPACKSPU_DUMPER83 82 crSPUInitDispatchTable( &(pack_spu.self) ); 84 83 crSPUCopyDispatchTable( &(pack_spu.self), self ); 85 #else86 (void)self;87 #endif88 84 } 89 85 -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
r50095 r51313 435 435 } 436 436 437 static void packspuCheckZerroVertAttr(GLboolean fEnable) 438 { 439 GET_THREAD(thread); 440 441 thread->currentContext->fCheckZerroVertAttr = fEnable; 442 } 443 437 444 void PACKSPU_APIENTRY packspu_ChromiumParameteriCR(GLenum target, GLint value) 438 445 { … … 442 449 /* this is a pure packspu state, don't propagate it any further */ 443 450 packspuFluchOnThreadSwitch(value); 451 return; 452 case GL_CHECK_ZERO_VERT_ARRT: 453 packspuCheckZerroVertAttr(value); 444 454 return; 445 455 case GL_SHARE_CONTEXT_RESOURCES_CR: -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c
r51200 r51313 131 131 CRASSERT(buf); 132 132 133 if (ctx && ctx->fCheckZerroVertAttr) 134 { 135 crStateCurrentRecoverNew(ctx->clientState, &thread->packer->current); 136 crStateResetCurrentPointers(&thread->packer->current); 137 } 138 133 139 /* We're done packing into the current buffer, unbind it */ 134 140 crPackReleaseBuffer( thread->packer ); -
trunk/src/VBox/GuestHost/OpenGL/include/chromium.h
r51064 r51313 731 731 #define GL_HH_RENDERTHREAD_INFORM 0x8B2F 732 732 733 /* enable zero vertex attribute generation to work around wine bug */ 734 #define GL_CHECK_ZERO_VERT_ARRT 0x8B30 735 733 736 /**********************************************************************/ 734 737 /***** Chromium-specific API *****/ -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_current.h
r15532 r51313 90 90 DECLEXPORT(void) crStateCurrentRecover( void ); 91 91 92 DECLEXPORT(void) crStateCurrentRecoverNew(CRContext *g, CRCurrentStatePointers *current); 93 92 94 DECLEXPORT(void) crStateCurrentDiff(CRCurrentBits *bb, CRbitvalue *bitID, 93 95 CRContext *fromCtx, CRContext *toCtx); … … 97 99 DECLEXPORT(void) crStateRasterPosUpdate(GLfloat x, GLfloat y, GLfloat z, GLfloat w); 98 100 101 DECLEXPORT(GLuint) crStateNeedDummyZeroVertexArray(CRContext *g, CRCurrentStatePointers *current, GLfloat *pZva); 102 99 103 #ifdef __cplusplus 100 104 } -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_client.c
r37216 r51313 28 28 unsigned char *p = array->a[attr].p + index * array->a[attr].stride; 29 29 30 #ifdef DEBUG_misha 31 Assert(index >= 0); 32 #endif 33 30 34 #ifdef CR_ARB_vertex_buffer_object 31 35 if (array->a[attr].buffer && array->a[attr].buffer->data) 32 36 { 37 Assert(((GLuint)p) < array->a[attr].buffer->size); 38 Assert(((GLint)p) >= 0); 33 39 p = (unsigned char *)(array->a[attr].buffer->data) + (unsigned long)p; 34 40 } … … 298 304 */ 299 305 void 300 crPackExpandArrayElement(GLint index, CRClientState *c )306 crPackExpandArrayElement(GLint index, CRClientState *c, const GLfloat *pZva) 301 307 { 302 308 unsigned char *p; … … 561 567 crPackVertexAttrib(array, VERT_ATTRIB_POS, index); 562 568 } 569 else if (pZva) 570 { 571 crPackVertexAttrib4fvARB(VERT_ATTRIB_POS, pZva); 572 } 563 573 else if (array->v.enabled) 564 574 { … … 613 623 614 624 void 615 crPackExpandDrawArrays(GLenum mode, GLint first, GLsizei count, CRClientState *c )625 crPackExpandDrawArrays(GLenum mode, GLint first, GLsizei count, CRClientState *c, const GLfloat *pZva) 616 626 { 617 627 int i; … … 632 642 for (i=0; i<count; i++) 633 643 { 634 crPackExpandArrayElement(first + i, c );644 crPackExpandArrayElement(first + i, c, pZva); 635 645 } 636 646 crPackEnd(); … … 753 763 void 754 764 crPackExpandDrawElements(GLenum mode, GLsizei count, GLenum type, 755 const GLvoid *indices, CRClientState *c )765 const GLvoid *indices, CRClientState *c, const GLfloat *pZva) 756 766 { 757 767 int i; … … 801 811 for (i=0; i<count; i++) 802 812 { 803 crPackExpandArrayElement((GLint) *p++, c );813 crPackExpandArrayElement((GLint) *p++, c, pZva); 804 814 } 805 815 break; … … 807 817 for (i=0; i<count; i++) 808 818 { 809 crPackExpandArrayElement((GLint) * (GLushort *) p, c );819 crPackExpandArrayElement((GLint) * (GLushort *) p, c, pZva); 810 820 p+=sizeof (GLushort); 811 821 } … … 814 824 for (i=0; i<count; i++) 815 825 { 816 crPackExpandArrayElement((GLint) * (GLuint *) p, c );826 crPackExpandArrayElement((GLint) * (GLuint *) p, c, pZva); 817 827 p+=sizeof (GLuint); 818 828 } … … 872 882 */ 873 883 void 874 crPackExpandDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, CRClientState *c )884 crPackExpandDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, CRClientState *c, const GLfloat *pZva) 875 885 { 876 886 if (start>end) … … 880 890 } 881 891 882 crPackExpandDrawElements(mode, count, type, indices, c );892 crPackExpandDrawElements(mode, count, type, indices, c, pZva); 883 893 } 884 894 … … 906 916 void 907 917 crPackExpandMultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count, 908 GLsizei primcount, CRClientState *c )918 GLsizei primcount, CRClientState *c, const GLfloat *pZva ) 909 919 { 910 920 GLint i; 911 921 for (i = 0; i < primcount; i++) { 912 922 if (count[i] > 0) { 913 crPackExpandDrawArrays(mode, first[i], count[i], c );923 crPackExpandDrawArrays(mode, first[i], count[i], c, pZva); 914 924 } 915 925 } … … 939 949 crPackExpandMultiDrawElementsEXT( GLenum mode, const GLsizei *count, 940 950 GLenum type, const GLvoid **indices, 941 GLsizei primcount, CRClientState *c )951 GLsizei primcount, CRClientState *c, const GLfloat *pZva ) 942 952 { 943 953 GLint i; 944 954 for (i = 0; i < primcount; i++) { 945 955 if (count[i] > 0) { 946 crPackExpandDrawElements(mode, count[i], type, indices[i], c );956 crPackExpandDrawElements(mode, count[i], type, indices[i], c, pZva); 947 957 } 948 958 } -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_currentheader.py
r15532 r51313 57 57 unsigned int vtx_count_begin; 58 58 unsigned int attribsUsedMask; 59 59 unsigned int changedVertexAttrib; 60 60 } CRCurrentStatePointers; 61 61 -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_currenttypes.py
r15532 r51313 57 57 'members': [] 58 58 }, 59 } 60 61 current_fns_new = { 62 'VertexAttrib': { 63 'types': ['s','f','d','b','i','ub','ui','us','Nub','Nus','Nui','Nb','Ns','Ni'], 64 'sizes': [1,2,3,4], 65 'default': [0,0,0,1], 66 'members': ['x', 'y', 'z', 'w'], 67 'array': 'CR_MAX_VERTEX_ATTRIBS' 68 }, 59 69 } 60 70 -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_program.c
r33475 r51313 366 366 unsigned char *data_ptr; 367 367 CR_GET_BUFFERED_POINTER( pc, 8 ); 368 pc->current.c.vertexAttrib.b4[index] = data_ptr + 12;368 pc->current.c.vertexAttrib.b4[index] = data_ptr + 4; 369 369 pc->current.attribsUsedMask |= (1 << index); 370 370 WRITE_DATA( 0, GLuint, index ); … … 382 382 unsigned char *data_ptr; 383 383 CR_GET_BUFFERED_POINTER( pc, 20 ); 384 pc->current.c.vertexAttrib.i4[index] = data_ptr + 12;384 pc->current.c.vertexAttrib.i4[index] = data_ptr + 4; 385 385 pc->current.attribsUsedMask |= (1 << index); 386 386 WRITE_DATA( 0, GLuint, index ); … … 398 398 unsigned char *data_ptr; 399 399 CR_GET_BUFFERED_POINTER( pc, 12 ); 400 pc->current.c.vertexAttrib.s4[index] = data_ptr + 12;400 pc->current.c.vertexAttrib.s4[index] = data_ptr + 4; 401 401 pc->current.attribsUsedMask |= (1 << index); 402 402 WRITE_DATA( 0, GLuint, index ); … … 414 414 unsigned char *data_ptr; 415 415 CR_GET_BUFFERED_POINTER( pc, 8 ); 416 pc->current.c.vertexAttrib.ub4[index] = data_ptr + 12;416 pc->current.c.vertexAttrib.ub4[index] = data_ptr + 4; 417 417 pc->current.attribsUsedMask |= (1 << index); 418 418 WRITE_DATA( 0, GLuint, index ); … … 430 430 unsigned char *data_ptr; 431 431 CR_GET_BUFFERED_POINTER( pc, 20 ); 432 pc->current.c.vertexAttrib.ui4[index] = data_ptr + 12;432 pc->current.c.vertexAttrib.ui4[index] = data_ptr + 4; 433 433 pc->current.attribsUsedMask |= (1 << index); 434 434 WRITE_DATA( 0, GLuint, index ); … … 446 446 unsigned char *data_ptr; 447 447 CR_GET_BUFFERED_POINTER( pc, 12 ); 448 pc->current.c.vertexAttrib.s4[index] = data_ptr + 12;448 pc->current.c.vertexAttrib.s4[index] = data_ptr + 4; 449 449 pc->current.attribsUsedMask |= (1 << index); 450 450 WRITE_DATA( 0, GLuint, index ); … … 462 462 unsigned char *data_ptr; 463 463 CR_GET_BUFFERED_POINTER( pc, 8 ); 464 pc->current.c.vertexAttrib.b4[index] = data_ptr + 12;464 pc->current.c.vertexAttrib.b4[index] = data_ptr + 4; 465 465 pc->current.attribsUsedMask |= (1 << index); 466 466 WRITE_DATA( 0, GLuint, index ); … … 478 478 unsigned char *data_ptr; 479 479 CR_GET_BUFFERED_POINTER( pc, 20 ); 480 pc->current.c.vertexAttrib.i4[index] = data_ptr + 12;480 pc->current.c.vertexAttrib.i4[index] = data_ptr + 4; 481 481 pc->current.attribsUsedMask |= (1 << index); 482 482 WRITE_DATA( 0, GLuint, index ); … … 494 494 unsigned char *data_ptr; 495 495 CR_GET_BUFFERED_POINTER( pc, 20 ); 496 pc->current.c.vertexAttrib.ui4[index] = data_ptr + 12;496 pc->current.c.vertexAttrib.ui4[index] = data_ptr + 4; 497 497 pc->current.attribsUsedMask |= (1 << index); 498 498 WRITE_DATA( 0, GLuint, index ); … … 510 510 unsigned char *data_ptr; 511 511 CR_GET_BUFFERED_POINTER( pc, 12 ); 512 pc->current.c.vertexAttrib.s4[index] = data_ptr + 12;512 pc->current.c.vertexAttrib.s4[index] = data_ptr + 4; 513 513 pc->current.attribsUsedMask |= (1 << index); 514 514 WRITE_DATA( 0, GLuint, index ); … … 527 527 unsigned char *data_ptr; 528 528 CR_GET_BUFFERED_POINTER( pc, 8 ); 529 pc->current.c.vertexAttrib.ub4[index] = data_ptr + 12;529 pc->current.c.vertexAttrib.ub4[index] = data_ptr + 4; 530 530 pc->current.attribsUsedMask |= (1 << index); 531 531 WRITE_DATA( 0, GLuint, index ); -
trunk/src/VBox/GuestHost/OpenGL/packer/packer.py
r43487 r51313 104 104 type = m.group(3) + m.group(2) 105 105 # Add 12 to skip the packet length, opcode and index fields 106 print "\tpc->current.c.%s.%s[index] = data_ptr + 12;" % (name,type)106 print "\tpc->current.c.%s.%s[index] = data_ptr + 4;" % (name,type) 107 107 if m.group(4) == "ARB" or m.group(4) == "NV": 108 108 print "\tpc->current.attribsUsedMask |= (1 << index);" 109 print "\tpc->current.changedVertexAttrib |= (1 << index);" 109 110 return 110 111 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_client.c
r50983 r51313 1565 1565 #ifdef DEBUG_misha 1566 1566 /* debugging */ 1567 # define CR_NO_SERVER_ARRAYS1567 //# define CR_NO_SERVER_ARRAYS 1568 1568 #endif 1569 1569 … … 1627 1627 1628 1628 return res; 1629 #else 1630 return GL_FALSE; 1631 #endif 1632 } 1633 1634 GLuint crStateNeedDummyZeroVertexArray(CRContext *g, CRCurrentStatePointers *current, GLfloat *pZva) 1635 { 1636 #if defined(CR_ARB_vertex_buffer_object) 1637 CRClientState *c = &(g->client); 1638 int i; 1639 GLuint zvMax = 0; 1640 1641 if (c->array.a[0].enabled) 1642 return 0; 1643 1644 for (i = 1; (unsigned int)i < g->limits.maxVertexProgramAttribs; i++) 1645 { 1646 if (c->array.a[i].enabled) 1647 { 1648 if (c->array.a[i].buffer && c->array.a[i].buffer->id) 1649 { 1650 GLuint cElements = c->array.a[i].buffer->size / c->array.a[i].stride; 1651 if (zvMax < cElements) 1652 zvMax = cElements; 1653 } 1654 else 1655 { 1656 zvMax = ~0; 1657 break; 1658 } 1659 } 1660 } 1661 1662 if (zvMax) 1663 { 1664 Assert(!c->array.v.enabled); 1665 1666 crStateCurrentRecoverNew(g, current); 1667 crStateResetCurrentPointers(current); 1668 1669 memcpy(pZva, &g->current.vertexAttrib[0][0], sizeof (*pZva) * 4); 1670 } 1671 1672 return zvMax; 1629 1673 #else 1630 1674 return GL_FALSE; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.c
r33540 r51313 111 111 void crStateResetCurrentPointers( CRCurrentStatePointers *current ) 112 112 { 113 crMemset(&(current->c.index), 0, sizeof(GLindex_p)); 114 crMemset(&(current->c.vertexAttrib), 0, sizeof(GLvertexattrib_p)); 115 crMemset(&(current->c.fogCoord), 0, sizeof(GLfogcoord_p)); 116 crMemset(&(current->c.edgeFlag), 0, sizeof(GLedgeflag_p)); 117 crMemset(&(current->c.normal), 0, sizeof(GLnormal_p)); 118 crMemset(&(current->c.color), 0, sizeof(GLcolor_p)); 119 crMemset(&(current->c.secondaryColor), 0, sizeof(GLsecondarycolor_p)); 120 crMemset(&(current->c.texCoord), 0, sizeof(GLtexcoord_p)); 121 /* 122 current->attribsUsedMask = 0; 123 */ 113 uint32_t attribsUsedMask = current->attribsUsedMask; 114 115 crMemset(current, 0, sizeof (*current)); 116 117 current->attribsUsedMask = attribsUsedMask; 124 118 } 125 119 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.py
r15532 r51313 287 287 print '\t}' 288 288 print '}' 289 290 print ''' 291 292 void crStateCurrentRecoverNew(CRContext *g, CRCurrentStatePointers *current) 293 { 294 const unsigned char *v; 295 convert_func convert=NULL; 296 CRCurrentState *c = &(g->current); 297 CRStateBits *sb = GetCurrentBits(); 298 CRCurrentBits *cb = &(sb->current); 299 300 static const GLfloat vertexAttrib_default[4] = {0.0f, 0.0f, 0.0f, 1.0f}; 301 302 GLvertexattrib_p *vertexAttrib = &(current->c.vertexAttrib); 303 304 unsigned int i; 305 CRbitvalue nbitID[CR_MAX_BITARRAY]; 306 307 308 /* silence warnings */ 309 (void) __convert_b1; 310 (void) __convert_b2; 311 (void) __convert_b3; 312 (void) __convert_b4; 313 (void) __convert_ui1; 314 (void) __convert_ui2; 315 (void) __convert_ui3; 316 (void) __convert_ui4; 317 (void) __convert_l1; 318 (void) __convert_l2; 319 (void) __convert_l3; 320 (void) __convert_l4; 321 (void) __convert_us1; 322 (void) __convert_us2; 323 (void) __convert_us3; 324 (void) __convert_us4; 325 (void) __convert_ub1; 326 (void) __convert_ub2; 327 (void) __convert_ub3; 328 (void) __convert_ub4; 329 (void) __convert_rescale_s1; 330 (void) __convert_rescale_s2; 331 (void) __convert_rescale_b1; 332 (void) __convert_rescale_b2; 333 (void) __convert_rescale_ui1; 334 (void) __convert_rescale_ui2; 335 (void) __convert_rescale_i1; 336 (void) __convert_rescale_i2; 337 (void) __convert_rescale_us1; 338 (void) __convert_rescale_us2; 339 (void) __convert_rescale_ub1; 340 (void) __convert_rescale_ub2; 341 (void) __convert_Ni1; 342 (void) __convert_Ni2; 343 (void) __convert_Ni3; 344 (void) __convert_Ni4; 345 (void) __convert_Nb1; 346 (void) __convert_Nb2; 347 (void) __convert_Nb3; 348 (void) __convert_Nb4; 349 (void) __convert_Nus1; 350 (void) __convert_Nus2; 351 (void) __convert_Nus3; 352 (void) __convert_Nus4; 353 (void) __convert_Nui1; 354 (void) __convert_Nui2; 355 (void) __convert_Nui3; 356 (void) __convert_Nui4; 357 (void) __convert_Ns1; 358 (void) __convert_Ns2; 359 (void) __convert_Ns3; 360 (void) __convert_Ns4; 361 (void) __convert_Nub1; 362 (void) __convert_Nub2; 363 (void) __convert_Nub3; 364 (void) __convert_Nub4; 365 366 367 ''' 368 369 for k in current_fns_new.keys(): 370 print '\t/* %s */' % k 371 print '\tif (current->changed%s)' % k 372 print '\t{' 373 print '\t\tv=NULL;' 374 name = '%s%s' % (k[:1].lower(),k[1:]) 375 376 indent = "" 377 if current_fns_new[k].has_key( 'array' ): 378 print '\t\tfor (i = 0 ; i < %s ; i++)' % current_fns_new[k]['array'] 379 print '\t\t{' 380 indent += "\t\t" 381 print '\t\tif (!(current->changed%s & (1 << i))) continue;' % k 382 for type in current_fns_new[k]['types']: 383 if type[0:1] == "N": 384 normalized = 1 385 type2 = type[1:] 386 else: 387 normalized = 0 388 type2 = type 389 for size in current_fns_new[k]['sizes']: 390 ptr = '%s->%s%d' % (name, type, size ) 391 if current_fns_new[k].has_key( 'array' ): 392 ptr += "[i]" 393 print '#ifdef DEBUG_misha' 394 print '%s\tif (%s)' % (indent, ptr) 395 print '%s\t{' % (indent) 396 print '%s\t\tuint32_t *pTst = (uint32_t*)(%s);' % (indent, ptr) 397 print '%s\t\t--pTst;' % (indent) 398 print '%s\t\tAssert((*pTst) == i);' % (indent) 399 print '%s\t}' % (indent) 400 print '#endif' 401 print '%s\tif (v < %s)' % (indent, ptr) 402 print '%s\t{' % indent 403 print '%s\t\tv = %s;' % (indent, ptr) 404 if (k == 'Color' or k == 'Normal' or k == 'SecondaryColor' or normalized) and type != 'f' and type != 'd' and type != 'l': 405 print '%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size) 406 else: 407 print '%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size) 408 print '%s\t}' % indent 409 print '' 410 print '%s\tif (v != NULL) {' % indent 411 if current_fns_new[k].has_key( 'array' ): 412 if k == 'TexCoord': 413 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name) 414 else: 415 print '%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name) 416 else: 417 if k == 'Normal': 418 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name) 419 elif k == 'FogCoord': 420 print '%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] = %s_default;' % (indent,name) 421 elif k == 'Color': 422 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name) 423 elif k == 'SecondaryColor': 424 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1], %s_default);' % (indent,name) 425 elif k == 'TexCoord': 426 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name) 427 elif k == 'Index': 428 print '%s\t\tc->colorIndex = %s_default;' % (indent,name) 429 elif k == 'EdgeFlag': 430 print '%s\t\tc->edgeFlag = %s_default;' % (indent,name) 431 else: 432 print '%s\t\tc->%s = %s_default;' % (indent,name,name) 433 if k == 'EdgeFlag': 434 print '%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent) 435 dirtyVar = 'cb->edgeFlag' 436 elif k == 'Normal': 437 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent) 438 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_NORMAL]' 439 elif k == 'TexCoord': 440 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent) 441 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_TEX0 + i]' 442 elif k == 'Color': 443 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent) 444 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR0]' 445 elif k == 'Index': 446 print '%s\t\tconvert(&(c->colorIndex), v);' % (indent) 447 dirtyVar = 'cb->colorIndex' 448 elif k == 'SecondaryColor': 449 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent) 450 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR1]' 451 elif k == 'FogCoord': 452 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent) 453 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_FOG]' 454 elif k == 'VertexAttrib': 455 print '%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent) 456 dirtyVar = 'cb->vertexAttrib[i]' 457 else: 458 assert 0 # should never get here 459 460 print '%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar) 461 462 # if current_fns_new[k].has_key( 'array' ): 463 # print '%s\t\tDIRTY(cb->%s[i], nbitID);' % (indent,name) 464 # else: 465 # print '%s\t\tDIRTY(cb->%s, nbitID);' % (indent,name) 466 467 468 469 print '%s\t\tDIRTY(cb->dirty, nbitID);' % indent 470 print '%s\t}' % indent 471 if current_fns_new[k].has_key( 'array' ): 472 print '%s\t%s->ptr[i] = v;' % (indent, name ) 473 else: 474 print '%s\t%s->ptr = v;' % (indent, name ) 475 if current_fns_new[k].has_key( 'array' ): 476 print '\t\t}' 477 print '\t\tcurrent->changed%s = 0;' % k 478 print '\t}' 479 print '}'
Note:
See TracChangeset
for help on using the changeset viewer.

