Search Issue Tracker
Fixed in 2022.1.X
Fixed in 2021.2.X
Votes
0
Found in
2019.4
2020.3
2021.1
2021.2
2022.1
Issue ID
1370660
Regression
No
[Shaders] compute '#pragma require' flags don't persist after shader cache clear and are not reparsed until shader is changed
How to reproduce:
1. Open the attached project "PragmaRepro" in a Windows editor
2. Navigate to the Assets folder and select "Repro.compute"
3. Observe the compiler error "undeclared identifier 'WaveActiveSum' at kernel CSMain" and that "Compile and show code" output is missing
4. Modify the shader in any way (e.g. add a comment or a new line to it)
5. Observe that the error disappears in the Shader inspector ("#pragma require" got parsed) and "Compile and Show Code" works
6. Clear the shader cache: "Assets" -> "Clear Shader Cache" or by deleting "Library/ShaderCache"
7. Observe that the error returns when you do "Compile and show code" (requirement flags got cleared with the shader cache and pragmas were not reparsed)
Expected result: "#pragma require" should get regarded at all times which should result in the DXC compiler being used and no compilation errors
Actual result: "#pragma require" gets neglected in compute shader after shader cache or Library clear
Reproducible with: 2019.4.31f1, 2020.3.19f1, 2021.1.23f1, 2021.2.0b15, 2022.1.0a11
Note: other pragmas, such as "#pragma only_renderers" and "#pragma use_dxc" don't seem to be disrupted by the cache clear, even though from the debugger ParseComputePragma is not called. The attached project is with no Library folder, which is why the error is present after the first opening.
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
- Keywords on Material Variants aren't automatically saved when changed on original Material through Shader Graph
- Light Probes get baked when calling LightProbes.Tetrahedralize
- Shadows flicker and cause visual artifacts when modifying a GameObject's bounds using Swizzle (Y Mask) and Sine Time nodes
- [WebGL] Frame rate drops by 5-20 fps when moving cursor or touch input in the Player
- Light bleeds when using box shaped spotlight with specific Emission Range values
Resolution Note (fix version 2022.1):
Fixed in: 2022.1.0b1
Resolution Note (fix version 2021.2):
Fixed in: 2021.2.9f1