VPP  0.7
A high-level modern C++ API for Vulkan
vppPhysicalDevice.hpp
1 /*
2  Copyright 2016-2018 SOFT-ERG, Przemek Kuczmierczyk (www.softerg.com)
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 // -----------------------------------------------------------------------------
28 namespace vpp {
29 // -----------------------------------------------------------------------------
30 
39 {
40  fRobustBufferAccess,
41  fFullDrawIndexUint32,
42  fImageCubeArray,
43  fIndependentBlend,
44  fGeometryShader,
45  fTessellationShader,
46  fSampleRateShading,
47  fDualSrcBlend,
48  fLogicOp,
49  fMultiDrawIndirect,
50  fDrawIndirectFirstInstance,
51  fDepthClamp,
52  fDepthBiasClamp,
53  fFillModeNonSolid,
54  fDepthBounds,
55  fWideLines,
56  fLargePoints,
57  fAlphaToOne,
58  fMultiViewport,
59  fSamplerAnisotropy,
60  fTextureCompressionETC2,
61  fTextureCompressionASTC_LDR,
62  fTextureCompressionBC,
63  fOcclusionQueryPrecise,
64  fPipelineStatisticsQuery,
65  fVertexPipelineStoresAndAtomics,
66  fFragmentStoresAndAtomics,
67  fShaderTessellationAndGeometryPointSize,
68  fShaderImageGatherExtended,
69  fShaderStorageImageExtendedFormats,
70  fShaderStorageImageMultisample,
71  fShaderStorageImageReadWithoutFormat,
72  fShaderStorageImageWriteWithoutFormat,
73  fShaderUniformBufferArrayDynamicIndexing,
74  fShaderSampledImageArrayDynamicIndexing,
75  fShaderStorageBufferArrayDynamicIndexing,
76  fShaderStorageImageArrayDynamicIndexing,
77  fShaderClipDistance,
78  fShaderCullDistance,
79  fShaderFloat64,
80  fShaderInt64,
81  fShaderInt16,
82  fShaderResourceResidency,
83  fShaderResourceMinLod,
84  fSparseBinding,
85  fSparseResidencyBuffer,
86  fSparseResidencyImage2D,
87  fSparseResidencyImage3D,
88  fSparseResidency2Samples,
89  fSparseResidency4Samples,
90  fSparseResidency8Samples,
91  fSparseResidency16Samples,
92  fSparseResidencyAliased,
93  fVariableMultisampleRate,
94  fInheritedQueries
95 };
96 
97 // -----------------------------------------------------------------------------
98 
115 {
116 public:
118  PhysicalDevice();
119 
121  PhysicalDevice ( VkPhysicalDevice hDevice );
122 
124  operator bool() const;
125 
127  VkPhysicalDevice handle() const;
128 
130  VkPhysicalDeviceProperties getPhysicalDeviceProperties() const;
131 
133  VkPhysicalDeviceMemoryProperties getMemoryProperties() const;
134 
136  size_t queueFamilyCount() const;
137 
139  const VkQueueFamilyProperties& getQueueFamilyProperties ( size_t iFamily ) const;
140 
142  bool supportsSurface ( const Surface& surface, size_t iFamily ) const;
143 
145  bool supportsFeature ( EFeature feature ) const;
146 
148  void getLimitValuesAsText ( std::ostream& sst ) const;
149 
155  {
159  };
160 
184  VkFormatFeatureFlags supportsFormat ( VkFormat fmt, EFormatUsage u = OPTIMAL_TILING ) const;
185 
187  bool supportsDepthStencilFormat ( VkFormat fmt ) const;
188 };
189 
190 // -----------------------------------------------------------------------------
191 
196 typedef std::vector< PhysicalDevice > PhysicalDevices;
197 
198 // -----------------------------------------------------------------------------
199 // -----------------------------------------------------------------------------
200 
214 class DeviceFeatures : public VkPhysicalDeviceFeatures
215 {
216 public:
218  DeviceFeatures ( const PhysicalDevice& hPhysDevice );
219 
224  bool enableIfSupported ( EFeature feature );
225 
227  bool isSupported ( EFeature feature ) const;
228 };
229 
230 // -----------------------------------------------------------------------------
231 } // namespace vpp
232 // -----------------------------------------------------------------------------
233 
234 
bool enableIfSupported(EFeature feature)
Enables specified feature, if supported by the device.
bool supportsSurface(const Surface &surface, size_t iFamily) const
Checks whether a queue family of this device supports presentation to a given surface.
VkPhysicalDeviceMemoryProperties getMemoryProperties() const
Retrieves memory properties for this device.
VkFormatFeatureFlags supportsFormat(VkFormat fmt, EFormatUsage u=OPTIMAL_TILING) const
Checks whether this device supports specified usage of given format.
VkPhysicalDeviceProperties getPhysicalDeviceProperties() const
Retrieves device properties.
The VPP namespace.
Definition: main.hpp:1
const VkQueueFamilyProperties & getQueueFamilyProperties(size_t iFamily) const
Retrieves properties for specified queue family.
Represents a surface visible on the screen.
Definition: vppSurface.hpp:59
bool supportsFeature(EFeature feature) const
Checks whether this device supports given feature.
bool supportsDepthStencilFormat(VkFormat fmt) const
Checks whether this device supports specified depth/stencil format.
void getLimitValuesAsText(std::ostream &sst) const
Gets textual representation of limits section in device properties. Useful for diagnostic logs...
Utility class for dealing with device feature lists.
Definition: vppPhysicalDevice.hpp:214
Represents physical rendering device.
Definition: vppPhysicalDevice.hpp:114
Use the format in texel buffers.
Definition: vppPhysicalDevice.hpp:158
size_t queueFamilyCount() const
Retrieves number of queue families supported by this device.
bool isSupported(EFeature feature) const
Checks whether the device supports given feature.
Use the format in optimal tiling images.
Definition: vppPhysicalDevice.hpp:156
EFormatUsage
Enumeration of possible usages for data format.
Definition: vppPhysicalDevice.hpp:154
PhysicalDevice()
Constructs null reference.
DeviceFeatures(const PhysicalDevice &hPhysDevice)
Constructs the feature list for specified device.
std::vector< PhysicalDevice > PhysicalDevices
Array of physical devices.
Definition: vppPhysicalDevice.hpp:196
EFeature
Optional device feature enumeration.
Definition: vppPhysicalDevice.hpp:38
VkPhysicalDevice handle() const
Retrieves Vulkan handle for this device.
Use the format in linear tiling images.
Definition: vppPhysicalDevice.hpp:157