Search Issue Tracker
Fixed in 2022.1.X
Fixed in 2021.2.X
[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.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Sprite Atlas remains loaded in memory after scene change or unloading assets
- Decompressing a DeflateStream under IL2CPP misses a few bytes
- Referred style sheet stays dirty after saving when using the UIBuilder
- The Height map Amplitude is not working when using HDRP/LayeredLit
- Infinite inertial tensor rotation values are not discarded (both AB and RB)