light/modules/renderer/private/backend/vk/context/context.hpp
light7734 16f3a80fd3
Some checks reported errors
continuous-integration/drone/push Build was killed
feat(renderer): separate things into backend/frontend + major vk backend refactors
2025-10-04 22:08:19 +03:30

60 lines
1.1 KiB
C++

#pragma once
#include <ecs/entity.hpp>
#include <memory/pointer_types/null_on_move.hpp>
#include <renderer/frontend/context/context.hpp>
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 = create_scope<vk::Swapchain>(m_device, m_surface);
}
private:
IInstance *m_instance;
Scope<ISurface> m_surface;
Scope<IGpu> m_gpu;
Scope<IDevice> m_device;
Scope<ISwapchain> m_swapchain;
};
} // namespace lt::renderer::vk