Search Issue Tracker
Fixed in Unity 2017.1
[Metal] Half-precision literal in HLSL is translated to float literal by Metal shader compiler
1) Open the attached project (HLSLHalfLiteralBecomesMetalFloatLiteral.zip).
2) Open "MobileBloom.shader".
3) Observe the literal "half4(0.01h, 0.01h, 0.01h, 0.01h)" in "half4 fragBloom ( v2f_simple i ) : SV_Target".
4) Select "MobileBloom.shader".
5) Open drop-down menu of the "Compile and show code" button in the inspector window.
6) Tick "Custom:", then under "Custom:" tick "Metal".
7) Push the "Compile and show code" button to view View "Compiled-Hidden-FastBloom.shader" file.
8) Observe the literal "float4(0.00999999978, 0.00999999978, 0.00999999978, 0.00999999978)" in "fragment Mtl_FragmentOut xlatMtlMain".
This doesn't occur when compiling to OpenGL.
- float4(0.00999999978, 0.00999999978, 0.00999999978, 0.00999999978) is generated in the Metal shader.
- half4(0.01h, 0.01h, 0.01h, 0.01h) is generated in the Metal shader.
2017.1.0b1, 5.6.0f3, 5.5.0p4
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Visual artifacts appear when rendering to render texture which uses a specific shader
- Unity crashes when calling GameObject.Destroy() on an "empty" GameObject
- FileNotFoundException exception when there are special characters in the assembly path when calling Activator.CreateInstance
- [VR] Crash w/ Oculus and DX11 on Camera selection
- Editor crashes in FindRelativeTransformWithPath on entering Play mode, when two certain scripts are attached to game object