shaderWarmUp property

ShaderWarmUp? shaderWarmUp
getter/setter pair

ShaderWarmUp instance to be executed during initInstances.

Defaults to null, meaning no shader warm-up is done. Some platforms may not support shader warm-up before at least one frame has been displayed.

If the application has scenes that require the compilation of complex shaders, it may cause jank in the middle of an animation or interaction. In that case, setting shaderWarmUp to a custom ShaderWarmUp before creating the binding (usually before runApp for normal Flutter apps, and before enableFlutterDriverExtension for Flutter driver tests) may help if that object paints the difficult scene in its ShaderWarmUp.warmUpOnCanvas method, as this allows Flutter to pre-compile and cache the required shaders during startup.

Currently the warm-up happens synchronously on the raster thread which means the rendering of the first frame on the raster thread will be postponed until the warm-up is finished.

The warm up is only costly (100ms-200ms, depending on the shaders to compile) during the first run after the installation or a data wipe. The warm up does not block the platform thread so there should be no "Application Not Responding" warning.

If this is null, no shader warm-up is executed.

See also:

Implementation

static ShaderWarmUp? shaderWarmUp;