cleanups for t_vb_program.c
[mesa.git] / src / mesa / tnl / t_vb_cull.c
index 9527ead9430c199c00bf53cf3b7cbb2fe143bad3..21a32e5b1d8a048ca9148ba8b8259523c652a00e 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.1
+ * Version:  6.5
  *
- * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -52,11 +52,15 @@ static GLboolean run_cull_stage( GLcontext *ctx,
    const GLfloat a = ctx->Transform.CullObjPos[0];
    const GLfloat b = ctx->Transform.CullObjPos[1];
    const GLfloat c = ctx->Transform.CullObjPos[2];
-   GLfloat *norm = (GLfloat *)VB->NormalPtr->data;
-   GLuint stride = VB->NormalPtr->stride;
+   GLfloat *norm = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
+   GLuint stride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
    GLuint count = VB->Count;
    GLuint i;
 
+   if (ctx->VertexProgram._Current ||
+       !ctx->Transform.CullVertexFlag) 
+      return GL_TRUE;
+
    VB->ClipOrMask &= ~CLIP_CULL_BIT;
    VB->ClipAndMask |= CLIP_CULL_BIT;
 
@@ -81,31 +85,13 @@ static GLboolean run_cull_stage( GLcontext *ctx,
 }
 
 
-static void check_cull( GLcontext *ctx, struct tnl_pipeline_stage *stage )
-{
-   stage->active = (!ctx->VertexProgram._Enabled &&
-                   ctx->Transform.CullVertexFlag);
-}
-
-
-static void dtr( struct tnl_pipeline_stage *stage )
-{
-}
-
 
 const struct tnl_pipeline_stage _tnl_vertex_cull_stage =
 {
    "EXT_cull_vertex",
-   _NEW_PROGRAM | 
-   _NEW_TRANSFORM,  
-   _NEW_TRANSFORM,
-   GL_TRUE,                    /* active */
-   _TNL_BIT_NORMAL | 
-   _TNL_BIT_POS,               /* inputs */
-   _TNL_BIT_POS,               /* outputs */
-   0,                          /* changed_inputs */
    NULL,                       /* private data */
-   dtr,                                /* destructor */
-   check_cull,         /* check */
+   NULL,                               /* ctr */
+   NULL,                               /* destructor */
+   NULL,
    run_cull_stage              /* run -- initially set to init */
 };