[Mesa-dev] [PATCH 05/12] i965/fs: Use offset a lot more places

Matt Turner mattst88 at gmail.com
Fri Sep 19 17:34:38 PDT 2014


On Fri, Sep 19, 2014 at 1:10 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> We have this wonderful offset() function for advancing registers, but we're
> not using it.  Using offset() allows us to do some sanity checking and
> avoid manually touching fs_reg::reg_offset.  In a few commits, we will make
> offset do even more nifty things for us.
>
> Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp              |  18 +--
>  src/mesa/drivers/dri/i965/brw_fs_cse.cpp          |  12 +-
>  src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp |   4 +-
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp      | 137 ++++++++++------------
>  4 files changed, 78 insertions(+), 93 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index af8c087..ea91705 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -310,8 +310,8 @@ fs_visitor::VARYING_PULL_CONSTANT_LOAD(const fs_reg &dst,
>           inst->mlen = 1 + dispatch_width / 8;
>     }
>
> -   vec4_result.reg_offset += (const_offset & 3) * scale;
> -   instructions.push_tail(MOV(dst, vec4_result));
> +   fs_reg result = offset(vec4_result, (const_offset & 3) * scale);
> +   instructions.push_tail(MOV(dst, result));

Isn't this going to cause us to copy an fs_reg twice, rather than just
setting .reg_offset?

I'd like to check the generated code.


More information about the mesa-dev mailing list