Fix stack overflow when formatting ColorMask

The old implementation of ColorMask relied on itself for formatting,
leading to an infinite recursive loop and eventual stack overflow.

Thanks to @bjz for suggesting this approach.
Return TextureError, if TextureInfo is invalid
Improve error messages for TextureError
Merge pull request #372 from hannobraun/color-mask-format

Fix stack overflow when formatting ColorMask
Merge pull request #375 from hannobraun/invalid-textureinfo

Fail with error message, if TextureInfo is invalid