• Advertisement
Sign in to follow this  

clip() HLSL

This topic is 1916 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does clip() improves performance?
rendering a quad in a 2D texture
Is it better in performance than, using depht or alpha to discard pixels.

Share this post


Link to post
Share on other sites
Advertisement
Yes, it does.
The pixel is not being written to the destination.
Alpha-blending requires a correct order of rendered meshes or even pixels, also. Edited by kubera

Share this post


Link to post
Share on other sites
Use clip only when it is necessary. Keep in mind that there are cases where clip isn't necessary such as rendering opaque geometry. Typically this leads to two permutations of the pixel shader, one with clip and another one without.

Clip may save pixels from being written to the screen buffer, but on the other hand, it may have detrimental effect on the z-buffering optimizations. So, if you absolutely need clip, call it as early as possible in the pixel shader.

Cheers!

Share this post


Link to post
Share on other sites
clip() can really hurt performance if you're depending a lot of z-buffer rejection, since the pixel shader then will be run even for geometry that ends up being hidden.

This blog post has some good information on the topic: http://fgiesen.wordpress.com/2011/07/08/a-trip-through-the-graphics-pipeline-2011-part-7/

If you have no overlapping geometry in your draw call, then it might improve performance.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement