Added VSG_ALPHA_TEST to built-in ShaderSets to improve performance #1168
robertosfield
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have added a VSG_ALPHA_TEST defined the Flat_Shaded, Phong and PBR ShaderSets to make the alpha based discard optionally compiled in. This is similar to GL_ALPHA_TEST provided in OpenGL's fixed function path.
To help test the performance impact of making the discard optional I have added the following to the vsgshadow example:
The fragment shader code that is controlled by this define is:
I have tested my AMD5700G Linux desktop (integrated GPU) and Intel i7 + Geforce 2060 Windows 11 system and see around 5% improvement with the new default configuration (without VSG_ALPHA_TEST) for the tests I've done.
I expect scenes with lots of overdraw when early depth test & discard GPU is most effective will see the most gains for this change, though I haven't done exhaustive tests with it yet. The results I've seen already given me enough confidence that switching off the above discard code-path by default is helpful for most applications.
Beta Was this translation helpful? Give feedback.
All reactions