How does the primate brain combine generative and discriminative computations in vision?