The OpenGL-Wiki states on the output limitations of geometry shaders:
The first limit, defined by
GL_MAX_GEOMETRY_OUTPUT_VERTICES
, is the maximum number that can be provided to themax_vertices
output layout qualifier.[...]
The other limit, defined by
GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS
is [...] the total number of output values (a component, in GLSL terms, is a component of a vector. So a float is one component; a vec3 is 3 components).
That's what the declarative part of my geometry shader looks like:
layout( triangles ) in;
layout( triangle_strip, max_vertices = 300 ) out;
out vec4 var1;
My vertex format only consists of 4 floats for position.
So I believe to have the 4 components from the varying var1
plus the 4 components from the position, i.e. 8 in total.
I have queried the following values for the constants mentioned above:
GL_MAX_GEOMETRY_OUTPUT_VERTICES = 36320
GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 36321
With max_vertices
set to 300, a total of 8*300 = 2400 components would be written. It is needless to say that this value is far below 36321 as well as the 300 of max_vertices
is far below 36320. So everything should be okay, right?
However, when I build the shader, the linking fails:
error C6033: Hardware limitation reached, can only emit 128 vertices of this size
Can somebody explain to me what is going on and why this doesn't work as I expected?