[Mesa-dev] [PATCH] r600g: fix blend setting with multiple render targets all with the same blend

Jerome Glisse j.glisse at gmail.com
Thu Mar 31 11:33:31 PDT 2011


On Thu, Mar 31, 2011 at 12:37 PM, Julian Adams <joolsa at gmail.com> wrote:
> inline...
>
> On 31 March 2011 12:07, Henri Verbeet <hverbeet at gmail.com> wrote:
>> On 30 March 2011 23:43, Julian Adams <joolsa at gmail.com> wrote:
>>> ---
>>>  src/gallium/drivers/r600/r600_state.c |   22 +++++++++++++---------
>>>  1 files changed, 13 insertions(+), 9 deletions(-)
>>>
>> Evergreen probably needs the same fix.
>
> Yes, the matching function there looks similar. I can update it, but
> can't test it.
>
>>
>>> +       for (int i = 0, j = 0; i < 8; i++) {
>>> +               /* state->rt entries > 0 only written if independent blending */
>>> +               if (state->independent_blend_enable)
>>> +                       j = i;
>> Not sure about declaring "j" inside the for. I don't think it exactly
>> helps readability, but otoh it doesn't bother me a lot either.
>>
>
> I copied that style from a function up the call stack, which was fixed
> in a similar way in commit: a476ca1fd1b4e76e31c9babfd7fb2a54a09f21d3.
> Mostly I write C++ so probably I'd be inclined to do this:
>
>        for (int i = 0; i < 8; i++) {
>                /* state->rt entries > 0 only written if independent blending */
>                const int j = state->independent_blend_enable ? i : 0;
>
> Let me know if you want the Evergreen fixes, and how "j" is declared and set.


Using for(int loopcountuer;;) construct is a good thing it helps the
compiler to make good decision but gcc is already good on its own to
figure this kind of things by itself.

Cheers,
Jerome


More information about the mesa-dev mailing list