NDEVR
API Documentation
VulkanDevice

A GraphicsDevice for managing Vulkan limitations and actions. More...

Inheritance diagram for VulkanDevice:
[legend]
Collaboration diagram for VulkanDevice:
[legend]

Public Member Functions

 VulkanDevice (const DynamicPointer< VulkanInstance > &instance)
 Constructs a Vulkan device that will auto-choose the best physical device.
 VulkanDevice (VkPhysicalDevice physical_device, const DynamicPointer< VulkanInstance > &instance)
 Constructs a Vulkan device for a specific physical device.
 VulkanDevice (VulkanDevice &&instance) noexcept
 Move constructor.
virtual ~VulkanDevice ()
 Destructor.
UUID id () const override
 Returns the unique identifier for this device.
void init () override
 Initializes the graphics device.
const void * initLockPtr () const override
 Returns a pointer used for synchronizing device initialization.
bool isInitialized () const override
 Checks whether the device has been initialized.
bool isValid () const override
 Checks whether this device is valid and usable.
uint04 maxSupportedSamples () const override
 Returns the maximum number of multisample samples supported.
void setDeviceLost ()
 Handles a device-lost event by cleaning up resources.
virtual bool supportsMultiThreading () const override
 Checks whether the device supports multi-threaded rendering.
Public Member Functions inherited from GraphicsDevice
 GraphicsDevice ()
 Default constructor.
virtual ~GraphicsDevice ()
 Destructor.
virtual bool isReady () const
 Checks whether the device is ready for rendering.
virtual bool updateFromLookup () const
 Checks whether the device should update from the design lookup.

Static Public Member Functions

static DynamicPointer< VulkanDevice > & DefaultVulkanDevice ()
 Returns a reference to the global default Vulkan device.

Protected Attributes

Buffer< uint04m_checkouts
 Available checkout IDs.
Dictionary< uint04, VkCommandPool > m_command_pools
 Command pools keyed by thread ID.
Time m_creation_time
 The time this device was created.
VkDevice m_device = nullptr
 The logical Vulkan device handle.
Buffer< Stringm_device_extensions
 Enabled device extensions.
Buffer< Stringm_device_layers
 Enabled device layers.
VkPhysicalDeviceFeatures * m_enabled_features = nullptr
 Features enabled on the logical device.
uint04 m_graphics_family_index = Constant<uint04>::Invalid
 The queue family index for graphics operations.
Dictionary< uint04, VkQueue > m_graphics_queue
 Graphics queues keyed by checkout ID.
Dictionary< uint04, uint04m_graphics_queue_index
 Queue family indices keyed by checkout ID.
UUID m_id
 Unique identifier for this device.
DynamicPointer< VulkanInstancem_instance
 The Vulkan instance this device belongs to.
bool m_is_init = false
 Whether the device has been initialized.
bool m_is_software_rendered = false
 Whether this is a software-rendered device.
LogPtr m_log = nullptr
 Log for device messages.
VkPhysicalDevice m_physical_device = nullptr
 The physical device handle.
VkPhysicalDeviceFeatures * m_physical_features = nullptr
 Cached physical device features.
VkPhysicalDeviceProperties * m_physical_properties = nullptr
 Cached physical device properties.
uint04 m_present_family_index = Constant<uint04>::Invalid
 The queue family index for presentation.
Dictionary< void *, VkQueue > m_present_queue
 Present queues keyed by window handle.
Buffer< VkQueueFamilyProperties > m_queue_families
 Available queue families on the physical device.
VulkanStagingRingm_staging_ring = nullptr
 Staging ring for CPU-to-GPU transfers.
Buffer< VkSurfaceKHR > m_surfaces
 Surfaces registered with this device.
Dictionary< uint04, uint04m_thread_checkouts
 Thread-to-checkout-ID mapping.

Additional Inherited Members

Public Attributes inherited from GraphicsDevice
Resource< bool > can_service_capture_requests
 Whether the device can service image capture requests.
Static Public Attributes inherited from GraphicsDevice
static DynamicPointer< GraphicsDevices_default_graphics_device
 The application-wide default graphics device.

Detailed Description

A GraphicsDevice for managing Vulkan limitations and actions.


See: https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html

Definition at line 13 of file VulkanDevice.h.

Constructor & Destructor Documentation

◆ VulkanDevice() [1/3]

VulkanDevice::VulkanDevice ( VkPhysicalDevice physical_device,
const DynamicPointer< VulkanInstance > & instance )

Constructs a Vulkan device for a specific physical device.

Parameters
[in]physical_deviceThe physical device handle.
[in]instanceThe Vulkan instance.

Referenced by VulkanDevice().

◆ VulkanDevice() [2/3]

VulkanDevice::VulkanDevice ( const DynamicPointer< VulkanInstance > & instance)

Constructs a Vulkan device that will auto-choose the best physical device.

Parameters
[in]instanceThe Vulkan instance.

◆ VulkanDevice() [3/3]

VulkanDevice::VulkanDevice ( VulkanDevice && instance)
noexcept

Move constructor.

Parameters
[in]instanceThe device to move from.

References VulkanDevice().

Member Function Documentation

◆ DefaultVulkanDevice()

DynamicPointer< VulkanDevice > & VulkanDevice::DefaultVulkanDevice ( )
static

Returns a reference to the global default Vulkan device.

Returns
A DynamicPointer to the default device.

Referenced by QtVulkanSession::DefaultSession().

◆ id()

UUID VulkanDevice::id ( ) const
inlineoverridevirtual

Returns the unique identifier for this device.

Returns
The device UUID.

Implements GraphicsDevice.

Definition at line 32 of file VulkanDevice.h.

References m_id.

◆ initLockPtr()

const void * VulkanDevice::initLockPtr ( ) const
overridevirtual

Returns a pointer used for synchronizing device initialization.

Returns
A pointer to the init lock.

Implements GraphicsDevice.

References m_instance.

◆ isInitialized()

bool VulkanDevice::isInitialized ( ) const
inlineoverridevirtual

Checks whether the device has been initialized.

Returns
True if initialized.

Implements GraphicsDevice.

Definition at line 36 of file VulkanDevice.h.

References m_is_init.

◆ isValid()

bool VulkanDevice::isValid ( ) const
overridevirtual

Checks whether this device is valid and usable.

Returns
True if valid.

Implements GraphicsDevice.

◆ maxSupportedSamples()

uint04 VulkanDevice::maxSupportedSamples ( ) const
overridevirtual

Returns the maximum number of multisample samples supported.

Returns
The max sample count.

Implements GraphicsDevice.

◆ supportsMultiThreading()

virtual bool VulkanDevice::supportsMultiThreading ( ) const
inlineoverridevirtual

Checks whether the device supports multi-threaded rendering.

Returns
True if multi-threading is supported.

Reimplemented from GraphicsDevice.

Definition at line 54 of file VulkanDevice.h.


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