#pragma once #include #include #include #include #include namespace lt::renderer::vk { using memory::NullOnMove; /** A layer of glue between main graphics objects. */ class Context: public IContext { public: Context(const ecs::Entity &surface_entity); [[nodiscard]] auto instance() const -> IInstance * override { return m_instance; } [[nodiscard]] auto gpu() const -> IGpu * override { return m_gpu.get(); } [[nodiscard]] auto device() const -> IDevice * override { return m_device.get(); } [[nodiscard]] auto swapchain() const -> ISwapchain * override { return m_swapchain.get(); } [[nodiscard]] auto surface() const -> ISurface * override { return m_surface.get(); } void recreate_swapchain() override { m_swapchain.reset(); m_swapchain = memory::create_scope( m_surface.get(), m_gpu.get(), m_device.get() ); } private: IInstance *m_instance; memory::Scope m_surface; memory::Scope m_gpu; memory::Scope m_device; memory::Scope m_swapchain; }; } // namespace lt::renderer::vk