VPP  0.8
A high-level modern C++ API for Vulkan
vpp::Device Class Reference

Represents logical rendering device. More...

#include <vppDevice.hpp>

Public Member Functions

 Device ()
 Constructs null reference.
 
 Device (const PhysicalDevice &hPhysicalDevice)
 Constructs logical device from physical device with default features.
 
 Device (const PhysicalDevice &hPhysicalDevice, const VkPhysicalDeviceFeatures &features)
 Constructs logical device from physical device with specified features. More...
 
 Device (const PhysicalDevice &hPhysicalDevice, const std::vector< float > &queuePriorities)
 Constructs logical device from physical device with specified queue priorities.
 
 Device (const PhysicalDevice &hPhysicalDevice, const std::vector< float > &queuePriorities, const VkPhysicalDeviceFeatures &features)
 Constructs logical device from physical device with specified queue priorities and features.
 
 ~Device ()
 Decreases reference count. Deletes the device object when count reaches zero.
 
 operator bool () const
 Checks whether this is not a null reference.
 
VkDevice handle () const
 Retrieves Vulkan handle for this device.
 
const PhysicalDevicephysical () const
 Retrieves parent physical device for this logical device.
 
unsigned int queueFamily (EQueueType queueType) const
 Retrieves default queue family index for queues of specified type.
 
unsigned int queueCount (EQueueType queueType) const
 Retrieves queue count within default queue family of specified type.
 
float queuePriority (unsigned int iQueue) const
 Retrieves queue priority for specified queue index within default graphics queue family.
 
CommandPooldefaultCmdPool (EQueueType queueType=Q_GRAPHICS) const
 Retrieves default command allocation pool for this device and specified queue type. More...
 
PipelineCachedefaultPipelineCache () const
 Retrieves default pipeline cache for this device. More...
 
bool hasFeature (EFeature feature) const
 Checks whether the device supports specified feature and has enabled it.
 
const std::set< std::string > & enabledExtensions () const
 Retrieves the names of enabled device extensions.
 
bool supportsVersion (const SVulkanVersion &ver) const
 Checks whether the device (and instance) supports specified Vulkan version.
 
VkResult waitForIdle ()
 Waits until all operations performed by this device are finished.
 

Detailed Description

Represents logical rendering device.

Logical rendering device is the primary interface to rendering. It actually represents a GPU unit in the computer. That is, this is the computation part of the graphic card, excluding the display subsystems like framebuffer and DAC (these are abstracted by Surface class).

Device object is obtained from a PhysicalDevice object.

Device object is required by most VPP class methods and functions.

Also in VPP (unlike core Vulkan) the Device object provides certain default helper objects like CommandPool and PipelineCache.

This object is reference-counted and may be passed by value.

Constructor & Destructor Documentation

◆ Device()

vpp::Device::Device ( const PhysicalDevice hPhysicalDevice,
const VkPhysicalDeviceFeatures &  features 
)

Constructs logical device from physical device with specified features.

Yopu can use DeviceFeatures object here, as it is derived from VkPhysicalDeviceFeatures.

Example:

vpp::PhysicalDevice hPhysicalDevice = ...;
vpp::DeviceFeatures feat ( hPhysicalDevice );
const bool bSupportsDepthBiasClamp = feat.enableIfSupported ( vpp::fDepthBiasClamp );
const bool bSupportsAlphaToOne = feat.enableIfSupported ( vpp::fAlphaToOne );
vpp::Device hDevice ( hPhysicalDevice, feat );

Member Function Documentation

◆ defaultCmdPool()

CommandPool& vpp::Device::defaultCmdPool ( EQueueType  queueType = Q_GRAPHICS) const

Retrieves default command allocation pool for this device and specified queue type.

You can use this pool for convenience, or create your own.

This command pool allows to reset individual command buffer allocated by it (that is, it has VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT set).

Examples:

vpp::Device hDevice = ...;
vpp::CommandPool hGraphicsCmdPool = hDevice.defaultCmdPool();
vpp::CommandPool hTransferCmdPool = hDevice.defaultCmdPool ( vpp::Q_TRANSFER );

◆ defaultPipelineCache()

PipelineCache& vpp::Device::defaultPipelineCache ( ) const

Retrieves default pipeline cache for this device.

You can use this cache for convenience, or create your own.

Example:

vpp::Device hDevice = ...;

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