blob: 5ffebc28f69f106258e700e6600acbdee91a8b50 [file] [log] [blame]
Jon Ashburn9eed2892015-06-01 10:02:09 -06001/*
Jon Ashburn9eed2892015-06-01 10:02:09 -06002 *
3 * Copyright (C) 2014 LunarG, Inc.
4 *
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 */
23#pragma once
24
25#include <unordered_map>
26
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060027typedef std::unordered_map<void *, VkLayerDispatchTable *> device_table_map;
28typedef std::unordered_map<void *, VkLayerInstanceDispatchTable *> instance_table_map;
Jon Ashburn9eed2892015-06-01 10:02:09 -060029VkLayerDispatchTable * initDeviceTable(const VkBaseLayerObject *devw);
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060030VkLayerDispatchTable * initDeviceTable(device_table_map &map, const VkBaseLayerObject *devw);
Jon Ashburn9eed2892015-06-01 10:02:09 -060031VkLayerInstanceDispatchTable * initInstanceTable(const VkBaseLayerObject *instancew);
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060032VkLayerInstanceDispatchTable * initInstanceTable(instance_table_map &map, const VkBaseLayerObject *instancew);
33
34typedef void *dispatch_key;
35
Tony Barboura05dbaa2015-07-09 17:31:46 -060036static inline dispatch_key get_dispatch_key(const void* object)
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060037{
38 return (dispatch_key) *(VkLayerDispatchTable **) object;
39}
Jon Ashburn9eed2892015-06-01 10:02:09 -060040
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060041VkLayerDispatchTable *device_dispatch_table(void* object);
Jon Ashburn9eed2892015-06-01 10:02:09 -060042
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060043VkLayerInstanceDispatchTable *instance_dispatch_table(void* object);
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060044
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060045VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void* object);
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060046
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060047VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void* object);
Courtney Goeltzenleuchterc08e72d2015-06-13 21:18:30 -060048
49void destroy_device_dispatch_table(dispatch_key key);
50void destroy_instance_dispatch_table(dispatch_key key);