From db6a8d55264aa3eaf2a6ecf14734263fb74c6a80 Mon Sep 17 00:00:00 2001 From: Mark Mueller Date: Tue, 3 May 2016 13:17:29 -0600 Subject: layers:LX#470 Fix poor use of hex vs dec output 1) Introduce convention of explicitly placing "0x" before hex format requests for clarity (don't use "%#") 2) All lower case in hex output (except w/stringstream which refuses to do anything but uppercase, possibly only on windows). 3) Decorated pointers are printed for all Vulkan structure types. 3) Some intelligence in generators based on Vulkan variable name: if the Vulkan variable name contains ("flag", "bit", "offset", "handle", "buffer", "object", "mask") it will be output in hexadecimal format 4) Remove "using namespace std;" from global scope of vk_struct_string_helper_cpp.h Change-Id: Idbae73bfdaa3bc059543d43b209373cd0bcbc099 --- layers/vk_layer_table.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'layers/vk_layer_table.cpp') diff --git a/layers/vk_layer_table.cpp b/layers/vk_layer_table.cpp index 8664a891..05e51659 100644 --- a/layers/vk_layer_table.cpp +++ b/layers/vk_layer_table.cpp @@ -40,10 +40,10 @@ VkLayerInstanceDispatchTable *instance_dispatch_table(void *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, + fprintf(stderr, "instance_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: 0x%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); + fprintf(stderr, "instance_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: UNKNOWN\n", &tableInstanceMap, object, key); } #endif assert(it != tableInstanceMap.end() && "Not able to find instance dispatch entry"); @@ -54,9 +54,9 @@ 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()) { - fprintf(stderr, "destroy device dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second); + fprintf(stderr, "destroy device dispatch_table: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second); } else { - fprintf(stderr, "destroy device dispatch table: map: %p, key: %p, table: UNKNOWN\n", &map, key); + fprintf(stderr, "destroy device dispatch table: map: 0x%p, key: 0x%p, table: UNKNOWN\n", &map, key); assert(it != map.end()); } #endif @@ -67,9 +67,9 @@ 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()) { - fprintf(stderr, "destroy instance dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second); + fprintf(stderr, "destroy instance dispatch_table: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second); } else { - fprintf(stderr, "destroy instance dispatch table: map: %p, key: %p, table: UNKNOWN\n", &map, key); + fprintf(stderr, "destroy instance dispatch table: map: 0x%p, key: 0x%p, table: UNKNOWN\n", &map, key); assert(it != map.end()); } #endif @@ -85,10 +85,10 @@ VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void *object) { 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, + fprintf(stderr, "device_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: 0x%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); + fprintf(stderr, "device_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: UNKNOWN\n", &tableInstanceMap, object, key); } #endif assert(it != map.end() && "Not able to find device dispatch entry"); @@ -101,10 +101,10 @@ VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void * 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, + fprintf(stderr, "instance_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: 0x%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); + fprintf(stderr, "instance_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: UNKNOWN\n", &tableInstanceMap, object, key); } #endif assert(it != map.end() && "Not able to find instance dispatch entry"); @@ -145,11 +145,11 @@ VkLayerInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_v 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); + fprintf(stderr, "New, Instance: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, pTable); #endif } else { #if DISPATCH_MAP_DEBUG - fprintf(stderr, "Instance: map: %p, key: %p, table: %p\n", &map, key, it->second); + fprintf(stderr, "Instance: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second); #endif return it->second; } @@ -172,11 +172,11 @@ VkLayerDispatchTable *initDeviceTable(VkDevice device, const PFN_vkGetDeviceProc 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); + fprintf(stderr, "New, Device: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, pTable); #endif } else { #if DISPATCH_MAP_DEBUG - fprintf(stderr, "Device: map: %p, key: %p, table: %p\n", &map, key, it->second); + fprintf(stderr, "Device: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second); #endif return it->second; } -- cgit v1.2.3