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
- Crash on [NSApplication endModalSession:] when saving while Play Mode is loading
- Incorrect Preferred Height calculation when a single text line uses different Font Assets
- [ShaderGraph] Redo Collapse Nodes action does not fully collapse the Nodes
- [Ubuntu] Mouse cursor is set box select mode after exiting VFX Graph's Rename Context function
- Unrecognized identifier DECLARE_STACK_CB error is thrown when VirtualTexture Property is used with Custom RenderTexture target
Resolution Note (fix version 2022.1):
Fixed in: 2022.1.0b1
Resolution Note (fix version 2021.2):
Fixed in: 2021.2.9f1