update colormaterial state on swtcl wakeup
[mesa.git] / src / mesa / tnl / t_vb_texgen.c
index bdf5c63786d627fe12be75a7f5cc8e23d00d5f2f..81751508bfb3737f9e0b14990270ff8a6f9549b5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_vb_texgen.c,v 1.9 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_vb_texgen.c,v 1.13 2002/06/29 19:48:17 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -95,7 +95,7 @@ static GLuint all_bits[5] = {
 
 
 static void build_m3( GLfloat f[][3], GLfloat m[],
-                     const GLvector3f *normal,
+                     const GLvector4f *normal,
                      const GLvector4f *eye )
 {
    GLuint stride = eye->stride;
@@ -122,7 +122,7 @@ static void build_m3( GLfloat f[][3], GLfloat m[],
 
 
 static void build_m2( GLfloat f[][3], GLfloat m[],
-                     const GLvector3f *normal,
+                     const GLvector4f *normal,
                      const GLvector4f *eye )
 {
    GLuint stride = eye->stride;
@@ -152,7 +152,7 @@ static void build_m2( GLfloat f[][3], GLfloat m[],
 
 typedef void (*build_m_func)( GLfloat f[][3],
                              GLfloat m[],
-                             const GLvector3f *normal,
+                             const GLvector4f *normal,
                              const GLvector4f *eye );
 
 
@@ -171,7 +171,7 @@ static build_m_func build_m_tab[5] = {
  */
 static void build_f3( GLfloat *f,
                      GLuint fstride,
-                     const GLvector3f *normal,
+                     const GLvector4f *normal,
                      const GLvector4f *eye )
 {
    GLuint stride = eye->stride;
@@ -198,7 +198,7 @@ static void build_f3( GLfloat *f,
 
 static void build_f2( GLfloat *f,
                      GLuint fstride,
-                     const GLvector3f *normal,
+                     const GLvector4f *normal,
                      const GLvector4f *eye )
 {
    GLuint stride = eye->stride;
@@ -226,7 +226,7 @@ static void build_f2( GLfloat *f,
 
 typedef void (*build_f_func)( GLfloat *f,
                              GLuint fstride,
-                             const GLvector3f *normal_vec,
+                             const GLvector4f *normal_vec,
                              const GLvector4f *eye );
 
 
@@ -281,7 +281,7 @@ static void texgen_normal_map_nv( GLcontext *ctx,
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
    GLvector4f *in = VB->TexCoordPtr[unit];
    GLvector4f *out = &store->texcoord[unit];
-   GLvector3f *normal = VB->NormalPtr;
+   GLvector4f *normal = VB->NormalPtr;
    GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start;
    GLuint count = VB->Count;
    GLuint i;
@@ -322,7 +322,7 @@ static void texgen_sphere_map( GLcontext *ctx,
    GLfloat (*f)[3] = store->tmp_f;
    GLfloat *m = store->tmp_m;
 
-/*     fprintf(stderr, "%s normstride %d eyestride %d\n",  */
+/*     _mesa_debug(NULL, "%s normstride %d eyestride %d\n",  */
 /*        __FUNCTION__, VB->NormalPtr->stride, */
 /*        VB->EyePtr->stride); */
 
@@ -362,7 +362,7 @@ static void texgen( GLcontext *ctx,
    struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
    const GLvector4f *obj = VB->ObjPtr;
    const GLvector4f *eye = VB->EyePtr;
-   const GLvector3f *normal = VB->NormalPtr;
+   const GLvector4f *normal = VB->NormalPtr;
    GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data;
    GLfloat *indata;
    GLuint count = VB->Count;
@@ -529,7 +529,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx,
 
    for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
       if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) {
-        if (stage->changed_inputs & (VERT_EYE | VERT_NORM | VERT_TEX(i)))
+        if (stage->changed_inputs & (VERT_BIT_EYE | VERT_BIT_NORMAL | VERT_BIT_TEX(i)))
            store->TexgenFunc[i]( ctx, store, i );
 
         VB->TexCoordPtr[i] = &store->texcoord[i];
@@ -591,28 +591,28 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage )
    GLuint i;
    stage->active = 0;
 
-   if (ctx->Texture._TexGenEnabled) {
+   if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram.Enabled) {
       GLuint inputs = 0;
       GLuint outputs = 0;
 
       if (ctx->Texture._GenFlags & TEXGEN_OBJ_LINEAR)
-        inputs |= VERT_OBJ;
+        inputs |= VERT_BIT_POS;
 
       if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD)
-        inputs |= VERT_EYE;
+        inputs |= VERT_BIT_EYE;
 
       if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS)
-        inputs |= VERT_NORM;
+        inputs |= VERT_BIT_NORMAL;
 
       for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
         if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i))
         {
-           outputs |= VERT_TEX(i);
+           outputs |= VERT_BIT_TEX(i);
 
            /* Need the original input in case it contains a Q coord:
             * (sigh)
             */
-           inputs |= VERT_TEX(i);
+           inputs |= VERT_BIT_TEX(i);
 
            /* Something for Feedback? */
         }
@@ -678,11 +678,14 @@ static void free_texgen_data( struct gl_pipeline_stage *stage )
 
 const struct gl_pipeline_stage _tnl_texgen_stage =
 {
-   "texgen",
+   "texgen",                   /* name */
    _NEW_TEXTURE,               /* when to call check() */
    _NEW_TEXTURE,               /* when to invalidate stored data */
-   0,0,0,                      /* active, inputs, outputs */
-   0,0,                                /* changed_inputs, private */
+   GL_FALSE,                   /* active? */
+   0,                          /* inputs */
+   0,                          /* outputs */
+   0,                          /* changed_inputs */
+   NULL,                       /* private data */
    free_texgen_data,           /* destructor */
    check_texgen,               /* check */
    alloc_texgen_data           /* run -- initially set to alloc data */