How you found out is important and if the seller already knew about the damage is important, too.
If the Seller's Disclosure, which is required in Texas, already mentioned that the roof had damage, then you are not in a good position to get back your earnest money, unless you are still within the notification period called out by the Third Party Financing addendum.
During the notification period you can send notice to the seller that your financing cannot be obtained and your Realtor can explain that the roof damage is preventing approval of the loan. This gives the seller a chance to extend the closing, repair the roof and still close.
If you signed off on the Disclosure that revealed damage existed, then you cannot claim that you were ignorant of the fact. On the other hand, if they knew and failed to disclose, Texas provides triple damages against such deceit under the Deceptive Trade Practices Act. You will need a lawyer to explain your rights and sue for damages.
Really this latter course is a last resort. You probably would prefer to have the roof fixed and close, but if you are now leery of other hidden defects and prefer not to close, that is understandable. A Release of Earnest Money form should be sent specifying you as the sole recipient of the Earnest Money -- your Realtor can arrange this.
Unfortunately, some sellers do try to hide defects they are aware of, which is why the law provides punitive damages. The money you spent on inspections, survey, application fees, appraisal and so on plus other expenses related to your purchase could become the basis to be multiplied times 3.
Claiming they were unaware may be difficult to disprove, especially if you didn't find out until a roofing inspection revealed it. Neighbors might know otherwide, such as they went to a roofing company and got a quote already. So, don't think it is automatic that you get money back. Your attorney is the best counsel on such matters.