From e2ebfd58c6cfbafbee172093b22e06867e1c3fe6 Mon Sep 17 00:00:00 2001 From: Mark Young Date: Tue, 28 Feb 2017 09:58:04 -0700 Subject: vulkan: update to header 1.0.42 Updated all necessary files to 1.0.42. This includes the various headers as well as the loader, and the parameter validation, object tracking, and threading layers. Additionally, bump all layer JSON files to 1.0.42. Also, in this change: - Enable loader extension automation so that the loader now generates all extension entry-points automatically during build to reduce likelihood of missing a critical piece on header update. - Enable layer dispatch table extension automation for the same reason. - Fixes from Mark Lobodzinski and Tony Barbour to resolve crash in loader when working with Intel's Windows driver due to GetInstanceProcAddr getting called on inappropriate command names. Change-Id: Ic18d3fac2e145c386c0192031deb5089c91a00d8 --- loader/loader.h | 188 ++++++++------------------------------------------------ 1 file changed, 25 insertions(+), 163 deletions(-) (limited to 'loader/loader.h') diff --git a/loader/loader.h b/loader/loader.h index 9a4fd8fc..417588ea 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -32,9 +32,9 @@ #include "vk_loader_platform.h" #include "vk_loader_layer.h" #include - #include #include +#include "vk_loader_extensions.h" #if defined(__GNUC__) && __GNUC__ >= 4 #define LOADER_EXPORT __attribute__((visibility("default"))) @@ -189,121 +189,29 @@ struct loader_device { struct loader_device *next; }; -/* per ICD structure */ +// Per ICD information + +// Per ICD structure struct loader_icd_term { // pointers to find other structs const struct loader_scanned_icd *scanned_icd; const struct loader_instance *this_instance; struct loader_device *logical_device_list; VkInstance instance; // instance object from the icd - PFN_vkGetDeviceProcAddr GetDeviceProcAddr; - PFN_vkDestroyInstance DestroyInstance; - PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; - PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures; - PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties; - PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties; - PFN_vkCreateDevice CreateDevice; - PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties; - PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties; - PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties; - PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; - PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties; - // WSI extensions - PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR; - PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR; - PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR; - PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR; -#ifdef VK_USE_PLATFORM_WIN32_KHR - PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR; - PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR GetPhysicalDeviceWin32PresentationSupportKHR; -#endif -#ifdef VK_USE_PLATFORM_MIR_KHR - PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR; - PFN_vkGetPhysicalDeviceMirPresentationSupportKHR GetPhysicalDeviceMirPresentationSupportKHR; -#endif -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR; - PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR GetPhysicalDeviceWaylandPresentationSupportKHR; -#endif -#ifdef VK_USE_PLATFORM_XCB_KHR - PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR; - PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR; -#endif -#ifdef VK_USE_PLATFORM_XLIB_KHR - PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR; - PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR; -#endif - PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR; - PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR; - PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR; - PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR; - PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR; - PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR; - PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR; - PFN_vkDestroySurfaceKHR DestroySurfaceKHR; - PFN_vkCreateSwapchainKHR CreateSwapchainKHR; - PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR; - - // KHR_get_physical_device_properties2 - PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysicalDeviceFeatures2KHR; - PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR; - PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysicalDeviceFormatProperties2KHR; - PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysicalDeviceImageFormatProperties2KHR; - PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysicalDeviceQueueFamilyProperties2KHR; - PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysicalDeviceMemoryProperties2KHR; - PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysicalDeviceSparseImageFormatProperties2KHR; - -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT - // EXT_acquire_xlib_display - PFN_vkAcquireXlibDisplayEXT AcquireXlibDisplayEXT; - PFN_vkGetRandROutputDisplayEXT GetRandROutputDisplayEXT; -#endif - - // EXT_debug_report - PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT; - PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT; - PFN_vkDebugReportMessageEXT DebugReportMessageEXT; - - // EXT_debug_marker (items needing a trampoline/terminator) - PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT; - PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT; - - // EXT_direct_mode_display - PFN_vkReleaseDisplayEXT ReleaseDisplayEXT; - - // EXT_display_surface_counter - PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT GetPhysicalDeviceSurfaceCapabilities2EXT; - - // NV_external_memory_capabilities - PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV GetPhysicalDeviceExternalImageFormatPropertiesNV; - - // NVX_device_generated_commands - PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX GetPhysicalDeviceGeneratedCommandsPropertiesNVX; + struct loader_icd_term_dispatch dispatch; struct loader_icd_term *next; PFN_PhysDevExt phys_dev_ext[MAX_NUM_UNKNOWN_EXTS]; }; -// per ICD library structure +// Per ICD library structure struct loader_icd_tramp_list { size_t capacity; uint32_t count; struct loader_scanned_icd *scanned_list; }; -union loader_instance_extension_enables { - struct { - uint8_t khr_get_physical_device_properties2 : 1; - uint8_t ext_acquire_xlib_display : 1; - uint8_t ext_debug_report : 1; - uint8_t ext_direct_mode_display : 1; - uint8_t ext_display_surface_counter : 1; - uint8_t nv_external_memory_capabilities : 1; - }; - uint64_t padding[4]; -}; - struct loader_instance_dispatch_table { VkLayerInstanceDispatchTable layer_inst_disp; // must be first entry in structure @@ -311,7 +219,7 @@ struct loader_instance_dispatch_table { PFN_PhysDevExt phys_dev_ext[MAX_NUM_UNKNOWN_EXTS]; }; -// per instance structure +// Per instance structure struct loader_instance { struct loader_instance_dispatch_table *disp; // must be first entry in structure @@ -369,27 +277,27 @@ struct loader_instance { bool wsi_display_enabled; }; -/* VkPhysicalDevice requires special treatment by loader. Firstly, terminator - * code must be able to get the struct loader_icd_term to call into the proper - * driver (multiple ICD/gpu case). This can be accomplished by wrapping the - * created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices(). - * Secondly, the loader must be able to handle wrapped by layer VkPhysicalDevice - * in trampoline code. This implies, that the loader trampoline code must also - * wrap the VkPhysicalDevice object in trampoline code. Thus, loader has to - * wrap the VkPhysicalDevice created object twice. In trampoline code it can't - * rely on the terminator object wrapping since a layer may also wrap. Since - * trampoline code wraps the VkPhysicalDevice this means all loader trampoline - * code that passes a VkPhysicalDevice should unwrap it. */ - -/* per enumerated PhysicalDevice structure, used to wrap in trampoline code and - also same structure used to wrap in terminator code */ +// VkPhysicalDevice requires special treatment by loader. Firstly, terminator +// code must be able to get the struct loader_icd_term to call into the proper +// driver (multiple ICD/gpu case). This can be accomplished by wrapping the +// created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices(). +// Secondly, the loader must be able to handle wrapped by layer VkPhysicalDevice +// in trampoline code. This implies, that the loader trampoline code must also +// wrap the VkPhysicalDevice object in trampoline code. Thus, loader has to +// wrap the VkPhysicalDevice created object twice. In trampoline code it can't +// rely on the terminator object wrapping since a layer may also wrap. Since +// trampoline code wraps the VkPhysicalDevice this means all loader trampoline +// code that passes a VkPhysicalDevice should unwrap it. + +// Per enumerated PhysicalDevice structure, used to wrap in trampoline code and +// also same structure used to wrap in terminator code struct loader_physical_device_tramp { struct loader_instance_dispatch_table *disp; // must be first entry in structure struct loader_instance *this_instance; VkPhysicalDevice phys_dev; // object from layers/loader terminator }; -/* per enumerated PhysicalDevice structure, used to wrap in terminator code */ +// Per enumerated PhysicalDevice structure, used to wrap in terminator code struct loader_physical_device_term { struct loader_instance_dispatch_table *disp; // must be first entry in structure struct loader_icd_term *this_icd_term; @@ -445,13 +353,12 @@ static inline void loader_init_dispatch(void *obj, const void *data) { loader_set_dispatch(obj, data); } -/* global variables used across files */ +// Global variables used across files extern struct loader_struct loader; extern THREAD_LOCAL_DECL struct loader_instance *tls_instance; extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_init); extern loader_platform_thread_mutex loader_lock; extern loader_platform_thread_mutex loader_json_lock; -extern const VkLayerInstanceDispatchTable instance_disp; extern const char *std_validation_str; struct loader_msg_callback_map_entry { @@ -459,7 +366,7 @@ struct loader_msg_callback_map_entry { VkDebugReportCallbackEXT loader_obj; }; -/* helper function definitions */ +// Helper function definitions void *loader_instance_heap_alloc(const struct loader_instance *instance, size_t size, VkSystemAllocationScope allocationScope); void loader_instance_heap_free(const struct loader_instance *instance, void *pMemory); void *loader_instance_heap_realloc(const struct loader_instance *instance, void *pMemory, size_t orig_size, size_t size, @@ -563,51 +470,6 @@ VkResult loader_validate_device_extensions(struct loader_physical_device_tramp * VkResult setupLoaderTrampPhysDevs(VkInstance instance); VkResult setupLoaderTermPhysDevs(struct loader_instance *inst); -/* instance layer chain termination entrypoint definitions */ -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkInstance *pInstance); - -VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, - VkPhysicalDevice *pPhysicalDevices); - -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, - VkPhysicalDeviceFeatures *pFeatures); - -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, - VkFormatProperties *pFormatInfo); - -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, - VkImageType type, VkImageTiling tiling, - VkImageUsageFlags usage, VkImageCreateFlags flags, - VkImageFormatProperties *pImageFormatProperties); - -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, - VkImageType type, VkSampleCountFlagBits samples, - VkImageUsageFlags usage, VkImageTiling tiling, - uint32_t *pNumProperties, - VkSparseImageFormatProperties *pProperties); - -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties *pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, - const char *pLayerName, uint32_t *pCount, - VkExtensionProperties *pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, - VkLayerProperties *pProperties); - -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, - VkQueueFamilyProperties *pProperties); - -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties *pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDevice *pDevice); - VkStringErrorFlags vk_string_validate(const int max_length, const char *char_array); -#endif /* LOADER_H */ +#endif // LOADER_H -- cgit v1.2.3