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

Save cluster render shader from being optimized out entirely #76832

Merged
merged 1 commit into from
May 9, 2023

Conversation

RandomShaper
Copy link
Member

In certain platforms (i.e., certain consoles) a fragment shader that doesn't output a fragment color can be heavily optimized, down to no-no. In practice, I've seen that happening in the cluster render shader. It leverages rasterization but at the same time acts as a compute shader, in that it writes to some buffer but doesn't output any fragment color.

What this PR does to solve that is letting the RD driver report whether the currrent platform/driver has such behavior and, where that's true, patches the aforementioned shader by adding an artificial data dependency between an also added fragment color output and the result of the atomic operations, preventing the aforementioned kind of heavy optimization from "rendering" it useless.

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.

Reviewed and discussed with Pedro. The need to do this is a bit unfortunate, but it appears to be necessary for now. This makes a minimal change and should not add any significant complexity in the future.

CI will need to be re-run once CI has been fixed upstream.

@RandomShaper RandomShaper force-pushed the cluster_render_prevail branch from 394bc11 to 6465432 Compare May 8, 2023 16:40
@akien-mga akien-mga merged commit 668cf3c into godotengine:master May 9, 2023
@akien-mga
Copy link
Member

Thanks!

@RandomShaper RandomShaper deleted the cluster_render_prevail branch May 9, 2023 09:52
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