{"action":"created","issue":{"url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/212","repository_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs","labels_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/212/comments","events_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/212/events","html_url":"https://github.com/KhronosGroup/Vulkan-Docs/issues/212","id":153921770,"number":212,"title":"Chapter 3 - incomplete description of vkGetInstanceProcAddr behavior","user":{"login":"AlessandroBorges","id":10035103,"avatar_url":"https://avatars.githubusercontent.com/u/10035103?v=3","gravatar_id":"","url":"https://api.github.com/users/AlessandroBorges","html_url":"https://github.com/AlessandroBorges","followers_url":"https://api.github.com/users/AlessandroBorges/followers","following_url":"https://api.github.com/users/AlessandroBorges/following{/other_user}","gists_url":"https://api.github.com/users/AlessandroBorges/gists{/gist_id}","starred_url":"https://api.github.com/users/AlessandroBorges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlessandroBorges/subscriptions","organizations_url":"https://api.github.com/users/AlessandroBorges/orgs","repos_url":"https://api.github.com/users/AlessandroBorges/repos","events_url":"https://api.github.com/users/AlessandroBorges/events{/privacy}","received_events_url":"https://api.github.com/users/AlessandroBorges/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-05-10T04:30:02Z","updated_at":"2016-05-12T02:30:06Z","closed_at":null,"body":"At item 3.1, docs says the following: \r\n>**3.1 Command Function Pointers**\r\n\r\n>Vulkan commands are not necessarily exposed statically on a platform. Function pointers for ***all Vulkan commands*** can be obtained with the command:\r\n\r\n>     PFN_vkVoidFunction vkGetInstanceProcAddr(\r\n>                                              VkInstance instance,\r\n>                                              const char* pName);\r\n\r\nBut this is not true.\r\n\r\nExtensions functions like **vkCreateWin32SurfaceKHR** and **VkWin32SurfaceCreateInfoKHR** can be obtained only by static linking or using ***dlsym / GetProcAddress***. There also the Vulkan's loader, but it is optional, I guess.\r\n\r\nThis is confirmed by the following comment at Initialization chapter, in lines 51-66. :\r\n(Note: it is hidden in final docs)\r\n\r\n>(Jon, Bug 14886 / Gitlab issue 4) The WSI group tentatively agreed that the\r\nWSI extensions were special, and should get static entry points in link\r\nlibraries and prototypes in +vulkan.h+, while future extensions would have\r\nto be dynamically loaded. If this decision is upheld by the group as a\r\nwhole, it would probably be encoded in the previous paragraph, in the WSI\r\nextensions branch of the Specification.\r\n\r\n> However, this decision hasn't been fully signed off on by the entire Vulkan\r\nWG yet AFAIK. Note that implementations typically won't support many of the\r\nWSI extensions, so ``static entry points'' doesn't relieve apps of the\r\nneccessity of runtime enabling and testing of each extension before using\r\nit.\r\n\r\nSo I would ask you to update the document about vkGetInstanceProcAddr, to reflect the pointed limitation when loading some extension functions.\r\n"},"comment":{"url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/comments/218643754","html_url":"https://github.com/KhronosGroup/Vulkan-Docs/issues/212#issuecomment-218643754","issue_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/212","id":218643754,"user":{"login":"AlessandroBorges","id":10035103,"avatar_url":"https://avatars.githubusercontent.com/u/10035103?v=3","gravatar_id":"","url":"https://api.github.com/users/AlessandroBorges","html_url":"https://github.com/AlessandroBorges","followers_url":"https://api.github.com/users/AlessandroBorges/followers","following_url":"https://api.github.com/users/AlessandroBorges/following{/other_user}","gists_url":"https://api.github.com/users/AlessandroBorges/gists{/gist_id}","starred_url":"https://api.github.com/users/AlessandroBorges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlessandroBorges/subscriptions","organizations_url":"https://api.github.com/users/AlessandroBorges/orgs","repos_url":"https://api.github.com/users/AlessandroBorges/repos","events_url":"https://api.github.com/users/AlessandroBorges/events{/privacy}","received_events_url":"https://api.github.com/users/AlessandroBorges/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T02:30:05Z","updated_at":"2016-05-12T02:30:05Z","body":"Gentleman, \r\n\r\nI think I got the problem.\r\nFirst of all, Vulkan docs really need a clarification, because it is not obvious or implicit.\r\n\r\nExtension functions are only available through  vkGetInstanceProcAddr() **if and only if** the corresponding extension name is included at VkInstanceCreateInfo.ppEnabledExtensionNames, at VkInstance creation time.\r\n\r\nBUT If programmer, by chance, put an extension name not supported in VkInstanceCreateInfo.ppEnabledExtensionNames, the VkInstance creation will fail with error VkResult::VK_ERROR_EXTENSION_NOT_PRESENT. Same happens when requesting a not available layer, but with  VK_ERROR_LAYER_NOT_PRESENT error;\r\n\r\nNote we have two pitfalls: not enabling an available  extension leads to  null function address; and requesting an unsupported extension/layer leads to an error when create VkInstance.\r\n\r\nSuggestions:\r\n1) at vkGetInstanceProcAddr() specs, change\r\n\r\n> If pName is not the name of a core Vulkan command, or is an extension command for any extension not supported by any available layer or implementation, then vkGetInstanceProcAddr will return NULL.\r\n\r\nto \r\n\r\n>  vkGetInstanceProcAddr will return NULL in following cases: (i) If pName is not the name of a core Vulkan command; (ii) if pName is an extension command name for any extension not supported by any available layer or implementation; or (iii) if pName is an extension command name from a supported layer or implementation, but which was not enabled throught VkInstanceCreateInfo.ppEnabledExtensionNames at VkInstance creation time.\r\n\r\n2) At item **3.2 Instances** at the following paragraph :\r\n\r\n> If you wish to enable layers or EXT and KHR extension commands, before calling VkCreateInstance() query supported layer names with **vkEnumerateInstanceLayerProperties**, as well supported extensions names through **vkEnumerateInstanceExtensionProperties**. Once you have a list of available layers names, as well a list of supported  extensions names, pick that ones you need and set then at **VkInstanceCreateInfo.ppEnabledLayerNames** and \r\n **VkInstanceCreateInfo.ppEnabledExtensionNames**. \r\n\r\nThanks for your attention and sorry for bad bad english, \r\nA.B.\r\n\r\n"}}