using AcDream.App.Rendering.Gpu.Vk; namespace AcDream.App.Composition; /// /// The graphics ownership that platform acquisition publishes. /// /// Vulkan is the only backend as of Campaign V slice V11: the raw-GL /// implementation (OpenGlGameWindowGraphics) and the members that only /// existed to branch on it (Backend, Gl, RequireGl) were /// deleted along with it. This class stays as the seam /// and the composition phases are /// already written against, so a future second backend would still add one /// class of this shape rather than reopening every call site. /// internal abstract class GameWindowGraphics : IDisposable { /// The live Vulkan context. public virtual VulkanGraphicsContext? Vulkan => null; /// /// The backend's world-pass seam. Every remaining renderer records into the /// pass this publishes rather than opening its own. /// public virtual AcDream.App.Rendering.IWorldPassScope? WorldPassScope => null; public abstract void Dispose(); } /// /// Vulkan ownership: the instance, surface, device, swapchain and RHI device /// that acquired and gated. /// internal sealed class VulkanGameWindowGraphics : GameWindowGraphics { public VulkanGameWindowGraphics(VulkanGraphicsContext context) { Context = context ?? throw new ArgumentNullException(nameof(context)); // The sample count is fixed at device creation, and every world pipeline // must be created against it, so the scope is built here rather than at // the first frame. WorldPassScopeCore = new VulkanWorldPassScope(context.SampleCount); } public VulkanGraphicsContext Context { get; } public override VulkanGraphicsContext? Vulkan => Context; /// The concrete scope, for the phase that publishes the encoder on it. public VulkanWorldPassScope WorldPassScopeCore { get; } public override AcDream.App.Rendering.IWorldPassScope? WorldPassScope => WorldPassScopeCore; public override void Dispose() => Context.Dispose(); }