[Mesa-dev] [PATCH 2/2] radv: bail out if using loader interface prior to v3

Emil Velikov emil.l.velikov at gmail.com
Tue Jan 24 14:16:20 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

Analogous to previous commit.

Cc: Dave Airlie <airlied at redhat.com>
Cc: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Cc: Shawn Starr <shawn.starr at rogers.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/amd/vulkan/radv_device.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 4aa6af2bbd..74a2f24925 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -43,6 +43,9 @@
 #include "vk_format.h"
 #include "sid.h"
 #include "util/debug.h"
+
+static uint32_t loader_version;
+
 struct radv_dispatch_table dtable;
 
 static int
@@ -1072,6 +1075,12 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
 	VkInstance                                  instance,
 	const char*                                 pName)
 {
+	if (loader_version < 3u) {
+		fprintf(stderr, "WARNING: RADV supports Loader interface v3 or "
+				"newer, v%u detected. Update your libvulkan.so.\n",
+			loader_version);
+		return NULL;
+	}
 	return radv_GetInstanceProcAddr(instance, pName);
 }
 
@@ -2108,6 +2117,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



More information about the mesa-dev mailing list