using AcDream.App.Rendering.Gpu; namespace AcDream.App.Rendering; /// /// Campaign V slice V4a: exposes whichever is /// currently open, so renderers ported onto the RHI (, /// today) can reach it without a stored /// window/delegate back-reference. Non-null exactly between a /// and its matching /// . /// internal interface ICurrentGpuFrameSource { IGpuFrame? CurrentFrame { get; } } /// /// Drives / once /// per rendered frame, additively over the existing /// -driven fence/slot bracket: /// 's own BeginFrame already calls straight /// through to the frame-flight controller it was constructed with (see its /// class comment), so routing the production /// 's /// through the device instead of the controller directly changes nothing about /// the existing fence-wait/slot-rotation contract — it only additionally /// yields the that ported renderers need, which /// alone could not supply. /// No clears move, no framebuffer binding changes, and the frame graph's /// phase order is untouched. /// internal sealed class GpuDeviceFrameLifetime : IRenderFrameLifetime, ICurrentGpuFrameSource { private readonly IGpuDevice _device; public GpuDeviceFrameLifetime(IGpuDevice device) => _device = device ?? throw new ArgumentNullException(nameof(device)); public IGpuFrame? CurrentFrame { get; private set; } public void BeginFrame() => CurrentFrame = _device.BeginFrame(); public void EndFrame() { IGpuFrame? frame = CurrentFrame; CurrentFrame = null; frame?.End(); } }