Merge changes from topic "vkjson_fix" into main

* changes:
  Fix nullpointer dereference at VKJson
  Update vkjson codegen
diff --git a/vulkan/scripts/vkjson_generator.py b/vulkan/scripts/vkjson_generator.py
index 7dc55d9..6f621a1 100644
--- a/vulkan/scripts/vkjson_generator.py
+++ b/vulkan/scripts/vkjson_generator.py
@@ -184,12 +184,22 @@
     vkJson_core_entries.append(f"{struct_name} {version.lower()}")
 
     f.write(f"struct {struct_name} {{\n")
+    f.write(f"  {struct_name}() {{\n") # Start of constructor
+    for item in items:
+      for struct_type, _ in item.items():
+        field_name = "properties" if "Properties" in struct_type else "features"
+        f.write(f" memset(&{field_name}, 0, sizeof({struct_type}));\n")
+    f.write("  }\n")  # End of constructor
 
     for item in items:
       for struct_type, _ in item.items():
         field_name = "properties" if "Properties" in struct_type else "features"
         f.write(f"  {struct_type} {field_name};\n")
 
+    if version == "Core14":
+      f.write(f"std::vector<VkImageLayout> copy_src_layouts;\n")
+      f.write(f"std::vector<VkImageLayout> copy_dst_layouts;\n")
+
     f.write("};\n\n")
 
   return vkJson_core_entries
@@ -212,11 +222,6 @@
     f.write(f"memset(&{variable_name}, 0, sizeof({class_name}));\n")
     entries.append(f"{class_name} {variable_name}")
 
-  # Process vulkan core structs
-  for version in VK.VULKAN_CORES_AND_STRUCTS_MAPPING["versions"]:
-    struct_name = f"VkJson{version}"
-    f.write(f"memset(&{version.lower()}, 0, sizeof({struct_name}));\n")
-
   return entries
 
 
@@ -1757,6 +1762,21 @@
   if (device.properties.apiVersion >= VK_API_VERSION_1_4) {\n""")
     f.write(cc_code_properties_14)
     f.write(f"vkGetPhysicalDeviceProperties2(physical_device, &properties);\n\n")
+
+    f.write("""\
+if (device.core14.properties.copySrcLayoutCount > 0 || device.core14.properties.copyDstLayoutCount > 0 ) {
+  if (device.core14.properties.copySrcLayoutCount > 0) {
+    device.core14.copy_src_layouts.resize(device.core14.properties.copySrcLayoutCount);
+    device.core14.properties.pCopySrcLayouts = device.core14.copy_src_layouts.data();
+  }
+  if (device.core14.properties.copyDstLayoutCount > 0) {
+    device.core14.copy_dst_layouts.resize(device.core14.properties.copyDstLayoutCount);
+    device.core14.properties.pCopyDstLayouts = device.core14.copy_dst_layouts.data();
+  }
+  vkGetPhysicalDeviceProperties2(physical_device, &properties);
+}
+    \n""")
+
     f.write(cc_code_features_14)
     f.write(f"vkGetPhysicalDeviceFeatures2(physical_device, &features);\n\n")
     f.write("""\
diff --git a/vulkan/vkjson/vkjson.cc b/vulkan/vkjson/vkjson.cc
index 531a623..517e62d 100644
--- a/vulkan/vkjson/vkjson.cc
+++ b/vulkan/vkjson/vkjson.cc
@@ -36,6 +36,9 @@
 #include <type_traits>
 #include <utility>
 
+/*
+ * This file is autogenerated by vkjson_generator.py. Do not edit directly.
+ */
 namespace {
 
 /*
diff --git a/vulkan/vkjson/vkjson.h b/vulkan/vkjson/vkjson.h
index d74644c..cfba8c5 100644
--- a/vulkan/vkjson/vkjson.h
+++ b/vulkan/vkjson/vkjson.h
@@ -33,6 +33,9 @@
 #undef max
 #endif
 
+/*
+ * This file is autogenerated by vkjson_generator.py. Do not edit directly.
+ */
 struct VkJsonLayer {
   VkLayerProperties properties;
   std::vector<VkExtensionProperties> extensions;
@@ -263,23 +266,41 @@
 };
 
 struct VkJsonCore11 {
+  VkJsonCore11() {
+    memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan11Properties));
+    memset(&features, 0, sizeof(VkPhysicalDeviceVulkan11Features));
+  }
   VkPhysicalDeviceVulkan11Properties properties;
   VkPhysicalDeviceVulkan11Features features;
 };
 
 struct VkJsonCore12 {
+  VkJsonCore12() {
+    memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan12Properties));
+    memset(&features, 0, sizeof(VkPhysicalDeviceVulkan12Features));
+  }
   VkPhysicalDeviceVulkan12Properties properties;
   VkPhysicalDeviceVulkan12Features features;
 };
 
 struct VkJsonCore13 {
+  VkJsonCore13() {
+    memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan13Properties));
+    memset(&features, 0, sizeof(VkPhysicalDeviceVulkan13Features));
+  }
   VkPhysicalDeviceVulkan13Properties properties;
   VkPhysicalDeviceVulkan13Features features;
 };
 
 struct VkJsonCore14 {
+  VkJsonCore14() {
+    memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan14Properties));
+    memset(&features, 0, sizeof(VkPhysicalDeviceVulkan14Features));
+  }
   VkPhysicalDeviceVulkan14Properties properties;
   VkPhysicalDeviceVulkan14Features features;
+  std::vector<VkImageLayout> copy_src_layouts;
+  std::vector<VkImageLayout> copy_dst_layouts;
 };
 
 struct VkJsonDevice {
@@ -306,10 +327,6 @@
            sizeof(VkPhysicalDeviceSamplerYcbcrConversionFeatures));
     memset(&shader_draw_parameter_features, 0,
            sizeof(VkPhysicalDeviceShaderDrawParameterFeatures));
-    memset(&core11, 0, sizeof(VkJsonCore11));
-    memset(&core12, 0, sizeof(VkJsonCore12));
-    memset(&core13, 0, sizeof(VkJsonCore13));
-    memset(&core14, 0, sizeof(VkJsonCore14));
   }
   VkJsonKHRVariablePointers khr_variable_pointers;
   VkJsonKHRShaderFloat16Int8 khr_shader_float16_int8;
diff --git a/vulkan/vkjson/vkjson_instance.cc b/vulkan/vkjson/vkjson_instance.cc
index 22b3204..636c119 100644
--- a/vulkan/vkjson/vkjson_instance.cc
+++ b/vulkan/vkjson/vkjson_instance.cc
@@ -27,6 +27,9 @@
 #include <algorithm>
 #include <utility>
 
+/*
+ * This file is autogenerated by vkjson_generator.py. Do not edit directly.
+ */
 namespace {
 
 bool EnumerateExtensions(const char* layer_name,
@@ -512,6 +515,23 @@
 
     vkGetPhysicalDeviceProperties2(physical_device, &properties);
 
+    if (device.core14.properties.copySrcLayoutCount > 0 ||
+        device.core14.properties.copyDstLayoutCount > 0) {
+      if (device.core14.properties.copySrcLayoutCount > 0) {
+        device.core14.copy_src_layouts.resize(
+            device.core14.properties.copySrcLayoutCount);
+        device.core14.properties.pCopySrcLayouts =
+            device.core14.copy_src_layouts.data();
+      }
+      if (device.core14.properties.copyDstLayoutCount > 0) {
+        device.core14.copy_dst_layouts.resize(
+            device.core14.properties.copyDstLayoutCount);
+        device.core14.properties.pCopyDstLayouts =
+            device.core14.copy_dst_layouts.data();
+      }
+      vkGetPhysicalDeviceProperties2(physical_device, &properties);
+    }
+
     device.core14.features.sType =
         VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES;
     device.core14.features.pNext = features.pNext;