converting between GLSL/Cg/HLSL

3a53830bbb3936338554ddf7a72b5e75
0
cdgray 101 Dec 05, 2004 at 21:11

Due to the very similar design and syntax, how hard would it be to write a convertor or parser that would convert between the three high-level shading languages: HLSL, Cg, and HLSL?

1 Reply

Please log in or register to post a reply.

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Dec 05, 2004 at 21:15

If I remember correctly, HLSL and Cg were designed to be interchangeable. Having not used both, I’m not sure how much different Cg/HLSL are from GLSL though. If it’s a matter of syntax, the conversion would be relatively easy I’d expect. However, if the languages were divergant on a deeper level, it could be harder because you’d have to actually change what code does (imagine converting between C and python, or lisp and basic).