Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug 2019.3.0f5 Fail to render with SRP Batcher on Mali GPUs on big scenes

Discussion in '2019.3 Beta' started by JesOb, Jan 17, 2020.

  1. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Can not send project for now but We have regression in f5 so SRP Bacther not working for our map on Mali GPUs

    Galaxy S7 just random crashed,
    Galaxy S10 not crashed but renders random half of scene.
     
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    If you get around to it, a bug report would be much appreciated.
     
  3. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    We will create it as soon as we can, I have create this post just to alert existing bug :)
     
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    I've checked and there's no known issue in the database.
     
  5. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    We will try to record video of bug and later try to create minimal reproduction
     
    LeonhardP likes this.
  6. Silentor666

    Silentor666

    Joined:
    Dec 14, 2013
    Posts:
    16
    Recorded on Samsung Galaxy S10e (international version, Exynos + Mali), same effect on older Samsung Galaxy S models (international). There is correlation between glitches and count of rendered objects. There are no glitches with SRP batcher turned off.
     
  7. Abruzzi

    Abruzzi

    Joined:
    Feb 6, 2015
    Posts:
    44
    We have similar two issues.

    1) Related to 2019.3.0f5 and crashes. We started to have random crashes on both android and ios (on 2019.3.0f4 all was fine) URP 7.1.7
    2) Related to "There is correlation between glitches and count of rendered objects"". We have same problem on Galaxy Note 3 (OpenGL ES 3.0). It was since LWRP 6.9.0 and still happens on URP 7.1.7
     
  8. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    We are still missing a report + reproducible for this.
     
  9. Silentor666

    Silentor666

    Joined:
    Dec 14, 2013
    Posts:
    16
    Finally I have stripped down our project to minimal reproduce :) Bug submitted, case 1214237

    The bug is caused by one specific vertex-moving shader (foliage wind-like movement).
     
    Last edited: Jan 24, 2020
  10. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Thanks a lot! I've forwarded it to the team.
     
    JesOb likes this.
  11. Silentor666

    Silentor666

    Joined:
    Dec 14, 2013
    Posts:
    16
    Reproduced in 2019.3.0f6 too
    There are much smaller flickering in 2019.3.0f4. I've hardly noticed it, but it still present
     
    Last edited: Jan 29, 2020
  12. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    There are 2019.3.3 already, do we have some news about srp batcher stability? case 1214237
     
  13. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    Hi!
    Regarding glitches/crashes when rendering a lot of objects with SRP batcher (case 1214237): Mali GPU drivers have a fixed amount of temporary memory for varyings. On Vulkan the driver crashes when this limit is hit. OpenGL ES driver handles this internally, but this results in much lower poerformance.
    We have some code to detect this on the engine side. If you see "Vulkan: Too much vertex data per render pass detected, this may cause rendering errors and instability. (only logged once)" in the console, this means we think you'll hit this limit.

    Normally, if the application is generating that much varying data per frame, it's not going to be performant enough on these devices anyway. The only proper workaround for this is to reduce the amount of geometry rendered.
     
    LeonhardP likes this.
  14. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Thanks for info.

    We have only 800K polygons and before that it was 4 000K and everything work fine
    What about the fact that bug only occurs with shader graph's shader on trees and mostly disappear when there is standart Lit shader used? Unity 2019.3.0f4 work almost fine but another one flicker a lot.

    Can you help please understand what we can do with it?
    And what Unity plan to do with it :)
     
    Last edited: Mar 5, 2020
  15. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    Let me take a look at the shader once more :)
     
    JesOb likes this.
  16. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Additional info:

    with SRP Batcher Galaxy s7 flicker a lot and crash in 5 to 10 secs
    without srp batcher we have 26-30 fps on it

    All on Vulkan
     
  17. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Keep in mind that the issues you're experiencing might not be the same as the ones caused by the shader in @Silentor666's repro project that are tracked in 1214237. We would need to have a look at your project/reproducible to determine that.
     
  18. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    My issues and silentor issues is the same issues because it is the same project :)
     
  19. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Good to know :D
     
  20. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    @Jes28 here's an example:
    there's a mango tree in the project, the mesh has 10224 verts
    looking into the shader, we have a PackedVaryings struct (stipping #ifdef'ed parts):
    Code (CSharp):
    1. struct PackedVaryings
    2. {
    3.     float4 positionCS : SV_Position;
    4.     float3 interp00 : TEXCOORD0;
    5.     float3 interp01 : TEXCOORD1;
    6.     float4 interp02 : TEXCOORD2;
    7.     float4 interp03 : TEXCOORD3;
    8.     float3 interp04 : TEXCOORD4;
    9.     float3 interp05 : TEXCOORD5;
    10.     float2 interp06 : TEXCOORD6;
    11.     float3 interp07 : TEXCOORD7;
    12.     float4 interp08 : TEXCOORD8;
    13.     float4 interp09 : TEXCOORD9;
    14. };
    The data generated by the vertex shader is 5x float4 + 5x float3 + 1x float2 = 2 + 15 + 20 floats = 37x4 bytes = 148 bytes per vertex.
    If we render a single mango tree, we get 148 bytes x 10224 verts = 1 513 152 bytes of data = ~1.44MB.

    The scene in question seems to be much more complicated than that. Suppose those 800K polygons are coming from just 800K vertices and are all rendered with this shader. We get 148 bytes x 800K = ~112 MB of data per frame for varyings. This data has to fit in the fixed buffer I mentioned :) So, if you use a simpler shader, it's likely to fit.

    Let's take a look at this from another point: memory bandwidth. S8 with a Mali GPU has peak memory bandwidth of ~15 GB/s.
    Let's assume the input data per vertex is pos (float3) + normal (float3) + tangent (float4) + color (byte4) + UV0 (float2) = 52 bytes. So each frame, just to read vertex attributes and to produce varyings, we need 52 (read) + 148 (write) = 200 bytes per vertex. 800K vertices means 160 000 000 byte, or ~152.5 MB per frame. Then there's a step needs to actually do the interpolation for the fragment shader (might be the fragment shader itself...), which needs to read the data generated by the vertex shader. Let's say a quarter of the triangles survive all the tests. We would then need half of the varyings data as input to the fragment shader = 56MB (read) per frame. Total memory transfers till this point score 208.5 MB.
    If we want to run at 60 FPS, we use about 12.5 GB/s of memory traffic just for the geometry. No shadows, no textures, no writing to the framebuffer, no postprocessing :)

    If you cut the amount of data used for varyings, you're going to have much less memory traffic. So using a simpler shader / using half where possible would help a lot :)

    This is quite interesting info. A quick guess would be that the SRP batcher path uses more memory somewhere, which leads to hitting this limit.
    Do you see the warning I mentioned above without the SRP batcher enabled?
     
    JesOb likes this.
  21. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Thanks a lot @aleksandrk :)

    I will look to find warning in logs and answer :)
     
  22. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    >looking into the shader, we have a PackedVaryings struct (stipping #ifdef'ed parts):
    AFAIK this is standard shader graph pbr node varyings layout.
     
  23. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    It can be :)
    I'll ask people doing shader graph.
    Do you know if they allow to customize varying precision?
     
  24. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    >allow to customize varying precision?
    nope
     
  25. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    :(
     
    Peter77 likes this.
  26. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    OK, it should now be in their backlog :)
     
    BattleAngelAlita and JesOb like this.