Atomic Engine
Atomic Engine is a cross-platform vulkan based 3D Game Engine
Loading...
Searching...
No Matches
atomic::render::vkLib::VkDeviceManager Class Reference

Manages Vulkan physical devices and their suitability for rendering. More...

#include <device.h>

Public Member Functions

 VkDeviceManager (VkInstance instance)
 Constructs a VkDeviceManager instance.
 
 ~VkDeviceManager ()
 Destroys the VkDeviceManager instance and releases resources.
 

Private Member Functions

int rateDeviceSuitability (VkPhysicalDevice device)
 Rates the suitability of a Vulkan physical device.
 
bool isDeviceSuitable (VkPhysicalDevice device)
 Checks if a Vulkan physical device is suitable for rendering.
 

Private Attributes

VkPhysicalDevice physicalDevice = VK_NULL_HANDLE
 The selected Vulkan physical device. This device is the one that will be used for rendering by vulkan.
 
uint32_t deviceCount = 0
 The number of Vulkan physical devices available. The number of all the devices available on the system.
 
std::vector< VkPhysicalDevice > devices
 List of all available Vulkan physical devices. Lists all the devices available on the system including those not usable by vulkan.
 
std::multimap< int, VkPhysicalDevice > deviceCandidates
 Ordered map to rank physical devices by their suitability score. This map is used to sort the devices based on their suitability for rendering. It only includes devices usable by vulkan and has them ranked by their suitability score.
 
atomic::render::vkLib::device::QueueFamilyIndices queueFamilyIndices
 Queue family indices for the selected physical device.
 

Detailed Description

Manages Vulkan physical devices and their suitability for rendering.

This class is responsible for selecting a suitable Vulkan physical device, managing queue family indices, and maintaining a list of available devices.

Constructor & Destructor Documentation

◆ VkDeviceManager()

atomic::render::vkLib::VkDeviceManager::VkDeviceManager ( VkInstance instance)

Constructs a VkDeviceManager instance.

Parameters
instanceThe Vulkan instance used to query physical devices.

Member Function Documentation

◆ isDeviceSuitable()

bool atomic::render::vkLib::VkDeviceManager::isDeviceSuitable ( VkPhysicalDevice device)
private

Checks if a Vulkan physical device is suitable for rendering.

Parameters
deviceThe Vulkan physical device to check.
Returns
True if the device is suitable, false otherwise.

◆ rateDeviceSuitability()

int atomic::render::vkLib::VkDeviceManager::rateDeviceSuitability ( VkPhysicalDevice device)
private

Rates the suitability of a Vulkan physical device.

This function evaluates the device based on various criteria :

  • Discrete GPU : score += 1000
  • Maximum possible tex size : score += maxImageDimension2D
  • No geomtry shader support : score = 0

    Todo
    Add more criteria for ranking devices.
Parameters
deviceThe Vulkan physical device to evaluate.
Returns
An integer score representing the device's suitability.

The documentation for this class was generated from the following files: