layers: Add typesafety traits

Add traits (present for dispatchable and for non-dispatchable 64 bit) to
improve type safety and enabled enhanced handle logging

Further typesafety changes will build on this in subsequent commits.

Change-Id: Ife7017df9c2516994407663cb2ebaaecc620a336
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index 438cc25..22f1dd0 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -47,6 +47,7 @@
 #include "vk_loader_platform.h"
 #include "vulkan/vk_layer.h"
 #include "vk_object_types.h"
+#include "cast_utils.h"
 #include "vk_validation_error_messages.h"
 #include "vk_layer_dispatch_table.h"
 
@@ -74,8 +75,8 @@
 
 // TODO: Could be autogenerated for the specific handles for extra type safety...
 template <typename HANDLE_T>
-static inline uint64_t HandleToUint64(HANDLE_T *h) {
-    return reinterpret_cast<uint64_t>(h);
+static inline uint64_t HandleToUint64(HANDLE_T h) {
+    return CastToUint64<HANDLE_T>(h);
 }
 
 static inline uint64_t HandleToUint64(uint64_t h) { return h; }
@@ -189,12 +190,8 @@
         return label;
     }
 
-    template <typename HANDLE_T>
-    std::string FormatHandle(HANDLE_T *h) const {
-        return FormatHandle(HandleToUint64(h));
-    }
-
-    std::string FormatHandle(uint64_t h) const {
+    std::string FormatHandle(const char * /* handle_name */, uint64_t h) const {
+        // Ignore handle_name string until the tests are changed to not fail when typename is emitted
         char uint64_string[64];
         sprintf(uint64_string, "0x%" PRIxLEAST64, h);
         std::string ret = uint64_string;
@@ -211,6 +208,14 @@
         return ret;
     }
 
+    // Backwards compatible path for entry points that pass uint64_t's
+    std::string FormatHandle(uint64_t h) const { return FormatHandle("", h); }
+
+    template <typename HANDLE_T>
+    std::string FormatHandle(HANDLE_T h) const {
+        return FormatHandle(VkHandleInfo<HANDLE_T>::Typename(), HandleToUint64(h));
+    }
+
 } debug_report_data;
 
 template debug_report_data *GetLayerDataPtr<debug_report_data>(void *data_key,