Andreas Goulas
Andreas Goulas

Reputation: 163

GLSL 4.2 - Syntax error: "layout" parse error

So, I recently found an interesting shader and tried to compile it.

But, the GLSL compiler threw the following error:

ERROR: 0:50: error(#132) Syntax error: "layout" parse error

@ (Fragment shader)

#version 420

...

uint ImageAtomic_Average_RGBA8(layout (r32ui) volatile uimage3D Img, ivec3 Coords, vec4 NewVal)
{ ... }

Details:

Upvotes: 0

Views: 1703

Answers (1)

thokra
thokra

Reputation: 2904

A layout qualifier cannot be part of the function's signature. Section 6.1.1 of the GLSL 4.40 Specification defines the following grammar for a function prototype:

function-prototype :
precision-qualifier type function-name(*parameter-qualifiers* precision-qualifier type name array-specifier, ... )

Now, a parameter-qualifier can be one of

const
in
out
inout
precise
memory qualifier (volatile, ...)
precision qualifier(lowp, ...)


Consistently, section 4.10 explicitly states:

Layout qualifiers cannot be used on formal function parameters [..]

If you drop the layout qualifier, you should be fine. If not, it's a driver bug.

Upvotes: 1

Related Questions