|
evan 2026.1.4
Evan
|
Desktop backend implementation. More...
#include <headers/evan/glfw/DesktopBackend.hpp>


Public Member Functions | |
| DesktopBackend (const IPlatform &platform) | |
| Constructor for DesktopBackend. | |
| ~DesktopBackend () | |
| Destructor for DesktopBackend. | |
| Error | preprocessFrame (ASwapchainContext &swapchainContext) override |
| Preprocesses a frame before rendering. | |
| Error | processFrame (VkPresentInfoKHR presentInfo, ASwapchainImage &swapchainImage) override |
| Processes a frame for rendering. | |
| Error | postprocessFrame (ASwapchainContext &swapchainContext) override |
| Postprocesses a frame after rendering. | |
| uint32_t | countSwapchainFormats () const override |
| Counts the number of supported swapchain formats for the Vulkan surface. | |
| std::vector< int64_t > | enumerateSwapchainFormats (uint32_t swapchainFormatCount) const override |
| Enumerates the supported swapchain formats for the Vulkan surface. | |
| QueueFamilyIndices | findQueueFamilies () override |
| Finds the queue family indices for the Vulkan physical device. | |
| evan::SwapChainSupportDetails | querySwapChainSupport () |
| Queries the swap chain support details for a given Vulkan physical device and surface. This function retrieves information about the swap chain capabilities, available surface formats, and present modes for the specified Vulkan physical device and surface. It populates a SwapChainSupportDetails structure with the retrieved information. | |
| void | createPresentQueue () |
| Creates the presentation queue for the device context. | |
| VkSurfaceKHR | getSurface () const |
| Retrieves the Vulkan surface associated with the Desktop backend. | |
Public Member Functions inherited from evan::ADeviceBackend | |
| virtual | ~ADeviceBackend () |
| Virtual destructor for the ADeviceBackend class. | |
| Error | createBuffer (const CreateBufferProperties &properties) const |
| Creates a Vulkan buffer and allocates memory for it. | |
| Error | transitionImageLayout (const TransitionImageLayoutProperties &properties) const |
| Transitions the layout of a Vulkan image. | |
| VkCommandBuffer | beginSingleTimeCommands (VkCommandPool commandPool) const |
| Begins recording a single-use command buffer for one-time operations. | |
| void | endSingleTimeCommands (VkCommandPool commandPool, VkQueue graphicsQueue, VkCommandBuffer commandBuffer) const |
| Ends recording of a single-use command buffer and submits it for execution. | |
| Error | createImage (const CreateImageProperties &properties) const |
| Creates a Vulkan image and allocates memory for it. | |
| Error | copyBufferToImage (const CopyBufferToImageProperties &properties) const |
| Copies data from a Vulkan buffer to a Vulkan image. | |
| Error | copyBuffer (const CopyBufferProperties &properties) const |
| Copies data from one Vulkan buffer to another. | |
| Result< VkImageView > | createImageView (VkImage image, VkFormat format, VkImageAspectFlags aspectFlags, uint32_t mipLevels, uint32_t layerCount=1) const |
| Creates a Vulkan image view for a given image. | |
| virtual VkDevice | getDevice () const |
| Retrieves the Vulkan logical device handle. | |
| virtual VkInstance | getInstance () const |
| Retrieves the Vulkan instance handle. | |
| virtual VkPhysicalDevice | getPhysicalDevice () const |
| Retrieves the Vulkan physical device handle. | |
| bool | supportsMultiview () const |
| Indicates whether multiview rendering is available. | |
| bool | supportsTimestampQueries () |
| Indicates whether GPU timestamp queries can be used. | |
| float | getTimestampPeriod () const |
| Nanoseconds per timestamp tick. | |
| uint32_t | getTimestampValidBits () |
| Number of valid bits in a timestamp value. | |
Protected Member Functions | |
| void | createInstance (const IPlatform &platform, const std::string &appName, Version &appVersion) override |
| Creates a Vulkan instance and initializes the device backend for the Desktop platform. | |
| void | createLogicalDevice () override |
| Creates a Vulkan logical device and retrieves the necessary queues for the Desktop platform. | |
| void | pickPhysicalDevice () override |
| Picks a suitable Vulkan physical device for the Desktop platform. | |
Protected Member Functions inherited from evan::ADeviceBackend | |
| std::vector< VkLayerProperties > | getAvailableLayers () |
| Retrieves the available Vulkan layers on the system. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from evan::ADeviceBackend | |
| static bool | queryMultiviewSupport (VkPhysicalDevice physicalDevice, uint32_t apiVersion) |
| Queries whether a physical device can run multiview passes. | |
Protected Attributes inherited from evan::ADeviceBackend | |
| VkPhysicalDevice | _physicalDevice = VK_NULL_HANDLE |
| VkDevice | _device = VK_NULL_HANDLE |
| VkInstance | _VkInstance = VK_NULL_HANDLE |
| bool | _multiviewSupported = false |
| Whether the multiview feature was enabled on the logical device created by this backend. | |
Desktop backend implementation.
This class provides an implementation of the backend for Desktop. It handles platform-specific functionality related to Desktop, such as creating a Vulkan surface for rendering or later handling input events.
Definition at line 73 of file DesktopBackend.hpp.
Constructor for DesktopBackend.
| platform | The platform instance to be used for Desktop initialization. |
Definition at line 85 of file DesktopBackend.cpp.

| evan::DesktopBackend::~DesktopBackend | ( | ) |
Destructor for DesktopBackend.
Ensures proper cleanup of Desktop resources.
Definition at line 109 of file DesktopBackend.cpp.
|
overridevirtual |
Counts the number of supported swapchain formats for the Vulkan surface.
This function queries the Vulkan API to determine the number of supported swapchain formats for the surface associated with the Desktop backend. It retrieves the list of supported surface formats and returns the count, which can be used to determine how many different formats are available for use when creating a swapchain.
Implements evan::ADeviceBackend.
Definition at line 143 of file DesktopBackend.cpp.
|
overrideprotectedvirtual |
Creates a Vulkan instance and initializes the device backend for the Desktop platform.
This function is responsible for creating a Vulkan instance and performing any necessary initialization for the device backend specific to the Desktop platform. It takes the platform information, application name, and application version as parameters to set up the Vulkan instance with the appropriate application info and extensions required for the Desktop backend.
| platform | The platform instance containing information about the Desktop environment. |
| appName | The name of the application, used for Vulkan instance creation. |
| appVersion | The version of the application, used for Vulkan instance creation. |
Implements evan::ADeviceBackend.
Definition at line 312 of file DesktopBackend.cpp.

|
overrideprotectedvirtual |
Creates a Vulkan logical device and retrieves the necessary queues for the Desktop platform.
This function is responsible for creating a Vulkan logical device based on the selected physical device and retrieving the necessary queues (such as graphics and presentation queues) for the Desktop platform. It uses the queue family indices determined during device selection to ensure that the created logical device has access to the required queues for rendering and presentation operations.
Implements evan::ADeviceBackend.
Definition at line 411 of file DesktopBackend.cpp.

| void evan::DesktopBackend::createPresentQueue | ( | ) |
Creates the presentation queue for the device context.
This function retrieves the presentation queue from the logical device and stores it in a member variable (not shown in this snippet). It assumes that the logical device has already been created and that the presentation queue family index has been determined.
Definition at line 291 of file DesktopBackend.cpp.

|
overridevirtual |
Enumerates the supported swapchain formats for the Vulkan surface.
This function retrieves the list of supported swapchain formats for the surface associated with the Desktop backend and returns them as a vector of integers. Each integer in the vector represents a specific Vulkan format that is supported for use in the swapchain. This information can be used when creating a swapchain to select an appropriate format for rendering.
| swapchainFormatCount | The number of swapchain formats to enumerate, which should match the count returned by countSwapchainFormats(). |
Implements evan::ADeviceBackend.
Definition at line 157 of file DesktopBackend.cpp.
|
overridevirtual |
Finds the queue family indices for the Vulkan physical device.
This function queries the Vulkan API to find the indices of the queue families that support graphics and presentation operations for the physical device associated with the Desktop backend. It returns a QueueFamilyIndices structure containing the indices of the graphics and presentation queue families, which can be used during device creation to ensure that the necessary queues are available for rendering and presentation.
Implements evan::ADeviceBackend.
Definition at line 178 of file DesktopBackend.cpp.
|
inline |
Retrieves the Vulkan surface associated with the Desktop backend.
Definition at line 245 of file DesktopBackend.hpp.
|
overrideprotectedvirtual |
Picks a suitable Vulkan physical device for the Desktop platform.
This function is responsible for selecting a Vulkan physical device that is suitable for use with the Desktop platform. It evaluates the available physical devices and checks their capabilities, features, and support for required extensions to determine which device is best suited for the application's needs. The selected physical device will be used for creating the logical device and performing rendering operations.
Implements evan::ADeviceBackend.
Definition at line 530 of file DesktopBackend.cpp.

|
inlineoverridevirtual |
Postprocesses a frame after rendering.
This function can be used to perform any necessary postprocessing steps after rendering a frame, such as presenting the rendered image to the screen, handling synchronization, or performing any other operations that need to occur after rendering. In the case of the Desktop backend, no specific postprocessing is needed, so this function simply returns true.
| swapchainContext | The swap chain context for the current frame, which may include information about the swap chain and presentation details. |
Implements evan::ADeviceBackend.
Definition at line 151 of file DesktopBackend.hpp.
|
inlineoverridevirtual |
Preprocesses a frame before rendering.
This function can be used to perform any necessary preprocessing steps before rendering a frame, such as updating uniform buffers, handling input events, or performing any other per-frame updates. In the case of the Desktop backend, no specific preprocessing is needed, so this function simply returns true.
| swapchainContext | The swap chain context for the current frame. |
Implements evan::ADeviceBackend.
Definition at line 105 of file DesktopBackend.hpp.
|
overridevirtual |
Processes a frame for rendering.
This function is responsible for processing a frame before it is rendered. In the context of the Desktop backend, this function can be used to perform any necessary operations on the frame, such as updating uniform buffers, handling input events, or performing any other per-frame updates. However, in the current implementation, no specific processing is needed for the Desktop backend, so this function simply returns true.
| presentInfo | The presentation information for the current frame, which may include details about the swap chain and presentation mode. |
| swapchainImage | The swap chain image that will be rendered to for the current frame. This parameter can be used to access the image and perform any necessary operations on it before rendering. |
Implements evan::ADeviceBackend.
Definition at line 126 of file DesktopBackend.cpp.
| evan::SwapChainSupportDetails evan::DesktopBackend::querySwapChainSupport | ( | ) |
Queries the swap chain support details for a given Vulkan physical device and surface. This function retrieves information about the swap chain capabilities, available surface formats, and present modes for the specified Vulkan physical device and surface. It populates a SwapChainSupportDetails structure with the retrieved information.
Definition at line 236 of file DesktopBackend.cpp.