Geometry shaders problem

Hi all. I made a tiny geometry shader (gs) that takes a point as input and outputs a more complex thing (a cylinder, or a box). It works fine, but I’m suffering a performance problem. It goes like this: the geometry shader outputs some info for the fragment shader (fs): a total of 18 floats per output vertex in 6 varying attributes. For the cube, this is 144 floats. Now, if the fragment program doesn’t make use of that info, the framerate is decent (few hundreds fps). But if I use those values on the fragment shader, it runs very slow, like 20 fps. The fragment program is not the bottleneck, because even doing just 3 additions gives 20 fps.

It looks more like if I don’t use those varyings, the linker optimizes the geometry shader code not to output that info. However, the geometry shader is just passing thru that info from the vertex shader to the fragment, is not really professing that info, so there is not much processing time to gain by skipping that code.

May be the problem is instead the amount of data that flows between the gs and the fs. But I don’t think it’s so much data anyway, not at least if you want to do some per pixel lighting.

So I thought I might be doing something wrong… Anyone any idea? What is the most efficient way to pass data from a vs to a fs when you have a gs in between?

Thanks!

As far as I know, G80 geometry shader wasn’t designed to output large number of primitives. I understand that there is a limit to variables that can be effectively produced per-primitive.

I have no experience with this, but it doesn’t sound like you are outputting that much data.

It would be very limiting, if this is already “too much” output data. However, as said by nVidia and ATI folks, one shouldn’t expect much from the first generation of geometry shaders.

Maybe try reducing the output step by step and check, whether you can find a “sweet spot”, at which fps jumps up. If that is the case, you know it’s a general hardware limitation.

Jan.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.