26 lines
461 B
C#
26 lines
461 B
C#
|
using System.Collections.Concurrent;
|
||
|
|
||
|
namespace Nerfed.Runtime.Graphics;
|
||
|
|
||
|
internal class ComputePassPool
|
||
|
{
|
||
|
private ConcurrentQueue<ComputePass> ComputePasses = new ConcurrentQueue<ComputePass>();
|
||
|
|
||
|
public ComputePass Obtain()
|
||
|
{
|
||
|
if (ComputePasses.TryDequeue(out ComputePass computePass))
|
||
|
{
|
||
|
return computePass;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return new ComputePass();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void Return(ComputePass computePass)
|
||
|
{
|
||
|
ComputePasses.Enqueue(computePass);
|
||
|
}
|
||
|
}
|