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
- Objects with Universal Render Pipeline/Particles/Lit shader are always lit up when changing their Rendering Layer Mask
- PolySpatial “Trying to set shader on a Material Variant.” error is printed in the console when entering Play Mode
- Error “Shader error in 'YSCloudCover': call to 'tex3D' is ambiguous at Assets/YSCloudCoverText.shader(606) (on d3d11)“ is present when compiling tex3D shader with DXC
- Placeholder asset is not loaded with Advertisement Legacy sample when using the latest version of the package
- Addressables content build fails but the Player build is successful when building a development build
Resolution Note (fix version 2022.1):
Fixed in: 2022.1.0b1
Resolution Note (fix version 2021.2):
Fixed in: 2021.2.9f1