Patch-Source: https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/f3ba14e491333d6bbba8c60328c4dbfd20571182
--
From f3ba14e491333d6bbba8c60328c4dbfd20571182 Mon Sep 17 00:00:00 2001
From: Simon Zeni <simon@bl4ckb0ne.ca>
Date: Fri, 11 Nov 2022 15:54:07 -0500
Subject: [PATCH] render/vulkan: remove hardcoded validation layers

Users should use the VK_INSTANCE_LAYERS env var to set layers at runtime
---
 render/vulkan/renderer.c |  2 ++
 render/vulkan/vulkan.c   | 12 ++----------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c
index c64937aa60..ff208abc47 100644
--- a/render/vulkan/renderer.c
+++ b/render/vulkan/renderer.c
@@ -1938,6 +1938,8 @@ error:
 struct wlr_renderer *wlr_vk_renderer_create_with_drm_fd(int drm_fd) {
 	wlr_log(WLR_INFO, "The vulkan renderer is only experimental and "
 		"not expected to be ready for daily use");
+	wlr_log(WLR_INFO, "Run with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation "
+		"to enable the validation layer");
 
 	// NOTE: we could add functionality to allow the compositor passing its
 	// name and version to this function. Just use dummies until then,
diff --git a/render/vulkan/vulkan.c b/render/vulkan/vulkan.c
index 748ba9c323..c964fe12eb 100644
--- a/render/vulkan/vulkan.c
+++ b/render/vulkan/vulkan.c
@@ -138,21 +138,13 @@ struct wlr_vk_instance *vulkan_instance_create(bool debug) {
 		.apiVersion = VK_API_VERSION_1_1,
 	};
 
-	const char *layers[] = {
-		"VK_LAYER_KHRONOS_validation",
-		// "VK_LAYER_RENDERDOC_Capture",
-		// "VK_LAYER_live_introspection",
-	};
-
-	unsigned layer_count = debug * (sizeof(layers) / sizeof(layers[0]));
-
 	VkInstanceCreateInfo instance_info = {
 		.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
 		.pApplicationInfo = &application_info,
 		.enabledExtensionCount = extensions_len,
 		.ppEnabledExtensionNames = extensions,
-		.enabledLayerCount = layer_count,
-		.ppEnabledLayerNames = layers,
+		.enabledLayerCount = 0,
+		.ppEnabledLayerNames = NULL,
 	};
 
 	VkDebugUtilsMessageSeverityFlagsEXT severity =
-- 
GitLab

