0
votes

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:

  • Card: AMD Radeon HD 7870 (It supports OpenGL 4.20)
  • I tried both the 4.2 driver and the 4.3 beta driver.
1
Could you post your entire vertex and fragment shader code?bwroga
@bwroga The original code can be found here. I slightly modified the style though (It shouldn't affect anything)Andreas Goulas

1 Answers

1
votes

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.