geometry shader outstream ?

Started by
2 comments, last by MJP 12 years, 5 months ago
as far as i can tell and looking at some sfk , the reson for out stream on geometry shadedr , is to loop that back into the input strem , so that a prticle system does all the worrk its self without any cpu

is there a way to output information though that the cpu can see, ie.e number of particles in the geometry shader

i am using the geometry shader for a particle system .
when you call the draw command, its draw (numberOfEntitys, 0);

i was wondering if the geometrty shader can output a number so i can use that number in the draw command, instead of a fixed number
Advertisement
You might want to take a look at the 'drawAuto' family of functions (assuming D3D, OpenGL also has the functionality but I'm not so sure on the name); if memory serves they allow you to take a buffer which has been written by the GPU as a draw source and use it without having to say how many elements are in it.
Are you sure you need a geometry shader?
I used a simple transform feedback objects and a pair of VBO's (OpenGL) for my particle system and it does just what you say.
For DirectX its called stream out.
Using stream out technically requires a geometry shader, since that's the only stage that can do it. In practice you do not actually need to author a GS if you're just going to stream out every primitive.

If you're using D3D11 you also have access to AppendStructuredBuffer's, which allow a compute shader or pixel shader to append elements to a buffer.

This topic is closed to new replies.

Advertisement