9.3 · Offscreen passes, rasterization, blending, shadows and masks
Most smooth screens become janky because of a handful of innocent-looking effects. Each has a known cost model, so you can predict and fix it instead of guessing.
Mental model. An effect is cheap when the GPU can apply it as it draws each layer. It is expensive when the layer must first be rendered somewhere else and composed afterwards.
What makes a frame expensive
Offscreen rendering, rasterization, and blending.
- What is offscreen rendering, which properties cause it, and how do you avoid the cost?
Normally the GPU draws each layer straight into the frame buffer in order. Offscreen rendering means a layer (and often its whole subtree) must first be… - What are blending and overdraw, how do opaque views help, and what are dirty rectangles?
When a layer is opaque (isOpaque true, its colour fully opaque, and its contents without alpha), the GPU can write its pixels directly. When it is translucent…
More in Layout, rendering & animation
- 9.1 · Auto Layout, intrinsic size, and when layoutSubviews and draw run
- 9.2 · From layout to the GPU, and the two layer trees
- 9.4 · Implicit and explicit animation, UIView animation, and animators
- 9.5 · Core Graphics, UIBezierPath and draw(_:)
- 9.6 · TextKit 1 and 2, and Text in SwiftUI
- 9.7 · Frame budgets, ProMotion, hitches and hangs
- 9.8 · Margins, stack views, guides, constraint ownership, the layout cycle and measuring
- 9.9 · Coordinate conversion, 3D transforms and layer contents
- 9.10 · How UIView animation really works, springs, timing and display links
- 9.11 · Transform order, fill rules, text measurement, text containers and bitmaps
- 9.12 · Rectangle containment and moving a point between coordinate spaces