  We prove a variable coefficient version of the square function estimate of
Guth--Wang--Zhang. By a classical argument of Mockenhaupt--Seeger--Sogge, it
implies the full range of sharp local smoothing estimates for $2+1$ dimensional
Fourier integral operators satisfying the cinematic curvature condition. In
particular, the local smoothing conjecture for wave equations on compact
Riemannian surfaces is completely settled.
