Search Issue Tracker
Fixed
Votes
0
Found in
5.2.1f1
Issue ID
740219
Regression
No
[Shaders] hlsl2glsl resolves some function overloads differently from HLSL, mostly with mixed vector types
User wrote a custom shader for particles. I use distance() to measure a pixel's UV distance with the particle center. This works fine in editor, and on PC and webplayer builds. However, it does not work in WebGL (Firefox 41.0.2). Replacing the calculation with length() works.
Repro:
--Open the Main.unity scene and play it in the editor
--you should see the white particles
--Make a WebGL build
--play it in browser
--NOTICE that the particles are not rendering and no error or warning is thrown
The problem seems to be in shader code that does "distance(uv, float2(0.5,0.5))", with uv being a float4 - hlsl2glsl shader translator picks a float4 overload, whereas actual HLSL compiler picks a float2 overload. Changing code to "distance(uv.xy, float2(0.5,0.5))" fixes the issue.
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
Add comment