r300c/r300g: add 3155 rv380 pci id
[mesa.git] / src / gallium / auxiliary / draw / draw_pipe_wide_line.c
index 329b5d0fb02bee5196b0c0b698e7c013ade5925d..3073c8708251e0ee521c516b5b18c6301ab16e19 100644 (file)
 /* Authors:  Keith Whitwell <keith@tungstengraphics.com>
  */
 
-#include "pipe/p_util.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
 #include "draw_private.h"
 #include "draw_pipe.h"
 
@@ -49,19 +50,6 @@ static INLINE struct wideline_stage *wideline_stage( struct draw_stage *stage )
 }
 
 
-static void wideline_point( struct draw_stage *stage,
-                               struct prim_header *header )
-{
-   stage->next->point( stage->next, header );
-}
-
-
-static void wideline_tri( struct draw_stage *stage,
-                             struct prim_header *header )
-{
-   stage->next->tri(stage->next, header);
-}
-
 
 /**
  * Draw a wide line by drawing a quad (two triangles).
@@ -71,6 +59,7 @@ static void wideline_line( struct draw_stage *stage,
                            struct prim_header *header )
 {
    /*const struct wideline_stage *wide = wideline_stage(stage);*/
+   const unsigned pos = draw_current_shader_position_output(stage->draw);
    const float half_width = 0.5f * stage->draw->rasterizer->line_width;
 
    struct prim_header tri;
@@ -80,13 +69,13 @@ static void wideline_line( struct draw_stage *stage,
    struct vertex_header *v2 = dup_vert(stage, header->v[1], 2);
    struct vertex_header *v3 = dup_vert(stage, header->v[1], 3);
 
-   float *pos0 = v0->data[0];
-   float *pos1 = v1->data[0];
-   float *pos2 = v2->data[0];
-   float *pos3 = v3->data[0];
+   float *pos0 = v0->data[pos];
+   float *pos1 = v1->data[pos];
+   float *pos2 = v2->data[pos];
+   float *pos3 = v3->data[pos];
 
-   const float dx = FABSF(pos0[0] - pos2[0]);
-   const float dy = FABSF(pos0[1] - pos2[1]);
+   const float dx = fabsf(pos0[0] - pos2[0]);
+   const float dy = fabsf(pos0[1] - pos2[1]);
 
    /* small tweak to meet GL specification */
    const float bias = 0.125f;
@@ -179,10 +168,11 @@ struct draw_stage *draw_wide_line_stage( struct draw_context *draw )
    draw_alloc_temp_verts( &wide->stage, 4 );
 
    wide->stage.draw = draw;
+   wide->stage.name = "wide-line";
    wide->stage.next = NULL;
-   wide->stage.point = wideline_point;
+   wide->stage.point = draw_pipe_passthrough_point;
    wide->stage.line = wideline_line;
-   wide->stage.tri = wideline_tri;
+   wide->stage.tri = draw_pipe_passthrough_tri;
    wide->stage.flush = wideline_flush;
    wide->stage.reset_stipple_counter = wideline_reset_stipple_counter;
    wide->stage.destroy = wideline_destroy;