[Mesa-dev] [PATCH 3/3] r600g: implement fragment and vertex color clamp
sroland at vmware.com
Mon Jun 27 05:38:02 PDT 2011
Am 25.06.2011 00:22, schrieb Vadim Girlin:
> On 06/24/2011 11:38 PM, Jerome Glisse wrote:
>> On Fri, Jun 24, 2011 at 12:29 PM, Vadim Girlin<vadimgirlin at gmail.com>
>>> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=38440
>>> Signed-off-by: Vadim Girlin<vadimgirlin at gmail.com>
>> As discussed previously, there is better to handle this. I think best
>> solution is to always add the instruction and to conditionally execute
>> them thanks to the boolean constant. If this reveal to have a too big
>> impact on shader, other solution i see is adding a cf block with those
>> instructions and to enable or disable that block (cf_nop) and reupload
>> shader that would avoid a rebuild.
> I know its not optimal to do a full rebuild, but rebuild is needed only
> when the application will use the same shader in different clamping
> states. It won't be a problem if the application doesn't change clamping
> state or if it changes the state but uses each shader in one state only.
> So assuming that typical app will not use one shader in both states, it
> shouldn't be a problem. Is this assumption wrong? I'm not really sure
> because I have no much experience in this. But if it's wrong then it's
> probably better for performance to build and cache both versions.
I tend to think you're right apps probably don't want to use the same
shader both with and without clamping.
> Also it seems last write to color output components is often done with
> op2 instructions, so there is another optimization possible - to find
> last op2 writes and set clamp bit instead of using additional
> instructions. Probably it's not very hard to implement with this patch.
> AFAICS it will be impossible with other suggested solutions.
Such optimization should probably be part of a more generic optimization
More information about the mesa-dev