Add render stage for unclipped vb's to fx driver.
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 28 Dec 2000 22:11:04 +0000 (22:11 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 28 Dec 2000 22:11:04 +0000 (22:11 +0000)
Bump MAX_TEXTURE_UNITS to 8
Fix mem. leak in destroy_lists
Fix crash in q3 (cva generally)

17 files changed:
src/mesa/Makefile.X11
src/mesa/array_cache/ac_import.c
src/mesa/drivers/glide/fxdd.c
src/mesa/drivers/glide/fxdrv.h
src/mesa/drivers/glide/fxvbtmp.h
src/mesa/main/Makefile.X11
src/mesa/main/config.h
src/mesa/main/varray.c
src/mesa/math/m_norm_tmp.h
src/mesa/tnl/t_array_import.c
src/mesa/tnl/t_imm_alloc.c
src/mesa/tnl/t_imm_dlist.c
src/mesa/tnl/t_imm_exec.c
src/mesa/tnl/t_imm_fixup.c
src/mesa/tnl/t_vb_cliptmp.h
src/mesa/tnl/t_vb_render.c
src/mesa/tnl/t_vb_rendertmp.h

index 9ea476376da41a56acacd4f13b7f31adedad038e..d5ab089af1dc71f028bef6a17e58e2247f8e92f2 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $
+# $Id: Makefile.X11,v 1.37 2000/12/28 22:11:04 keithw Exp $
 
 # Mesa 3-D graphics library
 # Version:  3.5
@@ -160,6 +160,7 @@ DRIVER_SOURCES = \
        FX/fxtexman.c \
        FX/fxtris.c \
        FX/fxvb.c \
+       FX/fxsimplerender.c \
        FX/fxglidew.c \
        X/glxapi.c \
        X/fakeglx.c \
index ca971dc1d84daa942744ab096405be32b9d0f3c3..e7fb795ef5052f11973757b45be0b7d54ca51708 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ac_import.c,v 1.1 2000/12/26 15:14:04 keithw Exp $ */
+/* $Id: ac_import.c,v 1.2 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -45,6 +45,8 @@ static void reset_texcoord( GLcontext *ctx, GLuint unit )
 {
    ACcontext *ac = AC_CONTEXT(ctx);
 
+/*     fprintf(stderr, "%s %d\n", __FUNCTION__, unit); */
+
    if (ctx->Array._Enabled & _NEW_ARRAY_TEXCOORD(unit))
       ac->Current.TexCoord[unit] = &ctx->Array.TexCoord[unit];
    else {
@@ -69,6 +71,8 @@ static void reset_vertex( GLcontext *ctx )
    ac->Current.Vertex = &ctx->Array.Vertex;
    ac->Writeable.Vertex = GL_FALSE;
    ac->NewArrayState &= ~_NEW_ARRAY_VERTEX;
+   
+/*     fprintf(stderr, "%s\n", __FUNCTION__); */
 }
 
 
@@ -178,6 +182,8 @@ static void import_texcoord( GLcontext *ctx, GLuint unit,
    ASSERT(stride == 4*sizeof(GLfloat) || stride == 0);
    ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize);
 
+/*     fprintf(stderr, "%s %d old ptr %p\n", __FUNCTION__, unit, from->Ptr); */
+   
    _math_trans_4f( to->Ptr,
                   from->Ptr,
                   from->StrideB,
@@ -191,6 +197,8 @@ static void import_texcoord( GLcontext *ctx, GLuint unit,
    to->Type = GL_FLOAT;
    ac->Current.TexCoord[unit] = to;
    ac->Writeable.TexCoord[unit] = GL_TRUE;
+
+/*     fprintf(stderr, "%s %d new ptr %p\n", __FUNCTION__, unit, to->Ptr); */
 }
 
 static void import_vertex( GLcontext *ctx,
@@ -200,6 +208,8 @@ static void import_vertex( GLcontext *ctx,
    struct gl_client_array *from = ac->Current.Vertex;
    struct gl_client_array *to = &ac->Cache.Vertex;
 
+/*     fprintf(stderr, "(ac) %s\n", __FUNCTION__); */
+
    /* Limited choices at this stage:
     */
    ASSERT(type == GL_FLOAT);
index 3bbe42328a954c08df79ed82996212e0c2a2a3ff..0f1ace3ee0dc47e0fd20a753ecc2f5f5de09b316 100644 (file)
@@ -61,6 +61,8 @@
 #include "tnl/tnl.h"
 #include "array_cache/acache.h"
 
+#include "tnl/t_pipeline.h"
+
 /* These lookup table are used to extract RGB values in [0,255] from
  * 16-bit pixel values.
  */
@@ -645,25 +647,21 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
   }
 }
 
-#if 0
-static const struct gl_pipeline_stage * const fx_pipeline[] = {
+static const struct gl_pipeline_stage *fx_pipeline[] = {
    &_tnl_update_material_stage, 
+                               /* TODO: Add the fastpath here */
    &_tnl_vertex_transform_stage, 
    &_tnl_normal_transform_stage, 
-   &_tnl_lighting_stage,       /* OMIT: fog coordinate stage */
+   &_tnl_lighting_stage,       
+   &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage */
    &_tnl_texgen_stage, 
    &_tnl_texture_transform_stage, 
    &_tnl_point_attenuation_stage, 
-   &_fx_fast_render_stage,     /* ADD: the fastpath as a render stage */
+   &fx_render_stage,           /* ADD:  render simple unclipped vb's */
    &_tnl_render_stage,         /* KEEP: the old render stage for fallbacks */
-   0
+   0,
 };
-#else
-/* Need to turn off tnl fogging, both the stage and the clipping in
- * _tnl_render_stage.  Could insert a dummy stage that did nothing but
- * provided storage that clipping could spin on?
- */
-#endif
+
 
 
 
@@ -771,6 +769,9 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
    _tnl_CreateContext( fxMesa->glCtx );
    _swsetup_CreateContext( fxMesa->glCtx );
 
+   _tnl_destroy_pipeline( fxMesa->glCtx );
+   _tnl_install_pipeline( fxMesa->glCtx, fx_pipeline );
+   
    fxAllocVB( fxMesa->glCtx );
 
    fxSetupDDPointers(fxMesa->glCtx);
@@ -780,6 +781,11 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
    _swrast_allow_vertex_fog( fxMesa->glCtx, GL_FALSE );
    _swrast_allow_pixel_fog( fxMesa->glCtx, GL_TRUE );
 
+   /* Tell tnl not to calculate or use vertex fog factors.  (Needed to
+    * tell render stage not to clip fog coords).
+    */
+/*     _tnl_calculate_vertex_fog( fxMesa->glCtx, GL_FALSE ); */
+
    fxDDInitExtensions(fxMesa->glCtx);  
 
 #ifdef FXVTXFMT
index 4e4eea96a3b4c3580ebe9053253d46f518f276a1..2f62133221f7009d87b4033de279f619c467f257 100644 (file)
@@ -100,7 +100,6 @@ typedef union {
 typedef struct {
    GrVertex v;
    GLfloat clip[4];
-   GLfloat win[4];     
    GLfloat texcoord[2][2];
    GLubyte mask;
    GLfloat normal[3];          /* for replay & fallback */
@@ -630,4 +629,8 @@ extern void fxDDCheckVtxfmt( GLcontext *ctx );
 extern void fx_update_lighting( GLcontext *ctx );
 extern void fxDDInitVtxfmt( GLcontext *ctx );
 
+/* fxsimplerender
+ */
+extern const struct gl_pipeline_stage fx_render_stage; 
+
 #endif
index 5f3a293650a4ae3abe222bcb351fa1e46b6b75e7..af21fc40af2e4ff55fde1235b08c617f3e5ab257 100644 (file)
@@ -56,8 +56,47 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs)
    if (IND & SETUP_RGBA)
       color = VB->ColorPtr[0]->data;
 
-   for (i = start ; i < end ; i++, v++) {
-      if (!clipmask[i]) {
+   if (VB->ClipOrMask) {
+      for (i = start ; i < end ; i++, v++) {
+        if (!clipmask[i]) {
+           if (IND & SETUP_XYZW) {
+              v->v.x   = s[0]  * proj[i][0] + s[12];   
+              v->v.y   = s[5]  * proj[i][1] + s[13];   
+              v->v.ooz = s[10] * proj[i][2] + s[14];   
+              v->v.oow = proj[i][3];   
+               
+              if (IND & SETUP_SNAP) {
+#if defined(USE_IEEE)
+                 const float snapper = (3L<<18);
+                 v->v.x   += snapper;
+                 v->v.x   -= snapper;
+                 v->v.y   += snapper;
+                 v->v.y   -= snapper;
+#else
+                 v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f);
+                 v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f);
+#endif
+              }
+           }
+           if (IND & SETUP_RGBA) {
+              UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.r, color[i][0]);
+              UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.g, color[i][1]);
+              UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.b, color[i][2]);
+              UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]);
+           }
+           if (IND & SETUP_TMU0) {
+              v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow; 
+              v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow; 
+           }
+           if (IND & SETUP_TMU1) {
+              v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow; 
+              v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow; 
+           }
+        }
+      }
+   }
+   else {
+      for (i = start ; i < end ; i++, v++) {
         if (IND & SETUP_XYZW) {
            v->v.x   = s[0]  * proj[i][0] + s[12];      
            v->v.y   = s[5]  * proj[i][1] + s[13];      
index 9ea476376da41a56acacd4f13b7f31adedad038e..d5ab089af1dc71f028bef6a17e58e2247f8e92f2 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $
+# $Id: Makefile.X11,v 1.37 2000/12/28 22:11:04 keithw Exp $
 
 # Mesa 3-D graphics library
 # Version:  3.5
@@ -160,6 +160,7 @@ DRIVER_SOURCES = \
        FX/fxtexman.c \
        FX/fxtris.c \
        FX/fxvb.c \
+       FX/fxsimplerender.c \
        FX/fxglidew.c \
        X/glxapi.c \
        X/fakeglx.c \
index 1b3c4f0f27159c8e783777c0da3620544da68d4b..fd2e1b599a69ec11a926f9224671079d582cd80f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: config.h,v 1.25 2000/12/26 05:09:28 keithw Exp $ */
+/* $Id: config.h,v 1.26 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
 #define MAX_TEXTURE_LEVELS 12
 
 /* Number of texture units - GL_ARB_multitexture */
-#define MAX_TEXTURE_UNITS 4
+#define MAX_TEXTURE_UNITS 8
 
 /* Maximum viewport/image size: */
 #define MAX_WIDTH 2048
index 9fa20997cf9c0c61a024da64beeaa90f4916a236..0050d9a1a177dbb75d88ea038c0a1c3be1f34457 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: varray.c,v 1.34 2000/12/26 05:09:29 keithw Exp $ */
+/* $Id: varray.c,v 1.35 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -411,6 +411,8 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr
    ctx->NewState |= _NEW_ARRAY;
    ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
 
+/*     fprintf(stderr, "%s ptr %p\n", __FUNCTION__, ptr); */
+
    if (ctx->Driver.TexCoordPointer)
       ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr );
 }
index e87d38297c0ef05894c1d1366b326631a009eb76..45111a41294bd6fcb45c835e16408f8e5f8330aa 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: m_norm_tmp.h,v 1.2 2000/11/19 23:42:33 jtaylor Exp $ */
+/* $Id: m_norm_tmp.h,v 1.3 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -77,8 +77,6 @@ TAG(transform_normalize_normals)( const GLmatrix *mat,
       }
    }
    else {
-      /* scale has been snapped to 1.0 if it is close.
-       */
       if (scale != 1.0) {
         m0 *= scale,  m4 *= scale,  m8 *= scale;
         m1 *= scale,  m5 *= scale,  m9 *= scale;
index 1cfed0676470e749f6149970d8375a8099129184..fc2c3d19447f5b3fbabaff83f83a8b7bb0a243c5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_array_import.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
+/* $Id: t_array_import.c,v 1.3 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -62,7 +62,7 @@ static void _tnl_import_vertex( GLcontext *ctx,
    inputs->Obj.stride = tmp->StrideB;
    inputs->Obj.size = tmp->Size;
    inputs->Obj.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
-   if (stride != 4*sizeof(GLfloat))
+   if (inputs->Obj.stride != 4*sizeof(GLfloat))
       inputs->Obj.flags |= VEC_BAD_STRIDE;
    if (!is_writeable)
       inputs->Obj.flags |= VEC_NOT_WRITEABLE;
@@ -84,7 +84,7 @@ static void _tnl_import_normal( GLcontext *ctx,
    inputs->Normal.start = (GLfloat *)tmp->Ptr;
    inputs->Normal.stride = tmp->StrideB;
    inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
-   if (stride != 3*sizeof(GLfloat))
+   if (inputs->Normal.stride != 3*sizeof(GLfloat))
       inputs->Normal.flags |= VEC_BAD_STRIDE;
    if (!is_writeable)
       inputs->Normal.flags |= VEC_NOT_WRITEABLE;
@@ -110,7 +110,7 @@ static void _tnl_import_color( GLcontext *ctx,
    inputs->Color.start = (GLubyte *)tmp->Ptr;
    inputs->Color.stride = tmp->StrideB;
    inputs->Color.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
-   if (stride != 4*sizeof(GLubyte))
+   if (inputs->Color.stride != 4*sizeof(GLubyte))
       inputs->Color.flags |= VEC_BAD_STRIDE;
    if (!is_writeable)
       inputs->Color.flags |= VEC_NOT_WRITEABLE;
@@ -135,7 +135,7 @@ static void _tnl_import_secondarycolor( GLcontext *ctx,
    inputs->SecondaryColor.start = (GLubyte *)tmp->Ptr;
    inputs->SecondaryColor.stride = tmp->StrideB;
    inputs->SecondaryColor.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
-   if (stride != 4*sizeof(GLubyte))
+   if (inputs->SecondaryColor.stride != 4*sizeof(GLubyte))
       inputs->SecondaryColor.flags |= VEC_BAD_STRIDE;
    if (!is_writeable)
       inputs->SecondaryColor.flags |= VEC_NOT_WRITEABLE;
@@ -157,7 +157,7 @@ static void _tnl_import_fogcoord( GLcontext *ctx,
    inputs->FogCoord.start = (GLfloat *)tmp->Ptr;
    inputs->FogCoord.stride = tmp->StrideB;
    inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
-   if (stride != sizeof(GLfloat))
+   if (inputs->FogCoord.stride != sizeof(GLfloat))
       inputs->FogCoord.flags |= VEC_BAD_STRIDE;
    if (!is_writeable)
       inputs->FogCoord.flags |= VEC_NOT_WRITEABLE;
@@ -179,7 +179,7 @@ static void _tnl_import_index( GLcontext *ctx,
    inputs->Index.start = (GLuint *)tmp->Ptr;
    inputs->Index.stride = tmp->StrideB;
    inputs->Index.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
-   if (stride != sizeof(GLuint))
+   if (inputs->Index.stride != sizeof(GLuint))
       inputs->Index.flags |= VEC_BAD_STRIDE;
    if (!is_writeable)
       inputs->Index.flags |= VEC_NOT_WRITEABLE;
@@ -195,6 +195,9 @@ static void _tnl_import_texcoord( GLcontext *ctx,
    struct gl_client_array *tmp;
    GLboolean is_writeable = 0;
 
+/*     fprintf(stderr, "%s %d before wr %d ptr %p\n", __FUNCTION__, i, writeable, */
+/*        inputs->TexCoord[i].data); */
+
    tmp = _ac_import_texcoord(ctx, i, GL_FLOAT, 
                             stride ? 4*sizeof(GLfloat) : 0, 
                             0,
@@ -206,10 +209,13 @@ static void _tnl_import_texcoord( GLcontext *ctx,
    inputs->TexCoord[i].stride = tmp->StrideB;
    inputs->TexCoord[i].size = tmp->Size;
    inputs->TexCoord[i].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
-   if (stride != 4*sizeof(GLfloat))
+   if (inputs->TexCoord[i].stride != 4*sizeof(GLfloat))
       inputs->TexCoord[i].flags |= VEC_BAD_STRIDE;
    if (!is_writeable)
       inputs->TexCoord[i].flags |= VEC_NOT_WRITEABLE;
+
+/*     fprintf(stderr, "%s %d before wr %d ptr %p\n", __FUNCTION__, i, is_writeable, */
+/*        inputs->TexCoord[i].data); */
 }
  
   
@@ -230,7 +236,7 @@ static void _tnl_import_edgeflag( GLcontext *ctx,
    inputs->EdgeFlag.start = (GLubyte *)tmp->Ptr;
    inputs->EdgeFlag.stride = tmp->StrideB;
    inputs->EdgeFlag.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
-   if (stride != sizeof(GLubyte))
+   if (inputs->EdgeFlag.stride != sizeof(GLubyte))
       inputs->EdgeFlag.flags |= VEC_BAD_STRIDE;
    if (!is_writeable)
       inputs->EdgeFlag.flags |= VEC_NOT_WRITEABLE;
@@ -256,6 +262,8 @@ static void _tnl_upgrade_client_data( GLcontext *ctx,
    if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr) 
       required |= VERT_OBJ;
 
+/*     _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */
+
    if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) {
       ASSERT(VB->ObjPtr == &inputs->Obj);
       _tnl_import_vertex( ctx, writeable, stride );
@@ -330,9 +338,9 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
    VB->Material = 0;
    VB->Flag = 0;
    
-/*     _tnl_print_vert_flags("_tnl_print_vert_flags: inputs", inputs); */
-/*     _tnl_print_vert_flags("_tnl_print_vert_flags: imports", imports); */
-/*     _tnl_print_vert_flags("_tnl_print_vert_flags: _Enabled", ctx->Array._Enabled); */
+/*     _tnl_print_vert_flags("_tnl_vb_bind_arrays: inputs", inputs); */
+/*     _tnl_print_vert_flags("_tnl_vb_bind_arrays: imports", imports); */
+/*     _tnl_print_vert_flags("_tnl_vb_bind_arrays: _Enabled", ctx->Array._Enabled); */
 
    if (inputs & VERT_OBJ) {
       if (imports & VERT_OBJ) {
@@ -409,7 +417,9 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
    VB->Primitive = tnl->tmp_primitive;
    VB->PrimitiveLength = tnl->tmp_primitive_length;
    VB->import_data = _tnl_upgrade_client_data;
-   VB->importable_data = imports;
+   VB->importable_data = imports & VERT_FIXUP;
+/*     _tnl_print_vert_flags("_tnl_vb_bind_arrays: importable", VB->importable_data); */
+   
 }
 
 
index 44e3a598ecb0bee45cd7bd9793929d0883a93a89..e6a37f810159629c3298c72a905cb032faacb1a2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_imm_alloc.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
+/* $Id: t_imm_alloc.c,v 1.2 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
 #include "t_imm_alloc.h"
 
 
+   static int id = 0;
 
 struct immediate *_tnl_alloc_immediate( GLcontext *ctx )
 {
-   static int id = 0;
    struct immediate *IM = ALIGN_MALLOC_STRUCT( immediate, 32 );
    GLuint j;
 
@@ -80,6 +80,7 @@ struct immediate *_tnl_alloc_immediate( GLcontext *ctx )
 
 void _tnl_free_immediate( struct immediate *IM )
 {
+   static int freed = 0;
    GLuint j;
 
    if (IM->NormalLengths) {
@@ -92,12 +93,15 @@ void _tnl_free_immediate( struct immediate *IM )
       FREE( IM->MaterialMask );
       IM->Material = 0;
       IM->MaterialMask = 0;
-
-      for (j = 1; j < IM->MaxTextureUnits; j++) 
-        ALIGN_FREE( IM->TexCoord[j] );
    }
 
+   for (j = 1; j < IM->MaxTextureUnits; j++) 
+      ALIGN_FREE( IM->TexCoord[j] );
+
+
    ALIGN_FREE( IM );
+   freed++;
+/*     printf("outstanding %d\n", id - freed);    */
 }
 
 
index a11217e43744d210f4a2a5209bd11bb78cede38b..e22661e7ea90e3c6efbdebff72ec2e3a4cc64e87 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_imm_dlist.c,v 1.3 2000/12/27 21:49:40 keithw Exp $ */
+/* $Id: t_imm_dlist.c,v 1.4 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -112,6 +112,8 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
       return;
    
    node->IM = im; im->ref_count++;
+/*     fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*        im->id, im->ref_count); */
    node->Start = im->Start;
    node->Count = im->Count;
    node->BeginState = im->BeginState;
@@ -142,6 +144,10 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
       if (!new_im) return;
       new_im->ref_count++;
       im->ref_count--;         /* remove CURRENT_IM reference */
+/*        fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*           im->id, im->ref_count); */
+/*        fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*           new_im->id, new_im->ref_count); */
       ASSERT(im->ref_count > 0);
       SET_IMMEDIATE( ctx, new_im );
       _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS,
@@ -230,20 +236,23 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
    }
 
 
-   /* Lazy optimization of the cassette.
+   /* Lazy optimization of the cassette.  Need to make these switchable
+    * or otherwise more useful for t&l cards.
     */
-/*     if (ctx->Transform.Normalize && !node->have_normal_lengths) { */
+#if 0
+   if (ctx->Transform.Normalize && !node->have_normal_lengths) {
 
-/*        if (!IM->NormalLengths) */
-/*      IM->NormalLengths = (GLfloat *)MALLOC(sizeof(GLfloat) * IMM_SIZE); */
+      if (!IM->NormalLengths)
+        IM->NormalLengths = (GLfloat *)MALLOC(sizeof(GLfloat) * IMM_SIZE);
 
-/*        calc_normal_lengths( IM->NormalLengths + IM->Start, */
-/*                        (const GLfloat (*)[3])(IM->Normal + IM->Start), */
-/*                        IM->Flag + IM->Start, */
-/*                        IM->Count - IM->Start); */
+      calc_normal_lengths( IM->NormalLengths + IM->Start,
+                          (const GLfloat (*)[3])(IM->Normal + IM->Start),
+                          IM->Flag + IM->Start,
+                          IM->Count - IM->Start);
 
-/*        node->have_normal_lengths = GL_TRUE; */
-/*     } */
+      node->have_normal_lengths = GL_TRUE;
+   }
+#endif
 
 
 #if 0
@@ -268,6 +277,10 @@ destroy_compiled_cassette( GLcontext *ctx, void *data )
 {
    TNLvertexcassette *node = (TNLvertexcassette *)data;
 
+/*     fprintf(stderr, "destroy_compiled_cassette node->IM id %d ref_count: %d\n", */
+/*        node->IM->id, */
+/*        node->IM->ref_count-1); */
+
    if ( --node->IM->ref_count == 0 )
       _tnl_free_immediate( node->IM );
 }
@@ -328,9 +341,20 @@ _tnl_EndList( GLcontext *ctx )
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    struct immediate *IM = TNL_CURRENT_IM(ctx);
 
+   ctx->swtnl_im = 0;
    IM->ref_count--;
-   if (IM == tnl->ExecCopySource)
+/*     fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*        IM->id, IM->ref_count); */
+   if (IM == tnl->ExecCopySource) {
       IM->ref_count--;
+/*        fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*           IM->id, IM->ref_count); */
+   } else {
+/*        fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*           tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */
+      if ( --tnl->ExecCopySource->ref_count == 0 )
+        _tnl_free_immediate( tnl->ExecCopySource );
+   }
 
    /* If this one isn't free, get a clean one.  (Otherwise we'll be
     * using one that's already half full).
@@ -342,9 +366,14 @@ _tnl_EndList( GLcontext *ctx )
 
    tnl->ExecCopySource = IM;
    IM->ref_count++;
+/*     fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*        IM->id, IM->ref_count); */
+
 
    SET_IMMEDIATE( ctx, IM );
    IM->ref_count++;
+/*     fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*        IM->id, IM->ref_count); */
 
    _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 );        
 
index f9b12126a83033a558cd1eb4c9342c1dfaff724b..1549fa53af4176f017eca26decd35bb4dbed63fe 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_imm_exec.c,v 1.3 2000/12/27 22:52:45 keithw Exp $ */
+/* $Id: t_imm_exec.c,v 1.4 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -474,11 +474,15 @@ void _tnl_imm_init( GLcontext *ctx )
 
    ctx->swtnl_im = _tnl_alloc_immediate( ctx );
    TNL_CURRENT_IM(ctx)->ref_count++;
+/*     fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*        TNL_CURRENT_IM(ctx)->id, TNL_CURRENT_IM(ctx)->ref_count); */
 
    tnl->ExecCopyTexSize = 0;
    tnl->ExecCopyCount = 0;
    tnl->ExecCopySource = TNL_CURRENT_IM(ctx);
    TNL_CURRENT_IM(ctx)->ref_count++;
+/*     fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*        TNL_CURRENT_IM(ctx)->id, TNL_CURRENT_IM(ctx)->ref_count); */
    TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS;
 
    gl_vector4f_init( &tmp->Obj, 0, 0 );
index d55ab48c56dd7b93991ebcc6c62c3534dc342f70..5da75db53bf138220734e69c483ff1b12967a570 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
+/* $Id: t_imm_fixup.c,v 1.2 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -432,11 +432,17 @@ static void copy_vertices( GLcontext *ctx,
    }
 
    ASSERT(prev == tnl->ExecCopySource);
+
+/*     fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*        tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */
+
    if (--tnl->ExecCopySource->ref_count == 0)
       _tnl_free_immediate( tnl->ExecCopySource );
    
    next->ref_count++;
    tnl->ExecCopySource = next;
+/*     fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*        next->id, next->ref_count); */
    tnl->ExecCopyElts[0] = next->Start-3;
    tnl->ExecCopyElts[1] = next->Start-2;
    tnl->ExecCopyElts[2] = next->Start-1;
@@ -726,10 +732,14 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
    
 
    if (tnl->ExecCopySource != IM) {
+/*        fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*           tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */
       if (--tnl->ExecCopySource->ref_count == 0)
         _tnl_free_immediate( tnl->ExecCopySource );
       IM->ref_count++;
       tnl->ExecCopySource = IM;
+/*        fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__,  */
+/*           tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count); */
    }
 
    if (prim == GL_POLYGON+1) {
index 34acfcfe554ff17f4c3e9b61151c299bdb05c58f..1aeb014e1598a8c0b5dd84df1a37e65c86a2338b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_vb_cliptmp.h,v 1.3 2000/12/27 21:49:40 keithw Exp $ */
+/* $Id: t_vb_cliptmp.h,v 1.4 2000/12/28 22:11:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -361,7 +361,7 @@ static void TAG(viewclip_polygon)( GLcontext *ctx,
               newvert = interp( ctx, t, idxPrev, idx, GL_FALSE );      \
            }                                                           \
             clipmask[newvert] = mask;                                  \
-            outlist[outcount++] = newvert;                             \
+            outlist[outcount++] = newvert;                             \
         }                                                              \
                                                                        \
         idxPrev = idx;                                                 \
index 1311d5721fc25039287353d5690021eab023f15d..1d0a1aaf15273d7bce076f541e4b533287053afd 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_vb_render.c,v 1.3 2000/12/27 21:49:40 keithw Exp $ */
+/* $Id: t_vb_render.c,v 1.4 2000/12/28 22:11:06 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -520,6 +520,8 @@ static GLboolean run_render( GLcontext *ctx,
    render_func *tab;
    GLint pass = 0;
 
+/*     return GL_FALSE; */
+
    VB->interpfunc = (void *)RENDER_STAGE_DATA(stage)->interp;
    
    if (new_inputs) {
@@ -615,7 +617,7 @@ static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
         }
       }
    }
-   else if (ctx->Light.ShadeModel==GL_SMOOTH)
+   else 
    {
       interp |= INTERP_INDEX;
       inputs |= VERT_INDEX;
index bd77b9668a09f42479ebce2d26a36623f1210f8d..5712d342d27831f0d0e38bc0f752b111213e043e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_vb_rendertmp.h,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
+/* $Id: t_vb_rendertmp.h,v 1.3 2000/12/28 22:11:06 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -39,7 +39,7 @@
 #ifndef NEED_EDGEFLAG_SETUP
 #define NEED_EDGEFLAG_SETUP 0
 #define EDGEFLAG_GET(a) 0
-#define EDGEFLAG_SET(a,b) 
+#define EDGEFLAG_SET(a,b) (void)b 
 #endif
 
 #ifndef RESET_STIPPLE
@@ -68,6 +68,7 @@ static void TAG(render_points)( GLcontext *ctx,
    LOCAL_VARS;
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    RESET_OCCLUSION;
    INIT(GL_POINTS);
    RENDER_POINTS( start, count );
@@ -83,6 +84,7 @@ static void TAG(render_lines)( GLcontext *ctx,
    LOCAL_VARS;
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    RESET_OCCLUSION;
    INIT(GL_LINES);
    for (j=start+1; j<count; j+=2 ) {
@@ -102,6 +104,7 @@ static void TAG(render_line_strip)( GLcontext *ctx,
    LOCAL_VARS;
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    RESET_OCCLUSION;
    INIT(GL_LINES);
 
@@ -125,6 +128,7 @@ static void TAG(render_line_loop)( GLcontext *ctx,
 
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    RESET_OCCLUSION;
    INIT(GL_LINES);
 
@@ -156,6 +160,7 @@ static void TAG(render_triangles)( GLcontext *ctx,
    LOCAL_VARS;
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    INIT(GL_POLYGON);
    if (NEED_EDGEFLAG_SETUP) {
       for (j=start+2; j<count; j+=3) {
@@ -186,6 +191,7 @@ static void TAG(render_tri_strip)( GLcontext *ctx,
    if (TEST_PRIM_PARITY(flags))
       parity = 1;
    
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    INIT(GL_POLYGON);
    if (NEED_EDGEFLAG_SETUP) {
       for (j=start+2;j<count;j++,parity^=1) {
@@ -225,6 +231,7 @@ static void TAG(render_tri_fan)( GLcontext *ctx,
    LOCAL_VARS;
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    INIT(GL_POLYGON);
    if (NEED_EDGEFLAG_SETUP) {
       for (j=start+2;j<count;j++) {
@@ -270,6 +277,7 @@ static void TAG(render_poly_pv)( GLcontext *ctx,
    LOCAL_VARS;
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    INIT(GL_POLYGON);
    if (NEED_EDGEFLAG_SETUP) {
       GLboolean efstart = EDGEFLAG_GET( ELT(start) );
@@ -335,6 +343,7 @@ static void TAG(render_poly)( GLcontext *ctx,
                              GLuint count,
                              GLuint flags )
 {
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    TAG(render_poly_pv)( ctx, start, count, flags, start );
 }
 
@@ -347,6 +356,7 @@ static void TAG(render_quads)( GLcontext *ctx,
    LOCAL_VARS;
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    INIT(GL_POLYGON);
    if (NEED_EDGEFLAG_SETUP) {
       for (j=start+3; j<count; j+=4) {
@@ -372,6 +382,7 @@ static void TAG(render_quad_strip)( GLcontext *ctx,
    LOCAL_VARS;
    (void) flags;
 
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    INIT(GL_POLYGON);
    if (NEED_EDGEFLAG_SETUP) {
       for (j=start+3;j<count;j+=2) {
@@ -406,10 +417,15 @@ static void TAG(render_noop)( GLcontext *ctx,
                              GLuint count,
                              GLuint flags )
 {
+/*     fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
    (void)(ctx && start && count && flags);
 }
 
-static render_func TAG(render_tab)[GL_POLYGON+2] = {
+static void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *,
+                                            GLuint,
+                                            GLuint,
+                                            GLuint) = 
+{
    TAG(render_points),
    TAG(render_lines),
    TAG(render_line_loop),