[Mesa-dev] [PATCH 1/7] i965: Make can_do_source_mods() a member of the instruction classes.
Kenneth Graunke
kenneth at whitecape.org
Tue Jun 24 17:57:59 PDT 2014
On Tuesday, June 24, 2014 12:16:49 PM Matt Turner wrote:
> Pretty nonsensical to have it as a method of the visitor just for access
> to brw.
> ---
> src/mesa/drivers/dri/i965/brw_fs.cpp | 8 ++++----
> src/mesa/drivers/dri/i965/brw_fs.h | 3 +--
> src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 2 +-
> src/mesa/drivers/dri/i965/brw_vec4.cpp | 8 ++++----
> src/mesa/drivers/dri/i965/brw_vec4.h | 3 +--
> src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp | 2 +-
> 6 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 185a1f6..929379a 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -371,15 +371,15 @@ fs_inst::is_send_from_grf() const
> }
>
> bool
> -fs_visitor::can_do_source_mods(fs_inst *inst)
> +fs_inst::can_do_source_mods(struct brw_context *brw)
> {
> - if (brw->gen == 6 && inst->is_math())
> + if (brw->gen == 6 && is_math())
> return false;
>
> - if (inst->is_send_from_grf())
> + if (is_send_from_grf())
> return false;
>
> - if (!inst->can_do_source_mods())
> + if (!backend_instruction::can_do_source_mods())
> return false;
>
> return true;
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h
b/src/mesa/drivers/dri/i965/brw_fs.h
> index b86a31c..0da79ba 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
> @@ -208,6 +208,7 @@ public:
> bool is_send_from_grf() const;
> bool is_partial_write() const;
> int regs_read(fs_visitor *v, int arg) const;
> + bool can_do_source_mods(struct brw_context *brw);
>
> bool reads_flag() const;
> bool writes_flag() const;
I really like this. A good follow-on, IMHO, would be to make
backend_instruction::can_do_source_mods() protected, rather than public.
That way, fs_inst and vec4_instruction methods could use it (as you do here),
but other code couldn't call it directly (accidentally bypassing the FS/Vec4
specific details).
Series looks great. I'd forgotten about adding math support for constant
propagation. Nice catch.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140624/83dae0cf/attachment-0001.sig>
More information about the mesa-dev
mailing list