From 36a0a3252e1e20df69b53f70ba93bc74c4a4bf0e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 8 Apr 2003 02:27:16 +0000 Subject: Added ctx->Texture._EnabledCoordUnits bitfield. Fixed some vertex array / vertex program glitches with glDrawElements. Fixed some fragment program runtime bugs. Non-trivial Cg programs are running now. --- src/mesa/main/state.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/state.c') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 000a1fd578..ed3499c8e6 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.102 2003/03/29 17:01:01 brianp Exp $ */ +/* $Id: state.c,v 1.103 2003/04/08 02:27:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -72,6 +72,9 @@ #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program #include "nvprogram.h" #endif +#if FEATURE_NV_fragment_program +#include "nvfragprog.h" +#endif #include "math/m_matrix.h" #include "math/m_xform.h" @@ -943,9 +946,30 @@ update_texture_state( GLcontext *ctx ) if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) { ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN; } + + ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits; + /* Fragment programs may need texture coordinates but not the + * corresponding texture images. + */ + if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) { + ctx->Texture._EnabledCoordUnits |= + (ctx->FragmentProgram.Current->InputsRead >> FRAG_ATTRIB_TEX0); + } } +/* + * Update items which depend on vertex/fragment programs. + */ +static void +update_program( GLcontext *ctx ) +{ + if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) { + if (ctx->FragmentProgram.Current->InputsRead & (1 << FRAG_ATTRIB_COL1)) + ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; + } +} + /* * If ctx->NewState is non-zero then this function MUST be called before @@ -1015,6 +1039,8 @@ void _mesa_update_state( GLcontext *ctx ) ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW; } + if (new_state & _NEW_PROGRAM) + update_program( ctx ); #if 0 /* XXX this is a bit of a hack. We should be checking elsewhere if -- cgit v1.2.3