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:
https://javadoc.lwjgl.org/org/lwjgl/vulkan/VK10.html#nvkGetInstanceProcAddr(org.lwjgl.vulkan.VkInstance,long)vkGetInstanceProcAddr behavior
instance pName return value
---------------------------------------------------------------------------------------------
* NULL undefined
invalid instance * undefined
NULL EnumerateInstanceVersion fp
Also from
https://javadoc.lwjgl.org/org/lwjgl/vulkan/VkApplicationInfo.htmlBecause 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(VK10.java:3322)
at org.lwjgl.vulkan.VK10.vkGetInstanceProcAddr(VK10.java:3461)
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?