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.