The study of the origin and composition of rocks, including the processes that contribute to their formation.