Search Unity

Question Why RenderGraph generate synchronization points for async pass and graphics pass in a different way?

Discussion in 'High Definition Render Pipeline' started by Averyu, Mar 11, 2023.

  1. Averyu

    Averyu

    Joined:
    Jun 5, 2017
    Posts:
    1
    RenderGraph.jpg
    I am going through SRP12.1.7 Render Graph code recently.And I found that, in the method
    void UpdateResourceAllocationAndSynchronization()
    (critical code snippet is shown above in the picture).
    The timing to release a resource is different between async pass and graphics pass.A resource will be released right after the graphics pass, the last consumer of this resource, while releasing will be postpone when it comes to async pass.

    The algorithm in RenderGraph is doing sth. like:
    If the last consumer of a resource is on the graphics pipe, we can release this resource to the pool right after this consumer pass.
    However,if the last consumer of a resource is on the async pipe, we should extend the lifetime of this resource, and release it before the first following graphics pass that wait for async passes to be over.


    In other words, according to the comments(shown in pic):
    "In case of graphics passes, we DON'T need to extend lifetime of resource to the first pass on the async pipeline that wait for graphics passes to be over.
    If we freed the resource right away during an graphics pass, another non graphics pass could reuse the resource safely even though the graphics pipe is not done."

    My problem is: What causes the difference?Why don't we use the same way for graphics pass consumer?


    I would highly appreciate if you can provide any help!:)
     
    Last edited: Mar 13, 2023