Factorize mesh shader.