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