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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (fix version 2022.1):
Fixed in: 2022.1.0b1
Resolution Note (fix version 2021.2):
Fixed in: 2021.2.9f1