Page MenuHome

Eevee: GPU Material node graph optimization.
Needs ReviewPublic

Authored by Jason Fielder (jason_apple) on Sep 20 2022, 12:08 PM.
Tags
None
Tokens
"Love" token, awarded by Dangry."Love" token, awarded by lopoIsaac."Burninate" token, awarded by shader."Love" token, awarded by hamza.elbarmaki."Burninate" token, awarded by EmiMartinez."Love" token, awarded by Alaska."Love" token, awarded by DaveDeer."Love" token, awarded by billreynish."Party Time" token, awarded by EAW."100" token, awarded by mycoconut.

Details

Summary

Certain material node graphs can be very expensive to run. This feature aims to produce secondary GPUPass shaders within a GPUMaterial which provide optimal runtime performance. Such optimizations include baking constant data into the shader source directly, allowing the compiler to propogate constants and perform aggressive optimization upfront.

As optimizations can result in reduction of shader editor and animation interactivity, optimized pass generation and compilation is deferred until all outstanding compilations have completed. Optimization is also delayed util a material has remained unmodified for a set period of time, to reduce excessive compilation. The original variant of the material shader is kept to maintain interactivity.

Further shader graph optimizations are likely also possible with this architecture. Certain scenes, such as Wanderer benefit significantly. Viewport performance for this scene is 2-3x faster on Apple-silicon based GPUs.

Authored by Apple: Michael Parkin-White

Ref T96261

Demo MacBook Pro 14" - M1 Pro GPU - 16 cores - OpenGL:

Please see demonstration in videos below using the Wanderer scene. The primary materials used in this scene are particularly expensive and benefit significantly from optimization.

Optimization Disabled:

Optimization Enabled:

Shader Node graph editor workflow:

  • Material starts off in the optimized state, when editing the shader graph, the optimized version is released and falls back to the dynamically editable material which passes in node data using a UBO. After a number of seconds, the material is re-optimized with the latest data and viewport performance improves.

Diff Detail

Repository
rB Blender
Branch
viewport_commits/GPUShaderGraphOptimization_flat
Build Status
Buildable 23843
Build 23843: arc lint + arc unit

Event Timeline

Jason Fielder (jason_apple) requested review of this revision.Sep 20 2022, 12:08 PM
Jason Fielder (jason_apple) created this revision.
Michael Parkin-White (MichaelPW) edited the summary of this revision. (Show Details)