[Cat11.8] layout + 'flat' = compile error

Whenever I use the ‘flat’ qualifier with the location layout my shaders fail to compile with Catalyst 11.8 on Ubuntu 11.04

#version 410 core

layout(location = 0)  in vec3 i_vertex;
layout(location = 1)  in vec4 i_perNodeData;
layout(location = 0)  flat out int o_instanceID; // fails !

uniform mat4 u_modelViewProjection;

void main()
{
	o_instanceID = gl_InstanceID;
	vec3 position = i_vertex.xyz*i_perNodeData.w + i_perNodeData.xyz;
	gl_Position = u_modelViewProjection * vec4(position,1.0);
}

Log :

Vertex shader failed to compile with the following errors:
ERROR: 0:8: error(#132) Syntax error: 'flat' parse error
ERROR: error(#273) 1 compilation errors.  No code generated

The compilation fails in core and compatibility profile.
I’m pretty sure the code is valid for glsl 330 and above though, can someone confirm this is a driver issue?

I’m pretty sure the code is valid for glsl 330 and above though

Unless you are using ARB_separate_shader_objects, you cannot give a layout location to the output of a fragment shader.

It’s possible that the driver is confused about that. What happens if you explicitly enable the separate_shader_objects extension in this shader (even though it’s core 4.10 functionality).

Use the OpenGL 4.2 beta drivers, this bug have been fixed.

This code is valid from OpenGL 4.1 and GLSL 410

What happens if you explicitly enable the separate_shader_objects extension in this shader (even though it’s core 4.10 functionality).
I got the same error.

Use the OpenGL 4.2 beta drivers, this bug have been fixed.
Confirmed, the shader compiles with 4.2 beta drivers.

This code is valid from OpenGL 4.1 and GLSL 410
Right again, I made a mistake in the first post, the code is only valid for glsl version 410 and above.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.