Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose internals for library consumption #77

Open
Swoorup opened this issue Feb 23, 2024 · 2 comments
Open

Expose internals for library consumption #77

Swoorup opened this issue Feb 23, 2024 · 2 comments

Comments

@Swoorup
Copy link

Swoorup commented Feb 23, 2024

I am currently working on a library which uses naga_oil to generate bindings of shaders utilizing naga oil's features. The library statically generates rust bindings given the shader entry points.

There are few things which would have been nicer if naga_oil exposed for consumption.

  • Path parsing basically given a shader content, figure out what are the imports of the file. At the moment, it is a semi handwritten + uses parse_imports from naga to parse further.
  • Demangle functions. Basically had to reduplicate the logic to figure out the original import path, so I can generate the equivalent bindings preserving the heirarchy.
@robtfm
Copy link
Collaborator

robtfm commented Feb 23, 2024

for path parsing, i'm not sure i understood exactly what you're asking for, but just want to make sure you're aware of the static get_preprocessor_data function which tells you the required imports (file names and items within them) for a given shader string.

demangle functions: we can certainly make Composer::decorate and Composer::undecorate pub, is that all you need?

@Swoorup
Copy link
Author

Swoorup commented Feb 24, 2024

Thank you, I wasn't aware of get_preprocessor_data. It does appear to be exactly what I want.

Only caveat being that if imports are unused, it doesn't show up at all. Would be nicer if there was a flag to toggle it. (I'd like to generate bindings for all imports and simply replace the entry point especially for testing shaders).

Is there a way to simply generate all unused structs optionally including bindings?

Yeah and exposing those 2 functions will suffice my need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants