[Mesa-dev] [PATCH 2/3] i965/fs: Only emit FS_OPCODE_PLACEHOLDER_HALT if there are discards

Kenneth Graunke kenneth at whitecape.org
Fri Apr 10 19:50:19 PDT 2015


On Friday, April 10, 2015 12:52:03 PM Ben Widawsky wrote:
> Based originally on a patch from Ken in May 2014 of the same title. Things
> changed enough that I didn't feel comfortable leaving his authorship. Ken, if
> you feel you should retain authorship, it's fine with me, just call it
> reviewed-by me instead.
> 
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
> 
> Notes:
>     Ken, if you feel you should retain authorship, it's fine with me, just call it
>     reviewed-by me instead.

No, I think you should retain authorship.  I wrote a similar patch ages
ago and abandoned it, but your new patch is completely rewritten.

> 
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 214ba40..72000cf 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -1700,6 +1700,9 @@ fs_visitor::emit_math(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1)
>  void
>  fs_visitor::emit_discard_jump()
>  {
> +   struct gl_fragment_program *fp = (struct gl_fragment_program *) this->prog;
> +   assert(fp->UsesKill);
> +
>     /* For performance, after a discard, jump to the end of the
>      * shader if all relevant channels have been discarded.
>      */

Please drop this hunk - I don't think it provides any real value.
Or, change it to check wm_prog_data->uses_kill.  Either way's fine.

> @@ -3956,7 +3959,8 @@ fs_visitor::run_fs()
>        if (failed)
>  	 return false;
>  
> -      emit(FS_OPCODE_PLACEHOLDER_HALT);
> +      if (wm_prog_data->uses_kill)
> +         emit(FS_OPCODE_PLACEHOLDER_HALT);
>  
>        if (wm_key->alpha_test_func)
>           emit_alpha_test();
> 

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/20150410/05881917/attachment.sig>


More information about the mesa-dev mailing list