aboutsummaryrefslogtreecommitdiff
path: root/layers/vk_layer_table.cpp
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2016-03-08 17:48:44 -0700
committerJon Ashburn <jon@lunarg.com>2016-03-08 17:48:44 -0700
commite512684d1b0dbe7ce1607108e3af2ca207b090f0 (patch)
tree2deadae2cbe46cfdc7c56baaf82665dfcaa0d742 /layers/vk_layer_table.cpp
parent9e313368449e99458a020ed489e295b89f7cf75a (diff)
downloadusermoji-e512684d1b0dbe7ce1607108e3af2ca207b090f0.tar.xz
layers: clang-format layers directory
Change-Id: I318e3759829f33441e57aafedec1e9ec06d658c4
Diffstat (limited to 'layers/vk_layer_table.cpp')
-rw-r--r--layers/vk_layer_table.cpp103
1 files changed, 41 insertions, 62 deletions
diff --git a/layers/vk_layer_table.cpp b/layers/vk_layer_table.cpp
index 5e364e5f..153f565c 100644
--- a/layers/vk_layer_table.cpp
+++ b/layers/vk_layer_table.cpp
@@ -35,21 +35,20 @@ static instance_table_map tableInstanceMap;
#define DISPATCH_MAP_DEBUG 0
// Map lookup must be thread safe
-VkLayerDispatchTable *device_dispatch_table(void* object)
-{
+VkLayerDispatchTable *device_dispatch_table(void *object) {
dispatch_key key = get_dispatch_key(object);
- device_table_map::const_iterator it = tableMap.find((void *) key);
+ device_table_map::const_iterator it = tableMap.find((void *)key);
assert(it != tableMap.end() && "Not able to find device dispatch entry");
return it->second;
}
-VkLayerInstanceDispatchTable *instance_dispatch_table(void* object)
-{
+VkLayerInstanceDispatchTable *instance_dispatch_table(void *object) {
dispatch_key key = get_dispatch_key(object);
- instance_table_map::const_iterator it = tableInstanceMap.find((void *) key);
+ instance_table_map::const_iterator it = tableInstanceMap.find((void *)key);
#if DISPATCH_MAP_DEBUG
if (it != tableInstanceMap.end()) {
- fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key, it->second);
+ fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key,
+ it->second);
} else {
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
}
@@ -58,8 +57,7 @@ VkLayerInstanceDispatchTable *instance_dispatch_table(void* object)
return it->second;
}
-void destroy_dispatch_table(device_table_map &map, dispatch_key key)
-{
+void destroy_dispatch_table(device_table_map &map, dispatch_key key) {
#if DISPATCH_MAP_DEBUG
device_table_map::const_iterator it = map.find((void *)key);
if (it != map.end()) {
@@ -72,8 +70,7 @@ void destroy_dispatch_table(device_table_map &map, dispatch_key key)
map.erase(key);
}
-void destroy_dispatch_table(instance_table_map &map, dispatch_key key)
-{
+void destroy_dispatch_table(instance_table_map &map, dispatch_key key) {
#if DISPATCH_MAP_DEBUG
instance_table_map::const_iterator it = map.find((void *)key);
if (it != map.end()) {
@@ -86,23 +83,17 @@ void destroy_dispatch_table(instance_table_map &map, dispatch_key key)
map.erase(key);
}
-void destroy_device_dispatch_table(dispatch_key key)
-{
- destroy_dispatch_table(tableMap, key);
-}
+void destroy_device_dispatch_table(dispatch_key key) { destroy_dispatch_table(tableMap, key); }
-void destroy_instance_dispatch_table(dispatch_key key)
-{
- destroy_dispatch_table(tableInstanceMap, key);
-}
+void destroy_instance_dispatch_table(dispatch_key key) { destroy_dispatch_table(tableInstanceMap, key); }
-VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void* object)
-{
+VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void *object) {
dispatch_key key = get_dispatch_key(object);
- device_table_map::const_iterator it = map.find((void *) key);
+ device_table_map::const_iterator it = map.find((void *)key);
#if DISPATCH_MAP_DEBUG
if (it != map.end()) {
- fprintf(stderr, "device_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key, it->second);
+ fprintf(stderr, "device_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key,
+ it->second);
} else {
fprintf(stderr, "device_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
}
@@ -111,14 +102,14 @@ VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void* object)
return it->second;
}
-VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void* object)
-{
-// VkLayerInstanceDispatchTable *pDisp = *(VkLayerInstanceDispatchTable **) object;
+VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void *object) {
+ // VkLayerInstanceDispatchTable *pDisp = *(VkLayerInstanceDispatchTable **) object;
dispatch_key key = get_dispatch_key(object);
- instance_table_map::const_iterator it = map.find((void *) key);
+ instance_table_map::const_iterator it = map.find((void *)key);
#if DISPATCH_MAP_DEBUG
if (it != map.end()) {
- fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key, it->second);
+ fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key,
+ it->second);
} else {
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
}
@@ -127,23 +118,19 @@ VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void*
return it->second;
}
-VkLayerInstanceCreateInfo *get_chain_info(const VkInstanceCreateInfo *pCreateInfo, VkLayerFunction func)
-{
- VkLayerInstanceCreateInfo *chain_info = (VkLayerInstanceCreateInfo *) pCreateInfo->pNext;
- while (chain_info && !(chain_info->sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
- && chain_info->function == func)) {
- chain_info = (VkLayerInstanceCreateInfo *) chain_info->pNext;
+VkLayerInstanceCreateInfo *get_chain_info(const VkInstanceCreateInfo *pCreateInfo, VkLayerFunction func) {
+ VkLayerInstanceCreateInfo *chain_info = (VkLayerInstanceCreateInfo *)pCreateInfo->pNext;
+ while (chain_info && !(chain_info->sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO && chain_info->function == func)) {
+ chain_info = (VkLayerInstanceCreateInfo *)chain_info->pNext;
}
assert(chain_info != NULL);
return chain_info;
}
-VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo, VkLayerFunction func)
-{
- VkLayerDeviceCreateInfo *chain_info = (VkLayerDeviceCreateInfo *) pCreateInfo->pNext;
- while (chain_info && !(chain_info->sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
- && chain_info->function == func)) {
- chain_info = (VkLayerDeviceCreateInfo *) chain_info->pNext;
+VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo, VkLayerFunction func) {
+ VkLayerDeviceCreateInfo *chain_info = (VkLayerDeviceCreateInfo *)pCreateInfo->pNext;
+ while (chain_info && !(chain_info->sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO && chain_info->function == func)) {
+ chain_info = (VkLayerDeviceCreateInfo *)chain_info->pNext;
}
assert(chain_info != NULL);
return chain_info;
@@ -156,21 +143,18 @@ VkLayerDeviceCreateInfo *get_chain_info(const VkDeviceCreateInfo *pCreateInfo, V
* Device -> CommandBuffer or Queue
* If use the object themselves as key to map then implies Create entrypoints have to be intercepted
* and a new key inserted into map */
-VkLayerInstanceDispatchTable * initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map)
-{
+VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map) {
VkLayerInstanceDispatchTable *pTable;
dispatch_key key = get_dispatch_key(instance);
- instance_table_map::const_iterator it = map.find((void *) key);
+ instance_table_map::const_iterator it = map.find((void *)key);
- if (it == map.end())
- {
- pTable = new VkLayerInstanceDispatchTable;
- map[(void *) key] = pTable;
+ if (it == map.end()) {
+ pTable = new VkLayerInstanceDispatchTable;
+ map[(void *)key] = pTable;
#if DISPATCH_MAP_DEBUG
fprintf(stderr, "New, Instance: map: %p, key: %p, table: %p\n", &map, key, pTable);
#endif
- } else
- {
+ } else {
#if DISPATCH_MAP_DEBUG
fprintf(stderr, "Instance: map: %p, key: %p, table: %p\n", &map, key, it->second);
#endif
@@ -182,26 +166,22 @@ VkLayerInstanceDispatchTable * initInstanceTable(VkInstance instance, const PFN_
return pTable;
}
-VkLayerInstanceDispatchTable * initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa)
-{
+VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa) {
return initInstanceTable(instance, gpa, tableInstanceMap);
}
-VkLayerDispatchTable * initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa, device_table_map &map)
-{
+VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa, device_table_map &map) {
VkLayerDispatchTable *pTable;
dispatch_key key = get_dispatch_key(device);
- device_table_map::const_iterator it = map.find((void *) key);
+ device_table_map::const_iterator it = map.find((void *)key);
- if (it == map.end())
- {
- pTable = new VkLayerDispatchTable;
- map[(void *) key] = pTable;
+ if (it == map.end()) {
+ pTable = new VkLayerDispatchTable;
+ map[(void *)key] = pTable;
#if DISPATCH_MAP_DEBUG
fprintf(stderr, "New, Device: map: %p, key: %p, table: %p\n", &map, key, pTable);
#endif
- } else
- {
+ } else {
#if DISPATCH_MAP_DEBUG
fprintf(stderr, "Device: map: %p, key: %p, table: %p\n", &map, key, it->second);
#endif
@@ -213,7 +193,6 @@ VkLayerDispatchTable * initDeviceTable(VkDevice device, const PFN_vkGetDevicePro
return pTable;
}
-VkLayerDispatchTable * initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa)
-{
+VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProcAddr gpa) {
return initDeviceTable(device, gpa, tableMap);
}