Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

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

  1. #1
    Intern Contributor
    Join Date
    Apr 2010
    Posts
    68

    [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
    Code :
    #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 :
    Code :
    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?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,713

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

    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).

  3. #3
    Super Moderator Frequent Contributor Groovounet's Avatar
    Join Date
    Jul 2004
    Posts
    936

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

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

    This code is valid from OpenGL 4.1 and GLSL 410

  4. #4
    Intern Contributor
    Join Date
    Apr 2010
    Posts
    68

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

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •