Towards Sample-Optimal Compressive Phase Retrieval with Sparse and Generative Priors