From bc227b9ebbbeeb4a13787340a6a8ca3f7110098a Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Sat, 13 Jun 2015 21:48:26 -0600 Subject: layers: Ifdef out debug code --- layers/layers_table.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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; } -- cgit v1.2.3