[Mesa-dev] [PATCH 09/20] i915: Handle provoking vertex in intelFastRenderClippedPoly()

Ian Romanick idr at freedesktop.org
Fri May 15 12:11:42 PDT 2015


This patch seems obviously correct and is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 03/23/2015 05:47 AM, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> intelFastRenderClippedPoly() renders the polygon using triangles. For
> polygons the provoking vertex is always the first one, and currently
> this function assumes that the provoking vertex for triangles is the
> last one. In case the user changed the provoking vertex convention,
> the hardware may be configured to treat the first vertex of triangles
> as the provoking vertex. So check the convention and emit the triangles
> in the appropriate order to avoid having to change the hardware
> provoking vertex convention for rendering polygons.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  src/mesa/drivers/dri/i915/intel_tris.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
> index 2c0a785..2b62104 100644
> --- a/src/mesa/drivers/dri/i915/intel_tris.c
> +++ b/src/mesa/drivers/dri/i915/intel_tris.c
> @@ -928,10 +928,18 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint
>     const GLuint *start = (const GLuint *) V(elts[0]);
>     int i, j;
>  
> -   for (i = 2; i < n; i++) {
> -      COPY_DWORDS(j, vb, vertsize, V(elts[i - 1]));
> -      COPY_DWORDS(j, vb, vertsize, V(elts[i]));
> -      COPY_DWORDS(j, vb, vertsize, start);
> +   if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION) {
> +      for (i = 2; i < n; i++) {
> +         COPY_DWORDS(j, vb, vertsize, V(elts[i - 1]));
> +         COPY_DWORDS(j, vb, vertsize, V(elts[i]));
> +         COPY_DWORDS(j, vb, vertsize, start);
> +      }
> +   } else {
> +      for (i = 2; i < n; i++) {
> +         COPY_DWORDS(j, vb, vertsize, start);
> +         COPY_DWORDS(j, vb, vertsize, V(elts[i - 1]));
> +         COPY_DWORDS(j, vb, vertsize, V(elts[i]));
> +      }
>     }
>  }
>  
> 



More information about the mesa-dev mailing list