Search Issue Tracker

Fixed

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&)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.