From: Emil Velikov <emil.veli...@collabora.com>

Strictly speaking we could add support for v2 and earlier. At the same
time, those tend to be buggy and as such there's limited testing done.

Cc: Jason Ekstrand <ja...@jlekstrand.net>
Cc: Shawn Starr <shawn.st...@rogers.com>
Cc: Chad Versace <chadvers...@chromium.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99446
Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
Slightly pedantic, yet explicitly mentioned in the spec as a way to
detect/manage older loader versions. Would have saved us a crash, so I'm
wondering if we want it for stable ?

Shawn considering you still have the old libvulkan.so around can you
give this and/or 2/2 a test ?
---
 src/intel/vulkan/anv_device.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index f80a36a940..e7aa81883a 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -36,6 +36,8 @@
 
 #include "genxml/gen7_pack.h"
 
+static uint32_t loader_version;
+
 struct anv_dispatch_table dtable;
 
 static void
@@ -739,6 +741,11 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL 
vk_icdGetInstanceProcAddr(
     VkInstance                                  instance,
     const char*                                 pName)
 {
+   if (loader_version < 3u) {
+      fprintf(stderr, "WARNING: ANV supports Loader interface v3 or newer, v%u 
"
+                      "detected. Update your libvulkan.so.\n", loader_version);
+      return NULL;
+   }
    return anv_GetInstanceProcAddr(instance, pName);
 }
 
@@ -2075,6 +2082,7 @@ vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* 
pSupportedVersion)
     *          vkDestroySurfaceKHR(), and other API which uses VKSurfaceKHR,
     *          because the loader no longer does so.
     */
+   loader_version = *pSupportedVersion;
    *pSupportedVersion = MIN2(*pSupportedVersion, 3u);
    return VK_SUCCESS;
 }
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to