[Mesa-dev] [PATCH 8/9] i965/vec4: Handle saturated constants in opt_vector_float

Matt Turner mattst88 at gmail.com
Thu Mar 17 18:18:23 UTC 2016


On Thu, Mar 17, 2016 at 10:21 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_vec4.cpp | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index 155a550..02a00b3 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -384,7 +384,13 @@ vec4_visitor::opt_vector_float()
>           continue;
>        }
>
> -      int vf = brw_float_to_vf(inst->src[0].f);
> +      float f = inst->src[0].f;
> +      if (inst->saturate) {
> +         assert(inst->dst.type == BRW_REGISTER_TYPE_F);
> +         f = CLAMP(f, 0.0f, 1.0f);
> +      }
> +
> +      int vf = brw_float_to_vf(f);
>        if (vf == -1)
>           continue;

Presumably the previous patch is to allow this to happen without
thinking about types.

This does look like a legitimate bug fix, but what does this fix or enable?


More information about the mesa-dev mailing list