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

@@ -23,11 +23,8 @@ internal sealed class CachedCompilation
// Placed resource metadata
public readonly List<PlacedResourceData> placedResources = new(32);
// Resource barriers
public readonly List<ResourceBarrier> barriers = new(128);
// Resource state mappings (for barrier generation)
public readonly Dictionary<int, ResourceBarrierData> resourceStates = new(128);
// Compiled barriers (stores only target states, queries before state from ResourceDatabase)
public readonly List<CompiledBarrier> compiledBarriers = new(128);
// Real gpu resource
public readonly List<Handle<GPUResource>> backingResources = new(32);
@@ -41,8 +38,7 @@ internal sealed class CachedCompilation
passCulledFlags.Clear();
logicalToPhysical.Clear();
placedResources.Clear();
barriers.Clear();
resourceStates.Clear();
compiledBarriers.Clear();
backingResources.Clear();
viewState = default;
}
@@ -112,12 +108,7 @@ internal sealed class RenderGraphCompilationCache
}
_cached.placedResources.AddRange(data.placedResources);
_cached.barriers.AddRange(data.barriers);
foreach (var kvp in data.resourceStates)
{
_cached.resourceStates[kvp.Key] = kvp.Value;
}
_cached.compiledBarriers.AddRange(data.compiledBarriers);
_cached.backingResources.AddRange(data.backingResources);
}