Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / mesa / tnl / t_vb_light.c
index d4c83189c2445b13303070e6580c386ef5c305ad..f47f99397c9ad29bf59664884f66325f1d25d879 100644 (file)
 
 
 
-#include "glheader.h"
-#include "colormac.h"
-#include "light.h"
-#include "macros.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/light.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/simple_list.h"
+#include "main/mtypes.h"
 
 #include "math/m_translate.h"
 
@@ -135,7 +135,7 @@ prepare_materials(GLcontext *ctx,
     * update_materials(), above, that'll actually copy the vertex color to
     * the material attribute(s).
     */
-   for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) {
+   for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
       if (VB->AttribPtr[i]->stride) {
         const GLuint j = store->mat_count++;
         const GLuint attr = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT;
@@ -203,10 +203,7 @@ static GLboolean run_lighting( GLcontext *ctx,
    GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr;
    GLuint idx;
 
-   if (ctx->ShaderObjects.CurrentProgram != NULL)
-      return GL_TRUE;
-
-   if (!ctx->Light.Enabled || ctx->VertexProgram._Enabled)
+   if (!ctx->Light.Enabled || ctx->VertexProgram._Current)
       return GL_TRUE;
 
    /* Make sure we can talk about position x,y and z:
@@ -251,7 +248,7 @@ static GLboolean run_lighting( GLcontext *ctx,
 
    VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0];
    VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0];
-   VB->AttribPtr[_TNL_ATTRIB_INDEX] = VB->IndexPtr[0];
+   VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = VB->IndexPtr[0];
 
    return GL_TRUE;
 }
@@ -264,10 +261,7 @@ static void validate_lighting( GLcontext *ctx,
 {
    light_func *tab;
 
-   if (ctx->ShaderObjects.CurrentProgram != NULL)
-      return;
-
-   if (!ctx->Light.Enabled || ctx->VertexProgram._Enabled)
+   if (!ctx->Light.Enabled || ctx->VertexProgram._Current)
       return;
 
    if (ctx->Visual.rgbMode) {