evan 2026.1.4
Evan
Loading...
Searching...
No Matches
IPlatform.hpp
1/*
2** ETIB PROJECT, 2026
3** evan
4** File description:
5** IPlatform
6*/
7
8#pragma once
9
10#include "evan/EvanPlatform.hpp"
11#include "evan/Error.hpp"
12
13#include <utility/event/event.hpp>
14
15#include <utility/logging/loggable.hpp>
16#include <utility/logging/default_logger.hpp>
17
18#include <filesystem>
19#include <string>
20
21namespace evan
22{
23 class ADeviceBackend;
24 class DeviceContext;
25 class ASwapchainContext;
26
33 class IPlatform:
34 protected utility::logging::Loggable<IPlatform,
35 utility::logging::DefaultLogger>
36 {
37 public:
43 virtual ~IPlatform() = default;
44
51 virtual std::vector<std::string>
53
62 virtual VkInstanceCreateFlags getInstanceCreateFlags() const
63 {
64 return 0;
65 }
66
76 virtual std::vector<std::string> getRequiredDeviceExtensions() const
77 {
78 return {};
79 }
80
102 virtual std::filesystem::path getPipelineCachePath() const;
103
109 virtual bool shouldClose() const = 0;
110
122 virtual std::vector<std::shared_ptr<utility::event::Event>>
123 pollEvents(ADeviceBackend &deviceBackend) = 0;
124
133 virtual std::shared_ptr<ADeviceBackend> createDeviceBackend() const = 0;
134
148 virtual std::shared_ptr<ASwapchainContext> createSwapchainContext(
149 const DeviceContext &deviceContext) const = 0;
150
159 Error getLastError() const
160 {
161 return _lastError;
162 }
163
164 protected:
181 virtual std::filesystem::path getDefaultCacheRoot() const = 0;
182
186 Error _lastError = Error::Ok;
187 };
188} // namespace evan
Abstract base class for Vulkan device backends.
Represents the device context for the engine, managing Vulkan-related resources and operations.
Abstract interface for platform-specific functionality.
Definition IPlatform.hpp:36
virtual std::shared_ptr< ASwapchainContext > createSwapchainContext(const DeviceContext &deviceContext) const =0
Get platform-specific instance creation information.
Error getLastError() const
Get the last error recorded by the platform.
virtual std::filesystem::path getPipelineCachePath() const
Get the path where the Vulkan pipeline cache is persisted.
virtual std::vector< std::shared_ptr< utility::event::Event > > pollEvents(ADeviceBackend &deviceBackend)=0
Poll for platform events.
Error _lastError
Sticky error recorded by the platform while polling events.
virtual std::vector< std::string > getRequiredDeviceExtensions() const
Get platform-specific required Vulkan device extensions.
Definition IPlatform.hpp:76
virtual bool shouldClose() const =0
Check if the platform should close.
virtual VkInstanceCreateFlags getInstanceCreateFlags() const
Get platform-specific Vulkan instance creation flags.
Definition IPlatform.hpp:62
virtual std::vector< std::string > getRequiredInstanceExtensions() const =0
Get the required instance extensions for the platform.
virtual std::shared_ptr< ADeviceBackend > createDeviceBackend() const =0
Create a device context for the platform.
virtual ~IPlatform()=default
Virtual destructor.
virtual std::filesystem::path getDefaultCacheRoot() const =0
Get the platform-specific cache root directory.