Search Unity

Is it ok to use "#pragma target 3.0" in shader for mobile game?

Discussion in 'Shaders' started by augustinus, Dec 29, 2016.

  1. augustinus

    augustinus

    Joined:
    Feb 3, 2015
    Posts:
    25
    My game is for mobile devices and phones.
    And I need 10 interpolators, so I should use target 3.0.

    In Unity manual, target 3.0 is described like this.

    https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html
    #pragma target 3.0
    • DX9 shader model 3.0: derivative instructions, texture LOD sampling, 10 interpolators, more math/texture instructions allowed.
    • Not supported on DX11 feature level 9.x GPUs (e.g. most Windows Phone devices).
    • Might not be fully supported by some OpenGL ES 2.0 devices, depending on driver extensions present and features used.
    But, I don't know it's okay to use this define in mobile games.
    Is there any device coverage information?
    I don't want to make my game for just small high performance devices.
     
  2. Fabian-Haquin

    Fabian-Haquin

    Joined:
    Dec 3, 2012
    Posts:
    231
    It's hard to say... Shader model version are for DirectX only. OpenGL doesn't use that.
    As is it said, depending on what feature you use from shader model 3.0, it may work, or it may not.

    Are you able to try your shader on a low cost android device or an old android phone like the Galaxy S3 ?
     
  3. tsangwailam

    tsangwailam

    Joined:
    Jul 30, 2013
    Posts:
    280
    iPad/iPhone technically can support almost all of shader model 3.0 features. And the features should work on most "not so old" android device.

    So, i think it is safe to set SM3.
     
    Fabian-Haquin likes this.
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,795
    Well, the manual is pretty clear.

    You can use it. It might cause issues with some Opengl ES 2.0 devices.