Should vkGetInstanceProcAddr() accept null argument for instance parameter?

Started by juha, February 24, 2020, 10:51:25

Previous topic - Next topic


Hello all,

First post here, on a journey to learn Vulkan. I've hit an issue I need some help with.

According to Vulkan spec, the vkGetInstanceProcAddr() should allow a NULL Vulkan instance argument when querying non-instance specific commands:

3.1. Command Function Pointers

PFN_vkVoidFunction vkGetInstanceProcAddr(
    VkInstance                                  instance,
    const char*                                 pName);

instance is the instance that the function pointer will be compatible with, or NULL for commands not dependent on any instance.

I am attempting to query the presence of vkEnumerateInstanceVersion() which was added to Vulkan 1.1 and is not present in Vulkan 1.0.

According to Javadoc:,long)

vkGetInstanceProcAddr behavior

instance                    pName                                          return value
*                           NULL                                          undefined
invalid instance            *                                             undefined
NULL                        EnumerateInstanceVersion                      fp

Also from

Because Vulkan 1.0 implementations may fail with ERROR_INCOMPATIBLE_DRIVER, applications should determine the version of Vulkan available before calling CreateInstance. If the GetInstanceProcAddr returns NULL for EnumerateInstanceVersion, it is a Vulkan 1.0 implementation. Otherwise, the application can call EnumerateInstanceVersion to determine the version of Vulkan.

However, a method call yields a NullPointerException:

 VK10.vkGetInstanceProcAddr(null, "vkEnumerateInstanceVersion");

Exception in thread "main" java.lang.NullPointerException
	at org.lwjgl.vulkan.VK10.nvkGetInstanceProcAddr(
	at org.lwjgl.vulkan.VK10.vkGetInstanceProcAddr(

Presumably due to address() being called on a null instance.

Am I misunderstanding how the API should be used, or should a null argument for instance be allowed, and checked?


One rather unpleasant workaround seems to be to force creation of Vulkan instance at zero address, i.e. NULL handle. This requires turning off some basic LWJGL safety checks:



long eivAddress = VK10.vkGetInstanceProcAddr(
  new VkInstance(

if (eivAddress != VK10.VK_NULL_HANDLE)
  System.err.println(">> NOT VERSION 1.0");


Hey juha,

Thank you for this post, I'm exploring a way to address this.