Refactor render pipeline and resource management APIs

Split IFenceSynchronizer/IRenderSystem interfaces for clarity. Refactor D3D12GraphicsEngine to use IFenceSynchronizer. Update RenderGraph and context to use explicit resource manager/database/allocator references. Add multi-buffering methods to IRGBuilder (stub). Support history access for multi-frame resources. Remove legacy RenderPipelineBase; introduce IRenderPipelineSettings and sealed GhostRenderPipeline. Clean up resource aliasing and pool logic. Improve modularity and future extensibility.
This commit is contained in:
2026-03-03 20:14:22 +09:00
parent b8af6e8c3a
commit bfe8588d76
17 changed files with 255 additions and 230 deletions

View File

@@ -6,6 +6,28 @@ using System.Collections.Concurrent;
namespace Ghost.Graphics;
public interface IRenderSystem : IFenceSynchronizer, IDisposable
{
IGraphicsEngine GraphicsEngine
{
get;
}
IResourceManager ResourceManager
{
get;
}
bool IsRunning
{
get;
}
void Start();
void Stop();
void RequestSwapChainResize(ISwapChain swapChain, uint2 newSize);
}
public enum GraphicsAPI
{
Direct3D12
@@ -63,6 +85,7 @@ internal class RenderSystem : IRenderSystem
private readonly RenderingConfig _config;
private readonly IGraphicsEngine _graphicsEngine;
private readonly IResourceManager _resourceManager;
private readonly FrameResource[] _frameResources;
private readonly Thread _renderThread;
@@ -77,6 +100,7 @@ internal class RenderSystem : IRenderSystem
private bool _disposed;
public IGraphicsEngine GraphicsEngine => _graphicsEngine;
public IResourceManager ResourceManager => _resourceManager;
public bool IsRunning => _isRunning;
public uint CPUFenceValue => _cpuFenceValue;
@@ -107,6 +131,8 @@ internal class RenderSystem : IRenderSystem
throw new NotSupportedException($"The specified graphics API '{config.GraphicsAPI}' is not supported.");
}
_resourceManager = new ResourceManager(_graphicsEngine.ResourceAllocator, _graphicsEngine.ResourceDatabase);
// Create frame resources for synchronization
_frameResources = new FrameResource[config.FrameBufferCount];
for (var i = 0; i < config.FrameBufferCount; i++)