15 #include <vsg/core/observer_ptr.h>
16 #include <vsg/vk/Surface.h>
27 operator VkPhysicalDevice()
const {
return _device; }
28 VkPhysicalDevice vk()
const {
return _device; }
30 int getQueueFamily(VkQueueFlags queueFlags)
const;
31 std::pair<int, int> getQueueFamily(VkQueueFlags queueFlags,
Surface* surface)
const;
33 using QueueFamilyProperties = std::vector<VkQueueFamilyProperties>;
34 const QueueFamilyProperties& getQueueFamilyProperties()
const {
return _queueFamilies; }
36 const VkPhysicalDeviceFeatures& getFeatures()
const {
return _features; }
37 const VkPhysicalDeviceProperties& getProperties()
const {
return _properties; }
39 template<
typename FeatureStruct, VkStructureType type>
40 FeatureStruct getFeatures()
const
42 FeatureStruct features = {};
43 features.sType = type;
45 if (_vkGetPhysicalDeviceFeatures2)
47 VkPhysicalDeviceFeatures2 features2 = {};
48 features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
49 features2.pNext = &features;
51 _vkGetPhysicalDeviceFeatures2(_device, &features2);
57 template<
typename PropertiesStruct, VkStructureType type>
58 PropertiesStruct getProperties()
const
60 PropertiesStruct properties = {};
61 properties.sType = type;
63 if (_vkGetPhysicalDeviceProperties2)
65 VkPhysicalDeviceProperties2 properties2 = {};
66 properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
67 properties2.pNext = &properties;
69 _vkGetPhysicalDeviceProperties2(_device, &properties2);
89 VkPhysicalDevice _device;
91 VkPhysicalDeviceFeatures _features;
92 VkPhysicalDeviceProperties _properties;
93 QueueFamilyProperties _queueFamilies;
95 PFN_vkGetPhysicalDeviceFeatures2 _vkGetPhysicalDeviceFeatures2 =
nullptr;
96 PFN_vkGetPhysicalDeviceProperties2 _vkGetPhysicalDeviceProperties2 =
nullptr;
Instance encapsulates the VkInstance.
Definition: Instance.h:43
Definition: PhysicalDevice.h:23
std::vector< VkExtensionProperties > enumerateDeviceExtensionProperties(const char *pLayerName=nullptr)
Call vkEnumerateDeviceExtensionProperties to enumerate extension properties.
bool supportsDeviceExtension(const char *extensionName)
return true if the extension is supported by physicalDevice
Surface encapsulates VkSurfaceKHR.
Definition: Surface.h:22
Definition: observer_ptr.h:24