Remove redundant 'update_materials' stage.
Fix conform segfault with seperate specular colors in mustpass.c. These
tests still fail, however.
-# $Id: Makefile.X11,v 1.43 2001/02/06 21:42:48 brianp Exp $
+# $Id: Makefile.X11,v 1.44 2001/02/16 00:35:34 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
tnl/t_pipeline.c \
tnl/t_vb_fog.c \
tnl/t_vb_light.c \
- tnl/t_vb_material.c \
tnl/t_vb_normals.c \
tnl/t_vb_points.c \
tnl/t_vb_render.c \
-# $Id: Makefile.X11,v 1.43 2001/02/06 21:42:48 brianp Exp $
+# $Id: Makefile.X11,v 1.44 2001/02/16 00:35:34 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
tnl/t_pipeline.c \
tnl/t_vb_fog.c \
tnl/t_vb_light.c \
- tnl/t_vb_material.c \
tnl/t_vb_normals.c \
tnl/t_vb_points.c \
tnl/t_vb_render.c \
-/* $Id: state.c,v 1.57 2001/02/12 19:04:30 brianp Exp $ */
+/* $Id: state.c,v 1.58 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
/*
- * This file manages internal Mesa state update.
+ * This file manages recalculation of derived values in the
+ * __GLcontext.
*/
*/
ctx->NewState = 0;
ctx->Driver.UpdateState(ctx, new_state);
+ ctx->Array.NewState = 0;
-#ifdef DEBUG
- /* At this point we can do some assertions to be sure the required device
- * driver function pointers are all initialized.
+ /* At this point we can do some assertions to be sure the required
+ * device driver function pointers are all initialized.
+ *
+ * KW: Moved the some of these asserts to t_vb_render.c, as they
+ * are strictly only required for that stage. The Driver struct
+ * should probably be split; the read/write span/pixels functions
+ * should be referenced only from swrast, for instance.
*/
- assert(ctx->Driver.GetString);
- assert(ctx->Driver.UpdateState);
- assert(ctx->Driver.Clear);
- assert(ctx->Driver.SetDrawBuffer);
- assert(ctx->Driver.SetReadBuffer);
- assert(ctx->Driver.GetBufferSize);
+ ASSERT(ctx->Driver.GetString);
+ ASSERT(ctx->Driver.UpdateState);
+ ASSERT(ctx->Driver.Clear);
+ ASSERT(ctx->Driver.SetDrawBuffer);
+ ASSERT(ctx->Driver.SetReadBuffer);
+ ASSERT(ctx->Driver.GetBufferSize);
if (ctx->Visual.rgbMode) {
- assert(ctx->Driver.WriteRGBASpan);
- assert(ctx->Driver.WriteRGBSpan);
- assert(ctx->Driver.WriteMonoRGBASpan);
- assert(ctx->Driver.WriteRGBAPixels);
- assert(ctx->Driver.WriteMonoRGBAPixels);
- assert(ctx->Driver.ReadRGBASpan);
- assert(ctx->Driver.ReadRGBAPixels);
+ ASSERT(ctx->Driver.WriteRGBASpan);
+ ASSERT(ctx->Driver.WriteRGBSpan);
+ ASSERT(ctx->Driver.WriteMonoRGBASpan);
+ ASSERT(ctx->Driver.WriteRGBAPixels);
+ ASSERT(ctx->Driver.WriteMonoRGBAPixels);
+ ASSERT(ctx->Driver.ReadRGBASpan);
+ ASSERT(ctx->Driver.ReadRGBAPixels);
}
else {
- assert(ctx->Driver.WriteCI32Span);
- assert(ctx->Driver.WriteCI8Span);
- assert(ctx->Driver.WriteMonoCISpan);
- assert(ctx->Driver.WriteCI32Pixels);
- assert(ctx->Driver.WriteMonoCIPixels);
- assert(ctx->Driver.ReadCI32Span);
- assert(ctx->Driver.ReadCI32Pixels);
+ ASSERT(ctx->Driver.WriteCI32Span);
+ ASSERT(ctx->Driver.WriteCI8Span);
+ ASSERT(ctx->Driver.WriteMonoCISpan);
+ ASSERT(ctx->Driver.WriteCI32Pixels);
+ ASSERT(ctx->Driver.WriteMonoCIPixels);
+ ASSERT(ctx->Driver.ReadCI32Span);
+ ASSERT(ctx->Driver.ReadCI32Pixels);
}
if (ctx->Visual.accumRedBits > 0) {
- assert(ctx->Driver.Accum);
+ ASSERT(ctx->Driver.Accum);
}
- assert(ctx->Driver.DrawPixels);
- assert(ctx->Driver.ReadPixels);
- assert(ctx->Driver.CopyPixels);
- assert(ctx->Driver.Bitmap);
- assert(ctx->Driver.ResizeBuffersMESA);
- assert(ctx->Driver.TexImage1D);
- assert(ctx->Driver.TexImage2D);
- assert(ctx->Driver.TexImage3D);
- assert(ctx->Driver.TexSubImage1D);
- assert(ctx->Driver.TexSubImage2D);
- assert(ctx->Driver.TexSubImage3D);
+ ASSERT(ctx->Driver.DrawPixels);
+ ASSERT(ctx->Driver.ReadPixels);
+ ASSERT(ctx->Driver.CopyPixels);
+ ASSERT(ctx->Driver.Bitmap);
+ ASSERT(ctx->Driver.ResizeBuffersMESA);
+ ASSERT(ctx->Driver.TexImage1D);
+ ASSERT(ctx->Driver.TexImage2D);
+ ASSERT(ctx->Driver.TexImage3D);
+ ASSERT(ctx->Driver.TexSubImage1D);
+ ASSERT(ctx->Driver.TexSubImage2D);
+ ASSERT(ctx->Driver.TexSubImage3D);
if (ctx->Extensions.ARB_texture_compression) {
- assert(ctx->Driver.CompressedTexImage1D);
- assert(ctx->Driver.CompressedTexImage2D);
- assert(ctx->Driver.CompressedTexImage3D);
- assert(ctx->Driver.CompressedTexSubImage1D);
- assert(ctx->Driver.CompressedTexSubImage2D);
- assert(ctx->Driver.CompressedTexSubImage3D);
- assert(ctx->Driver.IsCompressedFormat);
- assert(ctx->Driver.GetCompressedTexImage);
- assert(ctx->Driver.BaseCompressedTexFormat);
+ ASSERT(ctx->Driver.CompressedTexImage1D);
+ ASSERT(ctx->Driver.CompressedTexImage2D);
+ ASSERT(ctx->Driver.CompressedTexImage3D);
+ ASSERT(ctx->Driver.CompressedTexSubImage1D);
+ ASSERT(ctx->Driver.CompressedTexSubImage2D);
+ ASSERT(ctx->Driver.CompressedTexSubImage3D);
+ ASSERT(ctx->Driver.IsCompressedFormat);
+ ASSERT(ctx->Driver.GetCompressedTexImage);
+ ASSERT(ctx->Driver.BaseCompressedTexFormat);
}
- assert(ctx->Driver.RenderStart);
- assert(ctx->Driver.RenderFinish);
- assert(ctx->Driver.BuildProjectedVertices);
- assert(ctx->Driver.RenderPrimitive);
- assert(ctx->Driver.PointsFunc);
- assert(ctx->Driver.LineFunc);
- assert(ctx->Driver.TriangleFunc);
- assert(ctx->Driver.QuadFunc);
- assert(ctx->Driver.ResetLineStipple);
- assert(ctx->Driver.RenderInterp);
- assert(ctx->Driver.RenderCopyPV);
- assert(ctx->Driver.RenderClippedLine);
- assert(ctx->Driver.RenderClippedPolygon);
-#endif
-
- ctx->Array.NewState = 0;
+ ASSERT(ctx->Driver.RenderStart);
+ ASSERT(ctx->Driver.RenderFinish);
}
-/* $Id: ss_context.c,v 1.9 2001/01/29 20:47:39 keithw Exp $ */
+/* $Id: ss_context.c,v 1.10 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
VB->import_data( ctx,
VB->importable_data,
VEC_NOT_WRITEABLE|VEC_BAD_STRIDE);
+
+ /* Ugly hack: Tie up some dangling pointers for flat/twoside code
+ * in ss_tritmp.h and ss_interptmp.h
+ */
+ if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) == 0 ||
+ ctx->Texture._ReallyEnabled == 0) {
+ VB->SecondaryColorPtr[0] = VB->ColorPtr[0];
+ VB->SecondaryColorPtr[1] = VB->ColorPtr[1];
+ }
+
}
void
}
}
- /* Tie up some dangling pointers for flat/twoside code in ss_tritmp.h
- */
- if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) == 0) {
- VB->SecondaryColorPtr[0] = VB->ColorPtr[0];
- VB->SecondaryColorPtr[1] = VB->ColorPtr[1];
- }
-
-
proj = VB->ProjectedClipPtr->data;
if (IND & FOG)
fog = VB->FogCoordPtr->data;
-/* $Id: t_imm_dlist.c,v 1.8 2001/02/15 01:33:52 keithw Exp $ */
+/* $Id: t_imm_dlist.c,v 1.9 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
IM->AndFlag = node->AndFlag;
IM->LastData = node->LastData;
IM->LastPrimitive = node->LastPrimitive;
+ IM->LastMaterial = node->LastMaterial;
+ IM->MaterialOrMask = node->MaterialOrMask;
if ((MESA_VERBOSE & VERBOSE_DISPLAY_LIST) &&
(MESA_VERBOSE & VERBOSE_IMMEDIATE))
-/* $Id: t_imm_exec.c,v 1.11 2001/02/15 01:33:52 keithw Exp $ */
+/* $Id: t_imm_exec.c,v 1.12 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
IM->BeginState = beginstate;
IM->SavedBeginState = savedbeginstate;
IM->TexSize = 0;
+ IM->LastMaterial = 0;
+ IM->MaterialOrMask = 0;
IM->ArrayEltFlags = ~ctx->Array._Enabled;
IM->ArrayEltIncr = ctx->Array.Vertex.Enabled ? 1 : 0;
-/* $Id: t_pipeline.c,v 1.12 2001/02/15 01:33:52 keithw Exp $ */
+/* $Id: t_pipeline.c,v 1.13 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
* case, if it becomes necessary to do so.
*/
const struct gl_pipeline_stage *_tnl_default_pipeline[] = {
- &_tnl_update_material_stage,
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
-/* $Id: t_pipeline.h,v 1.5 2001/01/05 02:26:49 keithw Exp $ */
+/* $Id: t_pipeline.h,v 1.6 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
/* These are implemented in the t_vb_*.c files:
*/
-extern const struct gl_pipeline_stage _tnl_update_material_stage;
extern const struct gl_pipeline_stage _tnl_vertex_transform_stage;
extern const struct gl_pipeline_stage _tnl_normal_transform_stage;
extern const struct gl_pipeline_stage _tnl_lighting_stage;
-/* $Id: t_vb_light.c,v 1.6 2001/01/29 22:10:24 brianp Exp $ */
+/* $Id: t_vb_light.c,v 1.7 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLuint ind;
/* Make sure we can talk about elements 0..2 in the vector we are
- * lighting. TODO: Don't repeat this in CVA!
+ * lighting.
*/
- if (input->size <= 2) {
- if (input->flags & VEC_NOT_WRITEABLE) {
- ASSERT(VB->importable_data & VERT_OBJ);
- VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE );
- input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr;
- ASSERT((input->flags & VEC_NOT_WRITEABLE) == 0);
- }
+ if (stage->changed_inputs & (VERT_EYE|VERT_OBJ)) {
+ if (input->size <= 2) {
+ if (input->flags & VEC_NOT_WRITEABLE) {
+ ASSERT(VB->importable_data & VERT_OBJ);
+
+ VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE );
+ input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr;
- gl_vector4f_clean_elem(input, VB->Count, 2);
+ ASSERT((input->flags & VEC_NOT_WRITEABLE) == 0);
+ }
+
+ gl_vector4f_clean_elem(input, VB->Count, 2);
+ }
}
if (VB->Flag)
if (ctx->Visual.rgbMode) {
if (ctx->Light._NeedVertices) {
- if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
- ctx->Texture._ReallyEnabled)
+ if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
+ ctx->Texture._ReallyEnabled)
tab = _tnl_light_spec_tab;
else
tab = _tnl_light_tab;
else
tab = _tnl_light_fast_tab;
}
-/* tab = _tnl_light_tab; */
}
else
tab = _tnl_light_ci_tab;
const struct gl_pipeline_stage _tnl_lighting_stage =
{
"lighting",
- _NEW_LIGHT, /* recheck */
- _NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency
+ _NEW_LIGHT|_NEW_TEXTURE, /* recheck; texture for seperate_specular */
+ _NEW_LIGHT|_NEW_MODELVIEW|
+ _NEW_TEXTURE, /* recalc -- modelview dependency
* otherwise not captured by inputs
* (which may be VERT_OBJ) */
0,0,0, /* active, inputs, outputs */
-/* $Id: t_vb_lighttmp.h,v 1.6 2001/02/14 23:00:42 brianp Exp $ */
+/* $Id: t_vb_lighttmp.h,v 1.7 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
(void) nstride;
(void) vstride;
+/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
+
if (IDX & LIGHT_COLORMATERIAL) {
CMcolor = (GLchan (*)[4]) VB->ColorPtr[0]->data;
CMstride = VB->ColorPtr[0]->stride;
Bcolor[j][3] = sumA[1];
}
}
-
- if ( CHECK_COLOR_MATERIAL(j) )
- gl_update_color_material( ctx, CMcolor[j] );
-
- if ( CHECK_MATERIAL(j) )
- gl_update_material( ctx, new_material[j], new_material_mask[j] );
-
- if ( CHECK_VALIDATE(j) )
- gl_validate_all_lighting_tables( ctx );
}
GLuint *new_material_mask = VB->MaterialMask;
GLuint nr = VB->Count;
+/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
(void) flags;
(void) nstride;
(void) vstride;
Bcolor[j][3] = sumA[1];
}
}
-
- if ( CHECK_COLOR_MATERIAL(j) )
- gl_update_color_material( ctx, (GLchan *)CMcolor[j] );
-
- if ( CHECK_MATERIAL(j) )
- gl_update_material( ctx, new_material[j], new_material_mask[j] );
-
- if ( CHECK_VALIDATE(j) )
- gl_validate_all_lighting_tables( ctx );
}
GLfloat base[2][3];
GLuint nr = VB->Count;
+/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
(void) input; /* doesn't refer to Eye or Obj */
(void) flags;
(void) nr;
GLuint nr = VB->Count;
struct gl_light *light;
+/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
(void) flags;
(void) input;
(void) nr;
GLuint *new_material_mask = VB->MaterialMask;
GLuint nr = VB->Count;
+/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
(void) flags;
(void) nstride;
(void) vstride;
indexResult[side][j] = (GLuint) (GLint) index;
}
} /*for vertex*/
-
- if ( CHECK_COLOR_MATERIAL(j) )
- gl_update_color_material( ctx, CMcolor[j] );
-
- if ( CHECK_MATERIAL(j) )
- gl_update_material( ctx, new_material[j], new_material_mask[j] );
-
- if ( CHECK_VALIDATE(j) )
- gl_validate_all_lighting_tables( ctx );
}
-/* $Id: t_vb_render.c,v 1.12 2001/01/29 20:47:39 keithw Exp $ */
+/* $Id: t_vb_render.c,v 1.13 2001/02/16 00:35:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
-typedef void (*clip_line_func)( GLcontext *ctx,
- GLuint i, GLuint j,
- GLubyte mask);
+/* typedef void (*clip_line_func)( GLcontext *ctx, */
+/* GLuint i, GLuint j, */
+/* GLubyte mask); */
-typedef void (*clip_poly_func)( GLcontext *ctx,
- GLuint n, GLuint vlist[],
- GLubyte mask );
+/* typedef void (*clip_poly_func)( GLcontext *ctx, */
+/* GLuint n, GLuint vlist[], */
+/* GLubyte mask ); */
#define RENDER_LINE( v1, v2 ) \
LineFunc( ctx, v1, v2 )
-#define RENDER_TRI( v1, v2, v3 ) \
+#define RENDER_TRI( v1, v2, v3 ) \
TriangleFunc( ctx, v1, v2, v3 )
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
+#define RENDER_QUAD( v1, v2, v3, v4 ) \
QuadFunc( ctx, v1, v2, v3, v4 )
#define TAG(x) _tnl_##x##_verts
render_func *tab;
GLint pass = 0;
+
/* Allow the drivers to lock before projected verts are built so
* that window coordinates are guarenteed not to change before
* rendering.
*/
ctx->Driver.RenderStart( ctx );
+
+ ASSERT(ctx->Driver.BuildProjectedVertices);
+ ASSERT(ctx->Driver.RenderPrimitive);
+ ASSERT(ctx->Driver.PointsFunc);
+ ASSERT(ctx->Driver.LineFunc);
+ ASSERT(ctx->Driver.TriangleFunc);
+ ASSERT(ctx->Driver.QuadFunc);
+ ASSERT(ctx->Driver.ResetLineStipple);
+ ASSERT(ctx->Driver.RenderInterp);
+ ASSERT(ctx->Driver.RenderCopyPV);
+ ASSERT(ctx->Driver.RenderClippedLine);
+ ASSERT(ctx->Driver.RenderClippedPolygon);
+
ctx->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs );
if (VB->ClipOrMask) {
if (ctx->Visual.rgbMode) {
inputs |= VERT_RGBA;
- if (ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) {
+ if (ctx->_TriangleCaps & DD_SEPERATE_SPECULAR)
inputs |= VERT_SPEC_RGB;
- }
if (ctx->Texture._ReallyEnabled) {
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
}
}
}
- else
- {
+ else {
inputs |= VERT_INDEX;
}
/* How do drivers turn this off?
*/
- if (ctx->Fog.Enabled) {
+ if (ctx->Fog.Enabled)
inputs |= VERT_FOG_COORD;
- }
- if (ctx->_TriangleCaps & DD_TRI_UNFILLED) {
+ if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
inputs |= VERT_EDGE;
- }
- if (ctx->RenderMode==GL_FEEDBACK) {
+ if (ctx->RenderMode==GL_FEEDBACK)
inputs |= VERT_TEX_ANY;
- }
stage->inputs = inputs;
}