15#include <vsg/core/ref_ptr.h>
16#include <vsg/vk/AllocationCallbacks.h>
17#include <vsg/vk/InstanceExtensions.h>
27 using Names = std::vector<const char*>;
28 using ExtensionProperties = std::vector<VkExtensionProperties>;
29 using PhysicalDeviceTypes = std::vector<VkPhysicalDeviceType>;
30 using InstanceLayerProperties = std::vector<VkLayerProperties>;
33 extern VSG_DECLSPEC ExtensionProperties enumerateInstanceExtensionProperties(
const char* pLayerName =
nullptr);
36 extern VSG_DECLSPEC
bool isExtensionSupported(
const char* extensionName,
const char* pLayerName =
nullptr);
39 extern VSG_DECLSPEC InstanceLayerProperties enumerateInstanceLayerProperties();
42 extern VSG_DECLSPEC Names validateInstancelayerNames(
const Names& names);
48 Instance(Names instanceExtensions, Names layers, uint32_t vulkanApiVersion = VK_API_VERSION_1_0,
AllocationCallbacks* allocator =
nullptr);
51 const uint32_t apiVersion = VK_API_VERSION_1_0;
53 operator VkInstance()
const {
return _instance; }
54 VkInstance vk()
const {
return _instance; }
56 AllocationCallbacks* getAllocationCallbacks() {
return _allocator.get(); }
57 const AllocationCallbacks* getAllocationCallbacks()
const {
return _allocator.get(); }
59 using PhysicalDevices = std::vector<ref_ptr<PhysicalDevice>>;
60 PhysicalDevices& getPhysicalDevices() {
return _physicalDevices; }
61 const PhysicalDevices& getPhysicalDevices()
const {
return _physicalDevices; }
80 bool getProcAddr(T& procAddress,
const char* pName,
const char* pNameFallback =
nullptr)
const
82 procAddress =
reinterpret_cast<T
>(vkGetInstanceProcAddr(_instance, pName));
83 if (procAddress)
return true;
85 if (pNameFallback) procAddress =
reinterpret_cast<T
>(vkGetInstanceProcAddr(_instance, pNameFallback));
95 PhysicalDevices _physicalDevices;
99 VkDebugUtilsMessengerEXT _debugUtilsMessenger = VK_NULL_HANDLE;
Adapter class that provides a means of managing the lifetime of VkAllocationCallbacks.
Definition AllocationCallbacks.h:24
Definition InstanceExtensions.h:24
Instance encapsulates the VkInstance.
Definition Instance.h:46
bool getProcAddr(T &procAddress, const char *pName, const char *pNameFallback=nullptr) const
get the address of specified function using vkGetInstanceProcAddr.
Definition Instance.h:80
ref_ptr< PhysicalDevice > getPhysicalDevice(VkQueueFlags queueFlags, const PhysicalDeviceTypes &deviceTypePreferences={}) const
get a PhysicalDevice that supports the specified queueFlags, and presentation of specified surface if...
ref_ptr< PhysicalDevice > getPhysicalDevice(VkQueueFlags queueFlags, Surface *surface, const PhysicalDeviceTypes &deviceTypePreferences={}) const
get a PhysicalDevice that supports the specified queueFlags, and presentation of specified surface if...
const InstanceExtensions * getExtensions() const
get the extensions structure that holds a range of function pointers to vkInstance extensions
Definition Instance.h:76
std::pair< ref_ptr< PhysicalDevice >, int > getPhysicalDeviceAndQueueFamily(VkQueueFlags queueFlags, const PhysicalDeviceTypes &deviceTypePreferences={}) const
get a PhysicalDevice and queue family index that supports the specified queueFlags,...
std::tuple< ref_ptr< PhysicalDevice >, int, int > getPhysicalDeviceAndQueueFamily(VkQueueFlags queueFlags, Surface *surface, const PhysicalDeviceTypes &deviceTypePreferences={}) const
get a PhysicalDevice and queue family index that supports the specified queueFlags,...
Surface encapsulates VkSurfaceKHR.
Definition Surface.h:22