KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.98k stars 823 forks source link

Question: Can AST transform back to GLSL codes? #1820

Closed lishi0927 closed 5 years ago

lishi0927 commented 5 years ago

I have read the source code in this project and I know an example in the glslangvalidator.cpp to parser the GLSL codes into an AST. And now I want to know if the glslang project has achieved that AST can be transformed back to GLSL codes? Thank you.

johnkslang commented 5 years ago

Yes, this should be entirely possible, as the AST retains original type information.

Others have made tools that can cross between many languages, via SPIR-V. See for example https://github.com/KhronosGroup/SPIRV-Cross.