I wouldn't count on the foam. However, you can fill in large voids with the foam and then coat with something else.
Could you use "self-leveling" sealants, or something else (like epoxy) that you could pour?
I've done some DIY self-leveling sealant. Get a caulk that is solvent-based (i.e. not acrylic, not silicone - gutter sealant is good), and squirt the entire tube into a sacrificial container. Put on a respirator and/or go outside, add solvent (I used acetone), and whip it up with a loop of wire in a cordless drill until it's like pancake batter (we used roughly equal amounts of caulk & solvent). Pour and let dry for a few days.
There are also some white roof coatings (not tar/asphalt) that do the same thing. I got some of that from Lowes.