Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

clip() HLSL

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 lomateron   Members   

491
Like
0Likes
Like

Posted 19 October 2012 - 01:00 AM

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

#2 kubera   Members   

1570
Like
0Likes
Like

Posted 19 October 2012 - 01:37 AM

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, 19 October 2012 - 01:38 AM.


#3 kauna   Members   

2922
Like
2Likes
Like

Posted 19 October 2012 - 06:17 AM

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!

#4 phil_t   Members   

8005
Like
1Likes
Like

Posted 19 October 2012 - 12:26 PM

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.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.