shader-slang / slang

Making it easier to work with shaders
http://shader-slang.com
MIT License
2.16k stars 186 forks source link

Initial implementation for decl-tree reflection API #4666

Closed saipraveenb25 closed 3 months ago

saipraveenb25 commented 3 months ago

This patch adds Slang API methods for walking all the declarations in the AST.

We expose this functionality through an abstract DeclReflection class that can be a type, function or a variable declaration. We also provide ways to cast the decl to a FunctionReflection, TypeReflection or VariableReflection and traverse through the child nodes (for instance, a struct type will have component variable declarations)

Additional changes:

Fixes #4617