For SW-WR, the costs of clearing both the Z-buffer and color buffer can be substantial, whereas with HW accel these costs are usually more negligible
To this end, WebRender also identifies a backdrop per picture cache tile. In the general case, if we can avoid drawing this backdrop using a shader and can instead replace the draw with glClear calls, there can be significant improvements in performance so no shader is needed and we avoid churning the Z-buffer.
The optimization might work as follows:
For solid color backdrops - just replace the solid color draw with a clear using the color and z-id of the primitive. If we either know nothing draws behind the backdrop or can at least avoid anything drawing behind it, then we don't even need to know the z-id at all, and can instead just clear the z-buffer to the normal initial clear z-id since the backdrop will remain behind all drawn primitives in any case.
For complicated backdrops (images/gradients/etc.) - Skip clearing the color buffer entirely but still at least use glInvalidateFramebuffer to signal to HW OpenGL implementations that we are not reusing the previous frame's color buffer. Then clear the z-buffer to the appropriate z-id of the primitive (like above, this can just be the clear z-id if we know nothing is behind it). Then later during normal drawing draw the primitive, potentially disabling depth writes/mask if that would be viable without complicating the batching code (otherwise, it isn't terribly necessary to disable depth mask, but would be a slight benefit).
For composite backdrops where several primitives cover the entire tile but no single primitive covers the entire tile - Here we can again just skip clearing the color buffer, but still use glInvalidateFramebuffer. Clear the z-buffer as normal. This would still benefit in that we can avoid color buffer churn in SWGL for pixels that are just going to be overridden by primitives anyway.