When rendering in background there is no swap chain in play and
resources would never be collected. Resulting in out of resources and
crashes.
This PR is an initial fix what cycles resource pools every time a layer
has been rendered. It counts the render hierarchy
(GPU_rendering_begin/end) to identify if the background render is
completed and if so would cycle to the next resource pool.
Pull Request: https://projects.blender.org/blender/blender/pulls/126819