mesa-tnl-0-to-NULL.patch from Jeff Muizelaar
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 10 Feb 2005 10:57:22 +0000 (10:57 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 10 Feb 2005 10:57:22 +0000 (10:57 +0000)
21 files changed:
src/mesa/tnl/t_array_api.c
src/mesa/tnl/t_array_import.c
src/mesa/tnl/t_context.c
src/mesa/tnl/t_pipeline.c
src/mesa/tnl/t_save_api.c
src/mesa/tnl/t_save_loopback.c
src/mesa/tnl/t_save_playback.c
src/mesa/tnl/t_vb_fog.c
src/mesa/tnl/t_vb_light.c
src/mesa/tnl/t_vb_normals.c
src/mesa/tnl/t_vb_points.c
src/mesa/tnl/t_vb_program.c
src/mesa/tnl/t_vb_texgen.c
src/mesa/tnl/t_vb_texmat.c
src/mesa/tnl/t_vb_vertex.c
src/mesa/tnl/t_vertex.c
src/mesa/tnl/t_vertex_c.c
src/mesa/tnl/t_vertex_codegen.c
src/mesa/tnl/t_vtx_api.c
src/mesa/tnl/t_vtx_eval.c
src/mesa/tnl/t_vtx_exec.c

index c3e6358..3aa91f9 100644 (file)
@@ -422,13 +422,13 @@ void _tnl_array_init( GLcontext *ctx )
 
    /* Setup vector pointers that will be used to bind arrays to VB's.
     */
-   _mesa_vector4f_init( &tmp->Obj, 0, );
-   _mesa_vector4f_init( &tmp->Normal, 0, );   
-   _mesa_vector4f_init( &tmp->FogCoord, 0, );
-   _mesa_vector4f_init( &tmp->Index, 0, );
+   _mesa_vector4f_init( &tmp->Obj, 0, NULL);
+   _mesa_vector4f_init( &tmp->Normal, 0, NULL);   
+   _mesa_vector4f_init( &tmp->FogCoord, 0, NULL);
+   _mesa_vector4f_init( &tmp->Index, 0, NULL);
 
    for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
-      _mesa_vector4f_init( &tmp->TexCoord[i], 0, 0);
+      _mesa_vector4f_init( &tmp->TexCoord[i], 0, NULL);
 }
 
 
index 93d2640..00a933e 100644 (file)
@@ -347,11 +347,11 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end)
    VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS];
    VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
    VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
-   VB->ColorPtr[1] = 0;
+   VB->ColorPtr[1] = NULL;
    VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX];
-   VB->IndexPtr[1] = 0;
+   VB->IndexPtr[1] = NULL;
    VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
-   VB->SecondaryColorPtr[1] = 0;
+   VB->SecondaryColorPtr[1] = NULL;
    VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
 
    for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
index 7e4f3fd..531e639 100644 (file)
@@ -141,7 +141,7 @@ _tnl_DestroyContext( GLcontext *ctx )
    _ae_destroy_context( ctx );
 
    FREE(tnl);
-   ctx->swtnl_context = 0;
+   ctx->swtnl_context = NULL;
 }
 
 
index e90e21b..1e9b686 100644 (file)
@@ -212,5 +212,5 @@ const struct tnl_pipeline_stage *_tnl_default_pipeline[] = {
    &_tnl_vertex_program_stage,
 #endif
    &_tnl_render_stage,
-   0
+   NULL 
 };
index 6e737f4..6842636 100644 (file)
@@ -248,7 +248,7 @@ static void _save_compile_vertex_list( GLcontext *ctx )
    node->prim_count = tnl->save.prim_count;
    node->vertex_store = tnl->save.vertex_store;
    node->prim_store = tnl->save.prim_store;
-   node->normal_lengths = 0;
+   node->normal_lengths = NULL;
 
    node->vertex_store->refcount++;
    node->prim_store->refcount++;
@@ -457,7 +457,7 @@ static void _save_upgrade_vertex( GLcontext *ctx,
         tmp += tnl->save.attrsz[i];
       }
       else 
-        tnl->save.attrptr[i] = 0; /* will not be dereferenced. */
+        tnl->save.attrptr[i] = NULL; /* will not be dereferenced. */
    }
 
    /* Copy from current to repopulate the vertex with correct values.
@@ -481,7 +481,7 @@ static void _save_upgrade_vertex( GLcontext *ctx,
       if (tnl->save.currentsz[attr][0] == 0) {
         assert(oldsz == 0);
         tnl->save.dangling_attr_ref = GL_TRUE;
-        _mesa_debug(0, "_save_upgrade_vertex: dangling reference attr %d\n", 
+        _mesa_debug(NULL, "_save_upgrade_vertex: dangling reference attr %d\n", 
                      attr); 
 
 #if 0
@@ -1616,14 +1616,14 @@ static void _tnl_print_vertex_list( GLcontext *ctx, void *data )
    GLuint i;
    (void) ctx;
 
-   _mesa_debug(0, "TNL-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n",
+   _mesa_debug(NULL, "TNL-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n",
                node->count,
               node->prim_count,
               node->vertex_size);
 
    for (i = 0 ; i < node->prim_count ; i++) {
       struct tnl_prim *prim = &node->prim[i];
-      _mesa_debug(0, "   prim %d: %s %d..%d %s %s\n",
+      _mesa_debug(NULL, "   prim %d: %s %d..%d %s %s\n",
                  i, 
                  _mesa_lookup_enum_by_nr(prim->mode & PRIM_MODE_MASK),
                  prim->start, 
@@ -1669,7 +1669,7 @@ void _tnl_save_init( GLcontext *ctx )
 
 
    for (i = 0; i < _TNL_ATTRIB_MAX; i++)
-      _mesa_vector4f_init( &tmp->Attribs[i], 0, 0);
+      _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL);
 
    tnl->save.opcode_vertex_list =
       _mesa_alloc_opcode( ctx,
index 66def96..2dae9c6 100644 (file)
@@ -188,7 +188,7 @@ static void mat_attr4fv( GLcontext *ctx, GLint target, const GLfloat *v )
 
 static attr_func mat_attrfunc[4] = {
    mat_attr1fv,
-   0,
+   NULL,
    mat_attr3fv,
    mat_attr4fv
 };
index d5fcbe6..fa094b1 100644 (file)
@@ -105,11 +105,11 @@ static void _tnl_bind_vertex_list( GLcontext *ctx,
    VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS];
    VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
    VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
-   VB->ColorPtr[1] = 0;
+   VB->ColorPtr[1] = NULL;
    VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX];
-   VB->IndexPtr[1] = 0;
+   VB->IndexPtr[1] = NULL;
    VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
-   VB->SecondaryColorPtr[1] = 0;
+   VB->SecondaryColorPtr[1] = NULL;
    VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
 
    for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
index 13a2cbb..8eb1f78 100644 (file)
@@ -238,7 +238,7 @@ alloc_fog_data(GLcontext *ctx, struct tnl_pipeline_stage *stage)
       return GL_FALSE;
 
    _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 );
-   _mesa_vector4f_init( &store->input, 0, 0 );
+   _mesa_vector4f_init( &store->input, 0, NULL );
 
    if (!inited)
       init_static_data();
index cd5792e..aa420c3 100644 (file)
@@ -344,7 +344,7 @@ static void dtr( struct tnl_pipeline_stage *stage )
       _mesa_vector4f_free( &store->LitIndex[0] );
       _mesa_vector4f_free( &store->LitIndex[1] );
       FREE( store );
-      stage->privatePtr = 0;
+      stage->privatePtr = NULL;
    }
 }
 
index 9d6a4ba..f8c73c7 100644 (file)
@@ -85,7 +85,7 @@ static GLboolean run_normal_stage( GLcontext *ctx,
    VB->NormalPtr = &store->normal;
    VB->AttribPtr[_TNL_ATTRIB_NORMAL] = VB->NormalPtr;
 
-   VB->NormalLengthPtr = 0;    /* no longer valid */
+   VB->NormalLengthPtr = NULL; /* no longer valid */
    return GL_TRUE;
 }
 
@@ -126,7 +126,7 @@ static GLboolean run_validate_normal_stage( GLcontext *ctx,
         store->NormalTransform = _mesa_normal_tab[NORM_RESCALE];
       }
       else {
-        store->NormalTransform = 0;
+        store->NormalTransform = NULL;
       }
    }
 
index 746ea8b..de86697 100644 (file)
@@ -103,7 +103,7 @@ static void free_point_data( struct tnl_pipeline_stage *stage )
    if (store) {
       _mesa_vector4f_free( &store->PointSize );
       FREE( store );
-      stage->privatePtr = 0;
+      stage->privatePtr = NULL;
    }
 }
 
index 38b04b4..5207754 100644 (file)
@@ -201,9 +201,9 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
                                             &store->andmask );
    }
    else {
-      VB->NdcPtr = 0;
+      VB->NdcPtr = NULL;
       _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr,
-                                            0,
+                                            NULL,
                                             store->clipmask,
                                             &store->ormask,
                                             &store->andmask );
@@ -345,7 +345,7 @@ static void dtr( struct tnl_pipeline_stage *stage )
       ALIGN_FREE( store->clipmask );
 
       FREE( store );
-      stage->privatePtr = 0;
+      stage->privatePtr = NULL;
    }
 }
 
index a2912cf..3cdd234 100644 (file)
@@ -161,8 +161,8 @@ typedef void (*build_m_func)( GLfloat f[][3],
 
 
 static build_m_func build_m_tab[5] = {
-   0,
-   0,
+   NULL,
+   NULL,
    build_m2,
    build_m3,
    build_m3
@@ -238,8 +238,8 @@ typedef void (*build_f_func)( GLfloat *f,
 /* Just treat 4-vectors as 3-vectors.
  */
 static build_f_func build_f_tab[5] = {
-   0,
-   0,
+   NULL,
+   NULL,
    build_f2,
    build_f3,
    build_f3
index 8f6ca89..00330b6 100644 (file)
@@ -128,7 +128,7 @@ static void free_texmat_data( struct tnl_pipeline_stage *stage )
         if (store->texcoord[i].data)
            _mesa_vector4f_free( &store->texcoord[i] );
       FREE( store );
-      stage->privatePtr = 0;
+      stage->privatePtr = NULL;
    }
 }
 
index 3951439..ec30318 100644 (file)
@@ -118,8 +118,8 @@ static void (*(usercliptab[5]))( GLcontext *,
                                 GLvector4f *, GLubyte *,
                                 GLubyte *, GLubyte * ) =
 {
-   0,
-   0,
+   NULL,
+   NULL,
    userclip2,
    userclip3,
    userclip4
@@ -209,9 +209,9 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
                                                &store->andmask );
       }
       else {
-        VB->NdcPtr = 0;
+        VB->NdcPtr = NULL;
         _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr,
-                                               0,
+                                               NULL,
                                                store->clipmask,
                                                &store->ormask,
                                                &store->andmask );
index bc60665..2f7c37a 100644 (file)
@@ -831,8 +831,8 @@ const static struct {
      4 * sizeof(GLchan) },
 
    { "pad",
-     0,
-     { 0, 0, 0, 0 },
+     NULL,
+     { NULL, NULL, NULL, NULL },
      0 }
 
 };
@@ -1105,7 +1105,7 @@ static void choose_emit_func( GLcontext *ctx, GLuint count, GLubyte *dest)
    struct tnl_clipspace_attr *a = vtx->attr;
    const GLuint attr_count = vtx->attr_count;
    
-   vtx->emit = 0;
+   vtx->emit = NULL;
    
    if (0) 
       vtx->emit = _tnl_codegen_emit(ctx);
@@ -1421,7 +1421,7 @@ void _tnl_init_vertices( GLcontext *ctx,
 {
    struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);  
 
-   _tnl_install_attrs( ctx, 0, 0, 0, 0 );
+   _tnl_install_attrs( ctx, NULL, 0, NULL, 0 );
 
    vtx->need_extras = GL_TRUE;
    if (max_vertex_size > vtx->max_vertex_size) {
@@ -1440,7 +1440,7 @@ void _tnl_free_vertices( GLcontext *ctx )
    struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
    if (vtx->vertex_buf) {
       ALIGN_FREE(vtx->vertex_buf);
-      vtx->vertex_buf = 0;
+      vtx->vertex_buf = NULL;
    }
    
    _tnl_free_c_codegen( &vtx->codegen );
index 419e7b9..d7e1a03 100644 (file)
@@ -234,7 +234,7 @@ static GLboolean print_attr_footer( struct tnl_clipspace_codegen *p )
 static tnl_emit_func print_store_func( struct tnl_clipspace_codegen *p ) 
 {
    fprintf(stderr, "print_store_func: emitted:\n%s\n", p->buf);
-   return 0;
+   return NULL;
 }
 
 void _tnl_init_c_codegen( struct tnl_clipspace_codegen *p ) 
@@ -262,6 +262,6 @@ void _tnl_free_c_codegen( struct tnl_clipspace_codegen *p )
 {
    if (p->buf) {
       FREE(p->buf);
-      p->buf = 0;
+      p->buf = NULL;
    }
 }
index 4ff9643..e3d9a0a 100644 (file)
@@ -436,7 +436,7 @@ static struct {
        emit_4chan_4f_rgba_4 } },
 
    { "pad", 0, 0,
-     { 0, 0, 0, 0 } }
+     { NULL, NULL, NULL, NULL } }
 
 };
      
@@ -497,7 +497,7 @@ tnl_emit_func _tnl_codegen_emit( GLcontext *ctx )
 
       if (!emit_info[a[j].format].emit[sz]( p )) {
         fprintf(stderr, "codegen failed\n");
-        return 0;
+        return NULL;
       }
 
       p->emit_attr_footer( p );
index d92e03e..1ba0f46 100644 (file)
@@ -255,7 +255,7 @@ static void _tnl_wrap_upgrade_vertex( GLcontext *ctx,
         tmp += tnl->vtx.attrsz[i];
       }
       else 
-        tnl->vtx.attrptr[i] = 0; /* will not be dereferenced */
+        tnl->vtx.attrptr[i] = NULL; /* will not be dereferenced */
    }
 
    /* Copy from current to repopulate the vertex with correct values.
@@ -358,14 +358,14 @@ static struct _tnl_dynfn *lookup( struct _tnl_dynfn *l, GLuint key )
         return f;
    }
 
-   return 0;
+   return NULL;
 }
 
 
 static tnl_attrfv_func do_codegen( GLcontext *ctx, GLuint attr, GLuint sz )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx); 
-   struct _tnl_dynfn *dfn = 0;
+   struct _tnl_dynfn *dfn = NULL;
 
    if (attr == 0) {
       GLuint key = tnl->vtx.vertex_size;
@@ -387,7 +387,7 @@ static tnl_attrfv_func do_codegen( GLcontext *ctx, GLuint attr, GLuint sz )
    if (dfn) 
       return *(tnl_attrfv_func *) &dfn->code;
    else
-      return 0;
+      return NULL;
 }
 
 #endif /* USE_X86_ASM */
@@ -422,7 +422,7 @@ static tnl_attrfv_func do_choose( GLuint attr, GLuint sz )
       tnl->vtx.tabfv[attr][sz-1] = do_codegen( ctx, attr, sz );
    else
 #endif
-      tnl->vtx.tabfv[attr][sz-1] = 0;
+      tnl->vtx.tabfv[attr][sz-1] = NULL;
 
    /* Else use generic version:
     */
@@ -867,7 +867,7 @@ static void _tnl_current_init( GLcontext *ctx )
 static struct _tnl_dynfn *no_codegen( GLcontext *ctx, int key )
 {
    (void) ctx; (void) key;
-   return 0;
+   return NULL;
 }
 
 void _tnl_vtx_init( GLcontext *ctx )
@@ -912,7 +912,7 @@ void _tnl_vtx_init( GLcontext *ctx )
    }
 
    for (i = 0; i < _TNL_ATTRIB_INDEX; i++)
-      _mesa_vector4f_init( &tmp->Attribs[i], 0, 0);
+      _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL);
 
    for (i = 0; i < 4; i++) {
       make_empty_list( &tnl->vtx.cache.Vertex[i] );
index 5a24c70..3b09bd2 100644 (file)
 
 static void clear_active_eval1( TNLcontext *tnl, GLuint attr ) 
 {
-   tnl->vtx.eval.map1[attr].map = 0;
+   tnl->vtx.eval.map1[attr].map = NULL;
 }
 
 static void clear_active_eval2( TNLcontext *tnl, GLuint attr ) 
 {
-   tnl->vtx.eval.map2[attr].map = 0;
+   tnl->vtx.eval.map2[attr].map = NULL;
 }
 
 static void set_active_eval1( TNLcontext *tnl, GLuint attr, GLuint dim, 
index 690912d..e71a8fc 100644 (file)
@@ -49,7 +49,7 @@ static void _tnl_print_vtx( GLcontext *ctx )
 
    for (i = 0 ; i < tnl->vtx.prim_count ; i++) {
       struct tnl_prim *prim = &tnl->vtx.prim[i];
-      _mesa_debug(0, "   prim %d: %s %d..%d %s %s\n",
+      _mesa_debug(NULL, "   prim %d: %s %d..%d %s %s\n",
                  i, 
                  _mesa_lookup_enum_by_nr(prim->mode & PRIM_MODE_MASK),
                  prim->start, 
@@ -166,11 +166,11 @@ static void _tnl_vb_bind_vtx( GLcontext *ctx )
    VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS];
    VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
    VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
-   VB->ColorPtr[1] = 0;
+   VB->ColorPtr[1] = NULL;
    VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX];
-   VB->IndexPtr[1] = 0;
+   VB->IndexPtr[1] = NULL;
    VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
-   VB->SecondaryColorPtr[1] = 0;
+   VB->SecondaryColorPtr[1] = NULL;
    VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
 
    for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {