On Friday, April 10, 2015 10:49:51 PM Ben Widawsky wrote: > On Fri, Apr 10, 2015 at 07:50:19PM -0700, Kenneth Graunke wrote: > > 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 <kenn...@whitecape.org> > > > Signed-off-by: Ben Widawsky <b...@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 <kenn...@whitecape.org> > > Cool thanks... > > While we're on the subject, I wouldn't mind the 5 second explanation of the > distinction between fp->UsesKill and wm_prog_data->uses_kill. I actually only > kept the former since your original patch had it (iirc).
They're pretty similar. fp->UsesKill indicates that a ARB_fragment_program shader uses the KIL instruction, or that a GLSL shader uses the "discard" insntruction (which are analogous). On Gen4-5, we sometimes have to simulate OpenGL's "Alpha Test" feature by emitting shader code that implicitly does a "discard" instruction. In the key setup, we do: /* key->alpha_test_func means simulating alpha testing via discards, * so the shader definitely kills pixels. */ prog_data.uses_kill = fp->program.UsesKill || key->alpha_test_func; Even though the shader may not technically contain a "discard", we need to act as if it does. I've also been trying to move the i965 state setup code to use brw_wm_prog_key for everything, rather than poking at core Mesa's gl_program/gl_fragment_program/gl_shader/gl_shader_program structures. --Ken
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev