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
diff --git a/vk-layer-generate.py b/vk-layer-generate.py
index 66e0017..e57f8ec 100755
--- a/vk-layer-generate.py
+++ b/vk-layer-generate.py
@@ -268,19 +268,19 @@
if 'pUserData' == name:
return ("%i", "((pUserData == 0) ? 0 : *(pUserData))")
if 'const' in vk_type.lower():
- return ("%p", "(void*)(%s)" % name)
+ return ("0x%p", "(void*)(%s)" % name)
return ("%i", "*(%s)" % name)
return ("%i", name)
# TODO : This is special-cased as there's only one "format" param currently and it's nice to expand it
if "VkFormat" == vk_type:
if cpp:
- return ("%p", "&%s" % name)
+ return ("0x%p", "&%s" % name)
return ("{%s.channelFormat = %%s, %s.numericFormat = %%s}" % (name, name), "string_VK_COLOR_COMPONENT_FORMAT(%s.channelFormat), string_VK_FORMAT_RANGE_SIZE(%s.numericFormat)" % (name, name))
if output_param:
- return ("%p", "(void*)*%s" % name)
+ return ("0x%p", "(void*)*%s" % name)
if vk_helper.is_type(vk_type, 'struct') and '*' not in vk_type:
- return ("%p", "(void*)(&%s)" % name)
- return ("%p", "(void*)(%s)" % name)
+ return ("0x%p", "(void*)(&%s)" % name)
+ return ("0x%p", "(void*)(%s)" % name)
def _gen_create_msg_callback(self):
r_body = []