Search Unity

Does LWRP support OpenGLES 2.0 on old devices like Mali 400?

Discussion in 'General Discussion' started by zwcloud, Oct 22, 2019.

  1. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    It support both, I asked too, but you probably need to do custom optimization to get the full power of mali 400. I'm foolishly planning to do an open world game on mali 400 so ...
     
    zwcloud likes this.
  3. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
    Some clients reported that the scene in both LWRP and builtin-RP are not normally rendered on Mali 400 devices. But I don't have such a device. I'm here to confirm if LWRP casued the issue. But as you said, that's not caused by LWRP.:(

    I tested our shader on builtin-RP with Samsung Galaxy S3, whose GPU is very similar to Mali 400, and it works well...
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Meceka likes this.
  5. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
    Thanks for providing detailed documentation links!

    rendered scene on Mali 400:
    Screenshot_2019-09-24-12-02-12.png
    It seems the land's splat-texture is not tilling normally. The land is just a mesh rendered with a splat blending shader.
     
  6. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    oh it might be interpolation issues, mali 400 are 16bits, as soon as you apply fragment registers, vertex is still 32bits, that mean that it has precision issue when doing UV stuff in fragment. That has a lot of implication, it's theoretically limited to 2048² bilinear filtered textures (even if it can support up to 4096) but due to the facts it has only 8 blending subpixel, you probably are looking for 128² I think... Let me google that:
    https://developer.arm.com/docs/ecm0...n-note-precisions-on-arm-mali-gpus-version-10

    I had to add I'm a damn fool for this reason :p But I'm aiming for 32² texel ratio in nearest (pixelated textures)

    Try to see if it's better with nearest filter (no bilinear) potentially blurring the texture at higher rez to imitate the blinear look.
     
    zwcloud likes this.
  7. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
  8. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    If you need a Mali-400 device to test with there are tons of them on eBay for less than $30.

    https://www.ebay.com/itm/Q8-7Inch-M...Quad-Core-1-3GHZ-Tablet-PC-f-9Y3/312803446105
     
    AcidArrow and zwcloud like this.
  10. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Be sure to test first on device, the source ARM docs explicitly said vertices are 32, unreal talks say that vertices is 32bits, only fragment register are 16bits, that mean that if you pass data directly from varying without touching fragment register, the result will be 32bits, for example unprocess color gradients. Which isn't helpful as you need at least some register read for texture if you want UV, so it's as good as vertices being 16 bits FOR texture sampling, which might what unity really intend to say. BUT still there is a nuance between the two.
     
  11. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
    I got a Galaxy Tab 3 8.0 (SM-T311) from one of my workmates.

    And the issue has been reproduced:


    As what is shown in the video, when the texture coordinates becomes larger, the pixelization happens and becomes more and more obvious.

    Shader:
    Code (CSharp):
    1. struct Input
    2. {
    3.     float4 tc;
    4.     UNITY_FOG_COORDS(0)
    5. };
    6.  
    7. void surf(Input IN, inout SurfaceOutput o)
    8. {
    9.     o.Albedo = tex2D(_Splat0, IN.tc.xy*15);
    10.     o.Alpha = 1;
    11. }
    I'm trying to find a software to capture a frame from the device, but failed to find one that supports Android 4.2.2. Any ideas how to find one?
     
    Last edited: Nov 2, 2019
  12. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
    I think this is a good solution to the problem: wrap the texture around by UV-placing instead of wrapped textures.
    To achieve that, I need to modify the uv mapping of the land mesh.

    But I still not quite understand the reason of the problem: why the rendering mesh becomes more and more pixelated as the uv gets larger? The result of
    IN.tc.xy*15
    is losing more and more precision as the value of
    IN.tc.xy*15
    becomes larger? Why?
     
    Last edited: Nov 2, 2019
  13. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,266
    The further a value is from 0, the more precision is lost. This is very prominent on older devices as you have already noticed. A sure-fire way around is to multiply/offset your UV values in the vertex shader, then pass the result to the fragment shader (the IN.tc value). The vertex shader stage has more precision and won't easily succumb to such issues.

    But I see you're using a surface shader, I personally do not how to approach that in such a case. I do know surface shaders can have a custom vertex shader function, so it should be possible.
     
    zwcloud likes this.
  14. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
    I think, there are two situations (I don't know which one suits Mali 400):
    1. The precision lost happens when GPU interpolates the uv passed from the vertex shader: in such case, that will also not work if the range of uv is larger than [0, 1] or [0, 2] (I'm not sure about the range): I mean, even if the calculation result is 32bit when passed out from vertex shader, it will be clamped when the GPU interpolates the uv and make it 16bit.
    2. The precision lost happens when doing calculation in fragment shader (maybe caused by register precision limit, such as a 16bit only register when doing calcuation). So if no calculation happens (just
      tex2D(_Splat0, IN.tc.xy)
      instead of
      tex2D(_Splat0, IN.tc.xy*15)
      ), then the result should be good when that calculation was moved to vertex shader.
    And the calculation-in-vertex-shader solution won't work for every use case, for example, shader target 2.0 only allow 8 interpolators, if the calculation happens in vertex shader then it will occupy one texcoord, namely one interpolator. If the original shader have already used up 8 texcoords, then this shader cannot be modified that way, because more than 8 interpolators are not supported in #pragma target 2.0/2.5.
     
    Last edited: Nov 2, 2019
  15. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
    Could you or anyone experienced provide more theoretical materials on this? I want to fully understand what is happening.
     
  16. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Look for float precision, basically the number of digit is fixed, but the floating point can move around, so while you can have say 1234 as a number, you can represent 1.234 or 12.34 or 123.4, notice how many digit after the point, then you have exponent, so really big number like 123.4 x 10² cannot move with fine grain step (you don't have the number of digit necessary after the point). The bigger the number, the bigger the step between number, WORSE, that precision fluctuate, as you can have big number that don't use up digit after the point, so they get fully represented, but as you start using digit for intermediary step that fall neatly in the integer interval they start taking digit away and reduce precision. That is float precision isn't constant in float, the less bit you have to represent float, the more severe the issue is. Fixed point for life!


    more
    https://blog.demofox.org/2017/11/21/floating-point-precision/

     
  17. squarelover

    squarelover

    Joined:
    Nov 14, 2012
    Posts:
    31
    i ve tried to build with to alcatel pixi 4 with mali 400 graphic processor lwrp template without anything on the scene except camera and directional light with LWRP-LowQuality Settings->asset and lowest Quality settings in Project settings.

    this is the visual result https://ibb.co/37bqWmS.

    adb logcat pasted this in command line

    : WARNING: Shader

    12-25 13:58:53.457 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/CopyStdFromTexArray' - Pass '' has no vertex shader

    12-25 13:58:53.457 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.457 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.457 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.457 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/CopyStdFromTexArray' - Setting to default shader.

    12-25 13:58:53.459 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.459 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/DepthOfField' - Pass 'CoC Calculation' has no vertex shader

    12-25 13:58:53.459 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.459 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/DepthOfField' - Pass 'CoC Calculation' has no vertex shader

    12-25 13:58:53.460 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.460 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.460 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.460 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/DepthOfField' - Setting to default shader.

    12-25 13:58:53.463 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.463 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Debug/Waveform' - Pass '' has no vertex shader

    12-25 13:58:53.463 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.463 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.463 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.463 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Debug/Waveform' - Setting to default shader.

    12-25 13:58:53.732 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.732 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Uber' - Pass '' has no vertex shader

    12-25 13:58:53.732 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.732 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Uber' - Pass '' has no vertex shader

    12-25 13:58:53.817 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.817 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/TemporalAntialiasing' - Pass '' has no vertex shader

    12-25 13:58:53.817 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.817 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.817 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.817 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/TemporalAntialiasing' - Setting to default shader.

    12-25 13:58:53.818 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.818 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/MultiScaleVO' - Pass '' has no vertex shader

    12-25 13:58:53.818 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.818 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.818 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.818 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/MultiScaleVO' - Setting to default shader.

    12-25 13:58:53.822 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.822 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Debug/Vectorscope' - Pass '' has no vertex shader

    12-25 13:58:53.822 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.822 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.822 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.822 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Debug/Vectorscope' - Setting to default shader.

    12-25 13:58:53.822 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.822 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Debug/LightMeter' - Pass '' has no vertex shader

    12-25 13:58:53.822 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.822 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.823 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.823 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Debug/LightMeter' - Setting to default shader.

    12-25 13:58:53.832 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.832 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/FinalPass' - Pass '' has no vertex shader

    12-25 13:58:53.832 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.832 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/FinalPass' - Pass '' has no vertex shader

    12-25 13:58:53.832 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.832 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/FinalPass' - Pass '' has no vertex shader

    12-25 13:58:53.834 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.834 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Debug/Histogram' - Pass '' has no vertex shader

    12-25 13:58:53.834 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.834 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.834 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.834 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/Debug/Histogram' - Setting to default shader.

    12-25 13:58:53.834 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.834 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/ScreenSpaceReflections' - Pass '' has no vertex shader

    12-25 13:58:53.834 31943 31957 D Unity : ERROR: Shader

    12-25 13:58:53.834 31943 31957 D Unity : Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    12-25 13:58:53.834 31943 31957 D Unity : WARNING: Shader

    12-25 13:58:53.834 31943 31957 D Unity : Unsupported: 'Hidden/PostProcessing/ScreenSpaceReflections' - Setting to default shader.


    which couldnt be excluded from the build since there not in the "include" shaders but built in and i assume binded to a renderer pipeline. so i actually consider this result as a no to a topic question, really