Mesa (master): softpipe: fix flat shading provoking vertex for PIPE_PRIM_POLYGON
Brian Paul
brianp at kemper.freedesktop.org
Thu May 28 01:30:33 UTC 2009
Module: Mesa
Branch: master
Commit: 5d75124db480b37977c353511b4e228905b7cc95
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d75124db480b37977c353511b4e228905b7cc95
Author: Brian Paul <brianp at vmware.com>
Date: Wed May 27 19:27:31 2009 -0600
softpipe: fix flat shading provoking vertex for PIPE_PRIM_POLYGON
Use the first vertex, not the last.
---
src/gallium/drivers/softpipe/sp_context.h | 1 +
src/gallium/drivers/softpipe/sp_draw_arrays.c | 1 +
src/gallium/drivers/softpipe/sp_setup.c | 5 ++++-
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h
index b89a729..2f90d53 100644
--- a/src/gallium/drivers/softpipe/sp_context.h
+++ b/src/gallium/drivers/softpipe/sp_context.h
@@ -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: */
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index f117096..1460bc4 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -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)
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index accc692..c4dd61e 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -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 */
{
More information about the mesa-commit
mailing list