[Mesa-dev] [PATCH] i965/fs: Allow LRPs with uniform registers.

Matt Turner mattst88 at gmail.com
Thu Apr 25 21:55:31 PDT 2013


On Thu, Apr 25, 2013 at 9:06 PM, Eric Anholt <eric at anholt.net> wrote:
> Improves GLB2.7 performance on my HSW by 0.671455% +/- 0.225037% (n=62).
> ---
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index f1539d5..8aae516 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -198,10 +198,19 @@ fs_visitor::visit(ir_dereference_array *ir)
>     this->result = src;
>  }
>
> +static bool
> +is_valid_3src(fs_reg reg)
> +{
> +   return reg.file == GRF || reg.file == UNIFORM;
> +}
> +
>  void
>  fs_visitor::emit_lrp(fs_reg dst, fs_reg x, fs_reg y, fs_reg a)
>  {
> -   if (intel->gen < 6 || x.file != GRF || y.file != GRF || a.file != GRF) {
> +   if (intel->gen < 6 ||
> +       !is_valid_3src(x) ||
> +       !is_valid_3src(y) ||
> +       !is_valid_3src(a)) {
>        /* We can't use the LRP instruction.  Emit x*(1-a) + y*a. */
>        fs_reg y_times_a           = fs_reg(this, glsl_type::float_type);
>        fs_reg one_minus_a         = fs_reg(this, glsl_type::float_type);
> --
> 1.7.10.4

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list