Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.34f1
2022.3.17f1
2023.2.6f1
2023.3.0b3
6000.0.0b11
6000.1.0a7
Issue ID
UUM-62033
Regression
No
half4 type variables are cased to float4 when shaders are compiled on Metal or GLES graphics API
Reproduction steps:
1. Open the attached “BugRepro“
2. In the Project window, select the “Assets/Shader/TestShader” shader
3. In the inspector, in the “Compile and show code” popup menu, select the Metal graphics API
4. Click “Compile and show code”
5. In the opened code, observe the “u_xlat16_0” and “_TintColor” variables type and their usage
Expected result: the variable type stays the same as the declared type when they are used
Actual result: the variables are cast to float4 when they are used
Reproducible with: 2021.3.34f1, 2022.3.17f1, 2023.2.6f1, 2023.3.0b3
Reproducible on: Windows 11
Not reproducible on: No other environments tested
Note: On the Editor version 2023.3.0b3, in the compilied code the “_TintColor” variable is declared as a float4
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
After careful consideration, we decided to not fix this issue at this time.
It is possible to rewrite the code in a way that ends up only using fp16 temporaries:
half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
return lerp(col * _TintColor, _MixColor, i.uv.x);
Resolution Note:
After careful consideration, we decided to not fix this issue at this time.
It is possible to rewrite the code in a way that ends up only using fp16 temporaries:
half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
return lerp(col * _TintColor, _MixColor, i.uv.x);