[Mesa-dev] [PATCH 3/3] r600g: implement fragment and vertex color clamp

Jerome Glisse j.glisse at gmail.com
Mon Jun 27 06:32:46 PDT 2011


On Mon, Jun 27, 2011 at 8:38 AM, Roland Scheidegger <sroland at vmware.com> wrote:
> 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>
>>> wrote:
>>>> 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.

Well if boolean block (see COND field set to SQ_CF_COND_BOOL in
SQ_CF_WORD1) are free from perf point of view then i think it's best
to have one shader with the clamp instruction inside the boolean
enabled block. Only benchmark can tell.

Cheers,
Jerome


More information about the mesa-dev mailing list