using System;
using System.Collections.Generic;
namespace UnityEngine.Experimental.Rendering.RenderGraphModule
{
///
/// Helper class provided in the RenderGraphContext to all Render Passes.
/// It allows you to do temporary allocations of various objects during a Render Pass.
///
public sealed class RenderGraphObjectPool
{
class SharedObjectPool where T : new()
{
Stack m_Pool = new Stack();
public T Get()
{
var result = m_Pool.Count == 0 ? new T() : m_Pool.Pop();
return result;
}
public void Release(T value)
{
m_Pool.Push(value);
}
static readonly Lazy> s_Instance = new Lazy>();
public static SharedObjectPool sharedPool => s_Instance.Value;
}
Dictionary<(Type, int), Stack