Magnum::Vk::DeviceProperties class new in Git master

Physical device properties.

Wraps a VkPhysicalDevice along with its (lazy-populated) properties and features. See the Device creation docs for an example of using this class for enumerating available devices and picking one of them.

Public static functions

static auto wrap(Instance& instance, VkPhysicalDevice handle) -> DeviceProperties
Wrap existing Vulkan physical device.

Constructors, destructors, conversion operators

DeviceProperties(NoCreateT) explicit noexcept
Construct without populating the contents.
DeviceProperties(const DeviceProperties&) deleted
Copying is not allowed.
DeviceProperties(DeviceProperties&&) noexcept
Move constructor.
operator VkPhysicalDevice() const

Public functions

auto operator=(const DeviceProperties&) -> DeviceProperties& deleted
Copying is not allowed.
auto operator=(DeviceProperties&&) -> DeviceProperties& noexcept
Move assignment.
auto handle() const -> VkPhysicalDevice
Underlying VkPhysicalDevice handle.
auto properties() -> const VkPhysicalDeviceProperties2&
Raw device properties.
auto version() -> Version
Device version.
auto isVersionSupported(Version version) -> bool
Whether given version is supported on the device.
auto type() -> DeviceType
Device type.
auto name() -> Containers::StringView
Device name.
auto driver() -> DeviceDriver
Driver ID.
auto driverVersion() -> Version
Driver version.
auto driverName() -> Containers::StringView
Driver name.
auto driverInfo() -> Containers::StringView
Driver info.
auto enumerateExtensionProperties(Containers::ArrayView<const Containers::StringView> layers = {}) -> ExtensionProperties
Enumerate device extensions.
auto enumerateExtensionProperties(std::initializer_list<Containers::StringView> layers) -> ExtensionProperties
auto features() -> const DeviceFeatures&
Device features.
auto queueFamilyProperties() -> Containers::ArrayView<const VkQueueFamilyProperties2>
Queue family properties.
auto queueFamilyCount() -> UnsignedInt
Queue family count.
auto queueFamilySize(UnsignedInt queueFamily) -> UnsignedInt
Queue count in given family.
auto queueFamilyFlags(UnsignedInt queueFamily) -> QueueFlags
Queue family flags.
auto pickQueueFamily(QueueFlags flags) -> UnsignedInt
Pick a queue family satisfying given flags.
auto tryPickQueueFamily(QueueFlags flags) -> Containers::Optional<UnsignedInt>
Try to pick a queue family satisfying given flags.
auto memoryProperties() -> const VkPhysicalDeviceMemoryProperties2&
Device memory properties.
auto memoryHeapCount() -> UnsignedInt
Memory heap count.
auto memoryHeapSize(UnsignedInt heap) -> UnsignedLong
Memory heap size.
auto memoryHeapFlags(UnsignedInt heap) -> MemoryHeapFlags
Memory heap size.
auto memoryCount() -> UnsignedInt
Memory type count.
auto memoryFlags(UnsignedInt memory) -> MemoryFlags
Memory type flags.
auto memoryHeapIndex(UnsignedInt memory) -> UnsignedInt
Memory heap index.
auto pickMemory(MemoryFlags requiredFlags, MemoryFlags preferredFlags = {}, UnsignedInt memories = ~UnsignedInt{}) -> UnsignedInt
Pick a memory type satisfying given flags.
auto pickMemory(MemoryFlags requiredFlags, UnsignedInt memories) -> UnsignedInt
auto tryPickMemory(MemoryFlags requiredFlags, MemoryFlags preferredFlags = {}, UnsignedInt memories = ~UnsignedInt{}) -> Containers::Optional<UnsignedInt>
Try to pick a memory type satisfying given flags.
auto tryPickMemory(MemoryFlags requiredFlags, UnsignedInt memories) -> Containers::Optional<UnsignedInt>

Function documentation

static DeviceProperties Magnum::Vk::DeviceProperties::wrap(Instance& instance, VkPhysicalDevice handle)

Wrap existing Vulkan physical device.

Parameters
instance Vulkan instance
handle The VkPhysicalDevice handle

The handle is expected to be originating from instance. Unlike with other handle types, the VkPhysicalDevice handles don't have to be destroyed at the end. so there's no equivalent of e.g. Instance::release() or Instance::handleFlags().

Magnum::Vk::DeviceProperties::DeviceProperties(NoCreateT) explicit noexcept

Construct without populating the contents.

The constructed instance is equivalent to moved-from state. Useful in cases where you will overwrite the instance later anyway. Move another object over it to make it useful.

Magnum::Vk::DeviceProperties::operator VkPhysicalDevice() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

VkPhysicalDevice Magnum::Vk::DeviceProperties::handle() const

Underlying VkPhysicalDevice handle.

Unlike most handle getters, this one is marked as const because the DeviceProperties class is treated as a view on the physical device — it doesn't change the device state in any way, only queries its properties.

const VkPhysicalDeviceProperties2& Magnum::Vk::DeviceProperties::properties()

Raw device properties.

Populated lazily on first request. If Vulkan 1.1 is not supported and the KHR_get_physical_device_properties2 extension is not enabled on the originating instance, only the Vulkan 1.0 subset of device properties is queried, with the pNext member being nullptr. Otherwise:

Version Magnum::Vk::DeviceProperties::version()

Device version.

Convenience access to properties() internals, populated lazily on first request.

bool Magnum::Vk::DeviceProperties::isVersionSupported(Version version)

Whether given version is supported on the device.

Compares version against version().

DeviceType Magnum::Vk::DeviceProperties::type()

Device type.

Convenience access to properties() internals, populated lazily on first request.

Containers::StringView Magnum::Vk::DeviceProperties::name()

Device name.

Convenience access to properties() internals, populated lazily on first request.

DeviceDriver Magnum::Vk::DeviceProperties::driver()

Driver ID.

Convenience access to properties() internals, populated lazily on first request. Only present if Vulkan 1.2 is supported or the KHR_driver_properties extension is supported by the device, otherwise returns DeviceDriver::Unknown. Note that there might be driver IDs not yet listed in the DeviceDriver enum, moreover drivers are allowed to return unregistered IDs as well.

Version Magnum::Vk::DeviceProperties::driverVersion()

Driver version.

Convenience access to properties() internals, populated lazily on first request.

Containers::StringView Magnum::Vk::DeviceProperties::driverName()

Driver name.

Convenience access to properties() internals, populated lazily on first request. Only present if Vulkan 1.2 is supported or the KHR_driver_properties extension is supported by the device, otherwise returns an empty string.

Containers::StringView Magnum::Vk::DeviceProperties::driverInfo()

Driver info.

Convenience access to properties() internals, populated lazily on first request. Only present if Vulkan 1.2 is supported or the KHR_driver_properties extension is supported by the device, otherwise returns an empty string.

ExtensionProperties Magnum::Vk::DeviceProperties::enumerateExtensionProperties(Containers::ArrayView<const Containers::StringView> layers = {})

Enumerate device extensions.

Parameters
layers Additional layers to list extensions from

Expects that all listed layers are supported — however they don't need to be enabled on the instance.

ExtensionProperties Magnum::Vk::DeviceProperties::enumerateExtensionProperties(std::initializer_list<Containers::StringView> layers)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

const DeviceFeatures& Magnum::Vk::DeviceProperties::features()

Device features.

Populated lazily on first request, extracting the booleans into a more compact set of DeviceFeature values. If Vulkan 1.1 is not supported and the KHR_get_physical_device_properties2 extension is not enabled on the originating instance, only the Vulkan 1.0 subset of device features is queried. Otherwise:

If the KHR_portability_subset is not supported by the device, all features related to it are implicitly marked as supported to simplify portability-aware logic. See Vulkan portability subset for details.

Containers::ArrayView<const VkQueueFamilyProperties2> Magnum::Vk::DeviceProperties::queueFamilyProperties()

Queue family properties.

Populated lazily on first request. If Vulkan 1.1 is not supported and the KHR_get_physical_device_properties2 extension is not enabled on the originating instance, only the Vulkan 1.0 subset of device properties is queried.

UnsignedInt Magnum::Vk::DeviceProperties::queueFamilyCount()

Queue family count.

Convenience access to queueFamilyProperties() internals, populated lazily on first request.

UnsignedInt Magnum::Vk::DeviceProperties::queueFamilySize(UnsignedInt queueFamily)

Queue count in given family.

Parameters
queueFamily Queue family index, expected to be smaller than queueFamilyCount()

Convenience access to queueFamilyProperties() internals, populated lazily on first request.

QueueFlags Magnum::Vk::DeviceProperties::queueFamilyFlags(UnsignedInt queueFamily)

Queue family flags.

Parameters
queueFamily Queue family index, expected to be smaller than queueFamilyCount()

Convenience access to queueFamilyProperties() internals, populated lazily on first request.

UnsignedInt Magnum::Vk::DeviceProperties::pickQueueFamily(QueueFlags flags)

Pick a queue family satisfying given flags.

Returns Queue family index for use in queueFamilySize(), queueFamilyFlags() and DeviceCreateInfo::addQueues()

Queries queue family properties using queueFamilyProperties() and tries to find the first that contains all flags. If it is not found, exits. See tryPickQueueFamily() for an alternative that doesn't exit on failure.

Containers::Optional<UnsignedInt> Magnum::Vk::DeviceProperties::tryPickQueueFamily(QueueFlags flags)

Try to pick a queue family satisfying given flags.

Compared to pickQueueFamily() the function returns Containers::NullOpt if a desired family isn't found instead of exiting.

const VkPhysicalDeviceMemoryProperties2& Magnum::Vk::DeviceProperties::memoryProperties()

Device memory properties.

Populated lazily on first request. If Vulkan 1.1 is not supported and the KHR_get_physical_device_properties2 extension is not enabled on the originating instance, only the Vulkan 1.0 subset of device properties is queried.

UnsignedInt Magnum::Vk::DeviceProperties::memoryHeapCount()

Memory heap count.

Convenience access to memoryProperties() internals, populated lazily on first request.

UnsignedLong Magnum::Vk::DeviceProperties::memoryHeapSize(UnsignedInt heap)

Memory heap size.

Parameters
heap Memory heap index, expected to be smaller than memoryHeapCount()

Convenience access to memoryProperties() internals, populated lazily on first request.

MemoryHeapFlags Magnum::Vk::DeviceProperties::memoryHeapFlags(UnsignedInt heap)

Memory heap size.

Parameters
heap Memory heap index, expected to be smaller than memoryHeapCount()

Convenience access to memoryProperties() internals, populated lazily on first request.

UnsignedInt Magnum::Vk::DeviceProperties::memoryCount()

Memory type count.

Convenience access to memoryProperties() internals, populated lazily on first request.

MemoryFlags Magnum::Vk::DeviceProperties::memoryFlags(UnsignedInt memory)

Memory type flags.

Parameters
memory Memory type index, expected to be smaller than memoryCount()

Convenience access to memoryProperties() internals, populated lazily on first request.

UnsignedInt Magnum::Vk::DeviceProperties::memoryHeapIndex(UnsignedInt memory)

Memory heap index.

Parameters
memory Memory type index, expected to be smaller than memoryCount()
Returns Memory heap index, always smaller than memoryHeapCount()

Convenience access to memoryProperties() internals, populated lazily on first request.

UnsignedInt Magnum::Vk::DeviceProperties::pickMemory(MemoryFlags requiredFlags, MemoryFlags preferredFlags = {}, UnsignedInt memories = ~UnsignedInt{})

Pick a memory type satisfying given flags.

Parameters
requiredFlags Memory flags that should be present in picked memory type. Can be an empty set, but picking such memory is probably not very useful.
preferredFlags If there's more than one memory type matching requiredFlags, prefer one that has most of these as well. Defaults to an empty set.
memories Bits indicating which memory types should be considered (bit 0 indicates memory type 0 should be considered etc.). Expected to have at least one bit of the first memoryCount() bits set, otherwise the function will always fail. Defaults to all bits set, meaning all memory types are considered. Corresponds to MemoryRequirements::memories().

Queries memory properties using memoryProperties() and out of memory types set in memoryBits tries to find one that contains all requiredFlags and most of optionalFlags. If it is not found, exits. See tryPickMemory() for an alternative that doesn't exit on failure.

UnsignedInt Magnum::Vk::DeviceProperties::pickMemory(MemoryFlags requiredFlags, UnsignedInt memories)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Equivalent to calling pickMemory(MemoryFlags, MemoryFlags, UnsignedInt) with empty preferredFlags.

Containers::Optional<UnsignedInt> Magnum::Vk::DeviceProperties::tryPickMemory(MemoryFlags requiredFlags, MemoryFlags preferredFlags = {}, UnsignedInt memories = ~UnsignedInt{})

Try to pick a memory type satisfying given flags.

Compared to pickMemory() the function returns Containers::NullOpt if a desired memory type isn't found instead of exiting.

Containers::Optional<UnsignedInt> Magnum::Vk::DeviceProperties::tryPickMemory(MemoryFlags requiredFlags, UnsignedInt memories)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Equivalent to calling tryPickMemory(MemoryFlags, MemoryFlags, UnsignedInt) with empty preferredFlags.

Debug& operator<<(Debug& debug, DeviceType value) new in Git master

Debug output operator.

Debug& operator<<(Debug& debug, DeviceDriver value) new in Git master

Debug output operator.

Debug& operator<<(Debug& debug, QueueFlag value) new in Git master

Debug output operator.

Debug& operator<<(Debug& debug, QueueFlags value) new in Git master

Debug output operator.

Debug& operator<<(Debug& debug, MemoryHeapFlag value) new in Git master

Debug output operator.

Debug& operator<<(Debug& debug, MemoryHeapFlags value) new in Git master

Debug output operator.

Debug& operator<<(Debug& debug, MemoryFlag value) new in Git master

Debug output operator.

Debug& operator<<(Debug& debug, MemoryFlags value) new in Git master

Debug output operator.