GPU Compositor Layers and will-change
Promoting an element to a compositor layer isolates its pixels in a separate GPU texture. The Compositor Thread transforms or fades that texture at 60/120 FPS even while the main thread runs JavaScript.
VRAM Cost of GPU Layer Promotion
Adjust the number of animated elements and toggle static will-change.
Under the Hood
Like pre-printing actors onto transparent acetate cels before filming, layer promotion caches a subtree's rasterized bitmap in VRAM so the GPU only shifts or fades the cel instead of redrawing the entire scene.
- During the
Layerizephase of the Browser Rendering Pipeline, Blink decides whichPaintLayerobjects receive their ownCompositedLayer(transform: translate3d,will-change: transform,<video>,<canvas>). - The engine rasterizes each layer's tiles and uploads them to GPU memory (VRAM).
- Subsequent frames only update the layer's transformation matrix on the GPU without recalculating Style, Layout, or Paint.
/* Promote only on intent, not permanently across 500 cards */
.card:hover {
will-change: transform;
}
.card.is-animating {
transform: translate3d(0, -4px, 0);
transition: transform 180ms cubic-bezier(0.2, 0, 0, 1);
}Problem Genealogy
- 2011 (
translateZ(0)hack): Developers discovered that a zeroed 3D transform tricked WebKit into GPU promotion, soon copy-pasted onto* { transform: translateZ(0); }with predictable VRAM consequences. - 2015 (
will-change): Standardized hint warning the engine before an animation starts. - 2022+ (Blink Auto-compositing): Automatic promotion strictly for the active duration of CSS/WAAPI animations.
Production Pitfalls
- Layer Explosion: Elements overlapping an animated layer inside the same CSS Stacking Context are often promoted as well, silently multiplying VRAM consumption on mobile GPUs.
- Blurry text or lost subpixel antialiasing: On some operating systems, a promoted layer switches from LCD subpixel rendering to grayscale antialiasing, and fractional transforms misalign Device Pixel Ratio & Subpixel boundaries.
- When not to use
will-change: Never placewill-change: transformon generic selectors (.card) in static CSS; apply it only on:hoveror via JS right before animation.
Connections & Logical Next Steps
Scroll progress updates on the Compositor Thread without main-thread scroll listeners.
The ::view-transition pseudo-element tree animates captured textures on the compositor.
Compositor-friendly properties (transform, opacity) run off the main thread.
Promotion happens after Paint during the Layerize phase prior to GPU upload.
Compositor layer textures rasterize at devicePixelRatio scale and snap subpixel transforms to physical pixels.
Delegates promoted element layers to the GPU compositor thread after paint and layerization.
Top Layer elements and their ::backdrop pseudo-elements paint after all normal compositor layers.
Rasterized tiles are uploaded as GPU textures for the Compositor Thread.
Without passive listeners, the GPU compositor thread must stall scroll translation on main-thread JS.
Decoded image bitmaps are uploaded as GPU textures during compositing.
prefers-reduced-motion swaps large compositor transform animations for static states or subtle opacity fades.
Positioning windowed rows with transform: translateY() avoids triggering layout during scroll.
Seen in Architecture Autopsies
Applying transform or will-change promotes the parent to a GPU compositor layer, implicitly sealing its stacking context.
Blanket will-change: transform promotes 80 cards into permanent GPU textures, exhausting mobile tile memory.