Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to profile number of SRP batches from code

Discussion in 'High Definition Render Pipeline' started by LukeWarp, Nov 29, 2022.

  1. LukeWarp

    LukeWarp

    Joined:
    Oct 4, 2022
    Posts:
    3
    I'm writing a profiling system for an HDRP game which is using the SRP batcher. In previous games, I've made using the ProfilerRecorder API to spit out stats on batches, verts etc in builds to show us what the bottlenecks are. The way I'd normally get this is by running a recorder like this

    Code (CSharp):
    1. ProfilerRecorder.StartNew(ProfilerCategory.Render, "Batches Count");
    But the numbers I get from that hugely inflated. I'm aware this is the same as the batch metric in the stats window, which is unreliable when using the SRP batcher. In editor I can use the Frame Debugger to get a sensible number of draw calls but there's no way of doing this at runtime from what I can gather.

    TLDR: is there a profiler recorder marker that'll give me a reliable batch count when using the SRP batcher?
     
  2. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    236
  3. tcmicka

    tcmicka

    Joined:
    Aug 2, 2017
    Posts:
    9
    I have the same question. I outputted all the available markers in my project and didn't find any that appeared to represent this value.

    I'm also curious what the value of "Batches Count" represents when the SRP batcher is enabled?
     
  4. tcmicka

    tcmicka

    Joined:
    Aug 2, 2017
    Posts:
    9