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

Kenneth Graunke kenneth at whitecape.org
Fri Apr 26 09:16:58 PDT 2013


On 04/25/2013 09:06 PM, Eric Anholt 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);
>

Maybe make this a method of fs_reg?  i.e. fs_reg::is_valid_3src?

Either way, this is
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list