[Mesa-dev] r600/sb loop issue

Vadim Girlin vadimgirlin at gmail.com
Fri Dec 5 21:43:24 PST 2014


On 12/06/2014 08:01 AM, Matt Turner wrote:
> On Fri, Dec 5, 2014 at 8:56 PM, Vadim Girlin <vadimgirlin at gmail.com> wrote:
>> On 12/06/2014 07:50 AM, Matt Turner wrote:
>>>
>>> On Fri, Dec 5, 2014 at 8:13 PM, Vadim Girlin <vadimgirlin at gmail.com>
>>> wrote:
>>>>
>>>> I suspect we should rather get rid of such loops somehow, i.e. convert to
>>>> something else, the loop that never repeats is not really a loop anyway.
>>>> AFAICS "continue" is not supported in switch statements according to GLSL
>>>> specs, so the loops generated for switch will never be repeated. Am I
>>>> missing something? Even if repeating is possible somehow, at least we can
>>>> get rid of the loops that are not repeated.
>>>
>>>
>>> I don't think that's true. I don't see anything in the spec that would
>>> lead me to believe continue cannot occur in a switch statement.
>>
>>
>> I've double-checked some versions of GLSL spec (1.30, 1.50, 3.30, 4.40) and
>> all of them say the same (section "6.4 Jumps"):
>>
>> "The continue jump is used only in loops."
>
> Sure, but isn't the continue below in a loop?
>
> do {
>     switch (...) {
>     case ...:
>        continue;
>     }
> } while (...);
>

Ah, now I see, you're right. I just was mostly thinking about that loop 
that is created for a switch in IR, not about source, and somehow 
confused these things.

Thanks for pointing that out. Hopefully such cases won't complicate the 
problem in sb even more, need to check those tests.

> The grammar is pretty unambiguous.
>
>   jump_statement:
>      CONTINUE SEMICOLON
>      BREAK SEMICOLON
>      RETURN SEMICOLON
>      RETURN expression SEMICOLON
>      DISCARD SEMICOLON // Fragment shader only.
>
> If continue can't be in a switch, neither can break. :)
>



More information about the mesa-dev mailing list