Geometry shader compilation bug?

Bug: glCompileShader fails to compile geometry shader with max_vertices > 256 although GL_MAX_GEOMETRY_OUTPUT_VERTICES >> 256
• Repro steps (in Python):

  1. Initialize OpenGL
  2. Ensure version of GL and GLSL is > 3.0
  3. Ensure values of GL_MAX_GEOMETRY_OUTPUT_VERTICES and GL_MAX_GEOMETRY_OUTPUT_COMPONENTS are > 256
  4. Compile geometry shader with “layout( line_strip, max_vertices = 256 ) out;”
  5. Verify there are no errors and shader works as expected
  6. Change max_vertices to 257
  7. Recompile shader
    • Expected result:
    No errors and shader works as expected
    • Actual result:
    GL_GEOMETRY_SHADER (GL_GEOMETRY_SHADER) Shader compile failure (0): b"ERROR: 0:5: ‘max_vertices’ : layout qualifier-id value cannot be greater than 256\n\n"
    b’ layout( line_strip, max_vertices = 257 ) out;’
    • System config:
    PyOpenGL 3.1.5
    pyopengltk 0.0.3
    tk 0.1.0
    GL_VERSION: b’4.6.0 - Build 27.20.100.8681’
    GL_SHADING_LANGUAGE_VERSION: b’4.60 - Build 27.20.100.8681’
    GL_MAX_GEOMETRY_OUTPUT_VERTICES: 36320
    GL_MAX_GEOMETRY_OUTPUT_COMPONENTS: 37156
    Surface Pro 6
    Processor Intel(R) Core™ i5-8250U CPU @ 1.60GHz 1.80 GHz
    Installed RAM 8.00 GB
    System type 64-bit operating system, x64-based processor
    Edition Windows 11 Home Version 21H2
    OS build 22000.376

I really appreciate your help tracking down this bug. Even getting 512 vertices would be sufficient for my app, and the system supports 36,320 vertices. Only having 256 vertices is causing major headaches. I’m already using instancing to reduce the number of vertices needed.

That’s not the number of output vertices; that’s the value of the enumerator: 0x8DE0. If you want the implementation-defined limit, you pass that enumerator to glGetIntegerv.

All Intel hardware (and some open-source AMD Linux drivers) have a limit of 256 vertices.

Also, be advised that writing that many vertices from a GS is almost always not a good idea. If you’re doing tessellation, make your algorithm work with tessellation shaders.

That explains it. Thanks very much.