softpipe: fix flat shading provoking vertex for PIPE_PRIM_POLYGON
authorBrian Paul <brianp@vmware.com>
Thu, 28 May 2009 01:27:31 +0000 (19:27 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 28 May 2009 01:27:31 +0000 (19:27 -0600)
Use the first vertex, not the last.

src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_draw_arrays.c
src/gallium/drivers/softpipe/sp_setup.c

index b89a7292e5bf79589b9a8700b8e0e88eccd445ee..2f90d538a59ee8d2bb8fb75513c5052720814db5 100644 (file)
@@ -107,6 +107,7 @@ struct softpipe_context {
    /** Which vertex shader output slot contains point size */
    int psize_slot;
 
+   unsigned api_prim;  /**< current prim type being drawn: PIPE_PRIM_x */
    unsigned reduced_api_prim;  /**< PIPE_PRIM_POINTS, _LINES or _TRIANGLES */
 
    /** Derived from scissor and surface bounds: */
index f117096bf733d71e7e8bbce0f7d29889d0ce36a6..1460bc4b4b82e564ef4b10166f28fadaa9542ac2 100644 (file)
@@ -129,6 +129,7 @@ softpipe_draw_range_elements(struct pipe_context *pipe,
    struct draw_context *draw = sp->draw;
    unsigned i;
 
+   sp->api_prim = mode;
    sp->reduced_api_prim = reduced_prim[mode];
 
    if (sp->dirty)
index accc692b66fc0d6f268fa42f024e4688fe55a06d..c4dd61e41e046c3aa5347b0d95bd8dcfadebb165 100644 (file)
@@ -512,7 +512,10 @@ static boolean setup_sort_vertices( struct setup_context *setup,
                                     const float (*v1)[4],
                                     const float (*v2)[4] )
 {
-   setup->vprovoke = v2;
+   if (setup->softpipe->api_prim == PIPE_PRIM_POLYGON)
+      setup->vprovoke = v0;
+   else
+      setup->vprovoke = v2;
 
    /* determine bottom to top order of vertices */
    {