Fixes ported from bitbucket

Hello Aras,

I took some time to rebase my fork of  hlsl2glslfork onto the new git code, looks to work well for our shaders at Eugen Systems, maybe you'd like to merge or cherry pick some of these.

Cheers,

Maxime.