Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use early bailing to improve 3D shadow filtering performance in GLES3 #54160

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Oct 23, 2021

Early bailing makes PCF13 much faster than it previously was. The performance difference between PCF5 and PCF13 is now much lower.

Subtle artifacts may be visible in shadow corners, but they're unnoticeable in actual gameplay (especially with textures added):

image

I've tried to implement a similar approach in the PCF16 filter used in GLES2, but I couldn't get a convincing result (even by making two extra samples to match the diamond pattern used by GLES3). It brought noticeable performance improvements just like in GLES3, still.

Preview

Performance metrics are included in the top-left corner of each screenshot.

Old PCF13 New PCF13 PCF5 (for comparison) Disabled (for comparison)
2021-10-23_18 01 00 2021-10-23_18 06 32 2021-10-23_18 02 48 2021-10-23_18 04 00
GLES2 (not included in this PR for quality reasons)

Just to give an idea of the performance improvements:

Old PCF13 New PCF13 PCF5 (for comparison) Disabled (for comparison)
2021-10-23_18 18 34 2021-10-23_18 36 47 2021-10-23_18 18 59 2021-10-23_18 19 22

This makes PCF13 much faster than it previously was. The performance
difference between PCF5 and PCF13 is now much lower.
@Calinou Calinou force-pushed the shadow-filter-use-early-bailing branch from f95707a to e534343 Compare October 23, 2021 20:50
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Let's get this into 3.5 (and 4.0 of course ;))

@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants