[Mesa-dev] [PATCH 14/19] i965/fs: Add and use an fs_inst copy constructor.
Pohjolainen, Topi
topi.pohjolainen at intel.com
Sat Feb 22 12:43:02 PST 2014
On Thu, Feb 20, 2014 at 01:41:27PM -0800, Matt Turner wrote:
> Will get more complicated when fs_reg src becomes a pointer.
> ---
> src/mesa/drivers/dri/i965/brw_fs.cpp | 5 +++++
> src/mesa/drivers/dri/i965/brw_fs.h | 1 +
> src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 3 +--
> 3 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 7dc83ad..77b9f57 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -131,6 +131,11 @@ fs_inst::fs_inst(enum opcode opcode, fs_reg dst,
> assert(src[2].reg_offset >= 0);
> }
>
> +fs_inst::fs_inst(const fs_inst &that)
> +{
> + memcpy(this, &that, sizeof(that));
> +}
> +
Before patch 16 declaring and implementing this isn't really necessary as
compiler will generate this.
> #define ALU1(op) \
> fs_inst * \
> fs_visitor::op(fs_reg dst, fs_reg src0) \
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
> index fe063e6..054008e 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
> @@ -180,6 +180,7 @@ public:
> fs_inst(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1);
> fs_inst(enum opcode opcode, fs_reg dst,
> fs_reg src0, fs_reg src1,fs_reg src2);
> + fs_inst(const fs_inst &that);
>
> bool equals(fs_inst *inst);
> bool overwrites_reg(const fs_reg ®);
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index b28d7aa..76f93c9 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -2441,8 +2441,7 @@ fs_visitor::emit_untyped_surface_read(unsigned surf_index, fs_reg dst,
> fs_inst *
> fs_visitor::emit(const fs_inst &inst)
> {
> - fs_inst *list_inst = new(mem_ctx) fs_inst;
> - *list_inst = inst;
> + fs_inst *list_inst = new(mem_ctx) fs_inst(inst);
> emit(list_inst);
> return list_inst;
> }
> --
> 1.8.3.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list