Refactor render graph: modular compilation & execution

Major overhaul of render graph system for modularity and performance:
- Split compilation and execution logic into dedicated classes (Compiler, Executor, NativePassBuilder, Barriers)
- Overhauled barrier system: now uses CompiledBarrier with target state only, querying before state at execution
- Resource size/alignment now queried from D3D12 device for accurate heap allocation
- ResourceDesc now includes Type field and asserts correct union access
- Centralized D3D12 interop logic in D3D12Utility extensions
- Added RenderGraphHasher for structural graph hashing and cache invalidation
- RenderGraph class simplified to orchestrate specialized components
- ResourceAliasingManager now uses allocator for size queries
- Compilation cache now stores compiled barriers, reducing memory usage
- Improved comments, debug assertions, and removed redundant code

Result: more maintainable, efficient, and robust render graph pipeline.
This commit is contained in:
2026-01-23 18:12:52 +09:00
parent 4173ff2432
commit e11a9ebb52
14 changed files with 2797 additions and 1317 deletions

View File

@@ -285,6 +285,7 @@ internal sealed class PlacedResource
/// </summary>
internal sealed class ResourceAliasingManager
{
private readonly IResourceAllocator _allocator;
private readonly RenderGraphObjectPool _pool;
private readonly ResourceHeap _heap;
@@ -306,17 +307,20 @@ internal sealed class ResourceAliasingManager
if (resource.type == RenderGraphResourceType.Texture)
{
var textureDesc = resource.rgTextureDesc.ToTextureDesc(resource.resolvedWidth, resource.resolvedHeight);
return AlignUp(textureDesc.GetTotalBytes(), _DEFAULT_TEXTURE_ALIGNMENT);
return _allocator.GetSizeInfo(ResourceDesc.Texture(textureDesc)).Size;
}
else // Buffer
{
return resource.bufferDesc.Size;
//return resource.bufferDesc.Size;
return _allocator.GetSizeInfo(ResourceDesc.Buffer(resource.bufferDesc)).Size;
}
}
public ResourceAliasingManager(RenderGraphObjectPool pool)
public ResourceAliasingManager(IResourceAllocator allocator, RenderGraphObjectPool pool)
{
_allocator = allocator;
_pool = pool;
_heap = new ResourceHeap(0);
_placedResources = new List<PlacedResource>(32);
_logicalToPlaced = new Dictionary<int, int>(64);