Search Issue Tracker
Won't Fix
Votes
0
Found in
2018.4
2018.4.23f1
2020.2
Issue ID
1281058
Regression
No
Using macros and Shader features at the same time causes Shader compile errors
How to reproduce:
1. Open the attached "ShaderVariantsProblem.zip" Project
2. Build and run it on windows, android, or iOS build target
3. Observe the cube in the app
Expected Behavior: The cube is black
Actual Behavior: The cube is white
Reproducible with: 2018.4.27f1, 2019.4.11f1, 2020.1.7f1, 2020.2.0b5
Reproducible devices:
VLNQA00015, Samsung Galaxy Note8 (SM-N950W), Android 8.0.0, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00286, Meizu - (PRO 5), Android 7.0, CPU: Exynos 7 Octa 7420, GPU: Mali-T760
VLNQA00285, Samsung Galaxy J4 Core (SM-J410F), Android 8.1.0, CPU: Snapdragon 425 MSM8917, GPU: Adreno (TM) 308
VLNQA00310 iPad Pro 12.9 1st gen (iOS 13.4.1)
Note:
- If the project does not build - it should print a compilation errors showing this issue
- "compile_error.png" Error image attached
- Not reproducible with Dx11
- On Android, it was reproducible both with Vulkan and Gles3
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
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note (2021.1.X):
Unfortunately the shader in this case is using undefined behaviour.
The preprocessors used for shader languages are based on the C and C++ standards. The C and C++ standards declare it is undefined behaviour to have preprocessor directives within macro arguments.
As such, the shader code within the bug is undefined behaviour and may have different results between different shader compilers, versions and platforms.
On some platforms this code will compile and on others it may cause an error and on others it could potentially lead to undesired behaviour.
It is recommended that you re-structure your shader code not to have preprocessor directives within macros arguments.