vulkan: Remove GDK_DEBUG=vulkan-validate

The modern incantation to get validation layers enabled is via

VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation

Vulkan has a bunch of environment variables to toggle stuff, let's use
those instead of doing our own.
This commit is contained in:
Benjamin Otte 2024-07-13 08:52:28 -04:00 committed by Matthias Clasen
parent c7fcaaf443
commit a61d7f3864
3 changed files with 3 additions and 44 deletions

View File

@ -134,7 +134,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible" },
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)" },

View File

@ -54,7 +54,6 @@ typedef enum {
GDK_DEBUG_GL_GLX = 1 << 24,
GDK_DEBUG_GL_WGL = 1 << 25,
GDK_DEBUG_VULKAN_DISABLE = 1 << 26,
GDK_DEBUG_VULKAN_VALIDATE = 1 << 27,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 28,
GDK_DEBUG_HIGH_DEPTH = 1 << 29,
GDK_DEBUG_NO_VSYNC = 1 << 30,

View File

@ -1658,8 +1658,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
uint32_t i;
GPtrArray *used_extensions;
GPtrArray *used_layers;
gboolean validate = FALSE, have_debug_report = FALSE;
gboolean have_debug_report = FALSE;
VkResult res;
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_VULKAN_DISABLE)
@ -1708,43 +1707,6 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME);
}
uint32_t n_layers;
GDK_VK_CHECK (vkEnumerateInstanceLayerProperties, &n_layers, NULL);
VkLayerProperties *layers = g_newa (VkLayerProperties, n_layers);
GDK_VK_CHECK (vkEnumerateInstanceLayerProperties, &n_layers, layers);
used_layers = g_ptr_array_new ();
for (i = 0; i < n_layers; i++)
{
if (GDK_DISPLAY_DEBUG_CHECK (display, VULKAN))
g_print ("Layer available: %s v%u.%u.%u (%s)\n",
layers[i].layerName,
VK_VERSION_MAJOR (layers[i].specVersion),
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)
{
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;
}
}
}
if ((gdk_display_get_debug_flags (display) & GDK_DEBUG_VULKAN_VALIDATE) && !validate)
{
g_warning ("Vulkan validation layers were requested, but not found. Running without.");
}
res = GDK_VK_CHECK (vkCreateInstance, &(VkInstanceCreateInfo) {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = NULL,
@ -1758,14 +1720,13 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
.apiVersion = VK_API_VERSION_1_3
},
.enabledLayerCount = used_layers->len,
.ppEnabledLayerNames = (const char * const *) used_layers->pdata,
.enabledLayerCount = 0,
.ppEnabledLayerNames = NULL,
.enabledExtensionCount = used_extensions->len,
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata,
},
NULL,
&display->vk_instance);
g_ptr_array_free (used_layers, TRUE);
g_ptr_array_free (used_extensions, TRUE);
if (res != VK_SUCCESS)