From 1c155f962cbf2b64b19ab8dff84e46b8440327e8 Mon Sep 17 00:00:00 2001 From: Misaki Date: Fri, 16 Jan 2026 01:59:33 +0900 Subject: [PATCH] Render graph: native pass merging & heap-based aliasing Major architecture upgrade: - Add native render pass merging (hardware pass grouping, load/store op inference) - Implement heap-based aliasing for textures & buffers (D3D12-style) - Unify resource model: buffers and textures in one registry - Extend builder API for buffer creation/usage, access flags, hints - Improve barrier/state tracking (buffer hints, indirect argument state) - Update caching, hashing, and debug output for new model - Add enums/structs: AttachmentLoadOp, StoreOp, BufferHint, etc. - D3D12 backend: support named resources, temp upload buffers, correct heap usage - Update docs, benchmarks, and project files for new features Brings render graph closer to AAA engine standards, enabling efficient memory usage, lower driver overhead, and a more flexible API. --- Ghost.Core/Utilities/EnumUtility.cs | 9 + Ghost.Core/Utilities/Win32Utility.cs | 2 + .../Controls/BasicInput/Float3Field.xaml | 4 +- Ghost.Entities/World.cs | 2 +- .../Ghost.Graphics.Test.csproj | 14 +- Ghost.Graphics.Test/UnitTestApp.xaml.cs | 13 +- .../Windows/GraphicsTestWindow.xaml | 9 - .../Windows/GraphicsTestWindow.xaml.cs | 7 +- .../Windows/WorkGraphTestWindow.xaml | 22 - .../Windows/WorkGraphTestWindow.xaml.cs | 16 - Ghost.Graphics/AssemblyInfo.cs | 2 +- Ghost.Graphics/Core/Keyword.cs | 2 +- Ghost.Graphics/Core/Material.cs | 9 +- Ghost.Graphics/Core/RenderingContext.cs | 4 +- Ghost.Graphics/Core/SwapChainPresenter.cs | 54 -- Ghost.Graphics/D3D12/D3D12CommandBuffer.cs | 112 ++- .../D3D12/D3D12DescriptorAllocator.cs | 8 +- Ghost.Graphics/D3D12/D3D12DescriptorHeap.cs | 2 +- Ghost.Graphics/D3D12/D3D12PipelineLibrary.cs | 2 +- Ghost.Graphics/D3D12/D3D12RenderDevice.cs | 5 + Ghost.Graphics/D3D12/D3D12Renderer.cs | 6 + .../D3D12/D3D12ResourceAllocator.cs | 168 +++- Ghost.Graphics/D3D12/D3D12ResourceDatabase.cs | 21 +- Ghost.Graphics/D3D12/D3D12SwapChain.cs | 16 +- .../D3D12/Utilities/D3D12Utility.cs | 24 +- Ghost.Graphics/RHI/Common.cs | 89 ++- Ghost.Graphics/RHI/ICommandBuffer.cs | 10 +- Ghost.Graphics/RHI/IRenderDevice.cs | 1 + Ghost.Graphics/RHI/IResourceAllocator.cs | 97 ++- Ghost.Graphics/RHI/ISwapChain.cs | 2 +- Ghost.Graphics/RenderPasses/MeshRenderPass.cs | 8 +- Ghost.Graphics/RenderSystem.cs | 4 + .../Benchmark/RenderGraphBenchmark.cs | 28 +- .../IMPLEMENTATION_NOTES.md | 172 ----- Ghost.RenderGraph.Concept/PassData.cs | 7 + Ghost.RenderGraph.Concept/Program.cs | 11 +- Ghost.RenderGraph.Concept/README.md | 197 ----- Ghost.RenderGraph.Concept/RenderGraph.cs | 689 ++++++++++++++--- Ghost.RenderGraph.Concept/RenderGraph.cs.bak | 663 ---------------- .../RenderGraphAliasing.cs | 731 +++++++++++++----- .../RenderGraphAliasing.cs.bak | 329 -------- .../RenderGraphBarriers.cs | 13 +- .../RenderGraphBuilder.cs | 62 +- .../RenderGraphBuilder.cs.bak | 240 ------ .../RenderGraphCompilationCache.cs | 21 +- .../RenderGraphContext.cs | 15 + .../RenderGraphNativePass.cs | 52 ++ Ghost.RenderGraph.Concept/RenderGraphPass.cs | 23 +- .../RenderGraphPass.cs.bak | 129 ---- .../RenderGraphResourcePool.cs | 87 ++- Ghost.RenderGraph.Concept/RenderGraphTypes.cs | 103 +++ 51 files changed, 2002 insertions(+), 2314 deletions(-) create mode 100644 Ghost.Core/Utilities/EnumUtility.cs delete mode 100644 Ghost.Graphics.Test/Windows/WorkGraphTestWindow.xaml delete mode 100644 Ghost.Graphics.Test/Windows/WorkGraphTestWindow.xaml.cs delete mode 100644 Ghost.Graphics/Core/SwapChainPresenter.cs delete mode 100644 Ghost.RenderGraph.Concept/IMPLEMENTATION_NOTES.md delete mode 100644 Ghost.RenderGraph.Concept/README.md delete mode 100644 Ghost.RenderGraph.Concept/RenderGraph.cs.bak delete mode 100644 Ghost.RenderGraph.Concept/RenderGraphAliasing.cs.bak delete mode 100644 Ghost.RenderGraph.Concept/RenderGraphBuilder.cs.bak create mode 100644 Ghost.RenderGraph.Concept/RenderGraphNativePass.cs delete mode 100644 Ghost.RenderGraph.Concept/RenderGraphPass.cs.bak diff --git a/Ghost.Core/Utilities/EnumUtility.cs b/Ghost.Core/Utilities/EnumUtility.cs new file mode 100644 index 0000000..d6bb648 --- /dev/null +++ b/Ghost.Core/Utilities/EnumUtility.cs @@ -0,0 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Ghost.Core.Utilities; + +internal class EnumUtility +{ +} diff --git a/Ghost.Core/Utilities/Win32Utility.cs b/Ghost.Core/Utilities/Win32Utility.cs index 4a3675d..ad920ef 100644 --- a/Ghost.Core/Utilities/Win32Utility.cs +++ b/Ghost.Core/Utilities/Win32Utility.cs @@ -2,8 +2,10 @@ using Misaki.HighPerformance.LowLevel; using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using System.Runtime.Versioning; using TerraFX.Interop.Windows; +using TerraFX.Interop.WinRT; namespace Ghost.Core.Utilities; diff --git a/Ghost.Editor.Core/Controls/BasicInput/Float3Field.xaml b/Ghost.Editor.Core/Controls/BasicInput/Float3Field.xaml index af19cd1..ccec0a6 100644 --- a/Ghost.Editor.Core/Controls/BasicInput/Float3Field.xaml +++ b/Ghost.Editor.Core/Controls/BasicInput/Float3Field.xaml @@ -4,10 +4,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Ghost.Editor.Core.Controls"> -