Files
GhostEngine/Ghost.RenderGraph.Concept/ResourceLifetime.cs
Misaki 87e315a588 Refactor render graph & DSL; remove material system
- Major optimization of Ghost.RenderGraph.Concept: pooled resources, zero-allocation hot paths, explicit queue types, and batch barrier APIs.
- Migrated Ghost.DSL shader compiler to ANTLR4-based parser; removed hand-written parser, added grammar files and semantic model conversion.
- Added CollectionPool/ListPool for pooled list management.
- Updated documentation for new architecture and performance.
- Removed Ghost.Shader.Concept (material/material system) from repo and solution.
- README.md replaced with a brief project statement.
2026-01-11 13:28:17 +09:00

43 lines
1.1 KiB
C#

namespace Ghost.RenderGraph.Concept;
internal struct ResourceUsage
{
public RenderGraphResourceHandle Handle { get; }
public ResourceState State { get; }
public int PassIndex { get; }
public ResourceUsage(RenderGraphResourceHandle handle, ResourceState state, int passIndex)
{
Handle = handle;
State = state;
PassIndex = passIndex;
}
}
internal struct ResourceLifetime
{
public RenderGraphResourceHandle Handle { get; private set; }
public int FirstUse { get; set; } = int.MaxValue;
public int LastUse { get; set; } = -1;
public List<ResourceUsage> Usages { get; } = new();
public ResourceLifetime()
{
}
public void Initialize(RenderGraphResourceHandle handle)
{
Handle = handle;
FirstUse = int.MaxValue;
LastUse = -1;
Usages.Clear();
}
public void AddUsage(ResourceState state, int passIndex)
{
Usages.Add(new ResourceUsage(Handle, state, passIndex));
FirstUse = Math.Min(FirstUse, passIndex);
LastUse = Math.Max(LastUse, passIndex);
}
}