util: Update caps after helpfull input
[mesa.git] / src / gallium / auxiliary / draw / draw_pt_elts.c
index d49770e7b2de5c711b9203affe92b91209cce63f..88f4d9f495ac306aa0f0e1ae9138d1b9362c2dcb 100644 (file)
@@ -54,16 +54,17 @@ static unsigned elt_ubyte( const void *elts, unsigned idx )
 
 static unsigned elt_vert( const void *elts, unsigned idx )
 {
-   return (const ubyte *)elts - (const ubyte *)NULL + idx;
+   /* unsigned index is packed in the pointer */
+   return (unsigned)(uintptr_t)elts + idx;
 }
 
 pt_elt_func draw_pt_elt_func( struct draw_context *draw )
 {
-   switch (draw->user.eltSize) {
-   case 0: return elt_vert;
-   case 1: return elt_ubyte;
-   case 2: return elt_ushort; 
-   case 4: return elt_uint;
+   switch (draw->pt.user.eltSize) {
+   case 0: return &elt_vert;
+   case 1: return &elt_ubyte;
+   case 2: return &elt_ushort; 
+   case 4: return &elt_uint;
    default: return NULL;
    }
 }     
@@ -71,9 +72,9 @@ pt_elt_func draw_pt_elt_func( struct draw_context *draw )
 const void *draw_pt_elt_ptr( struct draw_context *draw,
                              unsigned start )
 {
-   const char *elts = draw->user.elts;
+   const char *elts = draw->pt.user.elts;
 
-   switch (draw->user.eltSize) {
+   switch (draw->pt.user.eltSize) {
    case 0: 
       return (const void *)(((const ubyte *)NULL) + start);
    case 1: