HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VE_PhysicalDevice Class Reference

#include <VE_PhysicalDevice.h>

Public Member Functions

VkPhysicalDevice getVkPhysicalDevice () const
 
const VkPhysicalDevicePropertiesproperties () const
 
const
VkPhysicalDeviceIDProperties
idProperties () const
 
const
VE_PhysicalDeviceFeatureChain
features () const
 
bool extensionAvailable (const char *name) const
 
bool extensionAvailable (VE_DeviceExtension ext) const
 
const UT_Array
< VkQueueFamilyProperties > & 
queueFamiltyProperties () const
 
const
VkPhysicalDeviceMemoryProperties
memoryProperties () const
 
void printInfo () const
 
UT_Optional< uint32_t > findMemoryTypeIndex (uint32_t memory_type_bits, VkMemoryPropertyFlags required_properties) const
 
UT_Optional< uint32_t > findMemoryTypeIndex (VkMemoryPropertyFlags flags) const
 
const UT_ArrayStringSetavailableExtensions () const
 
UT_Optional< uint32_t > findQueueFamilyIndex (VkQueueFlags flags) const
 
VkFormatProperties formatProperties (const VkFormat format) const
 
VE_Result
< VkImageFormatProperties2
imageFormatProperties (const VkImageCreateInfo &info) const
 
 VE_PhysicalDevice ()=default
 

Static Public Member Functions

static VE_Result
< VE_PhysicalDevice
create (VkPhysicalDevice)
 
static VE_Result< UT_Array
< VE_PhysicalDevice > > 
findAll (VkInstance instance)
 

Detailed Description

A wrapper around a VkPhysicalDevice object that also contains useful information about that physical device. Due to caching information from the driver, this object is rather hefty. Consider allocating it on the heap.

Definition at line 92 of file VE_PhysicalDevice.h.

Constructor & Destructor Documentation

VE_PhysicalDevice::VE_PhysicalDevice ( )
default

Member Function Documentation

const UT_ArrayStringSet& VE_PhysicalDevice::availableExtensions ( ) const
inline

Definition at line 167 of file VE_PhysicalDevice.h.

static VE_Result<VE_PhysicalDevice> VE_PhysicalDevice::create ( VkPhysicalDevice  )
static
bool VE_PhysicalDevice::extensionAvailable ( const char *  name) const
bool VE_PhysicalDevice::extensionAvailable ( VE_DeviceExtension  ext) const
const VE_PhysicalDeviceFeatureChain& VE_PhysicalDevice::features ( ) const
inline

Definition at line 111 of file VE_PhysicalDevice.h.

static VE_Result<UT_Array<VE_PhysicalDevice> > VE_PhysicalDevice::findAll ( VkInstance  instance)
static
UT_Optional<uint32_t> VE_PhysicalDevice::findMemoryTypeIndex ( uint32_t  memory_type_bits,
VkMemoryPropertyFlags  required_properties 
) const

Methods for retrieving a memory type index.

Vulkan resources can be created before any memory is actually allocated for them. This memory-less resource handle acts as a kind of meta-data object. One of the reasons for this is so the memory requirements for the resource can be queried before the resource is actually allocated, allowing us to merge the resources requirements with the applications needs and preferences.

The resource's requirements are expressed as memory type bits. The applications requirements or preferences are expressed as VkMemoryPropertyFlags. You can pass both of these to these new methods to retrieve the actually memory type index, which is all you need to actually allocate the memory.

Usage:

VkMemoryRequirements reqs;

vkGetBufferMemoryRequirements(device, buffer, &reqs);

uint32_t memory_type_index;

auto r = physical_device.findMemoryTypeIndex(reqs.memoryTypeBits,
        preferred_flags | required_flags);
if (!r)
    r = physical_device.findMemoryTypeIndex(reqs.memoryTypeBits,
        required_flags);

memory_type_index = *r;
UT_Optional<uint32_t> VE_PhysicalDevice::findMemoryTypeIndex ( VkMemoryPropertyFlags  flags) const

Returns the memory type index satisfying the given flags, or none. This is equivalent to the above call with memory_type_bits == 0xFFFFFFFF

UT_Optional<uint32_t> VE_PhysicalDevice::findQueueFamilyIndex ( VkQueueFlags  flags) const
VkFormatProperties VE_PhysicalDevice::formatProperties ( const VkFormat  format) const
VkPhysicalDevice VE_PhysicalDevice::getVkPhysicalDevice ( ) const
inline

Definition at line 99 of file VE_PhysicalDevice.h.

const VkPhysicalDeviceIDProperties& VE_PhysicalDevice::idProperties ( ) const
inline

Definition at line 106 of file VE_PhysicalDevice.h.

VE_Result<VkImageFormatProperties2> VE_PhysicalDevice::imageFormatProperties ( const VkImageCreateInfo info) const
const VkPhysicalDeviceMemoryProperties& VE_PhysicalDevice::memoryProperties ( ) const
inline

Definition at line 121 of file VE_PhysicalDevice.h.

void VE_PhysicalDevice::printInfo ( ) const
const VkPhysicalDeviceProperties& VE_PhysicalDevice::properties ( ) const
inline

Definition at line 101 of file VE_PhysicalDevice.h.

const UT_Array<VkQueueFamilyProperties>& VE_PhysicalDevice::queueFamiltyProperties ( ) const
inline

Definition at line 116 of file VE_PhysicalDevice.h.


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