This avoids crashing on devices when a number of varyings greater than the device limit is used.
For now this accurately prints an error when compiling the shader, but the error text only pops up in the editor if the number of user varyings is above the limit.
Most important is a fix for an occasional crash due to a use-after-free
bug.
A number of API availability declarations were updated to include tvOS.
The code is now simplified and generic for all platforms, which makes
way for future tvOS support.
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>