using Ghost.Core;
using Ghost.Graphics.RHI;
using System.Runtime.InteropServices;
namespace Ghost.Graphics.RenderGraphModule;
///
/// Represents a resource barrier that needs to be inserted.
///
internal struct ResourceBarrier
{
public int PassIndex;
public BarrierDesc Desc;
public Identifier LogicalResource;
public readonly Identifier Resource => LogicalResource;
public static ResourceBarrier Create(int passIndex, BarrierDesc desc, Identifier logicalResource)
{
return new ResourceBarrier
{
PassIndex = passIndex,
Desc = desc,
LogicalResource = logicalResource
};
}
}
///
/// Tracks the current state of a resource across passes.
///
internal sealed class ResourceStateTracker
{
public int resourceIndex;
public ResourceState currentState = ResourceState.Common;
public int lastAccessPass = -1;
public void Reset()
{
resourceIndex = -1;
currentState = ResourceState.Common;
lastAccessPass = -1;
}
}