diff options
author | Jason Ekstrand <[email protected]> | 2018-01-16 16:14:25 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-01-23 00:15:40 -0800 |
commit | a372b9247ddcaa43d13cf8161d2026c239d0bf57 (patch) | |
tree | d3049228fb2f084e6580802320460f3bb3667507 /src/intel | |
parent | cb0d1ba15692648bfa55e56a8f4ba1349a35a829 (diff) |
anv: Properly NULL for GetInstanceProcAddr with a null instance
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 33b2a52a51c..c3a8fbbb4e6 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1063,9 +1063,31 @@ void anv_GetPhysicalDeviceMemoryProperties2KHR( } PFN_vkVoidFunction anv_GetInstanceProcAddr( - VkInstance instance, + VkInstance _instance, const char* pName) { + ANV_FROM_HANDLE(anv_instance, instance, _instance); + + /* The Vulkan 1.0 spec for vkGetInstanceProcAddr has a table of exactly + * when we have to return valid function pointers, NULL, or it's left + * undefined. See the table for exact details. + */ + if (pName == NULL) + return NULL; + +#define LOOKUP_ANV_ENTRYPOINT(entrypoint) \ + if (strcmp(pName, "vk" #entrypoint) == 0) \ + return (PFN_vkVoidFunction)anv_##entrypoint + + LOOKUP_ANV_ENTRYPOINT(EnumerateInstanceExtensionProperties); + LOOKUP_ANV_ENTRYPOINT(EnumerateInstanceLayerProperties); + LOOKUP_ANV_ENTRYPOINT(CreateInstance); + +#undef LOOKUP_ANV_ENTRYPOINT + + if (instance == NULL) + return NULL; + return anv_lookup_entrypoint(NULL, pName); } |