We may want to push this into either wined3d or our future shader compiler dll. It's not a whole lot of code though.