VPP  0.7
A high-level modern C++ API for Vulkan
Public Types | Public Member Functions | List of all members
vpp::PhysicalDevice Class Reference

Represents physical rendering device. More...

#include <vppPhysicalDevice.hpp>

Public Types

enum  EFormatUsage { OPTIMAL_TILING, LINEAR_TILING, BUFFER }
 Enumeration of possible usages for data format. More...
 

Public Member Functions

 PhysicalDevice ()
 Constructs null reference.
 
 PhysicalDevice (VkPhysicalDevice hDevice)
 Constructs device reference from Vulkan device handle.
 
 operator bool () const
 Checks whether this is not a null reference.
 
VkPhysicalDevice handle () const
 Retrieves Vulkan handle for this device.
 
VkPhysicalDeviceProperties getPhysicalDeviceProperties () const
 Retrieves device properties.
 
VkPhysicalDeviceMemoryProperties getMemoryProperties () const
 Retrieves memory properties for this device.
 
size_t queueFamilyCount () const
 Retrieves number of queue families supported by this device.
 
const VkQueueFamilyProperties & getQueueFamilyProperties (size_t iFamily) const
 Retrieves properties for specified queue family.
 
bool supportsSurface (const Surface &surface, size_t iFamily) const
 Checks whether a queue family of this device supports presentation to a given surface.
 
bool supportsFeature (EFeature feature) const
 Checks whether this device supports given feature.
 
void getLimitValuesAsText (std::ostream &sst) const
 Gets textual representation of limits section in device properties. Useful for diagnostic logs.
 
VkFormatFeatureFlags supportsFormat (VkFormat fmt, EFormatUsage u=OPTIMAL_TILING) const
 Checks whether this device supports specified usage of given format. More...
 
bool supportsDepthStencilFormat (VkFormat fmt) const
 Checks whether this device supports specified depth/stencil format.
 

Detailed Description

Represents physical rendering device.

You obtain it from the Instance object, or by providing already known Vulkan physical device handle. In the latter case, PhysicalDevice class does not acquire ownership on the handle.

The PhysicalDevice object has the following purposes:

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

Member Enumeration Documentation

◆ EFormatUsage

Enumeration of possible usages for data format.

Enumerator
OPTIMAL_TILING 

Use the format in optimal tiling images.

LINEAR_TILING 

Use the format in linear tiling images.

BUFFER 

Use the format in texel buffers.

Member Function Documentation

◆ supportsFormat()

VkFormatFeatureFlags vpp::PhysicalDevice::supportsFormat ( VkFormat  fmt,
EFormatUsage  u = OPTIMAL_TILING 
) const

Checks whether this device supports specified usage of given format.

For typical applications, OPTIMAL_TILING is the best choice and largest number of formats support it. The LINEAR_TILING mode can be useful when you generate image contents on CPU. BUFFER is required to use with texel buffers.

Examples:

VkFormatFeatureFlags bFormatFlags1 = hPhysicalDevice.supportsFormat (
VK_FORMAT_R8G8B8_UNORM );
VkFormatFeatureFlags bFormatFlags2 = hPhysicalDevice.supportsFormat (
VK_FORMAT_R8G8B8_UNORM, vpp::PhysicalDevice::LINEAR_TILING );
if ( bFormatFlags2 & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT )
{
// can use linear tiling for storage images in VK_FORMAT_R8G8B8_UNORM format
}

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