10#include "evan/EvanPlatform.hpp"
11#include "evan/Error.hpp"
12#include "evan/Version.hpp"
14#include "evan/IPlatform.hpp"
15#include "evan/QueueFamilyIndices.hpp"
17#include <utility/logging/loggable.hpp>
18#include <utility/logging/default_logger.hpp>
25 class ASwapchainContext;
26 class ASwapchainImage;
46 protected utility::logging::Loggable<ADeviceBackend,
47 utility::logging::DefaultLogger>
312 virtual std::vector<int64_t>
463 VkQueue graphicsQueue,
464 VkCommandBuffer commandBuffer)
const;
548 VkImageAspectFlags aspectFlags,
550 uint32_t layerCount = 1)
const;
698 const std::string &appName,
752 uint32_t apiVersion);
782 bool hasStencilComponent(VkFormat format)
const;
807 VkMemoryPropertyFlags properties)
const;
Abstract base class for Vulkan device backends.
VkCommandBuffer beginSingleTimeCommands(VkCommandPool commandPool) const
Begins recording a single-use command buffer for one-time operations.
virtual VkPhysicalDevice getPhysicalDevice() const
Retrieves the Vulkan physical device handle.
float getTimestampPeriod() const
Nanoseconds per timestamp tick.
virtual Error processFrame(VkPresentInfoKHR presentInfo, ASwapchainImage &swapchainImage)=0
Processes a frame for presentation.
virtual void pickPhysicalDevice()=0
Selects a suitable Vulkan physical device for rendering.
virtual void createLogicalDevice()=0
Creates a Vulkan logical device and selects a physical device for rendering.
Error transitionImageLayout(const TransitionImageLayoutProperties &properties) const
Transitions the layout of a Vulkan image.
bool supportsTimestampQueries()
Indicates whether GPU timestamp queries can be used.
virtual VkInstance getInstance() const
Retrieves the Vulkan instance handle.
void endSingleTimeCommands(VkCommandPool commandPool, VkQueue graphicsQueue, VkCommandBuffer commandBuffer) const
Ends recording of a single-use command buffer and submits it for execution.
virtual Error preprocessFrame(ASwapchainContext &swapchainContext)=0
Preprocesses a frame before presentation.
VkPhysicalDevice _physicalDevice
bool supportsMultiview() const
Indicates whether multiview rendering is available.
virtual ~ADeviceBackend()
Virtual destructor for the ADeviceBackend class.
uint32_t getTimestampValidBits()
Number of valid bits in a timestamp value.
virtual VkDevice getDevice() const
Retrieves the Vulkan logical device handle.
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 std::vector< int64_t > enumerateSwapchainFormats(uint32_t swapchainFormatCount) const =0
Enumerates the available swapchain formats for the Vulkan device.
virtual uint32_t countSwapchainFormats() const =0
Counts the number of available swapchain formats for the Vulkan device.
virtual void createInstance(const IPlatform &platform, const std::string &appName, Version &appVersion)=0
Creates a Vulkan instance and initializes the device backend.
Error copyBuffer(const CopyBufferProperties &properties) const
Copies data from one Vulkan buffer to another.
Error createBuffer(const CreateBufferProperties &properties) const
Creates a Vulkan buffer and allocates memory for it.
Error createImage(const CreateImageProperties &properties) const
Creates a Vulkan image and allocates memory for it.
bool _multiviewSupported
Whether the multiview feature was enabled on the logical device created by this backend.
virtual evan::QueueFamilyIndices findQueueFamilies()=0
Finds the queue family indices for the Vulkan physical device.
std::vector< VkLayerProperties > getAvailableLayers()
Retrieves the available Vulkan layers on the system.
virtual Error postprocessFrame(ASwapchainContext &swapchainContext)=0
Postprocesses a frame after presentation.
Error copyBufferToImage(const CopyBufferToImageProperties &properties) const
Copies data from a Vulkan buffer to a Vulkan image.
static bool queryMultiviewSupport(VkPhysicalDevice physicalDevice, uint32_t apiVersion)
Queries whether a physical device can run multiview passes.
Represents the context for managing the swapchain in the rendering system.
ASwapchainImage is a class that represents an image in the swapchain of the Evan engine....
Represents a software version using major, minor, and patch numbers.
Encapsulates properties required for copying data between Vulkan buffers.
VkDevice _logicalDevice
The Vulkan logical device used for command buffer operations.
VkCommandPool _commandPool
The Vulkan command pool used to allocate command buffers for the copy operation.
VkQueue _graphicsQueue
The Vulkan graphics queue used to submit the command buffer for execution.
VkDeviceSize _size
The size of the data to copy in bytes.
VkBuffer _dstBuffer
The Vulkan buffer to which data will be copied.
VkBuffer _srcBuffer
The Vulkan buffer from which data will be copied.
Properties required to copy data from a buffer to an image in Vulkan.
VkQueue _graphicsQueue
The Vulkan graphics queue used to submit the command buffer for execution.
VkImage _image
The Vulkan image to which the data will be copied.
VkCommandPool _commandPool
The Vulkan command pool used to allocate command buffers for the copy operation.
uint32_t _width
The width of the image in pixels.
VkBuffer _buffer
The Vulkan buffer containing the image data to be copied.
uint32_t _height
The height of the image in pixels.
Properties required for creating a Vulkan buffer and allocating its memory.
VkDeviceSize _size
The size of the buffer in bytes.
VkDeviceMemory & _bufferMemory
A reference to the VkDeviceMemory object that will be allocated for the buffer.
VkMemoryPropertyFlags _properties
The memory property flags for the buffer (e.g., VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT).
VkBuffer & _buffer
A reference to the VkBuffer object that will be created.
VkBufferUsageFlags _usage
The usage flags for the buffer (e.g., VK_BUFFER_USAGE_VERTEX_BUFFER_BIT).
Encapsulates the properties required to create a Vulkan image and allocate its memory.
VkMemoryPropertyFlags _properties
The memory property flags for the image (e.g., VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT).
VkFormat _format
The format of the image (e.g., VK_FORMAT_R8G8B8A8_SRGB).
uint32_t _height
The height of the image in pixels.
VkImage & _image
A reference to the VkImage object that will be created.
VkImageTiling _tiling
The tiling arrangement of the image (e.g., VK_IMAGE_TILING_OPTIMAL).
VkImageUsageFlags _usage
The usage flags for the image (e.g., VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT).
uint32_t _arrayLayers
The number of array layers of the image.
uint32_t _mipLevels
The number of mipmap levels for the image.
VkDeviceMemory & _imageMemory
A reference to the VkDeviceMemory object that will be allocated for the image.
uint32_t _width
The width of the image in pixels.
VkSampleCountFlagBits _numSamples
The number of samples for multisample anti-aliasing (MSAA).
Encapsulates the properties required to perform an image layout transition in Vulkan.
VkCommandPool _commandPool
The Vulkan command pool used to allocate command buffers for the layout transition.
VkImage _image
The Vulkan image whose layout is to be transitioned.
VkImageLayout _oldLayout
The old layout of the image before the transition.
VkFormat _format
The format of the image being transitioned.
VkImageLayout _newLayout
The new layout of the image after the transition.
VkQueue _graphicsQueue
The Vulkan graphics queue used to submit the command buffer for execution.
uint32_t _mipLevels
The number of mipmap levels in the image.
A structure to represent Vulkan queue family indices.
Small result wrapper used by helpers that must return both a status and a value (e....