vpr::PhysicalDevice class

! PhysicalDevice is a wrapper around a VkPhysicalDevice object, which is itself merely a handle representing a Vulkan-compatible hardware device in a user's system.

This class stores the relevant VkPhysicalDeviceProperties, VkPhysicalDeviceFeatures, and VkPhysicalDeviceMemoryProperties that can be freely queried from anywhere in the program. This can/should be used to check for limits on things like texture and buffer size, supported memory types, supported rendering modes, and supported texture types like cubemaps.

Constructors, destructors, conversion operators

PhysicalDevice(const VkInstance& instance_handle)
Automated setup - uses the given instance handle to find the "best" available GPU on a system.

Public functions

auto GetMemoryTypeIdx(const uint32_t& type_bitfield, const VkMemoryPropertyFlags& property_flags, VkBool32* memory_type_found = nullptr) const -> uint32_t noexcept
! Attempts to find the hardware-appropriate index of a memory type that meets the flags given.
auto GetQueueFamilyIndex(const VkQueueFlagBits& bitfield) const -> uint32_t noexcept
! Attempts to find a Queue family that supports the full bitfield given: this can be multiple types, so graphics + compute options or compute + transfer bitfields can be passed to the method.

Function documentation

vpr::PhysicalDevice::PhysicalDevice(const VkInstance& instance_handle)

Automated setup - uses the given instance handle to find the "best" available GPU on a system.

This will prefer dedicated cards first, and uses some other parameters to "score" devices from there.

uint32_t vpr::PhysicalDevice::GetMemoryTypeIdx(const uint32_t& type_bitfield, const VkMemoryPropertyFlags& property_flags, VkBool32* memory_type_found = nullptr) const noexcept

! Attempts to find the hardware-appropriate index of a memory type that meets the flags given.

Parameters
type_bitfield - the memoryTypeBits field of a VkMemoryRequirements struct, retrieved from a vkGetImageMemoryRequirements/vkGetBufferMemoryRequirements call.
property_flags - the type of memory requested by the user, commonly device-local or host-coherent memory.
memory_type_found
Returns Index of the requested memory type on success, std::numeric_limits<uint32_t>::max() on failure.

uint32_t vpr::PhysicalDevice::GetQueueFamilyIndex(const VkQueueFlagBits& bitfield) const noexcept

! Attempts to find a Queue family that supports the full bitfield given: this can be multiple types, so graphics + compute options or compute + transfer bitfields can be passed to the method.

Returns Index of the queue meeting all of the flags specified, or std::numeric_limits<uint32_t>::max() on failure.