Sorting only visibleLayers before rendering.