-
Notifications
You must be signed in to change notification settings - Fork 352
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
Handle Topological Value Changes #1406
Conversation
…ph editor. Add some standardized UX coloring to be able to find conditionals easier + also inputs and outputs.
Signed-off-by: Jonathan Stone <[email protected]>
@kwokcb I've done an initial, naïve integration from main to this pull request, but I'll need your assistance to resolve a handful of merge errors that prevent compilation. |
- Fixes build errors. Not quite correct merge as top level inputs not working?
@jstone-lucasfilm, This should be cleaned up now. |
@kwokcb Other candidates for the topo change category include all nodes that have a C++ implementation instead of Native or NodeGraph implementations. |
It is possible that you will only need to look at the list of implementations registered in |
Hi @JGamache-autodesk , Yes, I was thinking the list could be expanded as needed going forward. There is a |
I did a quick check on your suggestion but the call to register Maybe I think it's better to have an explicit interface for this. |
Are you sure the But as soon as one of the two inputs is varying (connected, or with non-uniform value), then it should be impossible to elide because that value turns into an editable shader uniform parameter that needs to be computed in the shader. The term In fact, looking at the optimization code, I see recent changes that are very dangerous. If I create a color3 dot node and connect it to multiple locations, I expect to end up with only one shader uniform parameter to tweak and have it affect all connected locations. The code introduced in #1152 should have affected only ND_dot_filename and not any of the other Can I suggest we either revert the 1- Eliding an unconnected This would allow optimizing safely all comparison nodes, as well as the Those that have a C++ implementation, like the |
For an initial implementation of constant propagation code, see JGamache-autodesk@fe99fbc?w=1
Will print the following debugging output:
Which is a good start, but is missing the crucial part where all those newly |
Hi @JGamache-autodesk, |
@kwokcb Thinking more about how conditional nodes ought to be handled in shader generation, I wonder if this PR is putting the cart before the horse, where the first step ought to be designing the right set of rules for constant folding optimizations in shader generation. At the very least, I'm imagining that this new helper function will need to take a |
Proposal
Detect value changes which actually cause topological changes in the shader graph produced via code generation.
See issue #1394.
skips code generation resulting in no updates to be visible.
This routine can be incrementally improved over time and used for a topological value change check is required
to determine if a shader needs to be rebuilt. For example:
colorspace
orunit
changes on inputs which can require code insertion changes.correspondence is via the implementation source name which is a bit fragile. A larger change to allow generators to "publish" this information seems more appropriate but beyond the scope of this initial proposal to just add the interface.
Adding @ashwinbhat for comments.
Changes
inputValueAffectsShaderCode
which takes aninput
and atarget
.change requires rebuild.
Example
This test graph has a switch inside a nodegraph where the inputs to the switch are interface inputs.
Example Document
The following includes both a
switch
and aifgreater
node both of which are in theconditional
node group. Both can require code regeneration on input value change.Modification on the graph, or directly on the inputs (if detached) will cause shader rebuilds.