Search Unity

Bug SRP batcher does not work with OpenGLES3

Discussion in 'Universal Render Pipeline' started by drallcom3, Apr 19, 2021.

  1. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    136
    https://docs.unity3d.com/Manual/SRPBatcher.html says the SRP batcher should work with OpenGLES3.
    If I play the editor in DX11 it works fine. If I play the editor in OpenGLES3 or make an OpenGLES3 APK (with ES3.1 enabled) it doesn't work. Tested with the profiler and this script (https://github.com/Unity-Technologies/SRPBatcherBenchmark).
    I use the standard shaders from 2021.1 and URP 11 in a completely fresh project. In DX11 the shaders say "compatible", in OpenGLES3 they say they aren't (which seems to be true).

    Is the SRP batcher supposed to work with OpenGLES3?
    It says "OpenGL ES 3.1 and higher" in the description, but the editor only says "OpenGLES3". Is this something I should be concerned about?

    Unrelated bonus question: Does the SRP batcher have something to do with UI, too? Do I need a special compatible UI shader?
     
    Hobodi likes this.
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    Hi!
    SRP batcher should work on any OpenGL ES 3.1+ device. You don't need to explicitly enable OpenGL ES 3.1 on the player settings.
    Editor only works with OpenGL ES 3, so it doesn't support SRP batcher when using any OpenGL ES.
    Which Unity version do you use?
     
  3. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    136
    Unity 2021.1.2f1 with URP 11.0.0. So fairly up-to-date. I don't think it ever worked. I also tried the latest 2021.2 and 2020 LTS. Always with default materials, which should be compatible.
    SRP batcher never activates on my OpenGL ES 3.2 device (Pixel 2 XL). Even with fresh test projects where I haven't touched many settings.
     
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    This is worth a bug report then :)
     
  5. Ruslank100

    Ruslank100

    Joined:
    Apr 11, 2018
    Posts:
    23
    The same happened to me (on Huawei P20 Pro, Logcat reported that the phone uses openGLES 3.2), I will try to reproduce the behaviour in a new project and report it
     
  6. Ruslank100

    Ruslank100

    Joined:
    Apr 11, 2018
    Posts:
    23
    I reproduced the behaviour in a new project with URP11 (a simple scene with a plane, cube, sphere and cylinder with Simple Lit shader, a directional light with shadows and no sky). The scene was rendered in 4 steps in editor (the shadows in one pass and the primitives in one pass), while it took 11 steps on Android (everything was rendered one by one). Of course I disabled Auto Graphics API and checked "Require ES3.1". Batching (both the static and dynamic were off), the SRP batcher is on, of course
    Case 1331286
    Edit: 1. spelling
    2. Actually the scene on Android was rendered in 10 steps (the 11th was to write "development build" in the corner) but anyway, the meshes are not batched
     
    Last edited: Apr 23, 2021
    Hobodi and aleksandrk like this.
  7. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    136
    Thank you for confirming. I wasn't sure if it's just me.
     
    Hobodi and Ruslank100 like this.
  8. loonyq

    loonyq

    Joined:
    Feb 24, 2019
    Posts:
    1
    Hello. Unity 2021.1.6 same problem. SRP batcher works with Vulkan but not with OpenGL. Device: Oculus quest 2.
     
  9. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
  10. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    136
  11. KospY

    KospY

    Joined:
    May 12, 2014
    Posts:
    141
    Just encountered this issue today. Work fine on Vulkan but not OpenGL.
    Using 2020.3.8
     
  12. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    The fix is on its way.
    I'll post here when I know the fix versions.
     
  13. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    Hi!
    A small update: the fix will appear in 2019.4.29f1 and 2021.2.0a19.
    2020.3 and 2021.1 require more investigation, so will take a little longer.
     
  14. simba-mupfunya

    simba-mupfunya

    Joined:
    Nov 13, 2018
    Posts:
    4
    What does this investigation entail, and an ETA would be nice for 2020.3LTS at least (Doesnt have to be tomorrow)
     
  15. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    The same bug fix worked on 2021.2 and 2019.4, but didn't work on 2020.3 and 2021.1. This means there's something else that prevents the SRP batcher from working on GL on these versions - probably, a separate bug.
    Unfortunately, I cannot give an ETA on when it will be fixed, only that it has high priority.

    I'll post here when I have more information.
     
    simba-mupfunya likes this.
  16. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    2020.3.14f1 and 2021.1.14f1 will have the fix for SRP batcher on GL.
     
  17. simba-mupfunya

    simba-mupfunya

    Joined:
    Nov 13, 2018
    Posts:
    4
    Promise kept and speedy too! :)
     
  18. Temka_193

    Temka_193

    Joined:
    Oct 24, 2015
    Posts:
    44
    Version 2020.3.13 will not be? Immediately 14? Or will you have to wait for two versions to be released?
     
  19. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    Yes, that's correct. The fix got merged into what's going to become 2020.3.14f1.
     
    BloopTrangle and andreiagmu like this.
  20. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    59
    Can't wait! When is 2020.3.14 due?
     
  21. pw_prg_yinchao

    pw_prg_yinchao

    Joined:
    Feb 14, 2020
    Posts:
    18
    Looking forward for backport of 2019.4 LTS version :)
     
  22. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    If there are no shipstopper bugs found, around 07.07 :)
     
  23. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    59
    awh, is that refering to seven minutes past seven in the morning? or (hope not) a date far ahead into the next month ;)

    Are there any workarounds we could deploy up until then?
     
    Ruslank100 likes this.
  24. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    That would've been 07:07 ;)
    Somewhere around 7th of July 2021.

    Unfortunately not. The issue was with the shader compiler reporting incorrect data about matrices used in CBUFFERs.
     
    hippocoder and bjornsyse like this.
  25. yizhiyu848

    yizhiyu848

    Joined:
    Dec 22, 2020
    Posts:
    2
    Can't wait! When is 2020.3.8LTS due?
     
  26. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    59
    2020.3.8 is out long ago. Latest is 2020.3.12, but the fix is in 2020.3.14 due late next week.
     
    andreiagmu likes this.
  27. yizhiyu848

    yizhiyu848

    Joined:
    Dec 22, 2020
    Posts:
    2
    Thank You!
     
  28. MonaStudio

    MonaStudio

    Joined:
    Aug 21, 2020
    Posts:
    1
    we are using 2019.4.26f1c1, srp batcher can not work. When is 2019.4.29f1c1 due? The last version have released a month ago.
     
  29. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    59
    Hi, can we hope for a release today allready or hold off for some days?
     
  30. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    I don't have any information on when exactly it's going to be published, sorry.
    If everything is on schedule, it should be published today or tomorrow.
     
    andreiagmu and bjornsyse like this.
  31. spacepluk

    spacepluk

    Joined:
    Aug 26, 2015
    Posts:
    201
    I just tested 2021.1.14f1 and it's still not working for me. Did the fix make it into that release?
     
  32. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    Yes, it did.
    What exactly is not working? Is it still not SRP batcher compatible only for shaders on GL/GLES3? Which shaders?
     
  33. spacepluk

    spacepluk

    Joined:
    Aug 26, 2015
    Posts:
    201
    I'm testing an Android build with the new Starter Assets in a fresh project. Using the frame debugger I don't see any SRP Batches when using OpenGL. And it works if I force the Vulkan API in the player settings.

    I upgraded the materials using the auto-converter and the shaders are URP/Lit as far as I can see.
     
  34. spacepluk

    spacepluk

    Joined:
    Aug 26, 2015
    Posts:
    201
    The testing device is a Samsung Galaxy S7 with Android 8.0 (Mali T880 OpenGL ES 3.2)
     
    aleksandrk likes this.
  35. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    Thanks!
    Let me check with QA :)
     
    spacepluk likes this.
  36. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    OK, it turns out that the part of the fix on URP side didn't get into 2021.1.14f1 :(
    It will be there in 2021.1.16f1 and in 2020.3.14f1 + URP 10.6.0.
     
    spacepluk likes this.
  37. spacepluk

    spacepluk

    Joined:
    Aug 26, 2015
    Posts:
    201
    Cool, thanks for the update! Is there a rough ETA for that release?
     
  38. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    Around 2 weeks for 2021.1.16f1
     
    spacepluk likes this.
  39. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    59
    2020.3.14 haven't appeared in my hub yet though.
     
  40. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    8,221
    Wait another week.
     
  41. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    59
    Today is the day apparently!
     
    Last edited: Jul 14, 2021
    andreiagmu likes this.
  42. nishu6789

    nishu6789

    Joined:
    Apr 16, 2020
    Posts:
    2
    on a Galaxy S5 SRP batching didnt work for me with a compatible shader on 2020.3.14f1 + URP 10.6.0
     
  43. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    Galaxy S5 uses an Adreno 330 GPU. We don't support SRP batcher on this GPU family.
     
  44. xiaoyutou1988

    xiaoyutou1988

    Joined:
    Mar 16, 2017
    Posts:
    4
    Check SRP batcher by Unity2020.3.14f1, only available according by Vulkan first in the Player Settings->Graphics APIs.
    As I knew, SRP batcher is supported on GLES 3.1+AEP, will it repair this problem on next version?
    Thanks

    device: RedMi K30, GLES3.2, CPU:Qualcomm SM7150, GPU:Adreno 618, Android 11
     
  45. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    48
    So I'm on a Quest 1 and downloaded 2021.1.15 today. Managed to get SRP working on the Quest 1 using Vulkan (well the Frame Debug says it's SRP batching)
    My scene is a city environment made up of around 4000 objects in the scene. For performance testing I've made the materials URP Unlit.
    When GPU instancing is turned on for the scene takes 100 draw calls according to the Frame Debug.
    So this runs fine on the Quest 1 by itself but when I add in all my characters and the scene jumps to 160 draw calls the FPS drops to around 58.
    This is where I thought I'd give SRP a go.
    So going back to just displaying the environment objects (which was running fine with GPU instancing) I enabled SRP batching and Frame Debug says 11 SRP batches (which is great) bit my frame rate on Quest is 17fps

    Am I missing something? I though SRP was supposed to speed things up?
     
  46. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    AEP is not required, GLES 3.1 is enough.
    How exactly do you check SRP batcher availability?

    I don't think this question belongs in this thread. Also, please search the forums, this question has already been answered.
     
  47. nishu6789

    nishu6789

    Joined:
    Apr 16, 2020
    Posts:
    2
    Ah good to know, because adreno 330 GPU family doesn't support openGL ES 3.1? It should be fine on Adreno 4xx + gpus that support openGL ES 3.1 then?

    Thanks!
     
  48. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
    Yes to both :)
     
  49. xiaoyutou1988

    xiaoyutou1988

    Joined:
    Mar 16, 2017
    Posts:
    4
    I checked it by Unity FrameDebug from android device, and have no SRP batch on DrawOpaqueObjects List
    I just add some cube gameobjects with URP/Lit materials in a simple scene.
    It's success to SRP batch when set Vulkan first in the Player Settings->Graphics APIs.
    But it's fail to SRP batch when set OpenGLES3 first in the Player Settings->Graphics APIs.
     
  50. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,135
unityunity