Fix VK_NV_external_memory_capabilities support

-Need to init the instance function pointer

-The function should gracefully fall back on
 drivers that don't support it.

Change-Id: I15b0c68028c8f5ad3b07342e255dbb4c37bb6f0a
diff --git a/loader/extensions.c b/loader/extensions.c
index 17190a4..e14ceb1 100644
--- a/loader/extensions.c
+++ b/loader/extensions.c
@@ -58,17 +58,27 @@
     VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
     VkExternalMemoryHandleTypeFlagsNV externalHandleType,
     VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) {
-
     struct loader_physical_device *phys_dev =
         (struct loader_physical_device *)physicalDevice;
     struct loader_icd *icd = phys_dev->this_icd;
 
-    assert(icd->GetPhysicalDeviceExternalImageFormatPropertiesNV &&
-           "loader: null GetPhysicalDeviceExternalImageFormatPropertiesNV ICD "
-           "pointer");
+    if (!icd->GetPhysicalDeviceExternalImageFormatPropertiesNV) {
+        if (externalHandleType) {
+            return VK_ERROR_FORMAT_NOT_SUPPORTED;
+        }
 
-    if (!icd->GetPhysicalDeviceExternalImageFormatPropertiesNV)
-        return VK_ERROR_INITIALIZATION_FAILED;
+        if (!icd->GetPhysicalDeviceImageFormatProperties) {
+            return VK_ERROR_INITIALIZATION_FAILED;
+        }
+
+        pExternalImageFormatProperties->externalMemoryFeatures = 0;
+        pExternalImageFormatProperties->exportFromImportedHandleTypes = 0;
+        pExternalImageFormatProperties->compatibleHandleTypes = 0;
+
+        return icd->GetPhysicalDeviceImageFormatProperties(
+            phys_dev->phys_dev, format, type, tiling, usage, flags,
+            &pExternalImageFormatProperties->imageFormatProperties);
+    }
 
     return icd->GetPhysicalDeviceExternalImageFormatPropertiesNV(
         phys_dev->phys_dev, format, type, tiling, usage, flags,