Bug 26990 - [GLSL] variable declaration in "while" fails to compile
Summary: [GLSL] variable declaration in "while" fails to compile
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: Ian Romanick
QA Contact:
Depends on:
Blocks: 29044
  Show dependency treegraph
Reported: 2010-03-10 00:57 UTC by Gordon Jin
Modified: 2010-08-18 20:04 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Gordon Jin 2010-03-10 00:57:49 UTC

    while(bool b = (test_float1 > test_float2)) 

gets Error: scalar/boolean expression expected for 'while'

Changing it to:

    bool b;
    while(b = (test_float1 > test_float2)) 

gets the case pass.

But GLSL spec (both 1.10 and 1.50) section 6.3 says: "Both the condition-expression and the init-expression can declare and initialize a variable", so the case should be allowed.
Comment 1 Eric Anholt 2010-08-17 09:28:09 UTC
Fixed with glsl2 merge.
Comment 2 Gordon Jin 2010-08-18 19:47:15 UTC
verified with mesa master d442a01ac14382d83cdaac87d2832315ceb3e963.

CorrectFull.frag gets assertion now, but that'll be another bug.
Comment 3 Gordon Jin 2010-08-18 20:04:39 UTC
the assertion error has been tracked at bug#29573

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.