e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/* Copyright (c) 2001, Stanford University
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * All rights reserved
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync *
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * See the file LICENSE.txt for information on redistributing this software.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#include "cr_mem.h"
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#include "state.h"
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#include "state_internals.h"
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/*
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Note: regardless of GL_NV_vertex_program, we store all per-vertex
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * attributes in an array now, instead of specially named attributes
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * like color, normal, texcoord, etc.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid crStateCurrentInit( CRContext *ctx )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRCurrentState *c = &ctx->current;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRStateBits *sb = GetCurrentBits();
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRCurrentBits *cb = &(sb->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync static const GLfloat default_normal[4] = {0.0f, 0.0f, 1.0f, 1.0f};
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync static const GLfloat default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync static const GLfloat default_secondaryColor[4] = {0.0f, 0.0f, 0.0f, 1.0f};
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync static const GLfloat default_attrib[4] = {0.0f, 0.0f, 0.0f, 1.0f};
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync unsigned int i;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /*
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * initialize all vertex attributes to <0,0,0,1> for starters
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(c->vertexAttrib[i], default_attrib);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(c->vertexAttribPre[i], default_attrib);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* now re-do the exceptions */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], default_color);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1], default_secondaryColor);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], default_normal);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->rasterIndex = 1.0f;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->colorIndex = c->colorIndexPre = 1.0;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->edgeFlag = c->edgeFlagPre = GL_TRUE;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Set the "pre" values and raster position attributes */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(c->vertexAttribPre[i], c->vertexAttrib[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(c->rasterAttrib[i], c->vertexAttrib[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(c->rasterAttribPre[i], c->vertexAttrib[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->rasterValid = GL_TRUE;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->inBeginEnd = GL_FALSE;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->beginEndNum = 0;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /*c->beginEndMax = cfg->beginend_max;*/
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->mode = 0x10; /* Undefined Mode */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->flushOnEnd = 0;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->current = 0; /* picked up by crStateSetCurrentPointers() */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* init dirty bits */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync RESET(cb->dirty, ctx->bitid);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync RESET(cb->vertexAttrib[i], ctx->bitid);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync RESET(cb->edgeFlag, ctx->bitid);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync RESET(cb->colorIndex, ctx->bitid);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync RESET(cb->rasterPos, ctx->bitid);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid STATE_APIENTRY crStateColor3f( GLfloat r, GLfloat g, GLfloat b )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crStateColor4f(r, g, b, 1.0F);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid STATE_APIENTRY crStateColor3fv( const GLfloat *color )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crStateColor4f( color[0], color[1], color[2], 1.0F );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid STATE_APIENTRY crStateColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRContext *g = GetCurrentContext();
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRCurrentState *c = &(g->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRStateBits *sb = GetCurrentBits();
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRCurrentBits *cb = &(sb->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FLUSH();
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->vertexAttrib[VERT_ATTRIB_COLOR0][0] = red;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->vertexAttrib[VERT_ATTRIB_COLOR0][1] = green;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->vertexAttrib[VERT_ATTRIB_COLOR0][2] = blue;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->vertexAttrib[VERT_ATTRIB_COLOR0][3] = alpha;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync DIRTY(cb->dirty, g->neg_bitid);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync DIRTY(cb->vertexAttrib[VERT_ATTRIB_COLOR0], g->neg_bitid);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid STATE_APIENTRY crStateColor4fv( const GLfloat *color )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crStateColor4f( color[0], color[1], color[2], color[3] );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid crStateSetCurrentPointers( CRContext *ctx, CRCurrentStatePointers *current )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRCurrentState *c = &(ctx->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->current = current;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid crStateResetCurrentPointers( CRCurrentStatePointers *current )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
fcded3b75bf930c68355adc3e3757e35e9cabde4vboxsync uint32_t attribsUsedMask = current->attribsUsedMask;
fcded3b75bf930c68355adc3e3757e35e9cabde4vboxsync
fcded3b75bf930c68355adc3e3757e35e9cabde4vboxsync crMemset(current, 0, sizeof (*current));
fcded3b75bf930c68355adc3e3757e35e9cabde4vboxsync
fcded3b75bf930c68355adc3e3757e35e9cabde4vboxsync current->attribsUsedMask = attribsUsedMask;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid STATE_APIENTRY crStateBegin( GLenum mode )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRContext *g = GetCurrentContext();
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRCurrentState *c = &(g->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (mode > GL_POLYGON)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "Begin called with invalid mode: %d", mode);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (c->inBeginEnd)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glBegin called inside Begin/End");
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->attribsUsedMask = 0;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->inBeginEnd = GL_TRUE;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->mode = mode;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->beginEndNum++;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid STATE_APIENTRY crStateEnd( void )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRContext *g = GetCurrentContext();
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRCurrentState *c = &(g->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (!c->inBeginEnd)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION, "glEnd called outside Begin/End" );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync c->inBeginEnd = GL_FALSE;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid crStateCurrentSwitch( CRCurrentBits *c, CRbitvalue *bitID,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRContext *fromCtx, CRContext *toCtx )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const CRCurrentState *from = &(fromCtx->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const CRCurrentState *to = &(toCtx->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLuint maxTextureUnits = fromCtx->limits.maxTextureUnits;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync unsigned int i, j;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRbitvalue nbitID[CR_MAX_BITARRAY];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (j=0;j<CR_MAX_BITARRAY;j++)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync nbitID[j] = ~bitID[j];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->rasterPos, bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (to->rasterValid) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat fromX = from->rasterAttrib[VERT_ATTRIB_POS][0];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat fromY = from->rasterAttrib[VERT_ATTRIB_POS][1];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat fromZ = from->rasterAttrib[VERT_ATTRIB_POS][2];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat toX = to->rasterAttrib[VERT_ATTRIB_POS][0];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat toY = to->rasterAttrib[VERT_ATTRIB_POS][1];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat toZ = to->rasterAttrib[VERT_ATTRIB_POS][2];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (toX != fromX || toY != fromY || toZ != fromZ) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Use glWindowPos (which updates raster color) */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.WindowPos3fvARB(to->rasterAttrib[VERT_ATTRIB_POS]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->rasterPos);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->rasterPos, nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Vertex Current State Switch Code */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Its important that we don't do a value check here because
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync ** current may not actually have the correct values, I think...
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ** We also need to restore the current state tracking pointer
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ** since the packing functions will set it.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->colorIndex, bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (to->colorIndex != from->colorIndex) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.Indexf(to->colorIndex);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->colorIndex);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->colorIndex, nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->edgeFlag, bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (to->edgeFlag != from->edgeFlag) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.EdgeFlag(to->edgeFlag);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->edgeFlag);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->edgeFlag, nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* If using a vertex program, update the generic vertex attributes,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * which may or may not be aliased with conventional attributes.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#if defined(CR_ARB_vertex_program) || defined(CR_NV_vertex_progra)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (toCtx->program.vpEnabled &&
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync (toCtx->extensions.ARB_vertex_program ||
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync (toCtx->extensions.NV_vertex_program))) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const unsigned attribsUsedMask = toCtx->current.attribsUsedMask;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 1; i < CR_MAX_VERTEX_ATTRIBS; i++) { /* skip zero */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if ((attribsUsedMask & (1 << i))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync && CHECKDIRTY(c->vertexAttrib[i], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_VECTOR (from->vertexAttrib[i], to->vertexAttribPre[i])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.VertexAttrib4fvARB(i, &(to->vertexAttrib[i][0]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->vertexAttrib[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[i], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Fall-through so that attributes which don't have their bit set in the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * attribsUsedMask get handled via the conventional attribute functions.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* use conventional attribute functions */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* NEED TO FIX THIS!!!!!! */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR0], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR0],to->vertexAttrib[VERT_ATTRIB_COLOR0])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.Color4fv ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_COLOR0]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR0]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR0], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* NEED TO FIX THIS, ALSO?!!!!! */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#ifdef CR_EXT_secondary_color
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR1], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR1],to->vertexAttrib[VERT_ATTRIB_COLOR1])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.SecondaryColor3fvEXT ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_COLOR1]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR1]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR1], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* NEED TO FIX THIS, ALSO?!!!!! */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#ifdef CR_EXT_fog_coord
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (from->vertexAttrib[VERT_ATTRIB_FOG][0] != to->vertexAttrib[VERT_ATTRIB_FOG][0] ) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.FogCoordfvEXT ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_FOG][0] ));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_NORMAL], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_VECTOR (from->vertexAttrib[VERT_ATTRIB_NORMAL], to->vertexAttrib[VERT_ATTRIB_NORMAL])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.Normal3fv ((GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_NORMAL][0]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_NORMAL]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_NORMAL], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 0; i < maxTextureUnits; i++) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_TEXCOORD (from->vertexAttrib[VERT_ATTRIB_TEX0 + i], to->vertexAttribPre[VERT_ATTRIB_TEX0 + i])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.MultiTexCoord4fvARB (i+GL_TEXTURE0_ARB, (GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_TEX0+ i][0]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->vertexAttrib[VERT_ATTRIB_TEX0 + i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync FILLDIRTY(c->dirty);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->dirty, nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrStateCurrentDiff( CRCurrentBits *c, CRbitvalue *bitID,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRContext *fromCtx, CRContext *toCtx )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRCurrentState *from = &(fromCtx->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const CRCurrentState *to = &(toCtx->current);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync unsigned int i, j;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CRbitvalue nbitID[CR_MAX_BITARRAY];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (j=0;j<CR_MAX_BITARRAY;j++)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync nbitID[j] = ~bitID[j];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->rasterPos, bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync from->rasterValid = to->rasterValid;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (to->rasterValid) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat fromX = from->rasterAttrib[VERT_ATTRIB_POS][0];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat fromY = from->rasterAttrib[VERT_ATTRIB_POS][1];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat fromZ = from->rasterAttrib[VERT_ATTRIB_POS][2];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat toX = to->rasterAttrib[VERT_ATTRIB_POS][0];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat toY = to->rasterAttrib[VERT_ATTRIB_POS][1];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const GLfloat toZ = to->rasterAttrib[VERT_ATTRIB_POS][2];
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (toX != fromX || toY != fromY || toZ != fromZ) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Use glWindowPos (which updates raster color) */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.WindowPos3fvARB(to->rasterAttrib[VERT_ATTRIB_POS]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync from->rasterAttrib[VERT_ATTRIB_POS][0] = toX;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync from->rasterAttrib[VERT_ATTRIB_POS][1] = toY;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync from->rasterAttrib[VERT_ATTRIB_POS][2] = toZ;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->rasterPos, nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Vertex Current State Sync Code */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Some things to note here:
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ** 1) Compare is done against the pre value since the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ** current value includes the geometry info.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ** 2) Update is done with the current value since
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ** the server will be getting the geometry block
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ** 3) Copy is done outside of the compare to ensure
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ** that it happens.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* edge flag */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->edgeFlag, bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (from->edgeFlag != to->edgeFlagPre) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.EdgeFlag (to->edgeFlagPre);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync from->edgeFlag = to->edgeFlag;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->edgeFlag, nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* color index */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->colorIndex, bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (from->colorIndex != to->colorIndexPre) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.Indexf (to->colorIndex);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync from->colorIndex = to->colorIndex;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->colorIndex, nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* If using a vertex program, update the generic vertex attributes,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * which may or may not be aliased with conventional attributes.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#if defined(CR_ARB_vertex_program) || defined(CR_NV_vertex_progra)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (toCtx->program.vpEnabled &&
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync (toCtx->extensions.ARB_vertex_program ||
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync (toCtx->extensions.NV_vertex_program))) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync const unsigned attribsUsedMask = toCtx->current.attribsUsedMask;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync int i;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 1; i < CR_MAX_VERTEX_ATTRIBS; i++) { /* skip zero */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if ((attribsUsedMask & (1 << i))
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync && CHECKDIRTY(c->vertexAttrib[i], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_VECTOR (from->vertexAttrib[i], to->vertexAttribPre[i])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.VertexAttrib4fvARB(i, &(to->vertexAttribPre[i][0]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(from->vertexAttrib[i] , to->vertexAttrib[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[i], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* Fall-through so that attributes which don't have their bit set in the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * attribsUsedMask get handled via the conventional attribute functions.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /* use conventional attribute functions */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR0], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR0],to->vertexAttribPre[VERT_ATTRIB_COLOR0])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.Color4fv ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_COLOR0]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(from->vertexAttrib[VERT_ATTRIB_COLOR0] , to->vertexAttrib[VERT_ATTRIB_COLOR0]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR0], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#ifdef CR_EXT_secondary_color
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR1], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR1],to->vertexAttribPre[VERT_ATTRIB_COLOR1])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.SecondaryColor3fvEXT ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_COLOR1]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(from->vertexAttrib[VERT_ATTRIB_COLOR1] , to->vertexAttrib[VERT_ATTRIB_COLOR1]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_COLOR1], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#ifdef CR_EXT_fog_coord
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (from->vertexAttrib[VERT_ATTRIB_FOG] != to->vertexAttribPre[VERT_ATTRIB_FOG]) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.FogCoordfvEXT ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_FOG]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(from->vertexAttrib[VERT_ATTRIB_FOG] , to->vertexAttrib[VERT_ATTRIB_FOG]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_FOG], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_NORMAL], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_VECTOR (from->vertexAttrib[VERT_ATTRIB_NORMAL], to->vertexAttribPre[VERT_ATTRIB_NORMAL])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.Normal3fv ((GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_NORMAL]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(from->vertexAttrib[VERT_ATTRIB_NORMAL] , to->vertexAttrib[VERT_ATTRIB_NORMAL]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_NORMAL], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for ( i = 0 ; i < fromCtx->limits.maxTextureUnits ; i++)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (CHECKDIRTY(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], bitID)) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (COMPARE_TEXCOORD (from->vertexAttrib[VERT_ATTRIB_TEX0 + i], to->vertexAttribPre[VERT_ATTRIB_TEX0 + i])) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync diff_api.MultiTexCoord4fvARB (GL_TEXTURE0_ARB + i, (GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_TEX0 + i]));
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync COPY_4V(from->vertexAttrib[VERT_ATTRIB_TEX0 + i] , to->vertexAttrib[VERT_ATTRIB_TEX0 + i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync CLEARDIRTY(c->dirty, nbitID);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}