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

@@ -104,7 +104,7 @@ internal sealed class ResourceAliasingManager
#endif
// Build list of all logical resources with their lifetimes
var logicalResources = ListPool<(int index, TextureResource resource)>.Rent();
var logicalResources = ListPool<(int index, RenderGraphResource resource)>.Rent();
for (int i = 0; i < registry.TextureResourceCount; i++)
{
@@ -194,7 +194,7 @@ internal sealed class ResourceAliasingManager
Console.WriteLine("================================\n");
#endif
ListPool<(int index, TextureResource resource)>.Return(logicalResources);
ListPool<(int index, RenderGraphResource resource)>.Return(logicalResources);
}
public int GetPhysicalResourceIndex(int logicalIndex)
@@ -209,7 +209,7 @@ internal sealed class ResourceAliasingManager
: null;
}
private bool HasLifetimeOverlap(PhysicalResource physical, TextureResource logical)
private bool HasLifetimeOverlap(PhysicalResource physical, RenderGraphResource logical)
{
// Check if the lifetimes overlap
// No overlap if: logical.First > physical.Last OR logical.Last < physical.First
@@ -227,7 +227,7 @@ internal sealed class ResourceAliasingManager
}
else
{
resource = _pool.Get<PhysicalResource>();
resource = _pool.Rent<PhysicalResource>();
resource.Reset();
_physicalResources.Add(resource);
}
@@ -254,7 +254,7 @@ internal sealed class ResourceAliasingManager
{
for (int i = 0; i < _physicalResources.Count; i++)
{
_pool.Release(_physicalResources[i]);
_pool.Return(_physicalResources[i]);
}
_physicalResources.Clear();
_physicalResourceCount = 0;
@@ -284,7 +284,7 @@ internal sealed class ResourceAliasingManager
}
else
{
physical = _pool.Get<PhysicalResource>();
physical = _pool.Rent<PhysicalResource>();
physical.Reset();
_physicalResources.Add(physical);
}