PDA

View Full Version : glDrawTransformFeedback() outputs only the first captured primitive



Asylum
09-26-2017, 08:40 AM
I would like to make a simple demo app using transform feedback. However when I try to render the captured results (points) it outputs only the first one (of the actual 16). The TF result is generated from a single vertex with a geometry shader. I render this result with another geometry shader which creates quads from points (I will be referring to this from now on).


a query object verifies that the TF indeed captured 16 primitives (points)
f I use glDrawArrays() instead, then the vertex shader receives and outputs all 16 vertices, but the geometry shader uses only the first (and outputs the same quad 16 times)
the geometry shader is pretty simple, and it works fine, so I don't think that's the issue


Images from RenderDoc:

glDrawTransformFeedback: https://www.dropbox.com/s/qyst1ktkfomi649/dtf.png?dl=0
glDrawArrays: https://www.dropbox.com/s/gzznvgkctotg4s9/darr.png?dl=0

Relevant code: https://www.dropbox.com/s/8crnopeyjwrxnb7/main.cpp?dl=0

What might cause this behavior?

Asylum
09-29-2017, 08:24 AM
Solved...apparently it is not a wise idea to put user-defined outputs/inputs into gl_PerVertex (or perhaps any) interface block. After rewriting the shaders like:



out int vs_particleType;
out vec3 vs_particlePosition;
out vec3 vs_particleVelocity;
out float vs_particleAge;
out uint vs_particleColor;


etc. the program works as expected.

Alfonse Reinheart
09-29-2017, 02:22 PM
Solved...apparently it is not a wise idea to put user-defined outputs/inputs into gl_PerVertex

It's not a question of being a "wise idea"; it's not allowed. Your shader should have failed to compiled; the specification is very clear on this. When you redeclare `gl_PerVertex`, you can only insert the members that are predefined.