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

Add multiple specialization constants to Forward+ and Mobile. #98825

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

DarioSamo
Copy link
Contributor

@DarioSamo DarioSamo commented Nov 4, 2024

Since #90400 is now merged, it is now possible for us to further specialize shaders without adding stutters when the configuration of the scene changes.

I turned the following dynamic attributes of the shader into specialization constants and got some measurable improvements in frame time already. Most of these specializations are focused on the mobile renderer.

  • Omni light count
  • Spot light count
  • Directional light count
  • Reflection probe count
  • Multimesh format
  • Ambient cubemap toggle
  • Reflection cubemap toggle
  • Scene roughness limiter

TPS Demo from here

Average GPU Time in Mali-G78

  • master: 31.2ms
  • mobile-scs: 28.6ms

Further improvements could be found as I dig deeper into the shader for more optimization opportunities.


Contributed by W4 Games. 🍀

@DarioSamo DarioSamo requested a review from a team as a code owner November 4, 2024 17:22
@DarioSamo DarioSamo marked this pull request as draft November 4, 2024 17:25
@DarioSamo DarioSamo marked this pull request as ready for review November 4, 2024 17:36
@clayjohn clayjohn added this to the 4.4 milestone Nov 5, 2024
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.

Looks fantastic, I am very happy that we could finally do this.

@clayjohn
Copy link
Member

clayjohn commented Nov 5, 2024

For future reference for others, these are the low hanging fruit optimizations we can do with spec constants. In the future, we can continue to investigate what other areas would benefit from specializations.

@Repiteo Repiteo merged commit c68ec6c into godotengine:master Nov 5, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 5, 2024

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