Bug 90157 - GLSL ES does not allow non-constant initializers for globals
Summary: GLSL ES does not allow non-constant initializers for globals
Status: RESOLVED DUPLICATE of bug 92304
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-24 05:17 UTC by Ian Romanick
Modified: 2018-11-01 19:32 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Ian Romanick 2015-04-24 05:17:21 UTC
Desktop GLSL allows things like

uniform int foo;
int bar = foo + 10;

void main()
{
    ...
}

However, the GLSL ES 3.0 and 3.1 specifications have the following language in section 4.3:

    "Initializers may only be used in declarations of globals with no storage
    qualifier or with a const qualifier. Such initializers must be a constant
    expression."

There is anecdotal evidence that other implementations, at least on Android, enforce this restriction.  At the very least, we should emit a portability warning.  We probably should emit an error (in GLSL ES only) and have a driconf option to disable.
Comment 1 vadym 2018-11-01 11:14:45 UTC
Looks like this is a duplicate of Bug 92304.

Piglit tests which testing this are fixed now:

        spec/glsl-es-1.00/compiler/global-initializer/from-attribute.vert
        spec/glsl-es-1.00/compiler/global-initializer/from-uniform.vert
        spec/glsl-es-1.00/compiler/global-initializer/from-uniform.frag
        spec/glsl-es-1.00/compiler/global-initializer/from-global.vert
        spec/glsl-es-1.00/compiler/global-initializer/from-global.frag
        spec/glsl-es-1.00/compiler/global-initializer/from-varying.frag
        spec/glsl-es-3.00/compiler/global-initializer/from-uniform.vert
        spec/glsl-es-3.00/compiler/global-initializer/from-uniform.frag
        spec/glsl-es-3.00/compiler/global-initializer/from-in.vert
        spec/glsl-es-3.00/compiler/global-initializer/from-in.frag
        spec/glsl-es-3.00/compiler/global-initializer/from-global.vert
        spec/glsl-es-3.00/compiler/global-initializer/from-global.frag
Comment 2 Mark Janes 2018-11-01 15:42:36 UTC
Ian, please close if this is a dup
Comment 3 Ian Romanick 2018-11-01 19:32:18 UTC

*** This bug has been marked as a duplicate of bug 92304 ***


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.