Rename log level to reflect its global status
authorCharles Giessen <charles@lunarg.com>
Wed, 26 Apr 2023 22:47:25 +0000 (16:47 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Mon, 29 May 2023 23:45:08 +0000 (17:45 -0600)
The log level is set only during dynamic initializatoin, rather than during any
specific vulkan call. This commit renames the log to reflect this global
nature of the debug level.

loader/loader.c
loader/loader_linux.c
loader/log.c
loader/log.h

index 41442d069e3c9f6735bde4d95363b7d9fb6c7ccc..593cc754cf82dc0d974715e79df2d7c9ef937583 100644 (file)
@@ -1800,7 +1800,7 @@ void loader_initialize(void) {
     loader_platform_thread_create_mutex(&loader_global_instance_list_lock);
 
     // initialize logging
-    loader_debug_init();
+    loader_init_global_debug_level();
 #if defined(_WIN32)
     windows_initialization();
 #endif
@@ -2012,7 +2012,7 @@ bool verify_meta_layer_component_layers(const struct loader_instance *inst, stru
                    prop->num_component_layers);
 
         // If layer logging is on, list the internals included in the meta-layer
-        if ((loader_get_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) {
+        if ((loader_get_global_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) {
             for (uint32_t comp_layer = 0; comp_layer < prop->num_component_layers; comp_layer++) {
                 loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "  [%d] %s", comp_layer, prop->component_layer_names[comp_layer]);
             }
@@ -2534,7 +2534,6 @@ VkResult loader_read_layer_json(const struct loader_instance *inst, struct loade
             } else {
                 ext_prop.specVersion = 0;
             }
-            // entrypoints = cJSON_GetObjectItem(ext_item, "entrypoints");
             GET_JSON_OBJECT(ext_item, entrypoints)
             int entry_count;
             if (entrypoints == NULL) {
@@ -4908,7 +4907,7 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c
 
         // If layer debugging is enabled, let's print out the full callstack with layers in their
         // defined order.
-        if ((loader_get_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) {
+        if ((loader_get_global_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) {
             loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "vkCreateInstance layer callstack setup to:");
             loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "   <Application>");
             loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "     ||");
@@ -5174,13 +5173,13 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre
         // If layer debugging is enabled, let's print out the full callstack with layers in their
         // defined order.
         uint32_t layer_driver_bits = VULKAN_LOADER_LAYER_BIT | VULKAN_LOADER_DRIVER_BIT;
-        if ((loader_get_debug_level() & layer_driver_bits) != 0) {
+        if ((loader_get_global_debug_level() & layer_driver_bits) != 0) {
             loader_log(inst, layer_driver_bits, 0, "vkCreateDevice layer callstack setup to:");
             loader_log(inst, layer_driver_bits, 0, "   <Application>");
             loader_log(inst, layer_driver_bits, 0, "     ||");
             loader_log(inst, layer_driver_bits, 0, "   <Loader>");
             loader_log(inst, layer_driver_bits, 0, "     ||");
-            if ((loader_get_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) {
+            if ((loader_get_global_debug_level() & VULKAN_LOADER_LAYER_BIT) != 0) {
                 for (uint32_t cur_layer = 0; cur_layer < num_activated_layers; ++cur_layer) {
                     uint32_t index = num_activated_layers - cur_layer - 1;
                     loader_log(inst, VULKAN_LOADER_LAYER_BIT, 0, "   %s", activated_layers[index].name);
index f697baef8a8b75af8beab06366c16a30d563758b..2918b6b4f5d8acda2824a48cb1fcd592224c5408 100644 (file)
@@ -437,7 +437,7 @@ VkResult linux_sort_physical_device_groups(struct loader_instance *inst, uint32_
     // Sort device groups by PCI info
     qsort(sorted_group_term, group_count, sizeof(struct loader_physical_device_group_term), compare_device_groups);
 
-    if (loader_get_debug_level() & (VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT)) {
+    if (loader_get_global_debug_level() & (VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT)) {
         loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "linux_sort_physical_device_groups:  Sorted order:");
         for (uint32_t group = 0; group < group_count; ++group) {
             loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "           Group %u", group);
index 33ed3ce6d2b01ca5f43c98525312e724879c0e03..c6c3ede320d4426d2dbde9b66270e10a444d3439 100644 (file)
@@ -36,7 +36,7 @@
 
 uint32_t g_loader_debug = 0;
 
-void loader_debug_init(void) {
+void loader_init_global_debug_level(void) {
     char *env, *orig;
 
     if (g_loader_debug > 0) return;
@@ -83,7 +83,7 @@ void loader_debug_init(void) {
     loader_free_getenv(orig, NULL);
 }
 
-uint32_t loader_get_debug_level(void) { return g_loader_debug; }
+uint32_t loader_get_global_debug_level(void) { return g_loader_debug; }
 
 void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, const char *format, ...) {
     char msg[512];
index b45a26494b2edb3cd91782827bf07ee818cd5b78..0133057f31389da0c453b148e18ce1eac125a824 100644 (file)
@@ -41,10 +41,10 @@ enum vulkan_loader_debug_flags {
 
 // Checks for the environment variable VK_LOADER_DEBUG and sets up the current debug level accordingly
 // This should be called before any Vulkan API calls, eg in the initialization of the .dll or .so
-void loader_debug_init(void);
+void loader_init_global_debug_level(void);
 
 // Returns a bitmask that indicates the current flags that should be output
-uint32_t loader_get_debug_level(void);
+uint32_t loader_get_global_debug_level(void);
 
 // Logs a message to stderr
 // May output to DebugUtils if the instance isn't null and the extension is enabled.