Fragment Discard with full screen

Hello,

Is doing a fragment discard while doing a full screen pass ok , since discard is no on power vr, i feel it should logically be a performance gain even on TBDR.

I am trying to do water as post process and would basically like to discard the fragment , if the fragment depth is greater than the scene depth,since it is not visible.

Regards,
Ganesh

Not sure what will be the impact of discard on full screen pass.
However I’ve seen it having a major impact on geometry heavy scenes.

You can do some really descent water fx without post processing.

The discard keyword (and depth-test for the same reasons) is discouraged on any GPU that performs early-z testing (generally, any modern GPU). This is because it causes a write to the depth buffer at the fragment shading stage at the end of the pipeline, as opposed to in the ISP near the beginning of the pipeline. This depth write causes the pipeline to stall as vertex processing must be halted to update the depth buffer.

An alternative is to use alpha blending, where fragments that should fail the depth test have their alpha set to 0 instead of discarding. This potentially may have some artifacting in the transition between fragments of differing alpha values. Because of the heavy performance implications of discard, it should only be used after carefully considering the performance/quality balance.

We have a section in our Performance Recommendations document that discusses our recommendations for the discard keyword. This document is in the process of being expanded and improved in areas including this.

The PowerVR Graphics SDK also has our Water demo, which includes source code, you may find that useful for your purposes.