Adaug proiectul Unity

This commit is contained in:
2026-11-01 23:39:55 +02:00
parent cb14d9d37d
commit 863eac8f2c
23463 changed files with 5412601 additions and 0 deletions
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using UnityEngine.Pool;
namespace UnityEngine.Experimental.Rendering
{
internal class XRLayoutStack : IDisposable
{
readonly Stack<XRLayout> m_Stack = new ();
public XRLayout New()
{
GenericPool<XRLayout>.Get(out var layout);
m_Stack.Push(layout);
return layout;
}
public bool hasLayout => m_Stack.Count > 0;
public XRLayout top => m_Stack.Peek();
public void Release()
{
if (!m_Stack.TryPop(out var value))
throw new InvalidOperationException($"Calling {nameof(Release)} without calling {nameof(New)} first.");
value.Clear();
GenericPool<XRLayout>.Release(value);
}
public void Dispose()
{
if (m_Stack.Count != 0)
throw new Exception($"Stack is not empty. Did you skip a call to {nameof(Release)}?");
}
}
}