blob: 277840336ab17d0387b336e04cc5c319feab52a0 [file] [log] [blame]
Jon Ashburn9eed2892015-06-01 10:02:09 -06001/*
2 * Vulkan
3 *
4 * Copyright (C) 2014 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 */
24#pragma once
25
26#include <unordered_map>
27
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060028typedef std::unordered_map<void *, VkLayerDispatchTable *> device_table_map;
29typedef std::unordered_map<void *, VkLayerInstanceDispatchTable *> instance_table_map;
Jon Ashburn9eed2892015-06-01 10:02:09 -060030VkLayerDispatchTable * initDeviceTable(const VkBaseLayerObject *devw);
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060031VkLayerDispatchTable * initDeviceTable(device_table_map &map, const VkBaseLayerObject *devw);
Jon Ashburn9eed2892015-06-01 10:02:09 -060032VkLayerInstanceDispatchTable * initInstanceTable(const VkBaseLayerObject *instancew);
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060033VkLayerInstanceDispatchTable * initInstanceTable(instance_table_map &map, const VkBaseLayerObject *instancew);
34
35typedef void *dispatch_key;
36
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060037static inline dispatch_key get_dispatch_key(void* object)
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060038{
39 return (dispatch_key) *(VkLayerDispatchTable **) object;
40}
Jon Ashburn9eed2892015-06-01 10:02:09 -060041
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060042VkLayerDispatchTable *device_dispatch_table(void* object);
Jon Ashburn9eed2892015-06-01 10:02:09 -060043
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060044VkLayerInstanceDispatchTable *instance_dispatch_table(void* object);
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060045
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060046VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void* object);
Courtney Goeltzenleuchtere45acec2015-06-14 12:03:26 -060047
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060048VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void* object);
Courtney Goeltzenleuchterc08e72d2015-06-13 21:18:30 -060049
50void destroy_device_dispatch_table(dispatch_key key);
51void destroy_instance_dispatch_table(dispatch_key key);