[2021.1] [Bugfix 1296776] Enforce SRP Batcher and Hybrid renderer compatibility by always using a consolidated property list #3623
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of this PR
Fix for bug https://fogbugz.unity3d.com/f/cases/1296776/
and https://fogbugz.unity3d.com/f/cases/1310624/
PR links:
2021.2: #3625
Backport 2021.1: #3623
Backport 2020.2: #3577
Previously, we built a global list of properties to populate the Property{} block in the shaderlab shader, but we built a separate list of properties per pass, that was used to build the HLSL declarations of those properties.
The per-pass properties would only include properties declared by the active Target and the active nodes used by the pass, so they could result in different properties for different passes.
The SRP Batcher requires all passes within a SubShader to use an identical UnityPerMaterial cbuffer declaration, which was often broken by the different property lists. (Also in the future the new BindSets will have a similar requirement for object resources (textures, samplers, etc) to be the same across all passes).
This change switches the HLSL declarations to use a per-sub-shader calculated list of properties. It gathers properties from any nodes upstream of blocks used by the Target, as well as graph and Target properties.
Testing status
Discovered Issues:
Yamato:
ShaderGraph PR Job: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/2021.1%252Fsg%252Ffix%252F1296776/.yamato%252Fall-shadergraph.yml%2523PR_ShaderGraph_2021.1/5480887/job/pipeline
HDRP PR Job: Failures match parent 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/2021.1%252Fsg%252Ffix%252F1296776/.yamato%252Fall-hdrp.yml%2523PR_HDRP_2021.1/5480909/job/pipeline
Failures:
HDRP on Linux_Vulkan_playmode_cache_mono_Linear on version 2021.1 -- both failing on same test in same way
HDRP on OSX_Metal_playmode_cache_mono_Linear on version 2021.1 -- same 18 tests failing same way
HDRP on Win_Vulkan_playmode_cache_mono_Linear on version 2021.1 -- same test failed same way
Universal PR Job: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/2021.1%252Fsg%252Ffix%252F1296776/.yamato%252Fall-universal.yml%2523PR_Universal_2021.1/5480938/job/pipeline
Package Validation: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/2021.1%252Fsg%252Ffix%252F1296776/.yamato%252F_projectcontext.yml%2523test_all_project_Win_2021.1/5520299/job
Parent 2021.1/staging: 7f85971
2021.1/staging HDRP PR Job:
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/2021.1%252Fstaging/.yamato%252Fall-hdrp.yml%2523PR_HDRP_2021.1/5484814/job/pipeline
Comments to reviewers
Notes for the reviewers you have assigned.