[Mesa-dev] [PATCH V3 5/5] i965 Gen4/5: clip: Don't mangle flat varyings

Paul Berry stereotype441 at gmail.com
Tue Jul 30 14:45:52 PDT 2013


On 14 July 2013 02:39, Chris Forbes <chrisf at ijw.co.nz> wrote:

> This patch ensures that integers will pass through unscathed.  Doing
> (useless) computations on them is risky, especially when their bit
> patterns correspond to values like inf or nan.
>
> [V1-2]: Signed-off-by: Olivier Galibert <galibert at pobox.com>
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/drivers/dri/i965/brw_clip_util.c | 57
> ++++++++++++++++++-------------
>  1 file changed, 34 insertions(+), 23 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c
> b/src/mesa/drivers/dri/i965/brw_clip_util.c
> index 56c9ccd..a168b32 100644
> --- a/src/mesa/drivers/dri/i965/brw_clip_util.c
> +++ b/src/mesa/drivers/dri/i965/brw_clip_util.c
> @@ -246,8 +246,8 @@ void brw_clip_interp_vertex( struct brw_clip_compile
> *c,
>        int varying = c->vue_map.slot_to_varying[slot];
>        GLuint delta = brw_vue_slot_to_offset(slot);
>
> -      /* HPOS is already handled above */
> -      if (varying == VARYING_SLOT_POS)
> +      /* HPOS, NDC already handled above */
> +      if (varying == VARYING_SLOT_POS || varying == BRW_VARYING_SLOT_NDC)
>           continue;
>

Was this hunk supposed to go in patch 4/5?

With that fixed, this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


>
>
> @@ -269,28 +269,39 @@ void brw_clip_interp_vertex( struct brw_clip_compile
> *c,
>           * header), so interpolate:
>           *
>           *        New = attr0 + t*attr1 - t*attr0
> +          *
> +          * Unless the attribute is flat shaded -- in which case just copy
> +          * from one of the sources (doesn't matter which; already copied
> from pv)
>           */
> -         struct brw_reg tmp = get_tmp(c);
> -         struct brw_reg t =
> -            c->key.interpolation_mode[slot] ==
> INTERP_QUALIFIER_NOPERSPECTIVE ?
> -            t_nopersp : t0;
> -
> -        brw_MUL(p,
> -                vec4(brw_null_reg()),
> -                deref_4f(v1_ptr, delta),
> -                t);
> -
> -        brw_MAC(p,
> -                tmp,
> -                negate(deref_4f(v0_ptr, delta)),
> -                t);
> -
> -        brw_ADD(p,
> -                deref_4f(dest_ptr, delta),
> -                deref_4f(v0_ptr, delta),
> -                tmp);
> -
> -         release_tmp(c, tmp);
> +         GLuint interp = c->key.interpolation_mode[slot];
> +
> +         if (interp != INTERP_QUALIFIER_FLAT) {
> +            struct brw_reg tmp = get_tmp(c);
> +            struct brw_reg t =
> +               interp == INTERP_QUALIFIER_NOPERSPECTIVE ? t_nopersp : t0;
> +
> +            brw_MUL(p,
> +                  vec4(brw_null_reg()),
> +                  deref_4f(v1_ptr, delta),
> +                  t);
> +
> +            brw_MAC(p,
> +                  tmp,
> +                  negate(deref_4f(v0_ptr, delta)),
> +                  t);
> +
> +            brw_ADD(p,
> +                  deref_4f(dest_ptr, delta),
> +                  deref_4f(v0_ptr, delta),
> +                  tmp);
> +
> +            release_tmp(c, tmp);
> +         }
> +         else {
> +            brw_MOV(p,
> +                  deref_4f(dest_ptr, delta),
> +                  deref_4f(v0_ptr, delta));
> +         }
>        }
>     }
>
> --
> 1.8.3.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130730/65c83588/attachment.html>


More information about the mesa-dev mailing list