10#include "evan/EvanPlatform.hpp"
11#include "evan/ADeviceBackend.hpp"
12#include "evan/ASwapchainImage.hpp"
13#include "evan/RenderSettings.hpp"
14#include "evan/ViewSet.hpp"
16#include <utility/graphic/view.hpp>
18#include <utility/logging/loggable.hpp>
19#include <utility/logging/default_logger.hpp>
42 protected utility::logging::Loggable<ASwapchainContext,
43 utility::logging::DefaultLogger>
96 virtual void destroy(VkDevice device) = 0;
118 VkRenderPass renderpass) = 0;
181 VkSemaphore imageAvailableSemaphore,
182 VkFence inFlightFence,
183 uint32_t &imageIndex) = 0;
297 utility::graphic::ViewF
getView(std::size_t index)
const;
310 const utility::graphic::ViewF &view);
453 const std::shared_ptr<ADeviceBackend> &deviceBackend,
454 VkSampleCountFlagBits msaaSamples, ColorAttachmentMode mode,
455 uint32_t viewMask = 0);
501 const std::vector<int64_t> &swapchainFormats);
545 const std::vector<VkFormat> &candidates,
546 VkImageTiling tiling,
547 VkFormatFeatureFlags features);
562 static bool isPlausibleVkFormat(int64_t value);
573 static bool supportsColorAttachment(VkPhysicalDevice physicalDevice,
590 fallbackSwapchainFormat(VkPhysicalDevice physicalDevice);
Represents the context for managing the swapchain in the rendering system.
const utility::graphic::PoseF & getViewOffset(void) const
Retrieves the persistent world-space view offset.
std::size_t getViewCount(void) const
Retrieves the number of views in the swapchain context.
utility::graphic::PoseF _viewOffset
Persistent world-space offset applied on top of the tracked poses.
utility::graphic::ViewF getView(std::size_t index) const
Retrieves the view matrix for the specified view index.
virtual void setView(std::size_t index, const utility::graphic::ViewF &view)
Sets the view state for the specified view index.
virtual const ViewSet & getViewSet() const =0
Retrieves the set of views to render (const version).
virtual VkResult aquireImage(uint32_t index, VkDevice device, VkSemaphore imageAvailableSemaphore, VkFence inFlightFence, uint32_t &imageIndex)=0
Acquires the next available image from the swapchain for rendering.
virtual void waitForImage(uint32_t index)=0
Waits for the specified image in the swapchain to become available for rendering.
VkRenderPass getRenderPass() const
Retrieves the render pass associated with the swapchain context.
static void updateViewForExtent(utility::graphic::ViewF &view, VkExtent2D extent)
Updates a view's viewport size and perspective for a new swapchain extent.
virtual ViewSet & getViewSet()=0
Retrieves the set of views to render for this swapchain context.
virtual void destroy(VkDevice device)=0
Destroys the swapchain and releases associated resources.
virtual void recreateSwapchain(const DeviceContext &deviceContext, VkRenderPass renderpass)=0
Recreates the swapchain and associated resources.
VkFormat selectSwapchainFormat(VkPhysicalDevice physicalDevice, const std::vector< int64_t > &swapchainFormats)
Selects the appropriate swapchain format from the available formats.
glm::mat4 getProjection(std::size_t index) const
Retrieves the projection matrix for the specified view index.
virtual bool usesImageAvailableSemaphore() const
Indicates whether aquireImage signals the image-available semaphore.
utility::math::Vector2F getViewportSize() const
Retrieves the current viewport size in pixels.
std::vector< std::shared_ptr< ASwapchainImage > > _swapchainImages
virtual VkSampleCountFlagBits getMsaaSamples() const =0
Retrieves the MSAA sample count used by this swapchain context.
virtual bool needsSwapchainRecreation() const
Indicates whether the swapchain needs to be recreated.
virtual bool usesMultiview() const
Indicates whether the frame renders every view in one pass.
void createRenderPass(const std::shared_ptr< ADeviceBackend > &deviceBackend, VkSampleCountFlagBits msaaSamples, ColorAttachmentMode mode, uint32_t viewMask=0)
Creates the Vulkan render pass for the swapchain context.
std::size_t getSwapchainCount() const
Retrieves the number of swapchain image sets in the context.
VkFormat findSupportedFormat(VkPhysicalDevice physicalDevice, const std::vector< VkFormat > &candidates, VkImageTiling tiling, VkFormatFeatureFlags features)
Finds a supported format from a list of candidates based on the specified tiling and feature requirem...
Represents the device context for the engine, managing Vulkan-related resources and operations.
Describes a set of views to render, independent of the swapchain image sets.
Struct to encapsulate details about swap chain support.
std::vector< VkPresentModeKHR > presentModes
A list of supported presentation modes (e.g., FIFO, Mailbox, etc.).
std::vector< VkSurfaceFormatKHR > formats
A list of supported surface formats (color space and pixel format).
VkSurfaceCapabilitiesKHR capabilities
Vulkan surface capabilities, such as the minimum and maximum image count, extent, and supported trans...