fragment program execution
[mesa.git] / src / mesa / tnl / t_imm_exec.c
index c2b31ee8691d270e44e70ba92840b6e556ca7426..fb149a123de0e7a1fcc47f0bb8cdbad70d0ecba8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_imm_exec.c,v 1.38 2002/04/09 16:56:52 keithw Exp $ */
+/* $Id: t_imm_exec.c,v 1.43 2002/10/24 23:57:25 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -25,7 +25,7 @@
  */
 
 /**
- * \file vpexec.c
+ * \file tnl/t_imm_exec.c
  * \brief Setup to execute immediate-mode vertex data.
  * \author Keith Whitwell
  */
@@ -36,7 +36,7 @@
 #include "enums.h"
 #include "dlist.h"
 #include "macros.h"
-#include "mem.h"
+#include "imports.h"
 #include "mmath.h"
 #include "light.h"
 #include "state.h"
@@ -72,8 +72,7 @@ static void reset_input( GLcontext *ctx,
       MEMSET(IM->Flag + start, 0, sizeof(GLuint) * (IM->Count+2-start));
 
    if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
-      fprintf(stderr, "reset_input: IM(%d) new %x\n", 
-             IM->id, beginstate);
+      _mesa_debug(ctx, "reset_input: IM(%d) new %x\n", IM->id, beginstate);
 
    IM->Start = start;
    IM->Count = start;
@@ -296,6 +295,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
       tmp->Normal.data = IM->Attrib[VERT_ATTRIB_NORMAL] + start;
       tmp->Normal.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_NORMAL] + start);
       tmp->Normal.count = count;
+      tmp->Normal.size = 3; /* just to be safe */
       VB->NormalPtr = &tmp->Normal;
       if (IM->NormalLengthPtr)
         VB->NormalLengthPtr = IM->NormalLengthPtr + start;
@@ -409,8 +409,6 @@ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM )
  */
 static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM )
 {
-/*     fprintf(stderr, "%s\n", __FUNCTION__); */
-
    if (IM->FlushElt) {
       /* Orflag is computed twice, but only reach this code if app is
        * using a mixture of glArrayElement() and glVertex() while
@@ -436,8 +434,6 @@ static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM )
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    struct vertex_buffer *VB = &tnl->vb;
 
-/*      fprintf(stderr, "%s\n", __FUNCTION__);  */
-
    _tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount );
 
    /* Take only elements and primitive information from the immediate:
@@ -518,9 +514,6 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
 
    if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1)
       ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES;
-
-/*     fprintf(stderr, "%s: NeedFlush: %x\n", __FUNCTION__,  */
-/*        ctx->Driver.NeedFlush); */
 }
 
 
@@ -592,7 +585,7 @@ void _tnl_imm_destroy( GLcontext *ctx )
    if (TNL_CURRENT_IM(ctx)) {
       TNL_CURRENT_IM(ctx)->ref_count--;
       if (TNL_CURRENT_IM(ctx)->ref_count == 0)
-        _tnl_free_immediate( TNL_CURRENT_IM(ctx) );
+        _tnl_free_immediate( ctx, TNL_CURRENT_IM(ctx) );
       /* 
        * Don't use SET_IMMEDIATE here, or else we'll whack the
        * _tnl_CurrentInput pointer - not good when another