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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.