gallium: Fix typo in define name.
[mesa.git] / src / mesa / tnl / t_vertex.c
index cf67dfc179cee12e55bd85ce62f7934b36a66d9a..b661524c87088913c399bdc29989da3c0c728191 100644 (file)
@@ -25,9 +25,9 @@
  *    Keith Whitwell <keithw@tungstengraphics.com>
  */
 
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
 
 #include "t_context.h"
 #include "t_vertex.h"
@@ -87,7 +87,8 @@ void _tnl_register_fastpath( struct tnl_clipspace *vtx,
    fastpath->attr_count = vtx->attr_count;
    fastpath->match_strides = match_strides;
    fastpath->func = vtx->emit;
-   fastpath->attr = MALLOC(vtx->attr_count * sizeof(fastpath->attr[0]));
+   fastpath->attr = (struct tnl_attr_type *)
+      _mesa_malloc(vtx->attr_count * sizeof(fastpath->attr[0]));
 
    for (i = 0; i < vtx->attr_count; i++) {
       fastpath->attr[i].format = vtx->attr[i].format;
@@ -228,7 +229,15 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin,
 
    /* Else return the value from ctx->Current.
     */
-   _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
+   if (attr == _TNL_ATTRIB_POINTSIZE) {
+      /* If the hardware vertex doesn't have point size then use size from
+       * GLcontext.  XXX this will be wrong if drawing attenuated points!
+       */
+      dest[0] = ctx->Point.Size;
+   }
+   else {
+      _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
+   }
 }
 
 
@@ -425,7 +434,7 @@ void *_tnl_emit_vertices_to_buffer( GLcontext *ctx,
 
    /* Note: dest should not be adjusted for non-zero 'start' values:
     */
-   vtx->emit( ctx, end - start, dest );        
+   vtx->emit( ctx, end - start, (GLubyte*) dest );     
    return (void *)((GLubyte *)dest + vtx->vertex_size * (end - start));
 }
 
@@ -494,14 +503,14 @@ void _tnl_free_vertices( GLcontext *ctx )
    for (fp = vtx->fastpath ; fp ; fp = tmp) {
       tmp = fp->next;
       FREE(fp->attr);
-      /* XXX Can we be sure that fp->func points to memory that was
-       * allocated with _mesa_exec_malloc()?  I think it's possible that
-       * the pointer can point to an ordinary C function.
-       * Just disable this for the time being.  See bug 5131.
+
+      /* KW: At the moment, fp->func is constrained to be allocated by
+       * _mesa_exec_alloc(), as the hardwired fastpaths in
+       * t_vertex_generic.c are handled specially.  It would be nice
+       * to unify them, but this probably won't change until this
+       * module gets another overhaul.
        */
-#if 0
       _mesa_exec_free((void *) fp->func);
-#endif
       FREE(fp);
    }