Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
|
Wraps selection and creation of a vulkan logical device. More...
#include <foray_vulkandevice.hpp>
Classes | |
struct | DefaultFeatures |
Public Types | |
using | BeforePhysicalDeviceSelectFunctionPointer = std::function< void(vkb::PhysicalDeviceSelector &)> |
Function called after default configuration and before action with physical device selector. | |
using | BeforeDeviceBuildFunctionPointer = std::function< void(vkb::DeviceBuilder &)> |
Function called after default configuration and before action with device builder. | |
Public Member Functions | |
VulkanDevice ()=default | |
VulkanDevice (core::Context *context, BeforePhysicalDeviceSelectFunctionPointer beforePhysicalDeviceSelectFunc, BeforeDeviceBuildFunctionPointer beforeDeviceBuildFunc) | |
operator bool () const | |
operator VkDevice () const | |
operator VkPhysicalDevice () const | |
operator vkb::Device & () | |
operator const vkb::Device & () const | |
VulkanDevice & | SetBeforePhysicalDeviceSelectFunc (BeforePhysicalDeviceSelectFunctionPointer beforePhysicalDeviceSelectFunc) |
Set the function called after default configuration and before action with physical device selector. | |
VulkanDevice & | SetBeforeDeviceBuildFunc (BeforeDeviceBuildFunctionPointer beforeDeviceBuildFunc) |
Set the function called after default configuration and before action with device builder. | |
void | Create () |
Create logical device by invoking SelectPhysicalDevice(..,) and BuildDevice() | |
void | SelectPhysicalDevice () |
If mSetDefaultCapabilitiesToDeviceSelector is set, configures defaults. If mBeforePhysicalDeviceSelectFunc is set, invokes it. Finally, selects device. | |
void | BuildDevice () |
If mEnableDefaultDeviceFeatures is set, configures defaults. If mBeforeDeviceBuildFunc is set, invokes it. Builds device. | |
bool | Exists () const |
void | Destroy () |
~VulkanDevice () | |
Protected Attributes | |
BeforePhysicalDeviceSelectFunctionPointer | mBeforePhysicalDeviceSelectFunc = nullptr |
BeforeDeviceBuildFunctionPointer | mBeforeDeviceBuildFunc = nullptr |
bool | mSetDefaultCapabilitiesToDeviceSelector = true |
Requires present capability, prefers dedicated devices. Enables VK_KHR_ACCELERATION_STRUCTURE, VK_KHR_RAY_TRACING_PIPELINE and VK_KHR_SYNCHRONIZATION_2 extensions (plus extensions those depend on). Enables samplerAnisotropy feature. | |
bool | mEnableDefaultDeviceFeatures = true |
Enables features listed in mDefaultFeatures member. | |
bool | mEnableDefaultPhysicalDeviceFeatures = true |
Enables features a few physical device features (anisotrophy, etc.) | |
bool | mShowConsoleDeviceSelectionPrompt = false |
If enabled, prompts the user in the console to select a device if multiple suitable devices are present. If disabled, selects the first index. | |
core::Context * | mContext = nullptr |
vkb::PhysicalDevice | mPhysicalDevice |
vkb::Device | mDevice |
vkb::DispatchTable | mDispatchTable |
struct foray::base::VulkanDevice::DefaultFeatures | mDefaultFeatures = {} |
VkPhysicalDeviceFeatures | mPhysicalDeviceFeatures {} |
Wraps selection and creation of a vulkan logical device.
using foray::base::VulkanDevice::BeforeDeviceBuildFunctionPointer = std::function<void(vkb::DeviceBuilder&)> |
Function called after default configuration and before action with device builder.
using foray::base::VulkanDevice::BeforePhysicalDeviceSelectFunctionPointer = std::function<void(vkb::PhysicalDeviceSelector&)> |
Function called after default configuration and before action with physical device selector.
|
default |
|
inline |
beforePhysicalDeviceSelectFunc | Function called after default configuration and before action with physical device selector |
beforeDeviceBuildFunc | Function called after default configuration and before action with device builder |
foray::base::VulkanDevice::~VulkanDevice | ( | ) |
void foray::base::VulkanDevice::BuildDevice | ( | ) |
If mEnableDefaultDeviceFeatures is set, configures defaults. If mBeforeDeviceBuildFunc is set, invokes it. Builds device.
void foray::base::VulkanDevice::Create | ( | ) |
Create logical device by invoking SelectPhysicalDevice(..,) and BuildDevice()
void foray::base::VulkanDevice::Destroy | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void foray::base::VulkanDevice::SelectPhysicalDevice | ( | ) |
If mSetDefaultCapabilitiesToDeviceSelector is set, configures defaults. If mBeforePhysicalDeviceSelectFunc is set, invokes it. Finally, selects device.
VulkanDevice & foray::base::VulkanDevice::SetBeforeDeviceBuildFunc | ( | BeforeDeviceBuildFunctionPointer | beforeDeviceBuildFunc | ) |
Set the function called after default configuration and before action with device builder.
VulkanDevice & foray::base::VulkanDevice::SetBeforePhysicalDeviceSelectFunc | ( | BeforePhysicalDeviceSelectFunctionPointer | beforePhysicalDeviceSelectFunc | ) |
Set the function called after default configuration and before action with physical device selector.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Enables features listed in mDefaultFeatures member.
|
protected |
Enables features a few physical device features (anisotrophy, etc.)
|
protected |
|
protected |
|
protected |
Requires present capability, prefers dedicated devices. Enables VK_KHR_ACCELERATION_STRUCTURE, VK_KHR_RAY_TRACING_PIPELINE and VK_KHR_SYNCHRONIZATION_2 extensions (plus extensions those depend on). Enables samplerAnisotropy feature.
|
protected |
If enabled, prompts the user in the console to select a device if multiple suitable devices are present. If disabled, selects the first index.