I am generating a buffer (accessed as a SSBO) in a fragment shader during draw call #1. Then I'd like to use that buffer (accessed as a VBO) as the input for draw call #2.
The problem is that, using the function void glDrawArrays(GLenum mode, GLint first, GLsizei count)
, I should know the count
value on the CPU. But on the CPU I don't know that value. The value is only stored in the GPU memory as an atomic counter storage.
Is there any way to make a draw call using as count
argument a value stored in the GPU memory?
I know that I could retrieve the value from the GPU and then use it in CPU, but that would slow down the program because of synchronization.