Search Issue Tracker
Duplicate
Votes
0
Found in
2022.3.25f1
2023.2.19f1
6000.0.0b15
Issue ID
UUM-71117
Regression
No
Crash on "DynamicBranchState::PrepareState" when entering the Play Mode with a shader variant collection that has a shader with a "dynamic_branch" keyword
How to reproduce:
1. Open the “ShaderWarmup“ project
2. Open the “Crash“ scene
3. Create a “Shader Variant Collection”
4. Open the new shader variant collection in the Inspector
5. Click on “Add shader” and choose “CustomUnlit“ shader
6. Add the shader variant with the keyword “Normal _C“
7. Create a new GameObject in the scene
8. Attach the “WarmupShader“ script to the new GameObject
9. In the “Collection” field choose the newly created shader variant collection
10. In the “Shader“ field choose the “CustomUnlit“ shader
11. Enter the Play Mode
Expected result: No crash
Actual result: The Editor crashes
Reproducible with: 2022.3.25f1, 2023.2.19f1, 6000.0.0b15
Could not test with: 2021.3.37f1 (was not able to downgrade the project)
Reproducible on: macOS 13.5.2 (Intel), Windows 10 Pro (22H2)
Not reproducible on: No other environments tested
Note: The code snippet “{{#pragma dynamic_branch __ _D _E}}“ is causing the issue in the “CustomUnlit.shader“
First few lines of the stack trace:
#0 0x0000010b298264 in DynamicBranchState::PrepareState(unsigned long, keywords::LocalKeywordState const&)
#1 0x0000010b2b6741 in ShaderLab::ShaderState::ApplyShaderState(unsigned int, ShaderPropertySheet const*, ShaderPassContext const&, keywords::LocalKeywordState const&, Shader const*, ShaderLab::Pass const*, DynamicBranchState*, ShaderLab::SubPrograms*, DeviceRenderStateBlock const*, int, int, ShaderLab::Pass const*, ShaderLab::Pass const*) const
#2 0x0000010b2a3df5 in ShaderLab::Pass::ApplyPass(unsigned int, ShaderPropertySheet const*, DynamicBranchState*, ShaderPassContext&, keywords::LocalKeywordState const&, Shader const*, int, int, ShaderLab::GrabPasses const*, ShaderLab::SubPrograms*, DeviceRenderStateBlock const*, ShaderLab::Pass const*, ShaderLab::Pass const*)
#3 0x0000010b28be07 in DrawVBOChunkWithPass(Shader*, DynamicBranchState*, int, int, ShaderLab::Pass*, ShaderPassContext&, keywords::LocalKeywordState const&, WarmupPassSetup const&, DynamicVBO*)
#4 0x0000010b28978a in ShaderWarmupFuncImpl(Shader*, DynamicBranchState*, int, int, ShaderLab::Pass*, keywords::LocalKeywordState const&, WarmupPassSetup const&, DynamicVBO*, void*, ShaderPassContext&)
-
Resolution Note:
null
Duplicate of https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-70277
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Build Profile] [VisionOS/iOS/tvOS] - Build Player Library button is getting displayed depending on the selected build target
- EnsureRunningOnMainThread error in TessellationJob.ApplyInset
- MultiColumnListView causes a memory leak when repeatedly shown and hidden
- Position Node with Object Space has a wrong value when there are multiple active GameObjects with the same shader
- [URP][RG] Fullscreen blit is not working when Render Graph is enabled
This is a duplicate of issue #UUM-70277