Forums - Is fragment discard truly an expensive operation on Adreno?

2 posts / 0 new
Last post
Is fragment discard truly an expensive operation on Adreno?
matthias.buehlmann
Join Date: 25 Jan 21
Posts: 3
Posted: Tue, 2021-08-31 08:24

I have heard multiple times that a manual discard in the fragment shader, for example if(texture.a < 0.1) { discard; } was an expensive operation. My question is whether that's really true, or whether the 'expense' is just from hidden surface removal having to be disabled if a shader uses discard (and thus the 'expense' just comes from additional fragments that need to get processed which otherwise could be skipped)? I understand that tiled renderer architectures such as adreno have hidden surface removal features and that these features get deactivated by using blending or fragment discard, but let's say that all meshes are rendered with blending enabled anyway - would a discard in fragment shaders still incur a (significant) additional cost on adreno gpus?

  • Up0
  • Down0
jleger
Join Date: 23 Aug 16
Posts: 15
Posted: Wed, 2021-10-20 18:30

That's about right.  It's not that the single instruction itsef consumes lots of GPU cycles, but that using the instruction triggers side effects (like disablement of HSR features) which will cause less efficient exection of the workload in most use-cases.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.