Encapsulates Vulkan Instance creation, physical device selection, queue family discovery, and logical device setup.
More...
#include <VulkanDevice.hpp>
|
| | VulkanDevice () |
| | Construct a new Vulkan Device object.
|
| | VulkanDevice (bool enableValidation) |
| | Construct a new Vulkan Device object specifying validation layers settings.
|
| | ~VulkanDevice () |
| | Destroy the Vulkan Device object.
|
| void | initialize () |
| | Initializes Vulkan instance context.
|
| void | cleanup () |
| | Releases Vulkan logical device and instance handles.
|
| VkInstance | getInstance () const |
| | Gets raw Vulkan Instance.
|
| VkPhysicalDevice | getPhysicalDevice () const |
| | Gets picked physical device.
|
| VkDevice | getDevice () const |
| | Gets raw Vulkan logical device.
|
| VkQueue | getGraphicsQueue () const |
| | Gets logical graphics queue.
|
| uint32_t | getGraphicsQueueFamily () const |
| | Gets selected graphics queue family index.
|
| void | pickPhysicalDevice (VkSurfaceKHR surface) |
| | Picks a physical GPU supporting graphics and surface presentation.
|
| void | createLogicalDevice () |
| | Instantiates logical device context and loads queue interfaces.
|
| uint32_t | findMemoryType (uint32_t typeFilter, VkMemoryPropertyFlags properties) const |
| | Searches physical memory capabilities for a matching property filter.
|
|
| void | createInstance () |
| | Creates the main Vulkan instance.
|
| bool | isDeviceSuitableForSurface (VkPhysicalDevice dev, VkSurfaceKHR surface) |
| | Verifies if physical device supports both graphics and surface presentation.
|
Encapsulates Vulkan Instance creation, physical device selection, queue family discovery, and logical device setup.
◆ VulkanDevice() [1/2]
| VulkanDevice::VulkanDevice |
( |
| ) |
|
Construct a new Vulkan Device object.
Construct a new Vulkan Device:: Vulkan Device object with validation active by default.
◆ VulkanDevice() [2/2]
| VulkanDevice::VulkanDevice |
( |
bool | enableValidation | ) |
|
Construct a new Vulkan Device object specifying validation layers settings.
Construct a new Vulkan Device:: Vulkan Device object.
- Parameters
-
| enableValidation | Whether validation checks are active. |
| enableValidation | Whether validation layers should be active. |
◆ ~VulkanDevice()
| VulkanDevice::~VulkanDevice |
( |
| ) |
|
Destroy the Vulkan Device object.
Destroy the Vulkan Device:: Vulkan Device object.
◆ cleanup()
| void VulkanDevice::cleanup |
( |
| ) |
|
Releases Vulkan logical device and instance handles.
Deallocates logical device and instance handles.
◆ createInstance()
| void VulkanDevice::createInstance |
( |
| ) |
|
|
private |
Creates the main Vulkan instance.
Sets up app structures and creates raw Vulkan instance.
◆ createLogicalDevice()
| void VulkanDevice::createLogicalDevice |
( |
| ) |
|
Instantiates logical device context and loads queue interfaces.
Configures logical device properties and initializes graphics queues.
◆ findMemoryType()
| uint32_t VulkanDevice::findMemoryType |
( |
uint32_t | typeFilter, |
|
|
VkMemoryPropertyFlags | properties ) const |
Searches physical memory capabilities for a matching property filter.
Checks physical device memory types for a match.
- Parameters
-
| typeFilter | Bitmask filtering memory types. |
| properties | Desired memory properties. |
- Returns
- Memory type index.
◆ getDevice()
| VkDevice VulkanDevice::getDevice |
( |
| ) |
const |
|
inline |
Gets raw Vulkan logical device.
- Returns
- VkDevice handle.
◆ getGraphicsQueue()
| VkQueue VulkanDevice::getGraphicsQueue |
( |
| ) |
const |
|
inline |
Gets logical graphics queue.
- Returns
- VkQueue handle.
◆ getGraphicsQueueFamily()
| uint32_t VulkanDevice::getGraphicsQueueFamily |
( |
| ) |
const |
|
inline |
Gets selected graphics queue family index.
- Returns
- Index value.
◆ getInstance()
| VkInstance VulkanDevice::getInstance |
( |
| ) |
const |
|
inline |
Gets raw Vulkan Instance.
- Returns
- VkInstance handle.
◆ getPhysicalDevice()
| VkPhysicalDevice VulkanDevice::getPhysicalDevice |
( |
| ) |
const |
|
inline |
Gets picked physical device.
- Returns
- VkPhysicalDevice handle.
◆ initialize()
| void VulkanDevice::initialize |
( |
| ) |
|
Initializes Vulkan instance context.
Instantiates the root Vulkan Instance.
◆ isDeviceSuitableForSurface()
| bool VulkanDevice::isDeviceSuitableForSurface |
( |
VkPhysicalDevice | dev, |
|
|
VkSurfaceKHR | surface ) |
|
private |
Verifies if physical device supports both graphics and surface presentation.
Verifies if the physical device queue families support both graphics and surface presentation.
- Parameters
-
| dev | Physical device. |
| surface | Presentation surface. |
- Returns
- True if suitable, false otherwise.
- Parameters
-
| dev | Physical device. |
| surface | Presentation surface. |
- Returns
- True if suited, false otherwise.
◆ pickPhysicalDevice()
| void VulkanDevice::pickPhysicalDevice |
( |
VkSurfaceKHR | surface | ) |
|
Picks a physical GPU supporting graphics and surface presentation.
Enumerates physical devices and picks the first suitable GPU.
- Parameters
-
| surface | Window presentation surface. |
| surface | Window rendering surface. |
◆ device
| VkDevice VulkanDevice::device = VK_NULL_HANDLE |
|
private |
Vulkan logical device interface.
◆ enableValidationLayers
| bool VulkanDevice::enableValidationLayers = true |
|
private |
Validation layers activity status.
◆ graphicsQueue
| VkQueue VulkanDevice::graphicsQueue = VK_NULL_HANDLE |
|
private |
logical graphics queue handle.
◆ graphicsQueueFamily
| uint32_t VulkanDevice::graphicsQueueFamily = 0 |
|
private |
graphics queue family index.
◆ instance
| VkInstance VulkanDevice::instance = VK_NULL_HANDLE |
|
private |
◆ physicalDevice
| VkPhysicalDevice VulkanDevice::physicalDevice = VK_NULL_HANDLE |
|
private |
Selected GPU physical device.
The documentation for this class was generated from the following files: