21.06.2014 Views

GLSLANG Spec 4.0 - OpenGL

GLSLANG Spec 4.0 - OpenGL

GLSLANG Spec 4.0 - OpenGL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4 Variables and Types<br />

layout-qualifier :<br />

layout ( layout-qualifier-id-list )<br />

interface-qualifier :<br />

in<br />

out<br />

uniform<br />

layout-qualifier-id-list<br />

comma separated list of layout-qualifier-id<br />

member-list :<br />

member-declaration<br />

member-declaration member-list<br />

member-declaration :<br />

layout-qualifier opt qualifiers opt type declarators ;<br />

instance-name :<br />

identifier<br />

identifier [ ]<br />

identifier [ integral-constant-expression ]<br />

Each of the above elements is discussed below, with the exception of layout qualifiers (layout-qualifier),<br />

which are defined in the next section.<br />

First, an example,<br />

uniform Transform {<br />

mat4 ModelViewMatrix;<br />

mat4 ModelViewProjectionMatrix;<br />

uniform mat3 NormalMatrix;<br />

float Deformation;<br />

};<br />

// allowed restatement of qualifier<br />

The above establishes a uniform block named “Transform” with four uniforms grouped inside it.<br />

Types and declarators are the same as for other input, output, and uniform variable declarations outside<br />

blocks, with these exceptions:<br />

• initializers are not allowed<br />

• sampler types are not allowed<br />

• structure definitions cannot be nested inside a block<br />

Otherwise, built-in types, previously declared structures, and arrays of these are allowed as the type of a<br />

declarator in the same manner they are allowed outside a block.<br />

39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!