stop rendering

Started by
1 comment, last by Jason Z 11 years, 2 months ago

I have a technique that uses vertex, geometry and pixel shaders

I want to render nothing to a texture when i read in the vertex shader a texel and i see that it has a determined value.

The best way I know in performance to make it render nothing is to replace the vertice position "w" (the fourth value) with 0.0f. Is there a fastest way? is there something similar to clip() but for the vertex shader? to stop going into the geometry shader.

Advertisement

You must output something from the vertex shader, but you can discard entire primitives in the geometry shader. So, you could set an integer in your VS out structure, and in GS see if any incoming vertices of the current primitive have that integer set.

Niko Suni

You didn't mention what types of primitives you are using, but in general, if you put your vertex outside of the clip space then you are effectively clipping the vertex. The trouble is that you are using the Geometry Shader, which operates before clip/cull operations in the rasterizer.

So in that case, you would probably have to use the GS as Niko mentioned. Depending on the amount of times that you expect to get one of these 'dead' vertices, it may or may not be worth doing from a performance standpoint... Probably you could just use the w value in the GS, and if it is zero then just directly jump out of the shader (of course this will vary based on your primitives...).

This topic is closed to new replies.

Advertisement