forked from Misaki/GhostEngine
Add render graph proof of concept and refactor graphics
Implemented a transient render graph system as a proof of concept, including resource aliasing, pass culling, and typed pass data. Added new project `Ghost.RenderGraph.Concept` targeting `.NET 10.0`. Refactored graphics-related components: - Simplified resource state transitions in `RenderingContext`. - Improved resize handling in `GraphicsTestWindow`. - Updated `D3D12GraphicsEngine` to streamline frame rendering. - Enhanced `D3D12ResourceDatabase` and `D3D12SwapChain` for better resource management. Added detailed documentation: - `ALIASING.md` explains resource aliasing techniques. - `API_DESIGN.md` outlines the render graph API design. Updated solution to include the new render graph project.
This commit is contained in:
35
Ghost.RenderGraph.Concept/ResourceLifetime.cs
Normal file
35
Ghost.RenderGraph.Concept/ResourceLifetime.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
namespace Ghost.RenderGraph.Concept;
|
||||
|
||||
internal class 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 class ResourceLifetime
|
||||
{
|
||||
public RenderGraphResourceHandle Handle { get; }
|
||||
public int FirstUse { get; set; } = int.MaxValue;
|
||||
public int LastUse { get; set; } = -1;
|
||||
public List<ResourceUsage> Usages { get; } = new();
|
||||
|
||||
public ResourceLifetime(RenderGraphResourceHandle handle)
|
||||
{
|
||||
Handle = handle;
|
||||
}
|
||||
|
||||
public void AddUsage(ResourceState state, int passIndex)
|
||||
{
|
||||
Usages.Add(new ResourceUsage(Handle, state, passIndex));
|
||||
FirstUse = Math.Min(FirstUse, passIndex);
|
||||
LastUse = Math.Max(LastUse, passIndex);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user