|
evan 2026.1.4
Evan
|
Abstract interface for platform-specific functionality. More...
#include <headers/evan/IPlatform.hpp>


Public Member Functions | |
| virtual | ~IPlatform ()=default |
| Virtual destructor. | |
| virtual std::vector< std::string > | getRequiredInstanceExtensions () const =0 |
| Get the required instance extensions for the platform. | |
| virtual VkInstanceCreateFlags | getInstanceCreateFlags () const |
| Get platform-specific Vulkan instance creation flags. | |
| virtual std::vector< std::string > | getRequiredDeviceExtensions () const |
| Get platform-specific required Vulkan device extensions. | |
| virtual std::filesystem::path | getPipelineCachePath () const |
| Get the path where the Vulkan pipeline cache is persisted. | |
| virtual bool | shouldClose () const =0 |
| Check if the platform should close. | |
| virtual std::vector< std::shared_ptr< utility::event::Event > > | pollEvents (ADeviceBackend &deviceBackend)=0 |
| Poll for platform events. | |
| virtual std::shared_ptr< ADeviceBackend > | createDeviceBackend () const =0 |
| Create a device context for the platform. | |
| 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. | |
Protected Member Functions | |
| virtual std::filesystem::path | getDefaultCacheRoot () const =0 |
| Get the platform-specific cache root directory. | |
Protected Attributes | |
| Error | _lastError = Error::Ok |
| Sticky error recorded by the platform while polling events. | |
Abstract interface for platform-specific functionality.
Defines a common interface for platform implementations. Derived classes must implement platform-specific behavior.
Definition at line 33 of file IPlatform.hpp.
|
virtualdefault |
Virtual destructor.
Ensures proper cleanup of derived class resources.
|
pure virtual |
Create a device context for the platform.
This method should create and return a device context that is compatible with the platform's requirements and capabilities.
Implemented in evan::IDesktopPlatform, and evan::IXrPlatform.
|
pure virtual |
Get platform-specific instance creation information.
| deviceContext | The device context to use for creating the swapchain context. |
This method can be used to provide additional instance creation information specific to the platform, such as application info or extension-specific structures.
Implemented in evan::IDesktopPlatform, and evan::IXrPlatform.
|
protectedpure virtual |
Get the platform-specific cache root directory.
This is the directory the pipeline cache blob is stored under, before the EVAN_PIPELINE_CACHE_DIR override is applied. It is where the platform is allowed to write user data, for example ~/Library/Caches on macOS, XDG_CACHE_HOME or ~/.cache on Linux, LOCALAPPDATA% on Windows, and the application cache directory on Android.
Every concrete platform implements this method, because only the platform knows which directory it is allowed to write to. Returning an empty path disables persistence.
Implemented in evan::LinuxDesktopPlatform, evan::MacOsDesktopPlatform, evan::WindowsDesktopPlatform, evan::AndroidXrPlatform, and evan::LinuxXrPlatform.
|
inlinevirtual |
Get platform-specific Vulkan instance creation flags.
Platforms that require special instance creation flags (e.g. the portability enumeration bit on macOS/MoltenVK) override this method.
Reimplemented in evan::MacOsDesktopPlatform.
Definition at line 62 of file IPlatform.hpp.
|
inline |
Get the last error recorded by the platform.
Platforms record a sticky error while polling events (e.g. evan::Error::RuntimeLost when the OpenXR session is lost).
Definition at line 159 of file IPlatform.hpp.
|
virtual |
Get the path where the Vulkan pipeline cache is persisted.
The returned path is where the cache blob written by PipelineCache::persist() is stored, and where the next run looks for a blob to reuse, so pipelines are not recompiled from scratch on every launch.
The default implementation honors two environment variables and then falls back to the per-user cache directory of the running platform:
EVAN_PIPELINE_CACHE_DISABLE, set to any non-empty value other than 0, disables persistence entirely.EVAN_PIPELINE_CACHE_DIR overrides the cache root directory, which lets an application keep the blob next to its own build output.Platforms without a writable cache location return an empty path, in which case the pipeline cache is kept in memory only.
|
inlinevirtual |
Get platform-specific required Vulkan device extensions.
Platforms that require additional device extensions (e.g. the portability subset on macOS/MoltenVK) override this method.
Reimplemented in evan::MacOsDesktopPlatform.
Definition at line 76 of file IPlatform.hpp.
|
pure virtual |
Get the required instance extensions for the platform.
Implemented in evan::LinuxDesktopPlatform, evan::MacOsDesktopPlatform, evan::WindowsDesktopPlatform, evan::AndroidXrPlatform, evan::LinuxXrPlatform, evan::IDesktopPlatform, and evan::IXrPlatform.
|
pure virtual |
Poll for platform events.
This method should be called regularly to process platform events.
| deviceBackend | The device backend to use for event processing, if needed. |
Implemented in evan::IDesktopPlatform, and evan::IXrPlatform.
Check if the platform should close.
Implemented in evan::IDesktopPlatform, and evan::IXrPlatform.
|
protected |
Sticky error recorded by the platform while polling events.
Definition at line 186 of file IPlatform.hpp.