blob: c4526dbc07b0709fbff6c7885bab91b523f6a69b [file] [log] [blame]
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -07001/* Copyright (c) 2015-2016 The Khronos Group Inc.
2 * Copyright (c) 2015-2016 Valve Corporation
3 * Copyright (c) 2015-2016 LunarG, Inc.
Jon Ashburnbe582642014-12-22 12:04:40 -07004 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -06005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Jon Ashburnbe582642014-12-22 12:04:40 -07008 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -06009 * http://www.apache.org/licenses/LICENSE-2.0
Jon Ashburnbe582642014-12-22 12:04:40 -070010 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -060011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
Jon Ashburnbe582642014-12-22 12:04:40 -070016 *
Jon Ashburne922f712015-11-03 13:41:23 -070017 * Author: Jon Ashburn <jon@lunarg.com>
Mark Lobodzinski97c4d512016-05-19 15:27:18 -060018 * Author: Mark Lobodzinski <mark@lunarg.com>
Jon Ashburnbe582642014-12-22 12:04:40 -070019 **************************************************************************/
20#pragma once
Tobin Ehlis0a43bde2016-05-03 08:31:08 -060021#include "vulkan/vulkan.h"
Mark Lobodzinski97c4d512016-05-19 15:27:18 -060022#include "vulkan/vk_layer.h"
23#include <unordered_map>
Jon Ashburna8aa8372015-03-03 15:07:15 -070024#include <stdbool.h>
Tobin Ehlis0a43bde2016-05-03 08:31:08 -060025#include <stdio.h>
Jon Ashburnbe582642014-12-22 12:04:40 -070026
27#ifdef __cplusplus
28extern "C" {
29#endif
30
Mark Lobodzinskib87f9022016-05-24 16:04:56 -060031// Definitions for Debug Actions
32typedef enum VkLayerDbgActionBits {
33 VK_DBG_LAYER_ACTION_IGNORE = 0x00000000,
34 VK_DBG_LAYER_ACTION_CALLBACK = 0x00000001,
35 VK_DBG_LAYER_ACTION_LOG_MSG = 0x00000002,
36 VK_DBG_LAYER_ACTION_BREAK = 0x00000004,
37 VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x00000008,
38 VK_DBG_LAYER_ACTION_DEFAULT = 0x40000000,
39} VkLayerDbgActionBits;
40typedef VkFlags VkLayerDbgActionFlags;
41
Mark Lobodzinski97c4d512016-05-19 15:27:18 -060042const std::unordered_map<std::string, VkFlags> debug_actions_option_definitions = {
43 {std::string("VK_DBG_LAYER_ACTION_IGNORE"), VK_DBG_LAYER_ACTION_IGNORE},
44 {std::string("VK_DBG_LAYER_ACTION_CALLBACK"), VK_DBG_LAYER_ACTION_CALLBACK},
45 {std::string("VK_DBG_LAYER_ACTION_LOG_MSG"), VK_DBG_LAYER_ACTION_LOG_MSG},
46 {std::string("VK_DBG_LAYER_ACTION_BREAK"), VK_DBG_LAYER_ACTION_BREAK},
47#if WIN32
48 {std::string("VK_DBG_LAYER_ACTION_DEBUG_OUTPUT"), VK_DBG_LAYER_ACTION_DEBUG_OUTPUT},
49#endif
50 {std::string("VK_DBG_LAYER_ACTION_DEFAULT"), VK_DBG_LAYER_ACTION_DEFAULT}};
51
52const std::unordered_map<std::string, VkFlags> report_flags_option_definitions = {
53 {std::string("warn"), VK_DEBUG_REPORT_WARNING_BIT_EXT},
54 {std::string("info"), VK_DEBUG_REPORT_INFORMATION_BIT_EXT},
55 {std::string("perf"), VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT},
56 {std::string("error"), VK_DEBUG_REPORT_ERROR_BIT_EXT},
57 {std::string("debug"), VK_DEBUG_REPORT_DEBUG_BIT_EXT}};
58
Jon Ashburnbe582642014-12-22 12:04:40 -070059const char *getLayerOption(const char *_option);
Jon Ashburn5484e0c2016-03-08 17:48:44 -070060FILE *getLayerLogOutput(const char *_option, const char *layerName);
Mark Lobodzinski97c4d512016-05-19 15:27:18 -060061VkFlags GetLayerOptionFlags(std::string _option, std::unordered_map<std::string, VkFlags> const &enum_data,
62 uint32_t option_default);
Jon Ashburnbe582642014-12-22 12:04:40 -070063
Jon Ashburndec60512015-01-13 17:24:01 -070064void setLayerOption(const char *_option, const char *_val);
Courtney Goeltzenleuchterf85e3612015-06-14 11:33:06 -060065void print_msg_flags(VkFlags msgFlags, char *msg_flags);
Mark Lobodzinski97c4d512016-05-19 15:27:18 -060066
Jon Ashburnbe582642014-12-22 12:04:40 -070067#ifdef __cplusplus
68}
69#endif