Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dreveman:openSUSE:11.1:cr
cr
cr-state-client-diff-fix.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cr-state-client-diff-fix.diff of Package cr
diff --git a/state_tracker/state_client.c b/state_tracker/state_client.c index 55a13de..418a8b9 100644 --- a/state_tracker/state_client.c +++ b/state_tracker/state_client.c @@ -1384,23 +1384,45 @@ crStateUseServerArrayElements(void) } +static void +ArrayBuffer(CRContext *ctx, CRBufferObject *b) +{ + if (ctx->bufferobject.arrayBuffer != b) { + diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, b ? b->name : 0); + ctx->bufferobject.arrayBuffer = b; + } +} + +static void +ActiveTexture(CRContext *ctx, int unit) +{ + if (ctx->client.curClientTextureUnit != unit) { + diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + unit); + ctx->client.curClientTextureUnit = unit; + } +} + void crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, CRContext *fromCtx, CRContext *toCtx) { CRClientState *from = &(fromCtx->client); const CRClientState *to = &(toCtx->client); + CRBufferObject *arrayBuffer = fromCtx->bufferobject.arrayBuffer; + int unit = fromCtx->client.curClientTextureUnit; int i; if (CHECKDIRTY(cb->clientPointer, bitID)) { /* one or more vertex pointers is dirty */ if (CHECKDIRTY(cb->v, bitID)) { if (from->array.v.size != to->array.v.size || - from->array.v.type != to->array.v.type || - from->array.v.stride != to->array.v.stride || - from->array.v.buffer != to->array.v.buffer) { + from->array.v.type != to->array.v.type || + from->array.v.stride != to->array.v.stride || + from->array.v.p != to->array.v.p || + from->array.v.buffer != to->array.v.buffer) { + ArrayBuffer( fromCtx, to->array.v.buffer ); diff_api.VertexPointer(to->array.v.size, to->array.v.type, - to->array.v.stride, to->array.v.p); + to->array.v.stride, to->array.v.p); from->array.v.size = to->array.v.size; from->array.v.type = to->array.v.type; from->array.v.stride = to->array.v.stride; @@ -1412,10 +1434,12 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, /* normal */ if (CHECKDIRTY(cb->n, bitID)) { if (from->array.n.type != to->array.n.type || - from->array.n.stride != to->array.n.stride || - from->array.n.buffer != to->array.n.buffer) { + from->array.n.stride != to->array.n.stride || + from->array.n.p != to->array.n.p || + from->array.n.buffer != to->array.n.buffer) { + ArrayBuffer( fromCtx, to->array.n.buffer ); diff_api.NormalPointer(to->array.n.type, - to->array.n.stride, to->array.n.p); + to->array.n.stride, to->array.n.p); from->array.n.type = to->array.n.type; from->array.n.stride = to->array.n.stride; from->array.n.p = to->array.n.p; @@ -1426,9 +1450,11 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, /* color */ if (CHECKDIRTY(cb->c, bitID)) { if (from->array.c.size != to->array.c.size || - from->array.c.type != to->array.c.type || - from->array.c.stride != to->array.c.stride || - from->array.c.buffer != to->array.c.buffer) { + from->array.c.type != to->array.c.type || + from->array.c.stride != to->array.c.stride || + from->array.c.p != to->array.c.p || + from->array.c.buffer != to->array.c.buffer) { + ArrayBuffer( fromCtx, to->array.c.buffer ); diff_api.ColorPointer(to->array.c.size, to->array.c.type, to->array.c.stride, to->array.c.p); from->array.c.size = to->array.c.size; @@ -1442,8 +1468,10 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, /* index */ if (CHECKDIRTY(cb->i, bitID)) { if (from->array.i.type != to->array.i.type || - from->array.i.stride != to->array.i.stride || - from->array.i.buffer != to->array.i.buffer) { + from->array.i.stride != to->array.i.stride || + from->array.i.p != to->array.i.p || + from->array.i.buffer != to->array.i.buffer) { + ArrayBuffer( fromCtx, to->array.i.buffer ); diff_api.IndexPointer(to->array.i.type, to->array.i.stride, to->array.i.p); from->array.i.type = to->array.i.type; @@ -1457,10 +1485,12 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, for (i = 0; (unsigned int)i < toCtx->limits.maxTextureUnits; i++) { if (CHECKDIRTY(cb->t[i], bitID)) { if (from->array.t[i].size != to->array.t[i].size || - from->array.t[i].type != to->array.t[i].type || - from->array.t[i].stride != to->array.t[i].stride || - from->array.t[i].buffer != to->array.t[i].buffer) { - diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i); + from->array.t[i].type != to->array.t[i].type || + from->array.t[i].stride != to->array.t[i].stride || + from->array.t[i].p != to->array.t[i].p || + from->array.t[i].buffer != to->array.t[i].buffer) { + ArrayBuffer( fromCtx, to->array.t[i].buffer ); + ActiveTexture( fromCtx, i ); diff_api.TexCoordPointer(to->array.t[i].size, to->array.t[i].type, to->array.t[i].stride, to->array.t[i].p); from->array.t[i].size = to->array.t[i].size; @@ -1475,7 +1505,9 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, /* edge flag */ if (CHECKDIRTY(cb->e, bitID)) { if (from->array.e.stride != to->array.e.stride || - from->array.e.buffer != to->array.e.buffer) { + from->array.e.p != to->array.e.p || + from->array.e.buffer != to->array.e.buffer) { + ArrayBuffer( fromCtx, to->array.e.buffer ); diff_api.EdgeFlagPointer(to->array.e.stride, to->array.e.p); from->array.e.stride = to->array.e.stride; from->array.e.p = to->array.e.p; @@ -1486,9 +1518,11 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, /* secondary color */ if (CHECKDIRTY(cb->s, bitID)) { if (from->array.s.size != to->array.s.size || - from->array.s.type != to->array.s.type || - from->array.s.stride != to->array.s.stride || - from->array.s.buffer != to->array.s.buffer) { + from->array.s.type != to->array.s.type || + from->array.s.stride != to->array.s.stride || + from->array.s.p != to->array.s.p || + from->array.s.buffer != to->array.s.buffer) { + ArrayBuffer( fromCtx, to->array.s.buffer ); diff_api.SecondaryColorPointerEXT(to->array.s.size, to->array.s.type, to->array.s.stride, to->array.s.p); from->array.s.size = to->array.s.size; @@ -1502,8 +1536,10 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, /* fog coord */ if (CHECKDIRTY(cb->f, bitID)) { if (from->array.f.type != to->array.f.type || - from->array.f.stride != to->array.f.stride || - from->array.f.buffer != to->array.f.buffer) { + from->array.f.stride != to->array.f.stride || + from->array.f.p != to->array.f.p || + from->array.f.buffer != to->array.f.buffer) { + ArrayBuffer( fromCtx, to->array.f.buffer ); diff_api.FogCoordPointerEXT(to->array.f.type, to->array.f.stride, to->array.f.p); from->array.f.type = to->array.f.type; @@ -1518,10 +1554,12 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, for (i = 0; (unsigned int)i < toCtx->limits.maxVertexProgramAttribs; i++) { if (CHECKDIRTY(cb->a[i], bitID)) { if (from->array.a[i].size != to->array.a[i].size || - from->array.a[i].type != to->array.a[i].type || - from->array.a[i].stride != to->array.a[i].stride || - from->array.a[i].normalized != to->array.a[i].normalized || - from->array.a[i].buffer != to->array.a[i].buffer) { + from->array.a[i].type != to->array.a[i].type || + from->array.a[i].stride != to->array.a[i].stride || + from->array.a[i].normalized != to->array.a[i].normalized || + from->array.a[i].p != to->array.a[i].p || + from->array.a[i].buffer != to->array.a[i].buffer) { + ArrayBuffer( fromCtx, to->array.a[i].buffer ); diff_api.VertexAttribPointerARB(i, to->array.a[i].size, to->array.a[i].type, to->array.a[i].normalized, @@ -1543,8 +1581,8 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, if (CHECKDIRTY(cb->enableClientState, bitID)) { /* update vertex array enable/disable flags */ glAble able[2]; - able[0] = diff_api.Disable; - able[1] = diff_api.Enable; + able[0] = diff_api.DisableClientState; + able[1] = diff_api.EnableClientState; if (from->array.v.enabled != to->array.v.enabled) { able[to->array.v.enabled](GL_VERTEX_ARRAY); from->array.v.enabled = to->array.v.enabled; @@ -1563,7 +1601,7 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, } for (i = 0; (unsigned int)i < toCtx->limits.maxTextureUnits; i++) { if (from->array.t[i].enabled != to->array.t[i].enabled) { - diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i); + ActiveTexture( fromCtx, i ); able[to->array.t[i].enabled](GL_TEXTURE_COORD_ARRAY); from->array.t[i].enabled = to->array.t[i].enabled; } @@ -1588,6 +1626,9 @@ crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, } CLEARDIRTY2(cb->enableClientState, bitID); } + + ArrayBuffer( fromCtx, arrayBuffer ); + ActiveTexture( fromCtx, unit ); } @@ -1597,15 +1638,19 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, { const CRClientState *from = &(fromCtx->client); const CRClientState *to = &(toCtx->client); + CRBufferObject *arrayBuffer = fromCtx->bufferobject.arrayBuffer; + int unit = fromCtx->client.curClientTextureUnit; int i; if (CHECKDIRTY(cb->clientPointer, bitID)) { /* one or more vertex pointers is dirty */ if (CHECKDIRTY(cb->v, bitID)) { if (from->array.v.size != to->array.v.size || - from->array.v.type != to->array.v.type || - from->array.v.stride != to->array.v.stride || - from->array.v.buffer != to->array.v.buffer) { + from->array.v.type != to->array.v.type || + from->array.v.stride != to->array.v.stride || + from->array.v.p != to->array.v.p || + from->array.v.buffer != to->array.v.buffer) { + ArrayBuffer( fromCtx, to->array.v.buffer ); diff_api.VertexPointer(to->array.v.size, to->array.v.type, to->array.v.stride, to->array.v.p); FILLDIRTY(cb->v); @@ -1616,8 +1661,10 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, /* normal */ if (CHECKDIRTY(cb->n, bitID)) { if (from->array.n.type != to->array.n.type || - from->array.n.stride != to->array.n.stride || - from->array.n.buffer != to->array.n.buffer) { + from->array.n.stride != to->array.n.stride || + from->array.n.p != to->array.n.p || + from->array.n.buffer != to->array.n.buffer) { + ArrayBuffer( fromCtx, to->array.n.buffer ); diff_api.NormalPointer(to->array.n.type, to->array.n.stride, to->array.n.p); FILLDIRTY(cb->n); @@ -1628,9 +1675,11 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, /* color */ if (CHECKDIRTY(cb->c, bitID)) { if (from->array.c.size != to->array.c.size || - from->array.c.type != to->array.c.type || - from->array.c.stride != to->array.c.stride || - from->array.c.buffer != to->array.c.buffer) { + from->array.c.type != to->array.c.type || + from->array.c.stride != to->array.c.stride || + from->array.c.p != to->array.c.p || + from->array.c.buffer != to->array.c.buffer) { + ArrayBuffer( fromCtx, to->array.c.buffer ); diff_api.ColorPointer(to->array.c.size, to->array.c.type, to->array.c.stride, to->array.c.p); FILLDIRTY(cb->c); @@ -1641,8 +1690,10 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, /* index */ if (CHECKDIRTY(cb->i, bitID)) { if (from->array.i.type != to->array.i.type || - from->array.i.stride != to->array.i.stride || - from->array.i.buffer != to->array.i.buffer) { + from->array.i.stride != to->array.i.stride || + from->array.i.p != to->array.i.p || + from->array.i.buffer != to->array.i.buffer) { + ArrayBuffer( fromCtx, to->array.i.buffer ); diff_api.IndexPointer(to->array.i.type, to->array.i.stride, to->array.i.p); FILLDIRTY(cb->i); @@ -1654,10 +1705,12 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, for (i = 0; (unsigned int)i < toCtx->limits.maxTextureUnits; i++) { if (CHECKDIRTY(cb->t[i], bitID)) { if (from->array.t[i].size != to->array.t[i].size || - from->array.t[i].type != to->array.t[i].type || - from->array.t[i].stride != to->array.t[i].stride || - from->array.t[i].buffer != to->array.t[i].buffer) { - diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i); + from->array.t[i].type != to->array.t[i].type || + from->array.t[i].stride != to->array.t[i].stride || + from->array.t[i].p != to->array.t[i].p || + from->array.t[i].buffer != to->array.t[i].buffer) { + ArrayBuffer( fromCtx, to->array.t[i].buffer ); + ActiveTexture( fromCtx, i ); diff_api.TexCoordPointer(to->array.t[i].size, to->array.t[i].type, to->array.t[i].stride, to->array.t[i].p); FILLDIRTY(cb->t[i]); @@ -1669,7 +1722,9 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, /* edge flag */ if (CHECKDIRTY(cb->e, bitID)) { if (from->array.e.stride != to->array.e.stride || - from->array.e.buffer != to->array.e.buffer) { + from->array.e.p != to->array.e.p || + from->array.e.buffer != to->array.e.buffer) { + ArrayBuffer( fromCtx, to->array.e.buffer ); diff_api.EdgeFlagPointer(to->array.e.stride, to->array.e.p); FILLDIRTY(cb->e); FILLDIRTY(cb->clientPointer); @@ -1679,9 +1734,11 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, /* secondary color */ if (CHECKDIRTY(cb->s, bitID)) { if (from->array.s.size != to->array.s.size || - from->array.s.type != to->array.s.type || - from->array.s.stride != to->array.s.stride || - from->array.s.buffer != to->array.s.buffer) { + from->array.s.type != to->array.s.type || + from->array.s.stride != to->array.s.stride || + from->array.s.p != to->array.s.p || + from->array.s.buffer != to->array.s.buffer) { + ArrayBuffer( fromCtx, to->array.s.buffer ); diff_api.SecondaryColorPointerEXT(to->array.s.size, to->array.s.type, to->array.s.stride, to->array.s.p); FILLDIRTY(cb->s); @@ -1692,8 +1749,10 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, /* fog coord */ if (CHECKDIRTY(cb->f, bitID)) { if (from->array.f.type != to->array.f.type || - from->array.f.stride != to->array.f.stride || - from->array.f.buffer != to->array.f.buffer) { + from->array.f.stride != to->array.f.stride || + from->array.f.p != to->array.f.p || + from->array.f.buffer != to->array.f.buffer) { + ArrayBuffer( fromCtx, to->array.f.buffer ); diff_api.FogCoordPointerEXT(to->array.f.type, to->array.f.stride, to->array.f.p); FILLDIRTY(cb->f); @@ -1706,10 +1765,12 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, for (i = 0; (unsigned int)i < toCtx->limits.maxVertexProgramAttribs; i++) { if (CHECKDIRTY(cb->a[i], bitID)) { if (from->array.a[i].size != to->array.a[i].size || - from->array.a[i].type != to->array.a[i].type || - from->array.a[i].stride != to->array.a[i].stride || - from->array.a[i].normalized != to->array.a[i].normalized || - from->array.a[i].buffer != to->array.a[i].buffer) { + from->array.a[i].type != to->array.a[i].type || + from->array.a[i].stride != to->array.a[i].stride || + from->array.a[i].normalized != to->array.a[i].normalized || + from->array.a[i].p != to->array.a[i].p || + from->array.a[i].buffer != to->array.a[i].buffer) { + ArrayBuffer( fromCtx, to->array.a[i].buffer ); diff_api.VertexAttribPointerARB(i, to->array.a[i].size, to->array.a[i].type, to->array.a[i].normalized, @@ -1727,8 +1788,8 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, if (CHECKDIRTY(cb->enableClientState, bitID)) { /* update vertex array enable/disable flags */ glAble able[2]; - able[0] = diff_api.Disable; - able[1] = diff_api.Enable; + able[0] = diff_api.DisableClientState; + able[1] = diff_api.EnableClientState; if (from->array.v.enabled != to->array.v.enabled) { able[to->array.v.enabled](GL_VERTEX_ARRAY); FILLDIRTY(cb->enableClientState); @@ -1747,7 +1808,7 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, } for (i = 0; (unsigned int)i < toCtx->limits.maxTextureUnits; i++) { if (from->array.t[i].enabled != to->array.t[i].enabled) { - diff_api.ClientActiveTextureARB(GL_TEXTURE0_ARB + i); + ActiveTexture( fromCtx, i ); able[to->array.t[i].enabled](GL_TEXTURE_COORD_ARRAY); FILLDIRTY(cb->enableClientState); } @@ -1772,4 +1833,7 @@ crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, } CLEARDIRTY2(cb->enableClientState, bitID); } + + ArrayBuffer( fromCtx, arrayBuffer ); + ActiveTexture( fromCtx, unit ); } diff --git a/state_tracker/state_current.c b/state_tracker/state_current.c index e8bc247..53229fe 100644 --- a/state_tracker/state_current.c +++ b/state_tracker/state_current.c @@ -413,10 +413,10 @@ crStateCurrentDiff( CRCurrentBits *c, CRbitvalue *bitID, #ifdef CR_EXT_fog_coord if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG], bitID)) { - if (from->vertexAttrib[VERT_ATTRIB_FOG] != to->vertexAttribPre[VERT_ATTRIB_FOG]) { - diff_api.FogCoordfvEXT ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_FOG])); + if (from->vertexAttrib[VERT_ATTRIB_FOG][0] != to->vertexAttribPre[VERT_ATTRIB_FOG][0]) { + diff_api.FogCoordfvEXT ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_FOG][0])); } - COPY_4V(from->vertexAttrib[VERT_ATTRIB_FOG] , to->vertexAttrib[VERT_ATTRIB_FOG]); + from->vertexAttrib[VERT_ATTRIB_FOG][0] = to->vertexAttrib[VERT_ATTRIB_FOG][0]; CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG], nbitID); } #endif diff --git a/state_tracker/state_lighting.txt b/state_tracker/state_lighting.txt index 0a07221..5a972db 100644 --- a/state_tracker/state_lighting.txt +++ b/state_tracker/state_lighting.txt @@ -40,20 +40,10 @@ :attenuation:constantAttenuation:Lightf, GL_LIGHT0+i, GL_CONSTANT_ATTENUATION :attenuation:linearAttenuation:Lightf, GL_LIGHT0+i, GL_LINEAR_ATTENUATION :attenuation:quadraticAttenuation:Lightf, GL_LIGHT0+i, GL_QUADRATIC_ATTENUATION -:position:*diff_api.MatrixMode(GL_MODELVIEW); -:position:*diff_api.PushMatrix(); -:position:*diff_api.LoadIdentity(); -:position:position|x,y,z,w:Lightfv, GL_LIGHT0+i, GL_POSITION -:position:*diff_api.PopMatrix(); -:position:*diff_api.MatrixMode(toCtx->transform.matrixMode); -:spot:*diff_api.MatrixMode(GL_MODELVIEW); -:spot:*diff_api.PushMatrix(); -:spot:*diff_api.LoadIdentity(); -:spot:spotDirection|x,y,z:Lightfv, GL_LIGHT0+i, GL_SPOT_DIRECTION -:spot:spotExponent:Lightf, GL_LIGHT0+i, GL_SPOT_EXPONENT -:spot:spotCutoff:Lightf, GL_LIGHT0+i, GL_SPOT_CUTOFF -:spot:*diff_api.PopMatrix(); -:spot:*diff_api.MatrixMode(toCtx->transform.matrixMode); +:position:position|x,y,z,w:*GLfloat varg[] = {tl->position.x,tl->position.y,tl->position.z,tl->position.w};diff_api.MatrixMode(GL_MODELVIEW);diff_api.PushMatrix();diff_api.LoadIdentity();diff_api.Lightfv(GL_LIGHT0+i,GL_POSITION,varg);diff_api.PopMatrix();diff_api.MatrixMode(toCtx->transform.matrixMode); +:spot:spotDirection|x,y,z:*GLfloat varg[] = {tl->position.x,tl->position.y,tl->position.z};diff_api.MatrixMode(GL_MODELVIEW);diff_api.PushMatrix();diff_api.LoadIdentity();diff_api.Lightfv(GL_LIGHT0+i,GL_SPOT_DIRECTION,varg);diff_api.PopMatrix();diff_api.MatrixMode(toCtx->transform.matrixMode); +:spot:spotExponent:*diff_api.MatrixMode(GL_MODELVIEW);diff_api.PushMatrix();diff_api.LoadIdentity();diff_api.Lightf(GL_LIGHT0+i,GL_SPOT_EXPONENT,tl->spotExponent);diff_api.PopMatrix();diff_api.MatrixMode(toCtx->transform.matrixMode); +:spot:spotCutoff:*diff_api.MatrixMode(GL_MODELVIEW);diff_api.PushMatrix();diff_api.LoadIdentity();diff_api.Lightf(GL_LIGHT0+i,GL_SPOT_CUTOFF,tl->spotCutoff);diff_api.PopMatrix();diff_api.MatrixMode(toCtx->transform.matrixMode); %flush >CLEARDIRTY(lb->dirty, nbitID); >} diff --git a/state_tracker/state_point.txt b/state_tracker/state_point.txt index 69ab8a7..8380d5b 100644 --- a/state_tracker/state_point.txt +++ b/state_tracker/state_point.txt @@ -22,15 +22,17 @@ :enableSprite:pointSprite:GL_POINT_SPRITE_ARB %flush >{ ->unsigned int activeUnit = (unsigned int) -1; +>unsigned int activeUnit = (unsigned int) toCtx->texture.curTextureUnit; >for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++) { -:coordReplacement[i]:*GLint replacement = to->coordReplacement[i]; -:coordReplacement[i]:*if (activeUnit != i) { -:coordReplacement[i]:* diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB ); -:coordReplacement[i]:* activeUnit = i; +:coordReplacement[i]:*if (from->coordReplacement[i] != to->coordReplacement[i]) { +:coordReplacement[i]:* GLint replacement = to->coordReplacement[i]; +:coordReplacement[i]:* if (activeUnit != i) { +:coordReplacement[i]:* diff_api.ActiveTextureARB(i + GL_TEXTURE0_ARB ); +:coordReplacement[i]:* activeUnit = i; +:coordReplacement[i]:* } +:coordReplacement[i]:* diff_api.TexEnviv(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, &replacement); ++:coordReplacement[i]:* from->coordReplacement[i] = to->coordReplacement[i]; :coordReplacement[i]:*} -:coordReplacement[i]:*diff_api.TexEnviv(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, &replacement); -+:coordReplacement[i]:*from->coordReplacement[i] = to->coordReplacement[i]; %flush >} >if (activeUnit != toCtx->texture.curTextureUnit) diff --git a/state_tracker/state_polygon.txt b/state_tracker/state_polygon.txt index 2c81285..951ea5a 100644 --- a/state_tracker/state_polygon.txt +++ b/state_tracker/state_polygon.txt @@ -15,8 +15,10 @@ :mode:frontMode:PolygonMode,GL_FRONT -:stipple:stipple:*diff_api.PolygonStipple ((GLubyte *) to->stipple); +:stipple:*int j; -+:stipple:*diff_api.PolygonStipple ((GLubyte *) to->stipple); -+:stipple:*for (j=0; j<32; j++) -+:stipple:*{ -+:stipple:* from->stipple[j] = to->stipple[j]; ++:stipple:*for (j=0; j<32; j++) { ++:stipple:* if (from->stipple[j] != to->stipple[j]) { ++:stipple:* diff_api.PolygonStipple ((GLubyte *) to->stipple); ++:stipple:* for (; j<32; j++) ++:stipple:* from->stipple[j] = to->stipple[j]; ++:stipple:* } +:stipple:*} diff --git a/state_tracker/state_texdiff.c b/state_tracker/state_texdiff.c index 6c4f933..d4f24a7 100644 --- a/state_tracker/state_texdiff.c +++ b/state_tracker/state_texdiff.c @@ -579,6 +579,23 @@ int crStateTextureCheckDirtyImages(CRContext *from, CRContext *to, GLenum target return 0; } +static void +ActiveTexture(CRContext *ctx, unsigned int u) +{ + if (ctx->texture.curTextureUnit != u) { + diff_api.ActiveTextureARB( GL_TEXTURE0_ARB + u); + ctx->texture.curTextureUnit = u; + } +} + +static void +MatrixMode(CRContext *ctx, GLenum mode) +{ + if (ctx->transform.matrixMode != GL_MODELVIEW) { + diff_api.MatrixMode(GL_MODELVIEW); + ctx->transform.matrixMode = GL_MODELVIEW; + } +} /* * Do texture state differencing for the given texture object. @@ -838,8 +855,6 @@ crStateTextureObjectDiff(CRContext *fromCtx, } /* if (CHECKDIRTY(tobj->imageBit, bitID)) */ } - - void crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, CRContext *fromCtx, CRContext *toCtx ) @@ -866,26 +881,22 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, /* take care of enables/disables */ if (CHECKDIRTY(tb->enable[u], bitID)) { - - /* Activate texture unit u if needed */ - if (fromCtx->texture.curTextureUnit != u) { - diff_api.ActiveTextureARB( GL_TEXTURE0_ARB + u); - fromCtx->texture.curTextureUnit = u; - } - if (from->unit[u].enabled1D != to->unit[u].enabled1D) { + ActiveTexture( fromCtx, u ); able[to->unit[u].enabled1D](GL_TEXTURE_1D); from->unit[u].enabled1D = to->unit[u].enabled1D; } if (from->unit[u].enabled2D != to->unit[u].enabled2D) { + ActiveTexture( fromCtx, u ); able[to->unit[u].enabled2D](GL_TEXTURE_2D); from->unit[u].enabled2D = to->unit[u].enabled2D; } #ifdef CR_OPENGL_VERSION_1_2 if (from->unit[u].enabled3D != to->unit[u].enabled3D) { + ActiveTexture( fromCtx, u ); able[to->unit[u].enabled3D](GL_TEXTURE_3D); from->unit[u].enabled3D = to->unit[u].enabled3D; } @@ -894,6 +905,7 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, if (fromCtx->extensions.ARB_texture_cube_map && from->unit[u].enabledCubeMap != to->unit[u].enabledCubeMap) { + ActiveTexture( fromCtx, u ); able[to->unit[u].enabledCubeMap](GL_TEXTURE_CUBE_MAP_ARB); from->unit[u].enabledCubeMap = to->unit[u].enabledCubeMap; } @@ -902,6 +914,7 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, if (fromCtx->extensions.NV_texture_rectangle && from->unit[u].enabledRect != to->unit[u].enabledRect) { + ActiveTexture( fromCtx, u ); able[to->unit[u].enabledRect](GL_TEXTURE_RECTANGLE_NV); from->unit[u].enabledRect = to->unit[u].enabledRect; } @@ -913,6 +926,7 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, from->unit[u].textureGen.r != to->unit[u].textureGen.r || from->unit[u].textureGen.q != to->unit[u].textureGen.q) { + ActiveTexture( fromCtx, u ); able[to->unit[u].textureGen.s](GL_TEXTURE_GEN_S); able[to->unit[u].textureGen.t](GL_TEXTURE_GEN_T); able[to->unit[u].textureGen.r](GL_TEXTURE_GEN_R); @@ -926,10 +940,6 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, /* Texgen coefficients */ if (CHECKDIRTY(tb->objGen[u], bitID)) { - if (fromCtx->texture.curTextureUnit != u) { - diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB ); - fromCtx->texture.curTextureUnit = u; - } if (from->unit[u].objSCoeff.x != to->unit[u].objSCoeff.x || from->unit[u].objSCoeff.y != to->unit[u].objSCoeff.y || from->unit[u].objSCoeff.z != to->unit[u].objSCoeff.z || @@ -940,6 +950,7 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, f[1] = to->unit[u].objSCoeff.y; f[2] = to->unit[u].objSCoeff.z; f[3] = to->unit[u].objSCoeff.w; + ActiveTexture( fromCtx, u ); diff_api.TexGenfv (GL_S, GL_OBJECT_PLANE, (const GLfloat *) f); from->unit[u].objSCoeff = to->unit[u].objSCoeff; } @@ -953,6 +964,7 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, f[1] = to->unit[u].objTCoeff.y; f[2] = to->unit[u].objTCoeff.z; f[3] = to->unit[u].objTCoeff.w; + ActiveTexture( fromCtx, u ); diff_api.TexGenfv (GL_T, GL_OBJECT_PLANE, (const GLfloat *) f); from->unit[u].objTCoeff = to->unit[u].objTCoeff; } @@ -966,6 +978,7 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, f[1] = to->unit[u].objRCoeff.y; f[2] = to->unit[u].objRCoeff.z; f[3] = to->unit[u].objRCoeff.w; + ActiveTexture( fromCtx, u ); diff_api.TexGenfv (GL_R, GL_OBJECT_PLANE, (const GLfloat *) f); from->unit[u].objRCoeff = to->unit[u].objRCoeff; } @@ -979,6 +992,7 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, f[1] = to->unit[u].objQCoeff.y; f[2] = to->unit[u].objQCoeff.z; f[3] = to->unit[u].objQCoeff.w; + ActiveTexture( fromCtx, u ); diff_api.TexGenfv (GL_Q, GL_OBJECT_PLANE, (const GLfloat *) f); from->unit[u].objQCoeff = to->unit[u].objQCoeff; } @@ -986,16 +1000,6 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, } if (CHECKDIRTY(tb->eyeGen[u], bitID)) { - if (fromCtx->texture.curTextureUnit != u) { - diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB ); - fromCtx->texture.curTextureUnit = u; - } - if (fromCtx->transform.matrixMode != GL_MODELVIEW) { - diff_api.MatrixMode(GL_MODELVIEW); - fromCtx->transform.matrixMode = GL_MODELVIEW; - } - diff_api.PushMatrix(); - diff_api.LoadIdentity(); if (from->unit[u].eyeSCoeff.x != to->unit[u].eyeSCoeff.x || from->unit[u].eyeSCoeff.y != to->unit[u].eyeSCoeff.y || from->unit[u].eyeSCoeff.z != to->unit[u].eyeSCoeff.z || @@ -1006,7 +1010,12 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, f[1] = to->unit[u].eyeSCoeff.y; f[2] = to->unit[u].eyeSCoeff.z; f[3] = to->unit[u].eyeSCoeff.w; + MatrixMode( fromCtx, GL_MODELVIEW ); + diff_api.PushMatrix(); + diff_api.LoadIdentity(); + ActiveTexture( fromCtx, u ); diff_api.TexGenfv (GL_S, GL_EYE_PLANE, (const GLfloat *) f); + diff_api.PopMatrix(); from->unit[u].eyeSCoeff = to->unit[u].eyeSCoeff; } if (from->unit[u].eyeTCoeff.x != to->unit[u].eyeTCoeff.x || @@ -1019,7 +1028,12 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, f[1] = to->unit[u].eyeTCoeff.y; f[2] = to->unit[u].eyeTCoeff.z; f[3] = to->unit[u].eyeTCoeff.w; + MatrixMode( fromCtx, GL_MODELVIEW ); + diff_api.PushMatrix(); + diff_api.LoadIdentity(); + ActiveTexture( fromCtx, u ); diff_api.TexGenfv (GL_T, GL_EYE_PLANE, (const GLfloat *) f); + diff_api.PopMatrix(); from->unit[u].eyeTCoeff = to->unit[u].eyeTCoeff; } if (from->unit[u].eyeRCoeff.x != to->unit[u].eyeRCoeff.x || @@ -1032,7 +1046,12 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, f[1] = to->unit[u].eyeRCoeff.y; f[2] = to->unit[u].eyeRCoeff.z; f[3] = to->unit[u].eyeRCoeff.w; + MatrixMode( fromCtx, GL_MODELVIEW ); + diff_api.PushMatrix(); + diff_api.LoadIdentity(); + ActiveTexture( fromCtx, u ); diff_api.TexGenfv (GL_R, GL_EYE_PLANE, (const GLfloat *) f); + diff_api.PopMatrix(); from->unit[u].eyeRCoeff = to->unit[u].eyeRCoeff; } if (from->unit[u].eyeQCoeff.x != to->unit[u].eyeQCoeff.x || @@ -1045,23 +1064,24 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, f[1] = to->unit[u].eyeQCoeff.y; f[2] = to->unit[u].eyeQCoeff.z; f[3] = to->unit[u].eyeQCoeff.w; + MatrixMode( fromCtx, GL_MODELVIEW ); + diff_api.PushMatrix(); + diff_api.LoadIdentity(); + ActiveTexture( fromCtx, u ); diff_api.TexGenfv (GL_Q, GL_EYE_PLANE, (const GLfloat *) f); + diff_api.PopMatrix(); from->unit[u].eyeQCoeff = to->unit[u].eyeQCoeff; } - diff_api.PopMatrix(); CLEARDIRTY(tb->eyeGen[u], nbitID); } if (CHECKDIRTY(tb->genMode[u], bitID)) { - if (fromCtx->texture.curTextureUnit != u) { - diff_api.ActiveTextureARB( u + GL_TEXTURE0_ARB ); - fromCtx->texture.curTextureUnit = u; - } if (from->unit[u].gen.s != to->unit[u].gen.s || from->unit[u].gen.t != to->unit[u].gen.t || from->unit[u].gen.r != to->unit[u].gen.r || from->unit[u].gen.q != to->unit[u].gen.q) { + ActiveTexture( fromCtx, u ); diff_api.TexGeni (GL_S, GL_TEXTURE_GEN_MODE, to->unit[u].gen.s); diff_api.TexGeni (GL_T, GL_TEXTURE_GEN_MODE, to->unit[u].gen.t); diff_api.TexGeni (GL_R, GL_TEXTURE_GEN_MODE, to->unit[u].gen.r); @@ -1237,17 +1257,12 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, continue; /* with next target */ } - /* Activate texture unit u if needed */ - if (fromCtx->texture.curTextureUnit != u) { - diff_api.ActiveTextureARB( GL_TEXTURE0_ARB + u); - fromCtx->texture.curTextureUnit = u; - } - /* bind this texture if needed */ if (CHECKDIRTY(tb->current[u], bitID)) { - if (*fromBinding != tobj) + if (!*fromBinding || (*fromBinding)->name != tobj->name) { + ActiveTexture( fromCtx, u ); diff_api.BindTexture(tobj->target, tobj->name); *fromBinding = tobj; } @@ -1256,7 +1271,8 @@ crStateTextureDiff( CRTextureBits *tb, CRbitvalue *bitID, /* now, if the texture object is dirty */ if (CHECKDIRTY(tobj->dirty, bitID)) { - crStateTextureObjectDiff(fromCtx, bitID, nbitID, tobj, GL_FALSE); + ActiveTexture( fromCtx, u ); + crStateTextureObjectDiff(fromCtx, bitID, nbitID, tobj, GL_FALSE); } CLEARDIRTY(tobj->dirty, nbitID); diff --git a/state_tracker/state_transform.c b/state_tracker/state_transform.c index 923a204..88479e5 100644 --- a/state_tracker/state_transform.c +++ b/state_tracker/state_transform.c @@ -1192,12 +1192,6 @@ crStateTransformDiff( CRTransformBits *t, CRbitvalue *bitID, } if (CHECKDIRTY(t->clipPlane, bitID)) { - if (from->matrixMode != GL_MODELVIEW) { - diff_api.MatrixMode(GL_MODELVIEW); - from->matrixMode = GL_MODELVIEW; - } - diff_api.PushMatrix(); - diff_api.LoadIdentity(); for (i=0; i<CR_MAX_CLIP_PLANES; i++) { if (from->clipPlane[i].x != to->clipPlane[i].x || from->clipPlane[i].y != to->clipPlane[i].y || @@ -1210,11 +1204,17 @@ crStateTransformDiff( CRTransformBits *t, CRbitvalue *bitID, cp[2] = to->clipPlane[i].z; cp[3] = to->clipPlane[i].w; + if (from->matrixMode != GL_MODELVIEW) { + diff_api.MatrixMode(GL_MODELVIEW); + from->matrixMode = GL_MODELVIEW; + } + diff_api.PushMatrix(); + diff_api.LoadIdentity(); diff_api.ClipPlane(GL_CLIP_PLANE0 + i, (const GLdouble *)(cp)); + diff_api.PopMatrix(); from->clipPlane[i] = to->clipPlane[i]; } } - diff_api.PopMatrix(); CLEARDIRTY(t->clipPlane, nbitID); } @@ -1228,7 +1228,8 @@ crStateTransformDiff( CRTransformBits *t, CRbitvalue *bitID, * - Alan H. */ if ( (from->modelViewStack.depth != to->modelViewStack.depth) || - CHECKDIRTY(t->modelviewMatrix, bitID) ) + (CHECKDIRTY(t->modelviewMatrix, bitID) && + !crMatrixIsEqual(to->modelViewStack.top, from->modelViewStack.top))) { if (from->matrixMode != GL_MODELVIEW) { diff_api.MatrixMode(GL_MODELVIEW); @@ -1262,7 +1263,8 @@ crStateTransformDiff( CRTransformBits *t, CRbitvalue *bitID, /* Projection matrix */ if ( (from->projectionStack.depth != to->projectionStack.depth) || - CHECKDIRTY(t->projectionMatrix, bitID) ) + (CHECKDIRTY(t->projectionMatrix, bitID) && + !crMatrixIsEqual(to->projectionStack.top, from->projectionStack.top))) { if (from->matrixMode != GL_PROJECTION) { diff_api.MatrixMode(GL_PROJECTION); @@ -1296,10 +1298,12 @@ crStateTransformDiff( CRTransformBits *t, CRbitvalue *bitID, /* Texture matrices */ for (i = 0 ; i < maxTextureUnits ; i++) - if (from->textureStack[i].depth != to->textureStack[i].depth) + if (from->textureStack[i].depth != to->textureStack[i].depth || + (CHECKDIRTY(t->textureMatrix, bitID) && + !crMatrixIsEqual(to->textureStack[i].top, from->textureStack[i].top))) checktex = 1; - if (checktex || CHECKDIRTY(t->textureMatrix, bitID)) + if (checktex) { if (from->matrixMode != GL_TEXTURE) { diff_api.MatrixMode(GL_TEXTURE); @@ -1345,7 +1349,8 @@ crStateTransformDiff( CRTransformBits *t, CRbitvalue *bitID, /* Color matrix */ if ( (from->colorStack.depth != to->colorStack.depth) || - CHECKDIRTY(t->colorMatrix, bitID) ) + (CHECKDIRTY(t->colorMatrix, bitID) && + !crMatrixIsEqual(to->colorStack.top, from->colorStack.top)) ) { if (from->matrixMode != GL_COLOR) { diff_api.MatrixMode(GL_COLOR);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor