HDRP - Detecting last "Execute" in custom pass

Inside a custom render pass, how can I tell if Execute is called the last time for the frame?

For example, there could be multiple cameras, so I how do I know when execute is called for the last time for the current frame?

The easy way would be to setup rendering priorities on the cameras, and check it in execute, the highest value would match to the last camera that renders (the one “on top”).

Else, you could use a counter to count the number of calls for each rendered frame, and if it matches the number of camera that means that it is supposedly the last call for execute.

So the issue I’m having is that the scene camera can be there or not based on if the scene window is open.

Is there a callback at a later stage once all render passes are executed?

Are you maybe searching for this ? Unity - Scripting API: Rendering.RenderPipelineManager.endContextRendering
Or for individual camera callback (and you can filter out the scene camera by the name) : Unity - Scripting API: Rendering.RenderPipelineManager.endCameraRendering

Yes, I have tried that, but that gets executed twice. Once for the game view camera and once for scene view camera.

The endContextRendering callback for the game view camera always seems to get executed after the scene view camera, but I don’t know how reliable that actually is.