aboutsummaryrefslogtreecommitdiff
path: root/layers
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2015-06-13 21:48:26 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-06-18 10:22:56 -0600
commitbc227b9ebbbeeb4a13787340a6a8ca3f7110098a (patch)
treefa60e4f0994d66ffe1cfcd02f039cc6757be1b7c /layers
parent7bbb869a633d04687ea5bb1afd91b53ed6066b9e (diff)
downloadusermoji-bc227b9ebbbeeb4a13787340a6a8ca3f7110098a.tar.xz
layers: Ifdef out debug code
Diffstat (limited to 'layers')
-rw-r--r--layers/layers_table.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/layers/layers_table.cpp b/layers/layers_table.cpp
index 43450174..c765e821 100644
--- a/layers/layers_table.cpp
+++ b/layers/layers_table.cpp
@@ -45,11 +45,13 @@ VkLayerInstanceDispatchTable *instance_dispatch_table(VkObject object)
// VkLayerInstanceDispatchTable *pDisp = *(VkLayerInstanceDispatchTable **) object;
dispatch_key key = get_dispatch_key(object);
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);
} else {
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
}
+#endif
assert(it != tableInstanceMap.end() && "Not able to find instance dispatch entry");
return it->second;
}
@@ -57,24 +59,28 @@ VkLayerInstanceDispatchTable *instance_dispatch_table(VkObject object)
void destroy_dispatch_table(device_table_map &map, dispatch_key key)
{
device_table_map::const_iterator it = map.find((void *) key);
+#if DISPATCH_MAP_DEBUG
if (it != map.end()) {
fprintf(stderr, "destroy device dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second);
} else {
fprintf(stderr, "destroy device dispatch table: map: %p, key: %p, table: UNKNOWN\n", &map, key);
assert(it != map.end());
}
+#endif
map.erase(key);
}
void destroy_dispatch_table(instance_table_map &map, dispatch_key key)
{
instance_table_map::const_iterator it = map.find((void *) key);
+#if DISPATCH_MAP_DEBUG
if (it != map.end()) {
fprintf(stderr, "destroy instance dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second);
} else {
fprintf(stderr, "destroy instance dispatch table: map: %p, key: %p, table: UNKNOWN\n", &map, key);
assert(it != map.end());
}
+#endif
map.erase(key);
}
@@ -93,11 +99,13 @@ VkLayerDispatchTable *get_dispatch_table(device_table_map &map, VkObject object)
// VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) object;
dispatch_key key = get_dispatch_key(object);
device_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);
} else {
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
}
+#endif
assert(it != map.end() && "Not able to find device dispatch entry");
return it->second;
}
@@ -107,11 +115,13 @@ VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, VkObje
// VkLayerInstanceDispatchTable *pDisp = *(VkLayerInstanceDispatchTable **) object;
dispatch_key key = get_dispatch_key(object);
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);
} else {
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
}
+#endif
assert(it != map.end() && "Not able to find instance dispatch entry");
return it->second;
}
@@ -134,11 +144,15 @@ VkLayerInstanceDispatchTable * initInstanceTable(instance_table_map &map, const
{
pTable = new VkLayerInstanceDispatchTable;
map[(void *) *ppDisp] = pTable;
+#if DISPATCH_MAP_DEBUG
fprintf(stderr, "New, Instance: map: %p, base object: %p, key: %p, table: %p\n", &map, instancew, *ppDisp, pTable);
+#endif
assert(map.size() <= 1 && "Instance dispatch table map has more than one entry");
} else
{
+#if DISPATCH_MAP_DEBUG
fprintf(stderr, "Instance: map: %p, base object: %p, key: %p, table: %p\n", &map, instancew, *ppDisp, it->second);
+#endif
return it->second;
}
@@ -164,10 +178,14 @@ VkLayerDispatchTable * initDeviceTable(device_table_map &map, const VkBaseLayerO
{
layer_device_table = new VkLayerDispatchTable;
map[(void *) base_device_table] = layer_device_table;
+#if DISPATCH_MAP_DEBUG
fprintf(stderr, "New, Device: map: %p, base object: %p, key: %p, table: %p\n", &map, devw, *ppDisp, layer_device_table);
+#endif
} else
{
+#if DISPATCH_MAP_DEBUG
fprintf(stderr, "Device: map: %p, base object: %p, key: %p, table: %p\n", &map, devw, *ppDisp, it->second);
+#endif
return it->second;
}