-
Notifications
You must be signed in to change notification settings - Fork 855
[VFX] Fix compilation error when shaderGraph is modified #5475
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
[VFX] Fix compilation error when shaderGraph is modified #5475
Conversation
+ Cleaner exception than a null ref exception
The regression has been probably introduced by #4971 What happens, 1st VFX import: - Not Sanitized - Skip first compilation - PostProcess => Sanitize & CheckGraphBeforeImport - Reimport Later, the ShaderGraph changes - Because the VFX is sanitized - Doesn't skip the first compilation => Fail - Post Process => CheckGraphBeforeImport is applied - ... Later VFX import will be ok until the SG isn't modified.
Thanks for the fix Paul! Quick summary - specifically Here's the work in progress test doc, logged all the scenarios I managed to find about this main issue, also logged some not caused by the PR bugs, maybe something will draw your attention and could be fixed. |
Equivalent change from e6d34d3 The following ContainsKey would have thrown an exception anyway
Thanks for the fix! Error is no longer persistent. Tried:
Other issues raised in test doc are unrelated to PR. |
I double checked the changelog.md, expected job are green 🟢 at this revision f6d7f03 |
* Add Editor Test to cover issue 1361601 + Cleaner exception than a null ref exception * Actual fix from https://fogbugz.unity3d.com/f/cases/1361601/ The regression has been probably introduced by #4971 What happens, 1st VFX import: - Not Sanitized - Skip first compilation - PostProcess => Sanitize & CheckGraphBeforeImport - Reimport Later, the ShaderGraph changes - Because the VFX is sanitized - Doesn't skip the first compilation => Fail - Post Process => CheckGraphBeforeImport is applied - ... Later VFX import will be ok until the SG isn't modified. * *Update changelog.md * More readable exception when failing to find expression Equivalent change from e6d34d3 The following ContainsKey would have thrown an exception anyway * Move changelog entry to 13.x.x # Conflicts: # com.unity.visualeffectgraph/CHANGELOG.md
* Add Editor Test to cover issue 1361601 + Cleaner exception than a null ref exception * Actual fix from https://fogbugz.unity3d.com/f/cases/1361601/ The regression has been probably introduced by #4971 What happens, 1st VFX import: - Not Sanitized - Skip first compilation - PostProcess => Sanitize & CheckGraphBeforeImport - Reimport Later, the ShaderGraph changes - Because the VFX is sanitized - Doesn't skip the first compilation => Fail - Post Process => CheckGraphBeforeImport is applied - ... Later VFX import will be ok until the SG isn't modified. * *Update changelog.md * More readable exception when failing to find expression Equivalent change from e6d34d3 The following ContainsKey would have thrown an exception anyway * Move changelog entry to 13.x.x # Conflicts: # com.unity.visualeffectgraph/CHANGELOG.md
Purpose of this PR
Fix case https://fogbugz.unity3d.com/f/cases/1361601/
The regression has been introduced by #4971 & #5104 but it can't be tested prior this change, the last C++ producing the correct old behavior is 21.2a21.
0) What was happening before "Fix Sanitize" #4971 :
1st VFX import
The dependent shaderGraph is modified
1) After "Fix Sanitize" #4971
1st VFX import
The dependent shaderGraph is modified
2) After "Fix Subgraph" #5104
Same than 1) but the PrepareSubgraph changes are now safely handled preventing any deleted references serialized in graph.
-...
The problem !
After first import the graph is marked as sanitized but the CheckGraphBeforeImport is occurring too late:
(...)
The dependent shaderGraph is modified
3) After this fix (and more precisely f62f1b6) adding CheckGraphBeforeImport process before compilation
N.B.: As PrepareSubgraph, the CheckGraphBeforeImport is safe during preprocess only because we are backuping/restoring the graph, otherwise, slot created during preprocess will be destroyed after the import.
Testing status
Tested locally with described repro step.
Tested manually at this revision (other integration branch) : 61ebca1

Added an editor regression test
Modify_ShaderGraph_Property_Check_VFX_Compilation_Doesnt_Fail
It simulates the repro step modifying the shaderGraph content.
Before

After

Run all test locally

Yamato trunk 🟢
Yamato 2021.2 at cba0eba12ed723121f116ca85995475593fe3963 🟢
Comments to reviewers
We are planning a live code review on this change with @julienf-unity
N.B: We could also benefit from the rework of OnPostprocessAllAssets thanks to this PR but these changes hasn't landed in 21.2 (see this conversation)