@@ -478,6 +478,41 @@ void loader_remove_instance_only_debug_funcs(struct loader_instance *ptr_instanc
478478 }
479479}
480480
481+ // Dump the app's VkInstanceCreateInfo under VK_LOADER_DEBUG (names, versions, requested layers/extensions). Handy
482+ // for debugging instance setup and matching driver workarounds to a specific app.
483+ static void loader_log_instance_create_info (const struct loader_instance * inst , const VkInstanceCreateInfo * pCreateInfo ) {
484+ const VkApplicationInfo * app_info = pCreateInfo -> pApplicationInfo ;
485+ const char * app_name = (app_info && app_info -> pApplicationName ) ? app_info -> pApplicationName : "" ;
486+ const char * engine_name = (app_info && app_info -> pEngineName ) ? app_info -> pEngineName : "" ;
487+ uint32_t app_version = app_info ? app_info -> applicationVersion : 0 ;
488+ uint32_t engine_version = app_info ? app_info -> engineVersion : 0 ;
489+ uint32_t api_version = app_info ? app_info -> apiVersion : 0 ;
490+
491+ loader_log (inst , VULKAN_LOADER_INFO_BIT , 0 ,
492+ "vkCreateInstance: applicationName: \"%s\", applicationVersion: %u, engineName: \"%s\", engineVersion: %u, "
493+ "apiVersion: %u.%u.%u" ,
494+ app_name , app_version , engine_name , engine_version , VK_API_VERSION_MAJOR (api_version ),
495+ VK_API_VERSION_MINOR (api_version ), VK_API_VERSION_PATCH (api_version ));
496+
497+ // Guard the name arrays: this runs before the loader validates pCreateInfo, so the count may be non-zero with a null
498+ // array (see the null-pointer tests).
499+ loader_log (inst , VULKAN_LOADER_INFO_BIT , 0 ,
500+ "vkCreateInstance: Requested %u instance layer(s):" , pCreateInfo -> enabledLayerCount );
501+ if (pCreateInfo -> ppEnabledLayerNames ) {
502+ for (uint32_t i = 0 ; i < pCreateInfo -> enabledLayerCount ; ++ i ) {
503+ loader_log (inst , VULKAN_LOADER_INFO_BIT , 0 , " %s" , pCreateInfo -> ppEnabledLayerNames [i ]);
504+ }
505+ }
506+
507+ loader_log (inst , VULKAN_LOADER_INFO_BIT , 0 ,
508+ "vkCreateInstance: Requested %u instance extension(s):" , pCreateInfo -> enabledExtensionCount );
509+ if (pCreateInfo -> ppEnabledExtensionNames ) {
510+ for (uint32_t i = 0 ; i < pCreateInfo -> enabledExtensionCount ; ++ i ) {
511+ loader_log (inst , VULKAN_LOADER_INFO_BIT , 0 , " %s" , pCreateInfo -> ppEnabledExtensionNames [i ]);
512+ }
513+ }
514+ }
515+
481516LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance (const VkInstanceCreateInfo * pCreateInfo ,
482517 const VkAllocationCallbacks * pAllocator , VkInstance * pInstance ) {
483518 struct loader_instance * ptr_instance = NULL ;
@@ -543,6 +578,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr
543578 goto out ;
544579 }
545580
581+ loader_log_instance_create_info (ptr_instance , pCreateInfo );
582+
546583 VkResult settings_file_res = get_loader_settings (ptr_instance , & ptr_instance -> settings );
547584 if (settings_file_res == VK_ERROR_OUT_OF_HOST_MEMORY ) {
548585 res = settings_file_res ;
0 commit comments