Sign in to follow this  
lomateron

clip() HLSL

Recommended Posts

lomateron    491
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
kubera    1587
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
kauna    2922
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
phil_t    8084
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this