Opengl Es 3.0 vertex Feedback, Pixel gathering

Hello,

In my current opengl project I try to implement a sift feature extractor. Right now I am at a point where I have all extrema, which can be used as a features in one texture. Where the angle ins coded in the red component, the size in green etc. The problem is that not every pixel of the texture contains an extrema, so that I need a way to gather them, to create another texture or a vertex buffer containing only the extrema. In directx for example exist something like an appandbuffer, so I thought maybe a feedback transform would be good, but with that I cannot vary the number of points/extrema, or am I missing something. Of course I could step over the cpu, but that is what I really want to avoid. I hope someone was a better idea to accomplish that,

Thanks for help
Moritz

You can use a geometry shader to skip points.

I have no idea how well that will fare compared to other approaches, e.g. using a fragment shader to sort by validity.

You are of course right, sadly those are not support in opengl es 3.0

Er, right. Geometry shaders were added in 3.2 (and compute shaders in 3.1).

Which I think basically leaves you with sorting the data so that valid entries are at the beginning and invalid entries at the end. Except that you can’t easily count the number of valid samples because ES 3.0 doesn’t support GL_SAMPLES_PASSED queries or atomic counters. So you’d need some more passes for counting.

Okay thanks for your help, I will now build some sort of pyramid, which includes for every stage the number of the maxima it gathers.

Perhaps I miss some salient point of your problem here, but could depending on the number of points, you could rasterize these points as fragments and use the min/max blending logic of the hardware to compute the extreme for you? Alternatively, if too many points, consider doing a ping-pong reduction on the points in the texture (possibly what you meant by pyramid) similar to building MIPmaps manually.

On a mobile GPU (since you mention GL-ES) you’ll need to be more careful to avoid pipeline fragment flushes and pipeline stalls. Consult your GPU profiler and consider using a ring-buffer of FBOs to help avoid these.