Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2016 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2016 Valve Corporation |
| 3 | * Copyright (c) 2015-2016 LunarG, Inc. |
Jon Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 4 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 5 | * 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 Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 8 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Jon Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 10 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 11 | * 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 Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 16 | * |
Jon Ashburn | e922f71 | 2015-11-03 13:41:23 -0700 | [diff] [blame] | 17 | * Author: Jon Ashburn <jon@lunarg.com> |
Mark Lobodzinski | 97c4d51 | 2016-05-19 15:27:18 -0600 | [diff] [blame] | 18 | * Author: Mark Lobodzinski <mark@lunarg.com> |
Jon Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 19 | **************************************************************************/ |
| 20 | #pragma once |
Tobin Ehlis | 0a43bde | 2016-05-03 08:31:08 -0600 | [diff] [blame] | 21 | #include "vulkan/vulkan.h" |
Mark Lobodzinski | 97c4d51 | 2016-05-19 15:27:18 -0600 | [diff] [blame] | 22 | #include "vulkan/vk_layer.h" |
Michael Jurka | 0f2a63f | 2016-12-19 16:31:43 +0100 | [diff] [blame] | 23 | #include <string> |
Mark Lobodzinski | 97c4d51 | 2016-05-19 15:27:18 -0600 | [diff] [blame] | 24 | #include <unordered_map> |
Jon Ashburn | a8aa837 | 2015-03-03 15:07:15 -0700 | [diff] [blame] | 25 | #include <stdbool.h> |
Tobin Ehlis | 0a43bde | 2016-05-03 08:31:08 -0600 | [diff] [blame] | 26 | #include <stdio.h> |
Jon Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 27 | |
| 28 | #ifdef __cplusplus |
| 29 | extern "C" { |
| 30 | #endif |
| 31 | |
Mark Lobodzinski | b87f902 | 2016-05-24 16:04:56 -0600 | [diff] [blame] | 32 | // Definitions for Debug Actions |
| 33 | typedef enum VkLayerDbgActionBits { |
| 34 | VK_DBG_LAYER_ACTION_IGNORE = 0x00000000, |
| 35 | VK_DBG_LAYER_ACTION_CALLBACK = 0x00000001, |
| 36 | VK_DBG_LAYER_ACTION_LOG_MSG = 0x00000002, |
| 37 | VK_DBG_LAYER_ACTION_BREAK = 0x00000004, |
| 38 | VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x00000008, |
| 39 | VK_DBG_LAYER_ACTION_DEFAULT = 0x40000000, |
| 40 | } VkLayerDbgActionBits; |
| 41 | typedef VkFlags VkLayerDbgActionFlags; |
| 42 | |
Mark Lobodzinski | 97c4d51 | 2016-05-19 15:27:18 -0600 | [diff] [blame] | 43 | const std::unordered_map<std::string, VkFlags> debug_actions_option_definitions = { |
| 44 | {std::string("VK_DBG_LAYER_ACTION_IGNORE"), VK_DBG_LAYER_ACTION_IGNORE}, |
| 45 | {std::string("VK_DBG_LAYER_ACTION_CALLBACK"), VK_DBG_LAYER_ACTION_CALLBACK}, |
| 46 | {std::string("VK_DBG_LAYER_ACTION_LOG_MSG"), VK_DBG_LAYER_ACTION_LOG_MSG}, |
| 47 | {std::string("VK_DBG_LAYER_ACTION_BREAK"), VK_DBG_LAYER_ACTION_BREAK}, |
Jamie Madill | 5738e27 | 2016-07-06 13:37:33 -0400 | [diff] [blame] | 48 | #if defined(WIN32) |
Mark Lobodzinski | 97c4d51 | 2016-05-19 15:27:18 -0600 | [diff] [blame] | 49 | {std::string("VK_DBG_LAYER_ACTION_DEBUG_OUTPUT"), VK_DBG_LAYER_ACTION_DEBUG_OUTPUT}, |
| 50 | #endif |
| 51 | {std::string("VK_DBG_LAYER_ACTION_DEFAULT"), VK_DBG_LAYER_ACTION_DEFAULT}}; |
| 52 | |
| 53 | const std::unordered_map<std::string, VkFlags> report_flags_option_definitions = { |
| 54 | {std::string("warn"), VK_DEBUG_REPORT_WARNING_BIT_EXT}, |
| 55 | {std::string("info"), VK_DEBUG_REPORT_INFORMATION_BIT_EXT}, |
| 56 | {std::string("perf"), VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT}, |
| 57 | {std::string("error"), VK_DEBUG_REPORT_ERROR_BIT_EXT}, |
| 58 | {std::string("debug"), VK_DEBUG_REPORT_DEBUG_BIT_EXT}}; |
| 59 | |
Mark Lobodzinski | 07954a5 | 2018-02-01 12:14:30 -0700 | [diff] [blame] | 60 | VK_LAYER_EXPORT const char *getLayerOption(const char *_option); |
| 61 | VK_LAYER_EXPORT FILE *getLayerLogOutput(const char *_option, const char *layerName); |
| 62 | VK_LAYER_EXPORT VkFlags GetLayerOptionFlags(std::string _option, std::unordered_map<std::string, VkFlags> const &enum_data, |
| 63 | uint32_t option_default); |
Jon Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 64 | |
Mark Lobodzinski | 07954a5 | 2018-02-01 12:14:30 -0700 | [diff] [blame] | 65 | VK_LAYER_EXPORT void setLayerOption(const char *_option, const char *_val); |
Mark Young | 6ba8abe | 2017-11-09 10:37:04 -0700 | [diff] [blame] | 66 | VK_LAYER_EXPORT void PrintMessageFlags(VkFlags vk_flags, char *msg_flags); |
| 67 | VK_LAYER_EXPORT void PrintMessageSeverity(VkFlags vk_flags, char *msg_flags); |
| 68 | VK_LAYER_EXPORT void PrintMessageType(VkFlags vk_flags, char *msg_flags); |
Mark Lobodzinski | 97c4d51 | 2016-05-19 15:27:18 -0600 | [diff] [blame] | 69 | |
Jon Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 70 | #ifdef __cplusplus |
| 71 | } |
| 72 | #endif |