Added functionality to get list of devices

This commit is contained in:
Alejandro Saucedo 2021-03-20 08:49:27 +00:00
parent aff13846c1
commit a8e5ce7903
3 changed files with 21 additions and 3 deletions

View file

@ -51,8 +51,10 @@ endif()
target_include_directories(
kompute PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/single_include
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/single_include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:single_include>
)
if(NOT KOMPUTE_OPT_ANDOID_BUILD)

View file

@ -453,4 +453,10 @@ Manager::getDeviceProperties() const
return this->mPhysicalDevice->getProperties();
}
std::vector<vk::PhysicalDevice>
Manager::listDevices() const
{
return this->mInstance->enumeratePhysicalDevices();
}
}

View file

@ -154,10 +154,20 @@ class Manager
void clear();
/**
* Return a struct containing information about the device.
* Information about the current device.
*
* @return vk::PhysicalDeviceProperties containing information about the device
**/
vk::PhysicalDeviceProperties getDeviceProperties() const;
/**
* List the devices available in the current vulkan instance.
*
* @return vector of physical devices containing their respective properties
**/
std::vector<vk::PhysicalDevice> listDevices() const;
private:
// -------------- OPTIONALLY OWNED RESOURCES
std::shared_ptr<vk::Instance> mInstance = nullptr;