-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Immutable Ast
usage
#29
Comments
I would like this too, the challenge is deciding how closely we align with the C++ API. This suggestion matches the original API but changed in #10 to align closer with the SPIRV-Cross classes/methods. The idea was that you could perform a single parse (into We could hide the fact that compile mutates the options internally and be careful to always override the previous state. Although if we went that route it would seem best to move all the other I was hoping to have a copy constructor for the SPIRV-Cross compiler instance. So internally the flow would work like:
|
In general, since this is not a
While it sounds ok, this use case is not needed for gfx-rs. We know the Target, we just don't want to provide any overrides before the parser -> MSL is done.
Yeah, it's an option, just not a pretty one :) |
Agreed, I just mention it here because it's similar conceptually - setting any options will mutate the internal compiler, so we have to fake immutability by creating new compilers or resetting stale state. Another idea is to split the API into two levels, where the higher level API supports the flow parse/multiple compile flow above and manages resetting internal compiler state, but the lower level API is mostly 1:1 with the C++ API. |
I think we might be able to do this now, we'll need to play around with this idea more. As far as I know the parse and compile step have been split apart, so we should be able to reuse the parsed SPIR-V. |
gfx-rs Metal backend stores the shader module in order to compile it with different options for different pipeline layouts (see gfx-rs/gfx#1576). It would be great to store
Ast
instead of re-parsing it each time, and just provide a reference toCompilerOption
at the spot where compilation is needed.How about we remove
set_compiler_options
at all and make theAst::compile(&self, &CompilerOptions)
(notice&self
)?The text was updated successfully, but these errors were encountered: