What Comes First, the Fabric or the Pattern?

When you go shopping for fabric, do you have a pattern already in mind or do you buy the fabric you like and hope that you’ll find the right use for it later?