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:
@@ -2,6 +2,7 @@ using Ghost.Core;
|
||||
using Ghost.Core.Graphics;
|
||||
using Ghost.Graphics.Core;
|
||||
using Misaki.HighPerformance.Mathematics;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -424,23 +425,45 @@ public struct ResourceDesc
|
||||
}
|
||||
|
||||
internal resource_union _desc;
|
||||
|
||||
public ResourceType Type
|
||||
{
|
||||
get; init;
|
||||
}
|
||||
|
||||
public TextureDesc TextureDescription
|
||||
{
|
||||
readonly get => _desc.textureDescription;
|
||||
set => _desc.textureDescription = value;
|
||||
readonly get
|
||||
{
|
||||
Debug.Assert(Type == ResourceType.Texture);
|
||||
return _desc.textureDescription;
|
||||
}
|
||||
set
|
||||
{
|
||||
Debug.Assert(Type == ResourceType.Texture);
|
||||
_desc.textureDescription = value;
|
||||
}
|
||||
}
|
||||
|
||||
public BufferDesc BufferDescription
|
||||
{
|
||||
readonly get => _desc.bufferDescription;
|
||||
set => _desc.bufferDescription = value;
|
||||
readonly get
|
||||
{
|
||||
Debug.Assert(Type == ResourceType.Buffer);
|
||||
return _desc.bufferDescription;
|
||||
}
|
||||
set
|
||||
{
|
||||
Debug.Assert(Type == ResourceType.Buffer);
|
||||
_desc.bufferDescription = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static ResourceDesc Buffer(BufferDesc desc)
|
||||
{
|
||||
return new ResourceDesc
|
||||
{
|
||||
Type = ResourceType.Buffer,
|
||||
BufferDescription = desc
|
||||
};
|
||||
}
|
||||
@@ -449,6 +472,7 @@ public struct ResourceDesc
|
||||
{
|
||||
return new ResourceDesc
|
||||
{
|
||||
Type = ResourceType.Texture,
|
||||
TextureDescription = desc
|
||||
};
|
||||
}
|
||||
@@ -990,6 +1014,12 @@ public enum ResourceMemoryType
|
||||
Readback // GPU-to-CPU memory
|
||||
}
|
||||
|
||||
public enum ResourceType
|
||||
{
|
||||
Texture,
|
||||
Buffer
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum TextureUsage
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user