Refactor Render Graph: unified resources, benchmarking

Major overhaul of Render Graph system:
- Replaced texture handles with generic Identifier<T> for unified, type-safe resource management (textures, buffers, etc.)
- Refactored resource registry and pooling for performance and extensibility
- Added AccessFlags and TextureAccess for precise resource usage tracking
- Split passes into Raster and Compute types; introduced builder interfaces for safer pass construction
- Modernized pass setup API (SetColorAttachment, UseTexture, etc.)
- Updated command buffer and context structs to use new resource system
- Refactored barrier and aliasing logic for improved correctness
- Integrated BenchmarkDotNet for performance/memory benchmarking
- Improved blackboard type safety and removed obsolete code/extensions
- Added BenchmarkDotNet NuGet package

These changes make the Render Graph more extensible, efficient, and ready for future resource types and advanced features.
This commit is contained in:
2026-01-12 23:48:56 +09:00
parent 1fc9df1812
commit 954e3756aa
15 changed files with 940 additions and 776 deletions

View File

@@ -7,12 +7,13 @@ namespace Ghost.RenderGraph.Concept;
/// </summary>
public sealed class RenderGraphBlackboard
{
private readonly Dictionary<Type, object> _data = new(16);
private readonly Dictionary<Type, IPassData> _data = new(16);
/// <summary>
/// Adds or updates pass data in the blackboard.
/// </summary>
public void Add<T>(T data) where T : class, IPassData
public void Add<T>(T data)
where T : class, IPassData
{
var type = typeof(T);
_data[type] = data;
@@ -21,20 +22,23 @@ public sealed class RenderGraphBlackboard
/// <summary>
/// Retrieves pass data from the blackboard.
/// </summary>
public T Get<T>() where T : class, IPassData
public T Get<T>()
where T : class, IPassData
{
var type = typeof(T);
if (_data.TryGetValue(type, out var obj))
{
return (T)obj;
}
throw new KeyNotFoundException($"Pass data of type {type.Name} not found in blackboard");
}
/// <summary>
/// Tries to get pass data from the blackboard.
/// </summary>
public bool TryGet<T>(out T? data) where T : class, IPassData
public bool TryGet<T>(out T? data)
where T : class, IPassData
{
var type = typeof(T);
if (_data.TryGetValue(type, out var obj))
@@ -42,6 +46,7 @@ public sealed class RenderGraphBlackboard
data = (T)obj;
return true;
}
data = null;
return false;
}