Mike Stroyan | 3712d5c | 2015-04-02 11:59:05 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Vulkan |
| 3 | * |
| 4 | * Copyright (C) 2015 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | */ |
Mike Stroyan | 313f7e6 | 2015-08-10 16:42:53 -0600 | [diff] [blame^] | 24 | #ifndef THREADING_H |
| 25 | #define THREADING_H |
| 26 | #include "vk_layer_config.h" |
| 27 | #include "vk_layer_logging.h" |
Mike Stroyan | 3712d5c | 2015-04-02 11:59:05 -0600 | [diff] [blame] | 28 | |
| 29 | // Draw State ERROR codes |
| 30 | typedef enum _THREADING_CHECKER_ERROR |
| 31 | { |
| 32 | THREADING_CHECKER_NONE, // Used for INFO & other non-error messages |
| 33 | THREADING_CHECKER_MULTIPLE_THREADS, // Object used simultaneously by multiple threads |
| 34 | THREADING_CHECKER_SINGLE_THREAD_REUSE, // Object used simultaneously by recursion in single thread |
| 35 | } THREADING_CHECKER_ERROR; |
| 36 | |
Mike Stroyan | 313f7e6 | 2015-08-10 16:42:53 -0600 | [diff] [blame^] | 37 | typedef struct _layer_data { |
| 38 | debug_report_data *report_data; |
| 39 | VkDbgMsgCallback logging_callback; |
| 40 | } layer_data; |
| 41 | |
| 42 | static std::unordered_map<void*, layer_data *> layer_data_map; |
| 43 | static device_table_map Threading_device_table_map; |
| 44 | static instance_table_map Threading_instance_table_map; |
| 45 | |
| 46 | static inline debug_report_data *mdd(const void* object) |
| 47 | { |
| 48 | dispatch_key key = get_dispatch_key(object); |
| 49 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
| 50 | return my_data->report_data; |
| 51 | } |
| 52 | #endif // THREADING_H |