1 /*
2  *
3  * Copyright (c) 2014-2021 The Khronos Group Inc.
4  * Copyright (c) 2014-2021 Valve Corporation
5  * Copyright (c) 2014-2021 LunarG, Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * Author: Jon Ashburn <jon@lunarg.com>
20  * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
21  * Author: Chia-I Wu <olvaffe@gmail.com>
22  * Author: Chia-I Wu <olv@lunarg.com>
23  * Author: Mark Lobodzinski <mark@LunarG.com>
24  * Author: Lenny Komow <lenny@lunarg.com>
25  * Author: Charles Giessen <charles@lunarg.com>
26  *
27  */
28 
29 #include "loader_common.h"
30 
31 enum vulkan_loader_debug_flags {
32     VULKAN_LOADER_INFO_BIT = 0x01,
33     VULKAN_LOADER_WARN_BIT = 0x02,
34     VULKAN_LOADER_PERF_BIT = 0x04,
35     VULKAN_LOADER_ERROR_BIT = 0x08,
36     VULKAN_LOADER_DEBUG_BIT = 0x10,
37     VULKAN_LOADER_LAYER_BIT = 0x20,
38     VULKAN_LOADER_DRIVER_BIT = 0x40,
39 };
40 
41 // Checks for the environment variable VK_LOADER_DEBUG and sets up the current debug level accordingly
42 // This should be called before any Vulkan API calls, eg in the initialization of the .dll or .so
43 void loader_debug_init(void);
44 
45 // Returns a bitmask that indicates the current flags that should be output
46 uint32_t loader_get_debug_level(void);
47 
48 // Logs a message to stderr
49 // May output to DebugUtils if the instance isn't null and the extension is enabled.
50 void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, const char *format, ...);
51