Resize Buffer Object from Transform Feedback Result. GL3 < GL 3.3

Hello GL Fellows.

I need to glBufferData a buffer based on the result of a Transform Feedback.
I do Iso-Surface extraction and the last step in the algo is the resize and copy of the result of the extraction into a more reasonable sized buffer object. Everything works just fine. I have everything on the GPU thanks to DrawTransformFeedback, except the last “copy to smaller sized buffer object” step.

The problem is, that last resize/copy step kills the performance! I could do the copy step with another DrawTransformFeedback and a copy vertex shader, but the resize command still remains that forces me to round-trip to the CPU… I.e. I wait for the query object that delivers the number of vertices written.

Do you have any advice or is it even possible to do a glBufferData(resize buffer) based on TF result on GL 3.3 and prior?

Please do not consider >= GL 4.0, I need to do it in pre-4.0 GL.

Thanks.

You should be able to do what you want by using atomics or ARB_query_buffer_object to keep the number of verts written on the GPU. For information on the former, see this thread.

Wait a minute! I looked ARB_draw_indirect up in the reg and it is written against GL 3.2. Doesnt this mean, it is only available in GL 4.0, or is it even available in GL 3.3? I cant get that version stuff right…

If your card/driver supports the extension, you can use it. Doesn’t so much matter what context version you’ve requested.

I am more concerned about the availability of the “indirect technique” pertaining older gfx cards, i.e. pre GL 4.0 gpus. Since I am coding a game, I want to have it run on older hardware that has GL 3.x driver/hardware support, and along with it, all the required GL features…
So it is not a question of, can my GL 4.0 Gpu perform these steps, but can older hardware perform it. This is what I mean with GL 3.x.

I think I dont understand the term “This extension is written against the OpenGL 3.2 specification” which can be found in ARB_draw_indirect.
Does this mean, it is available on GL 3.2>= hardware/driver?

Gotcha.

Consulting the:

we see that ARB_draw_indirect is (by NVidia at least) only supported by GeForce 4xx+ GPUs (Fermi+), which correspond to OpenGL 4.0+ capability. GeForce 2xx GPUs (OpenGL 3.x) don’t support it.

This blog post may give you some ideas:

As it mentions, you can use other GPU work to help hide the latency associated with those queries.

However, failing that, it kinda looks like all of the methods you’d want to use to keep the primitives generated count on the GPU are GL4.0+.

I think I dont understand the term “This extension is written against the OpenGL 3.2 specification” which can be found in ARB_draw_indirect.
Does this mean, it is available on GL 3.2>= hardware/driver?

Apparently not. I’d guess that just means that is the version of they spec to which the spec modifications in the extension “mark up”.

Dark Photon, thanks for boiling it down!

At least, I already assumed that the indirect technique in not available on GL 3.x hardware.

To me, transform feedback seems a bit unfinished and there is more potential in it. DrawTransformFeedback really helped me to realize a multi-stage pipeline, for fast iso-surface extraction, completely on the gpu. And thats at least something. Without it, I couldnt realize my ideas.

Is there any reason why for example, a CopyTransformFeedback or ResizeTransformFeedback is not available?

Apparently not. I’d guess that just means that is the version of they spec to which the spec modifications in the extension “mark up”.

So an extension stays a extension. It is still up to the vendor implementing a particular extension for the GL version suggested by the spec, as your example stated.

[QUOTE=master_of_the_gl;1256755]To me, transform feedback seems a bit unfinished and there is more potential in it. DrawTransformFeedback really helped me to realize a multi-stage pipeline, for fast iso-surface extraction, completely on the gpu. And thats at least something. Without it, I couldnt realize my ideas.

Is there any reason why for example, a CopyTransformFeedback or ResizeTransformFeedback is not available?[/quote]

That’s a question for the driver writers. Here’s one post that may shed some light on it for you: link.