VirtualBox

Changeset 51313 in vbox


Ignore:
Timestamp:
May 20, 2014 7:12:20 PM (10 years ago)
Author:
vboxsync
Message:

crOpenGL: bugfixes and work-arounds for wine issues

Location:
trunk/src/VBox
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/Makefile.kmk

    r51270 r51313  
    176176        VBOX_WITH_WINE_FIX_SURFUPDATA \
    177177        VBOX_WITH_WINE_FIX_CURVBO \
    178         VBOX_WITH_WINE_FIX_ZEROVERTATTR \
    179178        VBOX_WITH_WINE_FIX_FTOA \
    180179        VBOX_WITH_WINE_DBG
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/context.c

    r51270 r51313  
    19191919     * this is a kinda hack, but it is needed since our ogl driver currently does not support ShareLists */
    19201920    pglChromiumParameteriCR(GL_SHARE_CONTEXT_RESOURCES_CR, GL_TRUE);
     1921    pglChromiumParameteriCR(GL_CHECK_ZERO_VERT_ARRT, GL_TRUE);
    19211922# if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT)
    19221923    pglChromiumParameteriCR(GL_FLUSH_ON_THREAD_SWITCH_CR,  GL_TRUE);
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/device.c

    r51270 r51313  
    13411341    gl_info = context->gl_info;
    13421342
     1343#ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR
    13431344    zv_destroy(device);
     1345#endif
    13441346
    13451347    if (device->logo_surface)
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/state.c

    r51270 r51313  
    41364136#endif
    41374137            {
     4138#ifdef DEBUG_misha
     4139                Assert(i);
     4140#endif
    41384141
    41394142            if (context->numbered_array_mask & (1 << i))
     
    42254228#endif
    42264229            {
     4230#ifdef DEBUG_misha
     4231                Assert(i);
     4232#endif
    42274233
    42284234            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  
    189189/*configures host to create windows initially hidden*/
    190190#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
    191194
    192195typedef void (WINE_GLAPI *PGLFNCHROMIUMPARAMETERUCR)(GLenum param, GLint value);
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h

    r51200 r51313  
    2828typedef struct thread_info_t ThreadInfo;
    2929typedef struct context_info_t ContextInfo;
     30typedef struct zvabuffer_info_t ZvaBufferInfo;
     31
     32struct 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};
    3050
    3151struct thread_info_t {
     
    4868    GLint serverCtx;         /* context ID returned by server */
    4969    GLboolean  fAutoFlush;
     70    GLboolean  fCheckZerroVertAttr;
    5071    ThreadInfo *currentThread;
     72    ZvaBufferInfo zvaBufferInfo;
    5173    GLubyte glVersion[100];     /* GL_VERSION string */
    5274    GLubyte pszRealVendor[100];
     
    7698#endif
    7799
    78 #ifdef VBOX_WITH_CRPACKSPU_DUMPER
    79100    SPUDispatchTable self;
    80101
     102#ifdef VBOX_WITH_CRPACKSPU_DUMPER
    81103    CR_RECORDER Recorder;
    82104    CR_DBGPRINT_DUMPER Dumper;
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c

    r47079 r51313  
    99#include "cr_glstate.h"
    1010#include "packspu_proto.h"
     11#include "cr_mem.h"
    1112
    1213void PACKSPU_APIENTRY packspu_FogCoordPointerEXT( GLenum type, GLsizei stride, const GLvoid *pointer )
     
    173174}
    174175
     176#ifdef DEBUG_misha
     177/* debugging */
     178//# define CR_FORCE_ZVA_SERVER_ARRAY
     179#endif
     180# define CR_FORCE_ZVA_EXPAND
     181
     182
     183GLboolean 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
     239typedef struct
     240{
     241    ContextInfo *pCtx;
     242    GLuint idBuffer;
     243    CRClientPointer cp;
     244} CR_ZVA_RESTORE_CTX;
     245
     246void 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
     283void 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}
    175338
    176339void PACKSPU_APIENTRY
     
    180343#if 1
    181344    GLboolean serverArrays = GL_FALSE;
     345    GLuint cZvaValues = 0;
     346    GLfloat aAttrib[4];
    182347
    183348#if CR_ARB_vertex_buffer_object
     
    185350    /*crDebug("packspu_ArrayElement index:%i", index);*/
    186351    if (ctx->clientState->extensions.ARB_vertex_buffer_object)
     352    {
    187353        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;
    191365        GET_CONTEXT(ctx);
    192366        CRClientState *clientState = &(ctx->clientState->client);
     367
     368        Assert(cZvaValues < UINT32_MAX/2);
    193369
    194370        /* LockArraysEXT can not be executed between glBegin/glEnd pair, it also
     
    198374        CRASSERT(!clientState->array.locked || clientState->array.synced);
    199375
     376        if (cZvaValues)
     377            packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx);
     378
    200379        /* Send the DrawArrays command over the wire */
    201380        if (pack_spu.swap)
     
    203382        else
    204383            crPackArrayElement( index );
     384
     385        if (cZvaValues)
     386            packspuZvaDisable(&RestoreCtx);
    205387    }
    206388    else {
     
    208390        GET_CONTEXT(ctx);
    209391        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
    214409    }
    215410#else
    216411    GET_CONTEXT(ctx);
    217412    CRClientState *clientState = &(ctx->clientState->client);
    218     crPackExpandArrayElement(index, clientState);
     413    crPackExpandArrayElement(index, clientState, NULL);
    219414#endif
    220415}
    221416
    222417/*#define CR_USE_LOCKARRAYS*/
     418#ifdef CR_USE_LOCKARRAYS
     419# error "check Zero Vertex Attrib hack is supported properly!"
     420#endif
    223421
    224422void PACKSPU_APIENTRY
     
    226424{
    227425    GLboolean serverArrays = GL_FALSE;
     426    GLuint cZvaValues = 0;
     427    GLfloat aAttrib[4];
    228428
    229429#if CR_ARB_vertex_buffer_object
     
    233433    /*crDebug("DrawElements count=%d, indices=%p", count, indices);*/
    234434    if (ctx->clientState->extensions.ARB_vertex_buffer_object)
     435    {
    235436        serverArrays = crStateUseServerArrays();
     437        if (ctx->fCheckZerroVertAttr)
     438            cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib);
     439    }
    236440
    237441# ifdef CR_USE_LOCKARRAYS
     
    298502#endif
    299503
    300     if (serverArrays) {
     504    if (serverArrays
     505#ifdef CR_FORCE_ZVA_EXPAND
     506            && !cZvaValues
     507#endif
     508            ) {
     509        CR_ZVA_RESTORE_CTX RestoreCtx;
    301510        GET_CONTEXT(ctx);
    302511        CRClientState *clientState = &(ctx->clientState->client);
    303512
     513        Assert(cZvaValues < UINT32_MAX/2);
     514
     515        if (cZvaValues)
     516            packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx);
     517
    304518        /*Note the comment in packspu_LockArraysEXT*/
    305519        if (clientState->array.locked && !clientState->array.synced)
     
    308522            clientState->array.synced = GL_TRUE;
    309523        }
     524
    310525        /* Send the DrawArrays command over the wire */
    311526        if (pack_spu.swap)
     
    313528        else
    314529            crPackDrawElements( mode, count, type, indices );
     530
     531        if (cZvaValues)
     532            packspuZvaDisable(&RestoreCtx);
    315533    }
    316534    else {
     
    318536        GET_CONTEXT(ctx);
    319537        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 );
    322548        else
    323549        {
    324550            //packspu_Begin(mode);
    325             crPackExpandDrawElements( mode, count, type, indices, clientState );
     551            crPackExpandDrawElements( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
    326552            //packspu_End();
    327553        }
     554
     555#ifdef CR_FORCE_ZVA_SERVER_ARRAY
     556        if (cZvaValues && cZvaValues < UINT32_MAX/2)
     557            packspuZvaDisable(&RestoreCtx);
     558#endif
    328559    }
    329560
     
    341572{
    342573    GLboolean serverArrays = GL_FALSE;
     574    GLuint cZvaValues = 0;
     575    GLfloat aAttrib[4];
    343576
    344577#if CR_ARB_vertex_buffer_object
     
    346579    /*crDebug("DrawRangeElements count=%d", count);*/
    347580    if (ctx->clientState->extensions.ARB_vertex_buffer_object)
     581    {
    348582         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;
    352594        GET_CONTEXT(ctx);
    353595        CRClientState *clientState = &(ctx->clientState->client);
    354596
     597        Assert(cZvaValues < UINT32_MAX/2);
     598
     599        if (cZvaValues)
     600            packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx);
     601
    355602        /*Note the comment in packspu_LockArraysEXT*/
    356603        if (clientState->array.locked && !clientState->array.synced)
     
    365612        else
    366613            crPackDrawRangeElements( mode, start, end, count, type, indices );
     614
     615        if (cZvaValues)
     616            packspuZvaDisable(&RestoreCtx);
    367617    }
    368618    else {
     
    370620        GET_CONTEXT(ctx);
    371621        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
    378640    }
    379641}
     
    384646{
    385647    GLboolean serverArrays = GL_FALSE;
     648    GLuint cZvaValues = 0;
     649    GLfloat aAttrib[4];
    386650
    387651#if CR_ARB_vertex_buffer_object
     
    390654    /*crDebug("DrawArrays count=%d", count);*/
    391655    if (ctx->clientState->extensions.ARB_vertex_buffer_object)
     656    {
    392657         serverArrays = crStateUseServerArrays();
     658         if (ctx->fCheckZerroVertAttr)
     659             cZvaValues = crStateNeedDummyZeroVertexArray(thread->currentContext->clientState, &thread->packer->current, aAttrib);
     660    }
    393661
    394662# ifdef CR_USE_LOCKARRAYS
     
    409677#endif
    410678
    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;
    413686        GET_CONTEXT(ctx);
    414687        CRClientState *clientState = &(ctx->clientState->client);
    415688
     689        Assert(cZvaValues < UINT32_MAX/2);
     690
     691        if (cZvaValues)
     692            packspuZvaEnable(ctx, aAttrib, cZvaValues, &RestoreCtx);
     693
    416694        /*Note the comment in packspu_LockArraysEXT*/
    417695        if (clientState->array.locked && !clientState->array.synced)
     
    426704        else
    427705            crPackDrawArrays( mode, first, count );
     706
     707        if (cZvaValues)
     708            packspuZvaDisable(&RestoreCtx);
    428709    }
    429710    else
     
    432713        GET_CONTEXT(ctx);
    433714        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
    438732    }
    439733
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c

    r49260 r51313  
    419419    context->serverCtx = 0;
    420420    context->currentThread = NULL;
     421
     422    memset (&context->zvaBufferInfo, 0, sizeof (context->zvaBufferInfo));
    421423
    422424    if (curContext == context)
     
    500502            }
    501503
     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            }
    502509            thread->currentContext = newCtx;
    503510            crPackSetContext( thread->packer );
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py

    r51202 r51313  
    5858simple_funcs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ]
    5959simple_swaps = [ 'SWAP32', 'SWAPFLOAT', 'SWAPDOUBLE', '(GLboolean) SWAP32' ]
     60
     61vertattr_get_funcs = [ 'GetVertexAttribdv' 'GetVertexAttribfv' 'GetVertexAttribiv' ]
    6062
    6163hard_funcs = {
     
    122124        || pname == GL_DRAW_FRAMEBUFFER_BINDING_EXT
    123125#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
    124130        )
    125131        {
     
    157163        }
    158164            """ % (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
    159193        params.append( ("&writeback", "foo", 0) )
    160194        print '\tif (pack_spu.swap)'
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c

    r49264 r51313  
    8080packSPUSelfDispatch(SPUDispatchTable *self)
    8181{
    82 #ifdef VBOX_WITH_CRPACKSPU_DUMPER
    8382    crSPUInitDispatchTable( &(pack_spu.self) );
    8483    crSPUCopyDispatchTable( &(pack_spu.self), self );
    85 #else
    86     (void)self;
    87 #endif
    8884}
    8985
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c

    r50095 r51313  
    435435}
    436436
     437static void packspuCheckZerroVertAttr(GLboolean fEnable)
     438{
     439    GET_THREAD(thread);
     440
     441    thread->currentContext->fCheckZerroVertAttr = fEnable;
     442}
     443
    437444void PACKSPU_APIENTRY packspu_ChromiumParameteriCR(GLenum target, GLint value)
    438445{
     
    442449            /* this is a pure packspu state, don't propagate it any further */
    443450            packspuFluchOnThreadSwitch(value);
     451            return;
     452        case GL_CHECK_ZERO_VERT_ARRT:
     453            packspuCheckZerroVertAttr(value);
    444454            return;
    445455        case GL_SHARE_CONTEXT_RESOURCES_CR:
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c

    r51200 r51313  
    131131    CRASSERT(buf);
    132132
     133    if (ctx && ctx->fCheckZerroVertAttr)
     134    {
     135        crStateCurrentRecoverNew(ctx->clientState, &thread->packer->current);
     136        crStateResetCurrentPointers(&thread->packer->current);
     137    }
     138
    133139    /* We're done packing into the current buffer, unbind it */
    134140    crPackReleaseBuffer( thread->packer );
  • trunk/src/VBox/GuestHost/OpenGL/include/chromium.h

    r51064 r51313  
    731731#define GL_HH_RENDERTHREAD_INFORM     0x8B2F
    732732
     733/* enable zero vertex attribute generation to work around wine bug */
     734#define GL_CHECK_ZERO_VERT_ARRT       0x8B30
     735
    733736/**********************************************************************/
    734737/*****                Chromium-specific API                       *****/
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_current.h

    r15532 r51313  
    9090DECLEXPORT(void) crStateCurrentRecover( void );
    9191
     92DECLEXPORT(void) crStateCurrentRecoverNew(CRContext *g, CRCurrentStatePointers  *current);
     93
    9294DECLEXPORT(void) crStateCurrentDiff(CRCurrentBits *bb, CRbitvalue *bitID,
    9395                                    CRContext *fromCtx, CRContext *toCtx);
     
    9799DECLEXPORT(void) crStateRasterPosUpdate(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
    98100
     101DECLEXPORT(GLuint) crStateNeedDummyZeroVertexArray(CRContext *g, CRCurrentStatePointers  *current, GLfloat *pZva);
     102
    99103#ifdef __cplusplus
    100104}
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_client.c

    r37216 r51313  
    2828    unsigned char *p = array->a[attr].p + index * array->a[attr].stride;
    2929
     30#ifdef DEBUG_misha
     31    Assert(index >= 0);
     32#endif
     33
    3034#ifdef CR_ARB_vertex_buffer_object
    3135    if (array->a[attr].buffer && array->a[attr].buffer->data)
    3236    {
     37        Assert(((GLuint)p) < array->a[attr].buffer->size);
     38        Assert(((GLint)p) >= 0);
    3339        p = (unsigned char *)(array->a[attr].buffer->data) + (unsigned long)p;
    3440    }
     
    298304 */
    299305void
    300 crPackExpandArrayElement(GLint index, CRClientState *c)
     306crPackExpandArrayElement(GLint index, CRClientState *c, const GLfloat *pZva)
    301307{
    302308    unsigned char *p;
     
    561567        crPackVertexAttrib(array, VERT_ATTRIB_POS, index);
    562568    }
     569    else if (pZva)
     570    {
     571        crPackVertexAttrib4fvARB(VERT_ATTRIB_POS, pZva);
     572    }
    563573    else if (array->v.enabled)
    564574    {
     
    613623
    614624void
    615 crPackExpandDrawArrays(GLenum mode, GLint first, GLsizei count, CRClientState *c)
     625crPackExpandDrawArrays(GLenum mode, GLint first, GLsizei count, CRClientState *c, const GLfloat *pZva)
    616626{
    617627    int i;
     
    632642    for (i=0; i<count; i++)
    633643    {
    634         crPackExpandArrayElement(first + i, c);
     644        crPackExpandArrayElement(first + i, c, pZva);
    635645    }
    636646    crPackEnd();
     
    753763void
    754764crPackExpandDrawElements(GLenum mode, GLsizei count, GLenum type,
    755                                                  const GLvoid *indices, CRClientState *c)
     765                                                 const GLvoid *indices, CRClientState *c, const GLfloat *pZva)
    756766{
    757767    int i;
     
    801811            for (i=0; i<count; i++)
    802812            {
    803                 crPackExpandArrayElement((GLint) *p++, c);
     813                crPackExpandArrayElement((GLint) *p++, c, pZva);
    804814            }
    805815            break;
     
    807817            for (i=0; i<count; i++)
    808818            {
    809                 crPackExpandArrayElement((GLint) * (GLushort *) p, c);
     819                crPackExpandArrayElement((GLint) * (GLushort *) p, c, pZva);
    810820                p+=sizeof (GLushort);
    811821            }
     
    814824            for (i=0; i<count; i++)
    815825            {
    816                 crPackExpandArrayElement((GLint) * (GLuint *) p, c);
     826                crPackExpandArrayElement((GLint) * (GLuint *) p, c, pZva);
    817827                p+=sizeof (GLuint);
    818828            }
     
    872882 */
    873883void
    874 crPackExpandDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, CRClientState *c)
     884crPackExpandDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, CRClientState *c, const GLfloat *pZva)
    875885{
    876886    if (start>end)
     
    880890    }
    881891
    882     crPackExpandDrawElements(mode, count, type, indices, c);
     892    crPackExpandDrawElements(mode, count, type, indices, c, pZva);
    883893}
    884894
     
    906916void
    907917crPackExpandMultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count,
    908                                                                 GLsizei primcount, CRClientState *c )
     918                                                                GLsizei primcount, CRClientState *c, const GLfloat *pZva )
    909919{
    910920   GLint i;
    911921   for (i = 0; i < primcount; i++) {
    912922      if (count[i] > 0) {
    913          crPackExpandDrawArrays(mode, first[i], count[i], c);
     923         crPackExpandDrawArrays(mode, first[i], count[i], c, pZva);
    914924      }
    915925   }
     
    939949crPackExpandMultiDrawElementsEXT( GLenum mode, const GLsizei *count,
    940950                                  GLenum type, const GLvoid **indices,
    941                                   GLsizei primcount, CRClientState *c )
     951                                  GLsizei primcount, CRClientState *c, const GLfloat *pZva )
    942952{
    943953   GLint i;
    944954   for (i = 0; i < primcount; i++) {
    945955      if (count[i] > 0) {
    946          crPackExpandDrawElements(mode, count[i], type, indices[i], c);
     956         crPackExpandDrawElements(mode, count[i], type, indices[i], c, pZva);
    947957      }
    948958   }
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_currentheader.py

    r15532 r51313  
    5757        unsigned int vtx_count_begin;
    5858        unsigned int attribsUsedMask;
    59 
     59    unsigned int changedVertexAttrib;
    6060} CRCurrentStatePointers;
    6161
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_currenttypes.py

    r15532 r51313  
    5757                'members': []
    5858        },
     59}
     60
     61current_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    },
    5969}
    6070
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_program.c

    r33475 r51313  
    366366    unsigned char *data_ptr;
    367367    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;
    369369    pc->current.attribsUsedMask |= (1 << index);
    370370    WRITE_DATA( 0, GLuint, index );
     
    382382    unsigned char *data_ptr;
    383383    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;
    385385    pc->current.attribsUsedMask |= (1 << index);
    386386    WRITE_DATA( 0, GLuint, index );
     
    398398    unsigned char *data_ptr;
    399399    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;
    401401    pc->current.attribsUsedMask |= (1 << index);
    402402    WRITE_DATA( 0, GLuint, index );
     
    414414    unsigned char *data_ptr;
    415415    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;
    417417    pc->current.attribsUsedMask |= (1 << index);
    418418    WRITE_DATA( 0, GLuint, index );
     
    430430    unsigned char *data_ptr;
    431431    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;
    433433    pc->current.attribsUsedMask |= (1 << index);
    434434    WRITE_DATA( 0, GLuint, index );
     
    446446    unsigned char *data_ptr;
    447447    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;
    449449    pc->current.attribsUsedMask |= (1 << index);
    450450    WRITE_DATA( 0, GLuint, index );
     
    462462    unsigned char *data_ptr;
    463463    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;
    465465    pc->current.attribsUsedMask |= (1 << index);
    466466    WRITE_DATA( 0, GLuint, index );
     
    478478    unsigned char *data_ptr;
    479479    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;
    481481    pc->current.attribsUsedMask |= (1 << index);
    482482    WRITE_DATA( 0, GLuint, index );
     
    494494    unsigned char *data_ptr;
    495495    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;
    497497    pc->current.attribsUsedMask |= (1 << index);
    498498    WRITE_DATA( 0, GLuint, index );
     
    510510    unsigned char *data_ptr;
    511511    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;
    513513    pc->current.attribsUsedMask |= (1 << index);
    514514    WRITE_DATA( 0, GLuint, index );
     
    527527    unsigned char *data_ptr;
    528528    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;
    530530    pc->current.attribsUsedMask |= (1 << index);
    531531    WRITE_DATA( 0, GLuint, index );
  • trunk/src/VBox/GuestHost/OpenGL/packer/packer.py

    r43487 r51313  
    104104        type = m.group(3) + m.group(2)
    105105        # 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)
    107107        if m.group(4) == "ARB" or m.group(4) == "NV":
    108108            print "\tpc->current.attribsUsedMask |= (1 << index);"
     109            print "\tpc->current.changedVertexAttrib |= (1 << index);"
    109110        return
    110111
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_client.c

    r50983 r51313  
    15651565#ifdef DEBUG_misha
    15661566/* debugging */
    1567 # define CR_NO_SERVER_ARRAYS
     1567//# define CR_NO_SERVER_ARRAYS
    15681568#endif
    15691569
     
    16271627
    16281628    return res;
     1629#else
     1630    return GL_FALSE;
     1631#endif
     1632}
     1633
     1634GLuint 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;
    16291673#else
    16301674    return GL_FALSE;
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.c

    r33540 r51313  
    111111void crStateResetCurrentPointers( CRCurrentStatePointers *current )
    112112{
    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;
    124118}
    125119
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.py

    r15532 r51313  
    287287                print '\t}'
    288288print '}'
     289
     290print '''
     291
     292void 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
     369for 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}'
     479print '}'
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette