summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/state.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-04-08 02:27:16 +0000
committerBrian Paul <[email protected]>2003-04-08 02:27:16 +0000
commit36a0a3252e1e20df69b53f70ba93bc74c4a4bf0e (patch)
tree6c680de320af7a288fe70e5a95696bcf0f5faa56 /src/mesa/main/state.c
parent0cebd5822a39ad3b3d7621f8e59efab329bfb5b9 (diff)
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.
Diffstat (limited to 'src/mesa/main/state.c')
-rw-r--r--src/mesa/main/state.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 000a1fd578c..ed3499c8e6c 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