[Mesa-dev] [PATCH 7/8] i965/fs: Rewrite discards to use a flag subreg to track discarded pixels.

Eric Anholt eric at anholt.net
Mon Dec 10 18:51:01 PST 2012

Kenneth Graunke <kenneth at whitecape.org> writes:

> On 12/07/2012 02:08 PM, Eric Anholt wrote:
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index dbf48f8..b4e8d68 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -2434,6 +2434,14 @@ fs_visitor::run()
>>         else
>>   	 emit_interpolation_setup_gen6();
>> +      /* On gen6+, we handle discards by keeping track of the still-live
>> +       * pixels in f0.1.  If so, initialize it with the dispatched pixels.
> The wording "If so" doesn't make sense to me.  Perhaps just "Initialize 
> it with the dispatched pixels."  The fact that we only do so for 
> programs that use discards is obvious from the code and makes a lot of 
> sense.

I had meant "if we are gen6, then do the setup".  Except that it applies
on non-gen6 too, since I made the change there as well!  Fixed.

> Also: does this new approach work in SIMD16 mode?  (Is the f0.1 wide 
> enough?)  It looks like you've removed the code to fail 16-wide compiles 
> that use discard.  I wasn't sure if that was intentional.

Yeah, that was intentional: we can use predication now instead of a
conditional.  This should fix any KIL performance regression pre-gen6,
though I haven't seen one reported.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121210/01c59d31/attachment-0001.pgp>

More information about the mesa-dev mailing list