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.
51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
namespace Ghost.RenderGraph.Concept;
|
|
|
|
internal abstract class RenderGraphPass
|
|
{
|
|
public string Name { get; }
|
|
public int Index { get; }
|
|
public List<(RenderGraphResourceHandle handle, ResourceState state)> ResourceAccesses { get; }
|
|
public List<int> Dependencies { get; } = new();
|
|
public int RefCount { get; set; } = 0;
|
|
public bool AllowCulling { get; }
|
|
|
|
protected RenderGraphPass(
|
|
string name,
|
|
int index,
|
|
List<(RenderGraphResourceHandle handle, ResourceState state)> resourceAccesses,
|
|
bool allowCulling)
|
|
{
|
|
Name = name;
|
|
Index = index;
|
|
ResourceAccesses = resourceAccesses;
|
|
AllowCulling = allowCulling;
|
|
}
|
|
|
|
public abstract void Execute(ICommandBuffer commandBuffer);
|
|
}
|
|
|
|
internal class RenderGraphPass<TPassData> : RenderGraphPass
|
|
where TPassData : class
|
|
{
|
|
public TPassData PassData { get; }
|
|
public Action<TPassData, ICommandBuffer> RenderFunc { get; }
|
|
|
|
public RenderGraphPass(
|
|
string name,
|
|
int index,
|
|
TPassData passData,
|
|
Action<TPassData, ICommandBuffer> renderFunc,
|
|
List<(RenderGraphResourceHandle handle, ResourceState state)> resourceAccesses,
|
|
bool allowCulling)
|
|
: base(name, index, resourceAccesses, allowCulling)
|
|
{
|
|
PassData = passData;
|
|
RenderFunc = renderFunc;
|
|
}
|
|
|
|
public override void Execute(ICommandBuffer commandBuffer)
|
|
{
|
|
RenderFunc(PassData, commandBuffer);
|
|
}
|
|
}
|