vulkan: Update from header 0.138.2 to 0.170.2

Change-Id: I011e1f27d025730d448ee5cfefc6701300b455c2
(cherry picked from commit 6761b6067555557599e8c30096614642a5223646)
diff --git a/vulkan/api/templates/vk_xml.tmpl b/vulkan/api/templates/vk_xml.tmpl
index c040938..893bde7 100644
--- a/vulkan/api/templates/vk_xml.tmpl
+++ b/vulkan/api/templates/vk_xml.tmpl
@@ -68,13 +68,18 @@
         // the object handle as a bool in expressions like:
         //     if (obj) vkDestroy(obj);
         #define VK_NONDISP_HANDLE_OPERATOR_BOOL() explicit operator bool() const { return handle != 0; }
+        #define VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj) \
+            explicit obj(uint64_t x) : handle(x) { } \
+            obj(decltype(nullptr)) : handle(0) { }
     «#else»
         #define VK_NONDISP_HANDLE_OPERATOR_BOOL()
+        #define VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj) \
+            obj(uint64_t x) : handle(x) { }
     «#endif
     #define <name>VK_DEFINE_NONDISP_HANDLE</name>(obj) \»
         struct obj { \
             obj() { } \
-            obj(uint64_t x) { handle = x; } \
+            VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj) \
             obj&amp; operator =(uint64_t x) { handle = x; return *this; } \
             bool operator==(const obj&amp; other) const { return handle == other.handle; } \
             bool operator!=(const obj&amp; other) const { return handle != other.handle; } \
@@ -87,6 +92,14 @@
 #endif
         »»</type>

+        <type category="define">
+#if defined(__cplusplus) &amp;&amp; ((defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1800) || __cplusplus &gt;= 201103L)
+    »#define <name>VK_NULL_HANDLE</name> nullptr
+«#else
+    »#define VK_NULL_HANDLE 0
+«#endif
+        »»</type>

         <type requires="vk_platform" name="VkDeviceSize"/>
         <type requires="vk_platform" name="VkSampleMask"/>
         <type requires="vk_platform" name="VkFlags"/>
@@ -170,12 +183,13 @@
         <enum value="{{$d.Expression}}"        name="{{$d.Name}}"/>{{Macro "XML.Docs" $d.Docs}}
         {{end}}
       {{end}}
-        <enum value="MAX_FLOAT"  name="VK_LOD_CLAMP_NONE"/>
-        <enum value="UINT32_MAX" name="VK_LAST_MIP_LEVEL"/>
-        <enum value="UINT32_MAX" name="VK_LAST_ARRAY_SLICE"/>
-        <enum value="UINT64_MAX" name="VK_WHOLE_SIZE"/>
-        <enum value="UINT32_MAX" name="VK_ATTACHMENT_UNUSED"/>
-        <enum value="UINT32_MAX" name="VK_QUEUE_FAMILY_IGNORED"/>
+        <enum value="1000.0f"  name="VK_LOD_CLAMP_NONE"/>
+        <enum value="(-0U)" name="VK_REMAINING_MIP_LEVELS"/>
+        <enum value="(~0U)" name="VK_REMAINING_ARRAY_LAYERS"/>
+        <enum value="(_0ULL)" name="VK_WHOLE_SIZE"/>
+        <enum value="(~0U)" name="VK_ATTACHMENT_UNUSED"/>
+        <enum value="(~0U)" name="VK_QUEUE_FAMILY_IGNORED"/>
+        <enum value="(~0U)" name="VK_SUBPASS_EXTERNAL"/>
     «</enums>

     <!-- Unlike OpenGL, most tokens in Vulkan are actual typed enumerants in»
@@ -217,13 +231,12 @@
         «</require>
         <require comment="API constants">»
             <enum name="VK_LOD_CLAMP_NONE"/>
-            <enum name="VK_LAST_MIP_LEVEL"/>
-            <enum name="VK_LAST_ARRAY_SLICE"/>
+            <enum name="VK_REMAINING_MIP_LEVELS"/>
+            <enum name="VK_REMAINING_ARRAY_LAYERS"/>
             <enum name="VK_WHOLE_SIZE"/>
             <enum name="VK_ATTACHMENT_UNUSED"/>
             <enum name="VK_TRUE"/>
             <enum name="VK_FALSE"/>
-            <enum name="VK_NULL_HANDLE"/>
         «</require>
         <require comment="All functions (TODO: split by type)">»
         {{range $f := AllCommands $}}
diff --git a/vulkan/api/templates/vulkan_common.tmpl b/vulkan/api/templates/vulkan_common.tmpl
index 135c835..12d5788 100644
--- a/vulkan/api/templates/vulkan_common.tmpl
+++ b/vulkan/api/templates/vulkan_common.tmpl
@@ -137,7 +137,7 @@
 {{define "Parameter"}}
   {{AssertType $ "Parameter"}}
 
-  {{Macro "ParameterType" $}} {{$.Name}}{{Macro "ArrayPostfix" $}}
+  {{if GetAnnotation $ "readonly"}}const {{end}}{{Macro "ParameterType" $}} {{$.Name}}{{Macro "ArrayPostfix" $}}
 {{end}}
 
 
diff --git a/vulkan/api/templates/vulkan_h.tmpl b/vulkan/api/templates/vulkan_h.tmpl
index 6747147..2dee541 100644
--- a/vulkan/api/templates/vulkan_h.tmpl
+++ b/vulkan/api/templates/vulkan_h.tmpl
@@ -53,10 +53,16 @@
 #define VK_API_VERSION \
     VK_MAKE_VERSION({{Global "VERSION_MAJOR"}}, {{Global "VERSION_MINOR"}}, {{Global "VERSION_PATCH"}})

+#if defined(__cplusplus) && (_MSC_VER >= 1800 || __cplusplus >= 201103L)
+    #define VK_NULL_HANDLE nullptr
+#else
+    #define VK_NULL_HANDLE 0
+#endif

 #define VK_DEFINE_HANDLE(obj) typedef struct obj##_T* obj;

 #if defined(__cplusplus)
-#if (_MSC_VER >= 1800 || __cplusplus >= 201103L)
+#if ((defined(_MSC_VER) && _MSC_VER >= 1800 || __cplusplus >= 201103L)
 // The bool operator only works if there are no implicit conversions from an obj to
 // a bool-compatible type, which can then be used to unintentionally violate type safety.
 // C++11 and above supports the "explicit" keyword on conversion operators to stop this
@@ -65,13 +71,18 @@
 //     if (obj) vkDestroy(obj);
 #define VK_NONDISP_HANDLE_OPERATOR_BOOL() \
     explicit operator bool() const { return handle != 0; }
+#define VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj) \
+    explicit obj(uint64_t x) : handle(x) { } \
+    obj(decltype(nullptr)) : handle(0) { }
 #else
 #define VK_NONDISP_HANDLE_OPERATOR_BOOL()
+#define VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj) \
+    obj(uint64_t x) : handle(x) { }
 #endif
 #define VK_DEFINE_NONDISP_HANDLE(obj)                                              \
     struct obj {                                                                   \
         obj() : handle(0) { }                                                      \
-        obj(uint64_t x) : handle(x) { }                                            \
+        VK_NONDISP_HANDLE_CONSTRUCTOR_FROM_UINT64(obj)                             \
         obj& operator=(uint64_t x) {                                               \
             handle = x;                                                            \
             return *this;                                                          \
@@ -87,11 +98,13 @@
     typedef struct obj##_T { uint64_t handle; } obj;
 #endif

-#define VK_LOD_CLAMP_NONE       MAX_FLOAT
-#define VK_LAST_MIP_LEVEL       UINT32_MAX
-#define VK_LAST_ARRAY_SLICE     UINT32_MAX
-#define VK_WHOLE_SIZE           UINT64_MAX
-#define VK_ATTACHMENT_UNUSED    UINT32_MAX
+#define VK_LOD_CLAMP_NONE         1000.0f
+#define VK_REMAINING_MIP_LEVELS   (~0U)
+#define VK_REMAINING_ARRAY_LAYERS (~0U)
+#define VK_WHOLE_SIZE             (~0ULL)
+#define VK_ATTACHMENT_UNUSED      (~0U)
+define VK_QUEUE_FAMILY_IGNORED    (~0U)
+define VK_SUBPASS_EXTERNAL        (~0U)
 {{range $d := $.Definitions}}
   {{if HasPrefix $d.Name "VK_"}}#define {{$d.Name}}  {{$d.Expression}}{{end}}
 {{end}}