summaryrefslogtreecommitdiffstats
path: root/src/vulkan/overlay-layer/vk_layer_table.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vulkan/overlay-layer/vk_layer_table.h')
-rw-r--r--src/vulkan/overlay-layer/vk_layer_table.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/vulkan/overlay-layer/vk_layer_table.h b/src/vulkan/overlay-layer/vk_layer_table.h
new file mode 100644
index 00000000000..45b8f6e1770
--- /dev/null
+++ b/src/vulkan/overlay-layer/vk_layer_table.h
@@ -0,0 +1,51 @@
+/* Copyright (c) 2015-2016 The Khronos Group Inc.
+ * Copyright (c) 2015-2016 Valve Corporation
+ * Copyright (c) 2015-2016 LunarG, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Author: Tobin Ehlis <[email protected]>
+ */
+
+#pragma once
+
+#include "vulkan/vk_layer.h"
+#include "vulkan/vulkan.h"
+#include <unordered_map>
+
+typedef std::unordered_map<void *, VkLayerDispatchTable *> device_table_map;
+typedef std::unordered_map<void *, VkLayerInstanceDispatchTable *> instance_table_map;
+VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa, device_table_map &map);
+VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa);
+VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map);
+VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa);
+
+typedef void *dispatch_key;
+
+static inline dispatch_key get_dispatch_key(const void *object) { return (dispatch_key) * (VkLayerDispatchTable **)object; }
+
+VkLayerDispatchTable *device_dispatch_table(void *object);
+
+VkLayerInstanceDispatchTable *instance_dispatch_table(void *object);
+
+VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void *object);
+
+VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void *object);
+
+VkLayerInstanceCreateInfo *get_chain_info(const VkInstanceCreateInfo *pCreateInfo, VkLayerFunction func);
+VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo, VkLayerFunction func);
+
+void destroy_device_dispatch_table(dispatch_key key);
+void destroy_instance_dispatch_table(dispatch_key key);
+void destroy_dispatch_table(device_table_map &map, dispatch_key key);
+void destroy_dispatch_table(instance_table_map &map, dispatch_key key);