Search Issue Tracker
By Design
Votes
0
Found in [Package]
Issue ID
1358936
Regression
No
[Window][Vulkan][URP] "redefinition of SafePositivePow_half" error in Common.hlsl after switching Editor to Vulkan Graphics API
Reproduction steps:
1. Open the user's attached project "SkyboxCull.zip"
2. Open Assets > Scenes > "SampleScene"
3. Go to Assets > Materials
4. Right-click "CustomSkybox_LOD0_Dimmable" and select "Reimport"
Expected result: Shader works with no errors
Actual result: Shader does not work and a "redefinition of SafePositivePow_half" error is shown
Reproducible with: 7.7.1 (2019.4.30f1), 10.6.0 (2020.3.18f1), 11.0.0 (2021.1.20f1), 12.0.0 (2021.2.0b11, 2022.1.0a8)
Notes:
-Switching the Editor to DX11 or Auto Graphics API results in the shader working with no errors
-Other Editor Graphics API's do not reproduce the issue
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
- [Android][Vulkan] Crash on /system/lib/libandroid.so (ANativeWindow_setBuffersGeometry+4) when the Vulkan Graphics API is used
- Event handlers are preventing operations when trying to copy or paste HTML text in the WebGL Player
- [macOS] Crash on __pthread_kill when Exporting a Package while another export is in progress
- Crash on TransformAccessDestroyCallback when removing a URP Decal Projector component from a parent GameObject that had a URP Decal Projector child GameObject
- An added component is being removed form the prefab when reimporting the prefab
Resolution Note:
The shader in this case mixes both builtin shader library (UnityCG.cginc) and SRP shader library causing some issues due to differences on how half is defined.
The built-in shader library is included implicitly when using CGPROGRAM. Replacing CGPROGRAM with HLSLPROGRAM and fixing the dependencies on the built-in shader library fixes the issue.