Merge "Only flush after all layers are drawn instead of after each layer."