aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtneygo@google.com>2016-01-08 11:52:37 -0700
committerJon Ashburn <jon@lunarg.com>2016-01-20 18:04:44 -0700
commita40e0a9ffd47da0bbb3aaff74dced667e6dd5fe9 (patch)
treec678b4989841a40fbb9e3ce1cae26f7961bc3121
parente5210b951c8836dcb1eb9e31d8bda248321865b3 (diff)
downloadusermoji-a40e0a9ffd47da0bbb3aaff74dced667e6dd5fe9.tar.xz
layers: Add utility functions for new layer init
These utilities will find the appropriate CreateInfo extension that defines the layer link information.
-rw-r--r--layers/vk_layer_table.cpp20
-rw-r--r--layers/vk_layer_table.h4
2 files changed, 24 insertions, 0 deletions
diff --git a/layers/vk_layer_table.cpp b/layers/vk_layer_table.cpp
index 1c4fa133..93d2fbf4 100644
--- a/layers/vk_layer_table.cpp
+++ b/layers/vk_layer_table.cpp
@@ -125,6 +125,26 @@ VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void*
return it->second;
}
+VkLayerInstanceCreateInfo *get_chain_info(const VkInstanceCreateInfo *pCreateInfo)
+{
+ VkLayerInstanceCreateInfo *chain_info = (VkLayerInstanceCreateInfo *) pCreateInfo->pNext;
+ while (chain_info && chain_info->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO) {
+ chain_info = (VkLayerInstanceCreateInfo *) chain_info->pNext;
+ }
+ assert(chain_info != NULL);
+ return chain_info;
+}
+
+VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo)
+{
+ VkLayerDeviceCreateInfo *chain_info = (VkLayerDeviceCreateInfo *) pCreateInfo->pNext;
+ while (chain_info && chain_info->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO) {
+ chain_info = (VkLayerDeviceCreateInfo *) chain_info->pNext;
+ }
+ assert(chain_info != NULL);
+ return chain_info;
+}
+
/* Various dispatchable objects will use the same underlying dispatch table if they
* are created from that "parent" object. Thus use pointer to dispatch table
* as the key to these table maps.
diff --git a/layers/vk_layer_table.h b/layers/vk_layer_table.h
index bccd7364..816b6a69 100644
--- a/layers/vk_layer_table.h
+++ b/layers/vk_layer_table.h
@@ -24,6 +24,7 @@
*/
#pragma once
+#include "vulkan/vulkan.h"
#include <unordered_map>
typedef std::unordered_map<void *, VkLayerDispatchTable *> device_table_map;
@@ -48,5 +49,8 @@ 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);
+VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo);
+
void destroy_device_dispatch_table(dispatch_key key);
void destroy_instance_dispatch_table(dispatch_key key);