Search Unity

What is the purpose of SRP Batcher?

Discussion in 'Universal Render Pipeline' started by thenephalem, Feb 22, 2020.

  1. thenephalem

    thenephalem

    Joined:
    Jun 1, 2017
    Posts:
    14
    I am using frame debugging in order to optimize my upcoming game. I don't really understand the idea behind the SRP Batcher. I want to reduce the amount of batches and, although, it appears that many elements are combined in a batch, that is not the case as seen from the Frame Debugger.

    upload_2020-2-22_1-36-45.png

    So here in the first SRP Batch I have at the moment only 7 batches, however when I click the next SRP Batch the amount jumps to 21. As if the objects are rendered separately. But why is it called a SRP Batcher then? What does it do?

    upload_2020-2-22_1-39-28.png
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,723
    I don't think the Batches stat is as important if you're using the SRP batcher.
     
  3. buFFalo94

    buFFalo94

    Joined:
    Sep 14, 2015
    Posts:
    273
    Yeah that's true
    Been experimenting with SRP Batcher since it's came out and I've noticed that when it's enabled stats are somewhat wrong but performance is better so you should not care about stats when using it just look at FPS
     
  4. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    Necroing this for others who are trying to find information on the subject. In scenes with lots of terrain trees grass et cetera, SRP Batcher can in fact be up to 3x slower than traditional GPU instancing in the render thread. If you're drawing several thousand pieces of foliage with similar materials and meshes or some similar situation the SRP batcher doesn't stand a chance against instancing.

    It would really be the optimum situation if it were possible to disable or enable SRP batcher on a per material/shader basis without resorting to shader witchcraft by calling SRP incompatible var.

    The assumption that SRP is faster in all situations is plainly incorrect, i don't doubt it's commonly faster for a varied scene but situations where you're using thousands of identical meshes instancing really is quite a bit faster (real use case scene, on a 8700k render thread hits 20ms with SRP batcher, 5.6ms with a combination of static and GPU instancing. This is a huge difference).
     
  5. weiping-toh

    weiping-toh

    Joined:
    Sep 8, 2015
    Posts:
    192
    joshcamas and JJRivers like this.
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,325
    agreed - a toggle batch/instance would be easier than writing boiler plate c#. i wonder if URP 10.2 new particle system mesh intancing can be used for that.