Add a loader features interface

This is needed to tell a layer if the loader is sorting physical
devices, but it should be generalized so that other loader features
could be marked in the future.
This commit is contained in:
Lenny Komow 2020-07-30 18:05:12 -06:00
parent 471a35d21d
commit 8446db62f1

View File

@ -83,7 +83,8 @@ typedef VkResult(VKAPI_PTR *PFN_PhysDevExt)(VkPhysicalDevice phys_device);
typedef enum VkLayerFunction_ { typedef enum VkLayerFunction_ {
VK_LAYER_LINK_INFO = 0, VK_LAYER_LINK_INFO = 0,
VK_LOADER_DATA_CALLBACK = 1, VK_LOADER_DATA_CALLBACK = 1,
VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK = 2 VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK = 2,
VK_LOADER_FEATURES = 3,
} VkLayerFunction; } VkLayerFunction;
typedef struct VkLayerInstanceLink_ { typedef struct VkLayerInstanceLink_ {
@ -111,6 +112,12 @@ typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device,
typedef VkResult (VKAPI_PTR *PFN_vkLayerCreateDevice)(VkInstance instance, VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, typedef VkResult (VKAPI_PTR *PFN_vkLayerCreateDevice)(VkInstance instance, VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, PFN_vkGetInstanceProcAddr layerGIPA, PFN_vkGetDeviceProcAddr *nextGDPA); const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, PFN_vkGetInstanceProcAddr layerGIPA, PFN_vkGetDeviceProcAddr *nextGDPA);
typedef void (VKAPI_PTR *PFN_vkLayerDestroyDevice)(VkDevice physicalDevice, const VkAllocationCallbacks *pAllocator, PFN_vkDestroyDevice destroyFunction); typedef void (VKAPI_PTR *PFN_vkLayerDestroyDevice)(VkDevice physicalDevice, const VkAllocationCallbacks *pAllocator, PFN_vkDestroyDevice destroyFunction);
typedef enum VkLoaderFeastureFlagBits {
VK_LOADER_FEATURE_PHYSICAL_DEVICE_SORTING = 0x00000001,
} VkLoaderFlagBits;
typedef VkFlags VkLoaderFeatureFlags;
typedef struct { typedef struct {
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
const void *pNext; const void *pNext;
@ -119,9 +126,10 @@ typedef struct {
VkLayerInstanceLink *pLayerInfo; VkLayerInstanceLink *pLayerInfo;
PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData; PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
struct { struct {
PFN_vkLayerCreateDevice pfnLayerCreateDevice; PFN_vkLayerCreateDevice pfnLayerCreateDevice;
PFN_vkLayerDestroyDevice pfnLayerDestroyDevice; PFN_vkLayerDestroyDevice pfnLayerDestroyDevice;
} layerDevice; } layerDevice;
VkLoaderFeatureFlags loaderFeatures;
} u; } u;
} VkLayerInstanceCreateInfo; } VkLayerInstanceCreateInfo;