_x57_
06-27-2011, 07:17 AM
Hi everyone.
I just started experimenting with geometry shaders and ran into some strange behaviour ...
I wrote a simple pass-through geometry shader that takes a line and shall (later) subdivide that line into a linestrip. When i set
#version 330 compatibility
layout (lines) in;
layout (line_strip) out;
layout (max_vertices = X) out;
void main (void)
{
int i;
for (i=0; i<gl_in.length(); i++)
{
gl_Position = gl_in[i].gl_Position;
EmitVertex();
}
EndPrimitive();
};
in the shader, where X equals GL_MAX_GEOMETRY_OUTPUT_VERTICES = 1024, i get a compile error:
error C6033: Hardware limitation reached, can only emit 256 vertices of this size
I have three questions regarding this:
(1)
Does gl_Position count 4 times to the limit because it is a vec4?
(2)
When setting X>256 the shader won't compile/link, but when using glProgramParameteriEXT(program, GL_GEOMETRY_VERTICES_OUT_EXT, 1024) instead of the layout statement in the shader, the shader compiles and links successfully (and can be used). Why?
(3)
In both cases, whether using the layout statement in the shader or the glProgramParameteri(...) statement the program falls back to software rendering when X>128 (instead of >256). Is it a driver/compiler bug?
I'd appreciate if someone could shed some light on this.
PS: I am using a GeForce 9800 GT with the 266.58 whql driver on Vista64.
I just started experimenting with geometry shaders and ran into some strange behaviour ...
I wrote a simple pass-through geometry shader that takes a line and shall (later) subdivide that line into a linestrip. When i set
#version 330 compatibility
layout (lines) in;
layout (line_strip) out;
layout (max_vertices = X) out;
void main (void)
{
int i;
for (i=0; i<gl_in.length(); i++)
{
gl_Position = gl_in[i].gl_Position;
EmitVertex();
}
EndPrimitive();
};
in the shader, where X equals GL_MAX_GEOMETRY_OUTPUT_VERTICES = 1024, i get a compile error:
error C6033: Hardware limitation reached, can only emit 256 vertices of this size
I have three questions regarding this:
(1)
Does gl_Position count 4 times to the limit because it is a vec4?
(2)
When setting X>256 the shader won't compile/link, but when using glProgramParameteriEXT(program, GL_GEOMETRY_VERTICES_OUT_EXT, 1024) instead of the layout statement in the shader, the shader compiles and links successfully (and can be used). Why?
(3)
In both cases, whether using the layout statement in the shader or the glProgramParameteri(...) statement the program falls back to software rendering when X>128 (instead of >256). Is it a driver/compiler bug?
I'd appreciate if someone could shed some light on this.
PS: I am using a GeForce 9800 GT with the 266.58 whql driver on Vista64.