Sort renderable objects by materials and primitives