Search Unity

HDRP GC Alloc (2019.4.1 +HDRP 7.3.1 and 7.4.1)

Discussion in 'High Definition Render Pipeline' started by FlightOfOne, Jun 22, 2020.

  1. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    I am getting this in HDRP 7.3.1 and 7.4.1.

    gc.alloc RenderPipelineManager.DoRenderLoop_Internal()
    InI_RenderSky()



    I see several posts open regarding this leading back to over a year with no clear Answer. I am hoping someone from Unity can clarify this for me. Is this normal behavior with HDRP?

    Below is from an empty scene, and when I say empty, I do mean empty, nothing in the scene, no camera, no lights either.



    Thank you!

    upload_2020-6-22_8-54-46.png
     
    Last edited: Jun 22, 2020
    RoughSpaghetti3211 likes this.
  2. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,708
    Seeing the same thing on my end with one sphere
     
  3. Tomas-Kiniulis

    Tomas-Kiniulis

    Unity Technologies

    Joined:
    Apr 27, 2017
    Posts:
    55
    Hi FlightOfOne,

    Trying to repro on an empty HDRP scene in 2019.4.1f1 with 7.3.1 and 7.4.1 but without any cameras, I'm not observing any GC Allocations at all in Inl_RenderSky(). Are you on mac on windows? Could you share a project reproducing the issue? Possibly with more details describing repro steps?

    Edit: it does repro with a camera present. Inl_RenderSky() produces 19 GC_Allocation calls which seems to be an issue, we are currently investigating
     
    Last edited: Jun 29, 2020
    FlightOfOne likes this.
  4. Tomas-Kiniulis

    Tomas-Kiniulis

    Unity Technologies

    Joined:
    Apr 27, 2017
    Posts:
    55
    Seems like Inl_RenderSky() produces 19 GC_Allocation calls only on 7.3.1 on my end while 7.4.1 works correctly, if you could share more insight with a project to reproduce would be appreciated
     
  5. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668

    Hi, I have decided to stick with URP for now, but if I remember right it was literally an empty project and an empty scene with nothing in it, just a camera and light. I am on a windows 10.

    Here's something interesting, I also am getting the same thing on URP!

    upload_2020-6-29_8-43-4.png

    upload_2020-6-29_8-47-17.png

    upload_2020-6-29_8-51-37.png

    I will try to post a project later today or tomorrow. Thanks.
     
  6. Tomas-Kiniulis

    Tomas-Kiniulis

    Unity Technologies

    Joined:
    Apr 27, 2017
    Posts:
    55
    Ah that's odd. I'm not getting anything like that on URP at all. Checked on 2019.4.1f1 again in 7.3.1 and 7.4.1, I guess there's something specific which triggers GC alloc. If you'd have the time to share a project would be great, perhaps that will help to track the cause.
     
  7. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Hi @Tomas-Kiniulis

    I figured out what causes this, but no idea why or how to fix this. Since this is a URP thing I created a new thread in the URP forum: https://forum.unity.com/threads/just-by-having-a-second-camera-causes-gc-kick-in-urp.930594/
    I will go ahead and do a bug report too. Thanks!
     
    Tomas-Kiniulis likes this.
  8. AwesomeAlexx

    AwesomeAlexx

    Joined:
    Jan 30, 2016
    Posts:
    18
    I'm currently facing the same issue on my project using HDRP, I got 6 cameras, 5 of them renders into a rendertexture and every cam use nearly 1.2 KB of GC with around 95 calls of GC by cam.
    That seems huge to me, I was around 120FPS in built-in and now between 40 & 70 absolutly not stable.

    @Tomas-Kiniulis, I'm using Unity 2019.4.4f1 with HDRP 7.3.1, do you know if this will be solved like on URP ?
     
    Last edited: Jul 23, 2020
  9. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    HDRP has camera stacking now. I did not try it but I know the old workflow with mutiple camera does not longer work without heavy performence drop. Think, each new camera make HDRP render the whole scene, regarding all the render features which might be active by default, this is heavy work. You could drop a lot of features through the Custom Frame Settings in the camera in order to gain performence.
     
  10. AwesomeAlexx

    AwesomeAlexx

    Joined:
    Jan 30, 2016
    Posts:
    18
    @Bordeaux_Fox thank you I'll try optimizing on that way but I don't think being able to discard a lot of things on this projects.