gdk/vulkancontext: Accept Khronos validation layers
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 30 Mar 2023 20:09:24 +0000 (17:09 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 30 Mar 2023 20:13:35 +0000 (17:13 -0300)
The Lunarg validation layers seem to have been deprecated in favour
of the Khronos ones. There's no reason not to have both, to accept
loading both - simultaneously, even.

gdk/gdkvulkancontext.c

index 59416695cf3e455fe868bc02eaf891b91b40fd37..3f669bfc4da4a3b55604c8ecf38fe0e90b924f2a 100644 (file)
@@ -1101,11 +1101,19 @@ gdk_display_create_vulkan_instance (GdkDisplay  *display,
                                  VK_VERSION_MINOR (layers[i].specVersion),
                                  VK_VERSION_PATCH (layers[i].specVersion),
                                  layers[i].description);
-      if ((gdk_display_get_debug_flags (display) & GDK_DEBUG_VULKAN_VALIDATE) &&
-          g_str_equal (layers[i].layerName, "VK_LAYER_LUNARG_standard_validation"))
+      if (gdk_display_get_debug_flags (display) & GDK_DEBUG_VULKAN_VALIDATE)
         {
-          g_ptr_array_add (used_layers, (gpointer) "VK_LAYER_LUNARG_standard_validation");
-          validate = TRUE;
+          const char *validation_layer_names[] = {
+            "VK_LAYER_LUNARG_standard_validation",
+            "VK_LAYER_KHRONOS_validation",
+            NULL,
+          };
+
+          if (g_strv_contains (validation_layer_names, layers[i].layerName))
+            {
+              g_ptr_array_add (used_layers, layers[i].layerName);
+              validate = TRUE;
+            }
         }
     }