Add caching of compiled shaders

Implements #588 

@incanus you will need to hook up GL extension functions for iOS.