Dave Houlton | 59a2070 | 2017-02-02 17:26:23 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2017 Valve Corporation |
| 3 | * Copyright (c) 2015-2017 LunarG, Inc. |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [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 |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 8 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [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. |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 16 | * |
Jon Ashburn | e922f71 | 2015-11-03 13:41:23 -0700 | [diff] [blame] | 17 | * Author: Mark Lobodzinski <mark@lunarg.com> |
| 18 | * Author: Courtney Goeltzenleuchter <courtney@LunarG.com> |
Dave Houlton | 59a2070 | 2017-02-02 17:26:23 -0700 | [diff] [blame] | 19 | * Author: Dave Houlton <daveh@lunarg.com> |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 22 | #pragma once |
| 23 | #include <stdbool.h> |
Mark Lobodzinski | 1079e1b | 2016-03-15 14:21:59 -0600 | [diff] [blame] | 24 | #include <vector> |
Dave Houlton | 3c9fca7 | 2017-03-27 17:25:54 -0600 | [diff] [blame] | 25 | #include "vk_format_utils.h" |
Mark Lobodzinski | 1079e1b | 2016-03-15 14:21:59 -0600 | [diff] [blame] | 26 | #include "vk_layer_logging.h" |
| 27 | |
Courtney Goeltzenleuchter | d263550 | 2015-10-21 17:08:06 -0600 | [diff] [blame] | 28 | #ifndef WIN32 |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 29 | #include <strings.h> // For ffs() |
Courtney Goeltzenleuchter | 3698c62 | 2015-10-27 11:23:21 -0600 | [diff] [blame] | 30 | #else |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 31 | #include <intrin.h> // For __lzcnt() |
Courtney Goeltzenleuchter | d263550 | 2015-10-21 17:08:06 -0600 | [diff] [blame] | 32 | #endif |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 33 | |
| 34 | #ifdef __cplusplus |
| 35 | extern "C" { |
| 36 | #endif |
| 37 | |
Jon Ashburn | d883d81 | 2016-03-24 08:32:09 -0600 | [diff] [blame] | 38 | #define VK_LAYER_API_VERSION VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION) |
Mark Lobodzinski | adaac9d | 2016-01-08 11:07:56 -0700 | [diff] [blame] | 39 | |
Mark Lobodzinski | a9f3349 | 2016-01-11 14:17:05 -0700 | [diff] [blame] | 40 | typedef enum VkStringErrorFlagBits { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 41 | VK_STRING_ERROR_NONE = 0x00000000, |
| 42 | VK_STRING_ERROR_LENGTH = 0x00000001, |
| 43 | VK_STRING_ERROR_BAD_DATA = 0x00000002, |
Mark Lobodzinski | a9f3349 | 2016-01-11 14:17:05 -0700 | [diff] [blame] | 44 | } VkStringErrorFlagBits; |
| 45 | typedef VkFlags VkStringErrorFlags; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 46 | |
Mike Stroyan | a551bc0 | 2016-09-28 09:42:28 -0600 | [diff] [blame] | 47 | VK_LAYER_EXPORT void layer_debug_actions(debug_report_data *report_data, std::vector<VkDebugReportCallbackEXT> &logging_callback, |
| 48 | const VkAllocationCallbacks *pAllocator, const char *layer_identifier); |
Mark Lobodzinski | 1079e1b | 2016-03-15 14:21:59 -0600 | [diff] [blame] | 49 | |
Mike Stroyan | a551bc0 | 2016-09-28 09:42:28 -0600 | [diff] [blame] | 50 | VK_LAYER_EXPORT VkStringErrorFlags vk_string_validate(const int max_length, const char *char_array); |
| 51 | VK_LAYER_EXPORT bool white_list(const char *item, const char *whitelist); |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 52 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 53 | static inline int u_ffs(int val) { |
Courtney Goeltzenleuchter | d263550 | 2015-10-21 17:08:06 -0600 | [diff] [blame] | 54 | #ifdef WIN32 |
Mark Lobodzinski | 5ddf6c3 | 2015-12-16 17:47:28 -0700 | [diff] [blame] | 55 | unsigned long bit_pos = 0; |
Mike Stroyan | debb984 | 2016-01-07 10:05:21 -0700 | [diff] [blame] | 56 | if (_BitScanForward(&bit_pos, val) != 0) { |
Mark Lobodzinski | 5ddf6c3 | 2015-12-16 17:47:28 -0700 | [diff] [blame] | 57 | bit_pos += 1; |
| 58 | } |
| 59 | return bit_pos; |
Courtney Goeltzenleuchter | d263550 | 2015-10-21 17:08:06 -0600 | [diff] [blame] | 60 | #else |
Mark Lobodzinski | 5ddf6c3 | 2015-12-16 17:47:28 -0700 | [diff] [blame] | 61 | return ffs(val); |
Courtney Goeltzenleuchter | d263550 | 2015-10-21 17:08:06 -0600 | [diff] [blame] | 62 | #endif |
| 63 | } |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 64 | |
| 65 | #ifdef __cplusplus |
| 66 | } |
| 67 | #endif |