-
Notifications
You must be signed in to change notification settings - Fork 862
[2021.2] [ShaderGraph] [bugfix 1301915] Node Include files are now tracked explicitly BY GUID #3290
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
Conversation
… of subgraphs, and uniquely merged Some care was taken to keep the HDRP "replace placeholder" functionality working properly..
|
|
||
| if (!String.IsNullOrEmpty(include.descriptor.value)) | ||
| finalIncludes.Add(include.descriptor.value, include.descriptor.location, include.fieldConditions); | ||
| var path = include.path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an error in that it used to be modifying the values stored in the passDescriptor (which may be static global).. with this PR it no longer modifies the existing structure...
| } | ||
|
|
||
| public bool Reload(HashSet<string> changedFileDependencies) | ||
| public bool Reload(HashSet<string> changedFileDependencyGUIDs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just changing the name of the variable to make it clear these are GUIDs not paths
| if (asset == null || hasError) | ||
| return; | ||
|
|
||
| registry.RequiresIncludes(asset.includes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This forwards the includes from the subgraph asset to any graph using them..
| Dictionary<string, FunctionSource> m_Sources = new Dictionary<string, FunctionSource>(); | ||
| bool m_Validate = false; | ||
| ShaderStringBuilder m_Builder; | ||
| IncludeCollection m_Includes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easiest was to make the FunctionRegistry effectively a "FunctionAndNodeInclude" registry...
| [GenerationAPI] | ||
| internal class DefineCollection : IEnumerable<DefineCollection.Item> | ||
| { | ||
| public class Item : IConditional, IShaderString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IShaderString interface is not used anywhere... I removed it.
| { | ||
| [GenerationAPI] | ||
| internal class IncludeCollection : IEnumerable<IncludeCollection.Item> | ||
| [Serializable] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes here are to make the IncludeCollection serializable, so we can serialize it as part of the subgraph asset. We also switch it to being GUID-based instead of path-based. We still record the path, but the GUID is treated as the authoritative link to the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I removed "Item" and just combined it with the IncludeDescriptor. No one else was using either of them, so there didn't seem to be any reason to have separate classes for the two.
| namespace UnityEditor.ShaderGraph | ||
| { | ||
| [GenerationAPI] | ||
| [Serializable] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not strictly necessary, enums are serializable by default, but serves as a good reminder that this is a serialized enumeration, if anyone is looking to change it in the future...
| string command = GenerationUtils.GetSpliceCommand(passPragmaBuilder.ToCodeBlock(), "PassPragmas"); | ||
| spliceCommands.Add("PassPragmas", command); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These move further down, so we can combine the Target/pass includes with the node includes before generating them.
ghost
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did just a bit of extra testing (setting up a use case scenario and making sure the bug is fixed). Other than that, developer testing is sufficient.
Purpose of this PR
Fix for https://fogbugz.unity3d.com/f/cases/1301915/
Include files are now tracked by GUID (so they can find a file even after it moves), the includes are propagated out of subgraphs, and merged uniquely by the generator.
Some care was taken to keep the HDRP "replace placeholder" functionality working properly.
Testing status
Added new Editor test for moving directories of ShaderGraph/SubGraphs containing CFN nodes using include files, similar to the repro case.
ShaderGraph PR job: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Ffix%252F1301915/.yamato%252Fall-shadergraph.yml%2523PR_ShaderGraph_trunk/5141106/job/pipeline
ShaderGraph Stereo PR job: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Ffix%252F1301915/.yamato%252Fall-shadergraph_stereo.yml%2523PR_ShaderGraph_Stereo_trunk/5141105/job/pipeline
HDRP PR job: failures match master failures
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Ffix%252F1301915/.yamato%252Fall-hdrp.yml%2523PR_HDRP_trunk/5141136/job/pipeline
Master equivalent job:
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Fall-hdrp.yml%2523PR_HDRP_trunk/5068229/job/pipeline
Failures:
HDRP on Linux_Vulkan_playmode_cache_mono_Linear on version trunk -- same 4 tests failed same way
HDRP on OSX_Metal_playmode_cache_mono_Linear on version trunk -- master failed 8 tests, this branch failed 6, all matching master failures
master additionally failed: HDRP_GraphicTestRunner.2106_GI_EmissionSG, HDRP_GraphicTestRunner.2108_GI_IESCookie_B
seems unrelated to my changes, I assume non-determinism
HDRP on Win_Vulkan_playmode_cache_mono_Linear on version trunk -- same 4 tests failed same way
HDRP on Win_DX12_playmode_cache_mono_Linear on version trunk -- same 5 tests failed same way
slight difference on error amount for one of the same tests that failed in master OSX_Metal above -- assume non-determinism
HDRP on Win_DX11_playmode_XR_cache_mono_Linear on version trunk -- both had script compile failures
HDRP on Win_DX11_playmode_cache_mono_Linear on version trunk -- same 4 tests failed same way
HDRP_DXR PR Job: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Ffix%252F1301915/.yamato%252Fall-hdrp_dxr.yml%2523PR_HDRP_DXR_trunk/5141127/job/pipeline
HDRP_Hybrid PR Job: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Ffix%252F1301915/.yamato%252Fall-hdrp_hybrid.yml%2523PR_HDRP_Hybrid_trunk/5141129/job/pipeline
HDRP VFX PR job: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Ffix%252F1301915/.yamato%252Fall-vfx_hdrp.yml%2523PR_VFX_HDRP_trunk/5141135/job/pipeline
Universal PR job: failures match master failures
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Ffix%252F1301915/.yamato%252Fall-universal.yml%2523PR_Universal_trunk/5174976/job/pipeline
Master equivalent job:
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Fall-universal.yml%2523PR_Universal_trunk/5068179/job/pipeline
failures:
Universal on iPhone_Metal_Standalone_cache_il2cpp_Linear on version trunk -- same 1 test failed same way
Universal on Android_Vulkan_Standalone_cache_il2cpp_Linear on version trunk -- did not complete, re-running
Universal on Android_OpenGLES3_Standalone_cache_il2cpp_Linear on version trunk -- same 3 tests failed same way
Universal on Win_DX11_playmode_XR_cache_mono_Linear on version trunk -- both had script compile errors
Comments to reviewers
Notes for the reviewers you have assigned.