Shader Model and features

2.5: derivatives
3.0: 2.5 + interpolators10 + samplelod + fragcoord (also contains fragdepth)
3.5: 3.0 + interpolators15 + mrt4 + + integers + 2darray + instancing
4.0: 3.5 + [mrt8] + geometry
4.5: 3.5 + compute + randomwrite (so it means it has no 4.0 features)
4.6: 4.0 + [cubearray] + tesshw + tessellation (so it means it has no 4.5 features)
5.0: 4.0 + 4.5 + 4.6 + [interpolators32] (it has everything)

[Pink] : Mobile won’t implies it

info from @Aras

 

Shader Compilation

Import time – when you create a .shader file

  • compile the shader variants only when needed, etc. platform, variants

Build time – when you build a player

  • [level 1] ShaderLab -> glsl or hlsl or …etc
    • if platform supports, from [level 2] hlsl -> IL or MetalSL to AIR…etc
  • Cache identical shaders under Library/ShaderCache
  • compile only not-yet-ever-compiled shaders (variants for this platform only)

Run time – when you open the app

  • [level 3] glsl or hlsl or IL or AIR…etc -> driver (GPU bytecode)
    • because target device is unknown for PC/mobile at buildtime
  • Depends on driver, when to compile these codes e.g. only when it’s used
    • use shader pre-warm to “use” shaders to trigger compilation

 

Sources from lukasc, robs, Unity Manual and https://blogs.unity3d.com/2014/05/06/shader-compilation-in-unity-4-5/