summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/attrib.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2000-10-30 13:31:59 +0000
committerKeith Whitwell <[email protected]>2000-10-30 13:31:59 +0000
commita96308c37db0bc0086a017d318bc3504aa5f0b1a (patch)
tree0010de3aa19901acf13b57e57e7ba465abffa95e /src/mesa/main/attrib.c
parenta4575499679d9d91055a35c7673b81872ec127cb (diff)
Replace the flags Mesa was using for ctx->NewState with a new set
based on the GL attribute groups. Introduced constants describing the circumstances under which some key derived values can change: _SWRAST_NEW_RASTERMASK -- ctx->RasterMask _SWRAST_NEW_TRIANGLE -- The software rasterizer's triangle function _DD_NEW_FEEDBACK -- the 'DD_FEEDBACK' bit in ctx->TriangleCaps These are helpful in deciding whether you need to recalculate state if your recalculation involves reference to a derived value.
Diffstat (limited to 'src/mesa/main/attrib.c')
-rw-r--r--src/mesa/main/attrib.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 7d4199e27f4..bacd2e1ca4d 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.30 2000/10/29 18:12:14 brianp Exp $ */
+/* $Id: attrib.c,v 1.31 2000/10/30 13:31:59 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -564,6 +564,7 @@ _mesa_PopAttrib(void)
switch (attr->kind) {
case GL_ACCUM_BUFFER_BIT:
MEMCPY( &ctx->Accum, attr->data, sizeof(struct gl_accum_attrib) );
+ ctx->NewState |= _NEW_ACCUM;
break;
case GL_COLOR_BUFFER_BIT:
{
@@ -575,6 +576,7 @@ _mesa_PopAttrib(void)
GLenum oldLogicOp = ctx->Color.LogicOp;
MEMCPY( &ctx->Color, attr->data,
sizeof(struct gl_colorbuffer_attrib) );
+ ctx->NewState |= _NEW_COLOR;
if (ctx->Color.DrawBuffer != oldDrawBuffer) {
_mesa_DrawBuffer( ctx->Color.DrawBuffer);
}
@@ -623,6 +625,7 @@ _mesa_PopAttrib(void)
GLfloat oldDepthClear = ctx->Depth.Clear;
MEMCPY( &ctx->Depth, attr->data,
sizeof(struct gl_depthbuffer_attrib) );
+ ctx->NewState |= _NEW_DEPTH;
if (ctx->Depth.Test != oldDepthTest && ctx->Driver.Enable)
(*ctx->Driver.Enable)( ctx, GL_DEPTH_TEST, ctx->Depth.Test);
if (ctx->Depth.Func != oldDepthFunc && ctx->Driver.DepthFunc)
@@ -638,15 +641,18 @@ _mesa_PopAttrib(void)
const struct gl_enable_attrib *enable;
enable = (const struct gl_enable_attrib *) attr->data;
pop_enable_group(ctx, enable);
+ ctx->NewState |= _NEW_ALL;
}
break;
case GL_EVAL_BIT:
MEMCPY( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) );
+ ctx->NewState |= _NEW_EVAL;
break;
case GL_FOG_BIT:
{
GLboolean anyChange = (GLboolean) (memcmp( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) ) != 0);
MEMCPY( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) );
+ ctx->NewState |= _NEW_FOG;
if (anyChange && ctx->Driver.Fogfv) {
const GLfloat mode = (GLfloat) ctx->Fog.Mode;
const GLfloat density = ctx->Fog.Density;
@@ -666,6 +672,7 @@ _mesa_PopAttrib(void)
break;
case GL_HINT_BIT:
MEMCPY( &ctx->Hint, attr->data, sizeof(struct gl_hint_attrib) );
+ ctx->NewState |= _NEW_HINT;
if (ctx->Driver.Hint) {
(*ctx->Driver.Hint)( ctx, GL_PERSPECTIVE_CORRECTION_HINT,
ctx->Hint.PerspectiveCorrection );
@@ -680,6 +687,7 @@ _mesa_PopAttrib(void)
break;
case GL_LIGHTING_BIT:
MEMCPY( &ctx->Light, attr->data, sizeof(struct gl_light_attrib) );
+ ctx->NewState |= _NEW_LIGHT;
if (ctx->Driver.Enable) {
GLuint i;
for (i = 0; i < MAX_LIGHTS; i++) {
@@ -700,6 +708,7 @@ _mesa_PopAttrib(void)
break;
case GL_LINE_BIT:
MEMCPY( &ctx->Line, attr->data, sizeof(struct gl_line_attrib) );
+ ctx->NewState |= _NEW_LINE;
if (ctx->Driver.Enable) {
(*ctx->Driver.Enable)( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag );
(*ctx->Driver.Enable)( ctx, GL_LINE_STIPPLE, ctx->Line.StippleFlag );
@@ -715,9 +724,11 @@ _mesa_PopAttrib(void)
break;
case GL_PIXEL_MODE_BIT:
MEMCPY( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) );
+ ctx->NewState |= _NEW_PIXEL;
break;
case GL_POINT_BIT:
MEMCPY( &ctx->Point, attr->data, sizeof(struct gl_point_attrib) );
+ ctx->NewState |= _NEW_POINT;
if (ctx->Driver.Enable)
(*ctx->Driver.Enable)( ctx, GL_POINT_SMOOTH, ctx->Point.SmoothFlag );
break;
@@ -727,6 +738,7 @@ _mesa_PopAttrib(void)
GLenum oldBackMode = ctx->Polygon.BackMode;
MEMCPY( &ctx->Polygon, attr->data,
sizeof(struct gl_polygon_attrib) );
+ ctx->NewState |= _NEW_POLYGON;
if ((ctx->Polygon.FrontMode != oldFrontMode ||
ctx->Polygon.BackMode != oldBackMode) &&
ctx->Driver.PolygonMode) {
@@ -745,12 +757,14 @@ _mesa_PopAttrib(void)
break;
case GL_POLYGON_STIPPLE_BIT:
MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) );
+ ctx->NewState |= _NEW_POLYGONSTIPPLE;
if (ctx->Driver.PolygonStipple)
ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data );
break;
case GL_SCISSOR_BIT:
MEMCPY( &ctx->Scissor, attr->data,
sizeof(struct gl_scissor_attrib) );
+ ctx->NewState |= _NEW_SCISSOR;
if (ctx->Driver.Enable)
(*ctx->Driver.Enable)( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled );
if (ctx->Driver.Scissor)
@@ -760,6 +774,7 @@ _mesa_PopAttrib(void)
case GL_STENCIL_BUFFER_BIT:
MEMCPY( &ctx->Stencil, attr->data,
sizeof(struct gl_stencil_attrib) );
+ ctx->NewState |= _NEW_STENCIL;
if (ctx->Driver.StencilFunc)
(*ctx->Driver.StencilFunc)( ctx, ctx->Stencil.Function,
ctx->Stencil.Ref, ctx->Stencil.ValueMask);
@@ -780,6 +795,7 @@ _mesa_PopAttrib(void)
case GL_TRANSFORM_BIT:
MEMCPY( &ctx->Transform, attr->data,
sizeof(struct gl_transform_attrib) );
+ ctx->NewState |= _NEW_TRANSFORM;
if (ctx->Driver.Enable) {
(*ctx->Driver.Enable)( ctx, GL_NORMALIZE, ctx->Transform.Normalize );
(*ctx->Driver.Enable)( ctx, GL_RESCALE_NORMAL_EXT, ctx->Transform.RescaleNormals );
@@ -799,6 +815,7 @@ _mesa_PopAttrib(void)
}
MEMCPY( &ctx->Texture, attr->data,
sizeof(struct gl_texture_attrib) );
+ ctx->NewState |= _NEW_TEXTURE;
/* restore state of the currently bound texture objects */
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
copy_texobj_state( ctx->Texture.Unit[u].CurrentD[1],
@@ -822,7 +839,8 @@ _mesa_PopAttrib(void)
{
struct gl_viewport_attrib *v =
(struct gl_viewport_attrib *)attr->data;
-
+
+ ctx->NewState |= _NEW_VIEWPORT;
_mesa_Viewport( v->X, v->Y, v->Width, v->Height );
_mesa_DepthRange( v->Near, v->Far );
break;
@@ -838,7 +856,6 @@ _mesa_PopAttrib(void)
attr = next;
}
- ctx->NewState = NEW_ALL;
ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
}
@@ -940,7 +957,7 @@ _mesa_PopClientAttrib(void)
attr = next;
}
- ctx->NewState = NEW_ALL;
+ ctx->NewState = _NEW_ARRAY;
}