Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 doomoller   Members   -  Reputation: 108

Like
0Likes
Like

Posted 05 June 2014 - 03:33 PM

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();
        }
       
    }      
 
                                    
 


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS