2025-09-25 22:23:08 +03:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <app/system.hpp>
|
|
|
|
|
#include <ecs/entity.hpp>
|
|
|
|
|
#include <memory/pointer_types/null_on_move.hpp>
|
|
|
|
|
#include <surface/components.hpp>
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#include <renderer/vk/context/device.hpp>
|
|
|
|
|
#include <renderer/vk/context/instance.hpp>
|
|
|
|
|
#include <renderer/vk/context/surface.hpp>
|
|
|
|
|
#include <renderer/vk/context/swapchain.hpp>
|
|
|
|
|
|
|
|
|
|
namespace lt::renderer::vk {
|
|
|
|
|
|
|
|
|
|
using memory::NullOnMove;
|
|
|
|
|
|
|
|
|
|
class Context
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-10-01 17:31:46 +03:30
|
|
|
Context(const ecs::Entity &surface_entity);
|
2025-09-25 22:23:08 +03:30
|
|
|
|
|
|
|
|
[[nodiscard]] auto instance() const -> VkInstance
|
|
|
|
|
{
|
|
|
|
|
return Instance::get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] auto device() const -> const Device &
|
|
|
|
|
{
|
|
|
|
|
return m_device;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] auto swapchain() const -> const Swapchain &
|
|
|
|
|
{
|
|
|
|
|
return m_swapchain;
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-02 23:53:28 +03:30
|
|
|
void recreate_swapchain()
|
|
|
|
|
{
|
|
|
|
|
m_swapchain.destroy();
|
|
|
|
|
m_swapchain = Swapchain { m_device, m_surface };
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-25 22:23:08 +03:30
|
|
|
private:
|
|
|
|
|
Surface m_surface;
|
|
|
|
|
|
|
|
|
|
Device m_device;
|
|
|
|
|
|
|
|
|
|
Swapchain m_swapchain;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace lt::renderer::vk
|