Strange behavior in glsl geometry shader and Transform Feedback when change max_vertices

Started by
-1 comments, last by doomoller 9 years, 10 months ago

I have a very strange problem in my geometry shader and transform feedback buffer. I am creating a simple particle system, and everything works fine, until I test to create more particles and so I change the max_vertices from 40 to 200. Then, the system only create few particles, less than it should, and when I query to the particles generated it seems that the last particles override the first, so particles never progress.

Note, when I set 40 in max_vertices it works fine with about 1200 particles (max, the buffer is 2000), which is expected. Per iteration I create only 10 particles in both case. I not reached the limits, I mean, GL_MAX_GEOMETRY_OUTPUT_VERTICES, GL_MAX_GEOMETRY_OUTPUT_COMPONENTS, or GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, or the buffer size bound to the tranform feedback. There no error output. This is crazy how it get distorted just for change max_vertices, is like it change the way data is store in transform feedback buffer.

did someone see this before? I card is Radeon 7700

My shader look like this:

#version 330
layout (points) in;
layout (points, max_vertices = 40) out;
in float type0[];
in vec3 pos0[];
in vec3 vel0[];
in float time0[];
out float type1;
out vec3 pos1;
out vec3 vel1;
out float time1;
void main()
{
float _time = time0[0] + time;
if(type0[0] == 0.0f)
{
type1 = 0.0f;
pos1 = pos0[0];
vel1 = vel0[0];
time1 = (_time >= time_launch) ? 0.0 : _time;
EmitVertex();
EndPrimitive();
if(_time >= time_launch)
{
for(int i = 0; i < 10; i++)
{
type1 = 1.0f;
pos1 = pos0[0];
vel1 = random_dir(_time);
time1 = 0.0;
EmitVertex();
EndPrimitive();
}
}
}
else
{
if(_time < life)
{
type1 = 1.0f;
pos1 = pos0[0] + vel0[0];
vel1 = vel0[0];
time1 = _time;
EmitVertex();
EndPrimitive();
}
}
}

This topic is closed to new replies.

Advertisement