feat(render): support per-frame render payloads
Refactored the render pipeline system to introduce per-frame IRenderPayload management. IRenderPipelineSettings now requires CreatePipeline and CreatePayload methods. Updated RenderSystem and test pipeline to use the new payload model. Removed legacy GhostRenderPipeline and test code. Added RenderPipelineSystemAttribute for pipeline system registration. Includes minor fixes such as version field type corrections and typo fixes. BREAKING CHANGE: Render pipeline and payload creation APIs have changed; implementers must update to the new interface methods.
This commit is contained in:
@@ -26,6 +26,7 @@ public sealed partial class EngineCore : IDisposable
|
||||
{
|
||||
FrameBufferCount = 2,
|
||||
GraphicsAPI = GraphicsAPI.Direct3D12,
|
||||
InitialRenderPipelineSettings = null! // TODO: We should allow user to specify the initial render pipeline settings.
|
||||
};
|
||||
|
||||
_renderSystem = new RenderSystem(renderingConfig);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using Ghost.Entities;
|
||||
using Ghost.Graphics.RenderPipeline;
|
||||
|
||||
namespace Ghost.Engine.Systems;
|
||||
|
||||
public abstract class RenderPipelineSystemAttribute : Attribute
|
||||
{
|
||||
public abstract Type SettingsType { get; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class RenderPipelineSystemAttribute<T> : RenderPipelineSystemAttribute
|
||||
where T : class, IRenderPipelineSettings
|
||||
{
|
||||
public override Type SettingsType => typeof(T);
|
||||
}
|
||||
|
||||
public static class RenderPipelineSystemRegistry
|
||||
{
|
||||
private static readonly Dictionary<Type, List<Func<ISystem>>> s_renderPipelineSystems = new();
|
||||
|
||||
public static void RegisterRenderPipelineSystem(Type settingsType, Func<ISystem> systemFactory)
|
||||
{
|
||||
if (!s_renderPipelineSystems.TryGetValue(settingsType, out var systems))
|
||||
{
|
||||
systems = new List<Func<ISystem>>();
|
||||
s_renderPipelineSystems[settingsType] = systems;
|
||||
}
|
||||
|
||||
systems.Add(systemFactory);
|
||||
}
|
||||
|
||||
internal static IEnumerable<Func<ISystem>> GetRenderPipelineSystems(Type settingsType)
|
||||
{
|
||||
if (s_renderPipelineSystems.TryGetValue(settingsType, out var systems))
|
||||
{
|
||||
return systems;
|
||||
}
|
||||
|
||||
return Enumerable.Empty<Func<ISystem>>();
|
||||
}
|
||||
}
|
||||
7
src/Runtime/Ghost.Engine/Systems/RenderSystemGroup.cs
Normal file
7
src/Runtime/Ghost.Engine/Systems/RenderSystemGroup.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Ghost.Entities;
|
||||
|
||||
namespace Ghost.Engine.Systems;
|
||||
|
||||
internal class RenderSystemGroup : SystemGroup
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user