[Mesa-dev] [PATCH 01/57] i965/fs: Replace fs_reg::reg_offset with fs_reg::offset expressed in bytes.

Iago Toral itoral at igalia.com
Thu Sep 8 06:53:22 UTC 2016


On Wed, 2016-09-07 at 18:48 -0700, Francisco Jerez wrote:
(...)
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp
> b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index ea39252..29435f6 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
> @@ -672,7 +672,7 @@ backend_shader::backend_shader(const struct
> brw_compiler *compiler,
>  bool
>  backend_reg::equals(const backend_reg &r) const
>  {
> -   return brw_regs_equal(this, &r) && reg_offset == r.reg_offset;
> +   return brw_regs_equal(this, &r) && offset == r.offset;
>  }
>  
>  bool
> @@ -750,7 +750,9 @@ backend_reg::in_range(const backend_reg &r,
> unsigned n) const
>     return (file == r.file &&
>             nr == r.nr &&
>             reg_offset >= r.reg_offset &&
> -           reg_offset < r.reg_offset + n);
> +           reg_offset < r.reg_offset + n &&

Are you keeping the checks with reg_offset here for a reason or is this
just an omission? I would expect that these would be replaced with the
checks below like we do everywhere else in this patch.

> +           offset >= r.offset &&
> +           offset < r.offset + n * REG_SIZE);
>  }
>  
>  bool
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.h
> b/src/mesa/drivers/dri/i965/brw_shader.h
> index 0102098..72b94b6 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.h
> +++ b/src/mesa/drivers/dri/i965/brw_shader.h
> @@ -44,14 +44,14 @@ struct backend_reg : private brw_reg
>     const brw_reg &as_brw_reg() const
>     {
>        assert(file == ARF || file == FIXED_GRF || file == MRF || file
> == IMM);
> -      assert(reg_offset == 0);
> +      assert(reg_offset == 0 && offset == 0);

Same here.

>        return static_cast<const brw_reg &>(*this);
>     }
>  
>     brw_reg &as_brw_reg()
>     {
>        assert(file == ARF || file == FIXED_GRF || file == MRF || file
> == IMM);
> -      assert(reg_offset == 0);
> +      assert(reg_offset == 0 && offset == 0);

And here.


>        return static_cast<brw_reg &>(*this);
>     }
>  
> @@ -75,6 +75,9 @@ struct backend_reg : private brw_reg
>      */
>     uint16_t reg_offset;
>  
> +   /** Offset from the start of the (virtual) register in bytes. */
> +   uint16_t offset;
> +
>     using brw_reg::type;
>     using brw_reg::file;
>     using brw_reg::negate;


More information about the mesa-dev mailing list