Merge remote-tracking branch 'remotes/mesa/17.2' into merge

Change-Id: I8bfcd1eaefb30e59ef6543c71ef1727478bfade2
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..052fea7
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,12 @@
+Language: Cpp
+ColumnLimit: 100
+UseTab: Never
+IndentWidth: 3
+BreakBeforeBraces: WebKit
+AccessModifierOffset: -3
+DerivePointerAlignment: false
+PointerAlignment: Left
+AllowShortFunctionsOnASingleLine: All
+KeepEmptyLinesAtTheStartOfBlocks: true
+AlignEscapedNewlinesLeft: false
+ForEachMacros: ['list_for_every_entry']
diff --git a/.gn b/.gn
new file mode 100644
index 0000000..a37c1d0
--- /dev/null
+++ b/.gn
@@ -0,0 +1,26 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+# This file is used by the gn meta-buildsystem find the root of the source tree
+# and to set startup options.
+
+# The location of the build configuration file.
+buildconfig = "//gnbuild/config/BUILDCONFIG.gn"
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..270cabb
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,38 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+group("magma_vulkan") {
+  public_deps = [
+    "include:vulkan",
+    "src/intel/vulkan:vulkan_intel",
+  ]
+}
+
+group("tests") {
+  testonly = true
+
+  public_deps = [
+    "src/intel/vulkan/tests",
+    "tests",
+  ]
+}
diff --git a/fetch_buildtools.sh b/fetch_buildtools.sh
new file mode 100755
index 0000000..e4d7562
--- /dev/null
+++ b/fetch_buildtools.sh
@@ -0,0 +1,4 @@
+git clone https://chromium.googlesource.com/chromium/buildtools.git
+
+# From depot_tools
+download_from_google_storage -s buildtools/linux64/gn.sha1 --bucket chromium-gn
diff --git a/gnbuild/config/BUILDCONFIG.gn b/gnbuild/config/BUILDCONFIG.gn
new file mode 100644
index 0000000..59bace6
--- /dev/null
+++ b/gnbuild/config/BUILDCONFIG.gn
@@ -0,0 +1,37 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+if (target_os == "") {
+  target_os = host_os
+}
+if (target_cpu == "") {
+  target_cpu = host_cpu
+}
+if (current_cpu == "") {
+  current_cpu = target_cpu
+}
+if (current_os == "") {
+  current_os = target_os
+}
+
+host_toolchain = "//build/toolchain/$host_os:$host_cpu"
+
+set_default_toolchain("//build/toolchain/$target_os:$target_cpu")
diff --git a/gnbuild/toolchain/gcc_toolchain.gni b/gnbuild/toolchain/gcc_toolchain.gni
new file mode 100644
index 0000000..3b6bbb4
--- /dev/null
+++ b/gnbuild/toolchain/gcc_toolchain.gni
@@ -0,0 +1,300 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This template defines a toolchain for something that works like gcc
+# (including clang).
+#
+# It requires the following variables specifying the executables to run:
+#  - cc
+#  - cxx
+#  - ar
+#  - ld
+# and the following which is used in the toolchain_args
+#  - toolchain_cpu  (What "current_cpu" should be set to when invoking a
+#                    build using this toolchain.)
+#  - toolchain_os  (What "current_os" should be set to when invoking a
+#                   build using this toolchain.)
+#
+# Optional parameters that control the tools:
+#
+#  - libs_section_prefix
+#  - libs_section_postfix
+#      The contents of these strings, if specified, will be placed around
+#      the libs section of the linker line. It allows one to inject libraries
+#      at the beginning and end for all targets in a toolchain.
+#  - solink_libs_section_prefix
+#  - solink_libs_section_postfix
+#      Same as libs_section_{pre,post}fix except used for solink instead of link.
+#  - post_solink
+#      The content of this string, if specified, will be appended to the solink
+#      command.
+#  - deps
+#      Just forwarded to the toolchain definition.
+#
+# Optional build argument contols.
+#
+#  - is_clang
+#      Whether to use clang instead of gcc.
+#  - is_component_build
+#      Whether to forcibly enable or disable component builds for this
+#      toolchain; if not specified, the toolchain will inherit the
+#      default setting.
+#  - use_gold
+#      Override the global use_gold setting, useful if the particular
+#      toolchain has a custom link step that is not actually using Gold.
+template("gcc_toolchain") {
+  toolchain(target_name) {
+    assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value")
+    assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value")
+    assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value")
+    assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value")
+    assert(defined(invoker.toolchain_cpu),
+           "gcc_toolchain() must specify a \"toolchain_cpu\"")
+    assert(defined(invoker.toolchain_os),
+           "gcc_toolchain() must specify a \"toolchain_os\"")
+
+    compiler_prefix = ""
+
+    # This define changes when the toolchain changes, forcing a rebuild.
+    # Nothing should ever use this define.
+    if (defined(invoker.rebuild_define)) {
+      rebuild_string = "-D" + invoker.rebuild_define + " "
+    } else {
+      rebuild_string = ""
+    }
+
+    # We can't do string interpolation ($ in strings) on things with dots in
+    # them. To allow us to use $cc below, for example, we create copies of
+    # these values in our scope.
+    cc = compiler_prefix + invoker.cc
+    cxx = compiler_prefix + invoker.cxx
+    ar = invoker.ar
+    ld = invoker.ld
+    if (defined(invoker.readelf)) {
+      readelf = invoker.readelf
+    } else {
+      readelf = "readelf"
+    }
+    if (defined(invoker.nm)) {
+      nm = invoker.nm
+    } else {
+      nm = "nm"
+    }
+
+    if (defined(invoker.executable_extension)) {
+      default_executable_extension = invoker.executable_extension
+    } else {
+      default_executable_extension = ""
+    }
+
+    # Bring these into our scope for string interpolation with default values.
+    if (defined(invoker.libs_section_prefix)) {
+      libs_section_prefix = invoker.libs_section_prefix
+    } else {
+      libs_section_prefix = ""
+    }
+
+    if (defined(invoker.libs_section_postfix)) {
+      libs_section_postfix = invoker.libs_section_postfix
+    } else {
+      libs_section_postfix = ""
+    }
+
+    if (defined(invoker.solink_libs_section_prefix)) {
+      solink_libs_section_prefix = invoker.solink_libs_section_prefix
+    } else {
+      solink_libs_section_prefix = ""
+    }
+
+    if (defined(invoker.solink_libs_section_postfix)) {
+      solink_libs_section_postfix = invoker.solink_libs_section_postfix
+    } else {
+      solink_libs_section_postfix = ""
+    }
+
+    # These library switches can apply to all tools below.
+    lib_switch = "-l"
+    lib_dir_switch = "-L"
+
+    tool("cc") {
+      depfile = "{{output}}.d"
+      command = "$cc -g -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
+      depsformat = "gcc"
+      description = "CC {{output}}"
+      outputs = [
+        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+      ]
+    }
+
+    tool("cxx") {
+      depfile = "{{output}}.d"
+      command = "$cxx -g -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
+      depsformat = "gcc"
+      description = "CXX {{output}}"
+      outputs = [
+        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+      ]
+    }
+
+    tool("asm") {
+      # We can just use the C compiler to compile assembly.
+      command = "$cc ${rebuild_string}{{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
+      description = "ASM {{output}}"
+      outputs = [
+        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+      ]
+    }
+
+    tool("alink") {
+      rspfile = "{{output}}.rsp"
+      command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
+      description = "AR {{output}}"
+      rspfile_content = "{{inputs}}"
+      outputs = [
+        "{{target_out_dir}}/{{target_output_name}}{{output_extension}}",
+      ]
+      default_output_extension = ".a"
+      output_prefix = "lib"
+    }
+
+    tool("solink") {
+      soname = "{{target_output_name}}{{output_extension}}"  # e.g. "libfoo.so".
+      sofile = "{{root_out_dir}}/$soname"  # Possibly including toolchain dir.
+      rspfile = sofile + ".rsp"
+
+      # These variables are not built into GN but are helpers that implement
+      # (1) linking to produce a .so, (2) extracting the symbols from that file
+      # to a temporary file, (3) if the temporary file has differences from the
+      # existing .TOC file, overwrite it, otherwise, don't change it.
+      tocfile = sofile + ".TOC"
+      temporary_tocname = sofile + ".tmp"
+      link_command =
+          "$ld -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile"
+      toc_command = "{ $readelf -d $sofile | grep SONAME ; $nm -gD -f p $sofile | cut -f1-2 -d' '; } > $temporary_tocname"
+      replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi"
+
+      command = "$link_command && $toc_command && $replace_command"
+      if (defined(invoker.postsolink)) {
+        command += " && " + invoker.postsolink
+      }
+      rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix"
+
+      description = "SOLINK $sofile"
+
+      # Use this for {{output_extension}} expansions unless a target manually
+      # overrides it (in which case {{output_extension}} will be what the target
+      # specifies).
+      default_output_extension = ".so"
+
+      output_prefix = "lib"
+
+      # Since the above commands only updates the .TOC file when it changes, ask
+      # Ninja to check if the timestamp actually changed to know if downstream
+      # dependencies should be recompiled.
+      restat = true
+
+      # Tell GN about the output files. It will link to the sofile but use the
+      # tocfile for dependency management.
+      outputs = [
+        sofile,
+        tocfile,
+      ]
+      if (defined(invoker.solink_outputs)) {
+        outputs += invoker.solink_outputs
+      }
+      link_output = sofile
+      depend_output = tocfile
+    }
+
+    tool("link") {
+      outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
+      rspfile = "$outfile.rsp"
+      command = "$ld {{ldflags}} -g -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix"
+
+      default_output_extension = default_executable_extension
+
+      if (defined(invoker.postlink)) {
+        command += " && " + invoker.postlink
+      }
+      description = "LINK $outfile"
+      rspfile_content = "{{inputs}}"
+      outputs = [
+        outfile,
+      ]
+      if (defined(invoker.link_outputs)) {
+        outputs += invoker.link_outputs
+      }
+    }
+
+    tool("stamp") {
+      command = "touch {{output}}"
+      description = "STAMP {{output}}"
+    }
+
+    tool("copy") {
+      command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
+      description = "COPY {{source}} {{output}}"
+    }
+
+    # When invoking this toolchain not as the default one, these args will be
+    # passed to the build. They are ignored when this is the default toolchain.
+    toolchain_args() {
+      current_cpu = invoker.toolchain_cpu
+      current_os = invoker.toolchain_os
+
+      # These values need to be passed through unchanged.
+      target_os = target_os
+      target_cpu = target_cpu
+
+      forward_variables_from(invoker,
+                             [
+                               "is_clang",
+                               "is_component_build",
+                               "use_gold",
+                               "symbol_level",
+                             ])
+    }
+
+    forward_variables_from(invoker, [ "deps" ])
+  }
+}
+
+# This is a shorthand for gcc_toolchain instances based on the
+# Chromium-built version of Clang.  Only the toolchain_cpu and
+# toolchain_os variables need to be specified by the invoker, and
+# optionally toolprefix if it's a cross-compile case.  Note that for
+# a cross-compile case this toolchain requires a config to pass the
+# appropriate -target option, or else it will actually just be doing
+# a native compile.  The invoker can optionally override use_gold too.
+template("clang_toolchain") {
+  assert(defined(invoker.toolchain_cpu),
+         "clang_toolchain() must specify a \"toolchain_cpu\"")
+  assert(defined(invoker.toolchain_os),
+         "clang_toolchain() must specify a \"toolchain_os\"")
+  if (defined(invoker.toolprefix)) {
+    toolprefix = invoker.toolprefix
+  } else {
+    toolprefix = ""
+  }
+
+  gcc_toolchain(target_name) {
+    prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
+                         root_build_dir)
+    cc = "$prefix/clang"
+    cxx = "$prefix/clang++"
+    ld = cxx
+    is_clang = true
+
+    readelf = "${toolprefix}readelf"
+    ar = "${toolprefix}ar"
+    nm = "${toolprefix}nm"
+
+    forward_variables_from(invoker,
+                           [
+                             "toolchain_cpu",
+                             "toolchain_os",
+                             "use_gold",
+                           ])
+  }
+}
diff --git a/gnbuild/toolchain/linux/BUILD.gn b/gnbuild/toolchain/linux/BUILD.gn
new file mode 100644
index 0000000..57312ea
--- /dev/null
+++ b/gnbuild/toolchain/linux/BUILD.gn
@@ -0,0 +1,36 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//build/toolchain/gcc_toolchain.gni")
+
+declare_args() {
+  toolchain_prefix = ""
+}
+
+gcc_toolchain("x64") {
+  cc = "${toolchain_prefix}gcc"
+  cxx = "${toolchain_prefix}g++"
+  ar = "${toolchain_prefix}ar"
+  ld = cxx
+
+  toolchain_cpu = host_cpu
+  toolchain_os = host_os
+}
diff --git a/hello_world.cpp b/hello_world.cpp
new file mode 100644
index 0000000..ed98a74
--- /dev/null
+++ b/hello_world.cpp
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main() {
+  printf("Hello, world\n");
+  return 0;
+}
diff --git a/include/BUILD.gn b/include/BUILD.gn
new file mode 100644
index 0000000..0374fb3
--- /dev/null
+++ b/include/BUILD.gn
@@ -0,0 +1,97 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("include_config") {
+  include_dirs = [ "." ]
+}
+
+source_set("GL") {
+  public_configs = [ ":include_config" ]
+  sources = [
+    "GL/gl.h",
+    "GL/gl_mangle.h",
+    "GL/glcorearb.h",
+    "GL/glext.h",
+    "GL/glx.h",
+    "GL/glx_mangle.h",
+    "GL/glxext.h",
+    "GL/internal/dri_interface.h",
+    "GL/osmesa.h",
+    "GL/wglext.h",
+  ]
+}
+
+config("vulkan_public_config") {
+  defines = [ "VK_USE_PLATFORM_MAGMA_KHR=1" ]
+}
+
+source_set("vulkan") {
+  public_configs = [
+    ":include_config",
+    ":vulkan_public_config",
+  ]
+  sources = [
+    "vulkan/vk_platform.h",
+    "vulkan/vulkan.h",
+    "vulkan/vulkan_intel.h",
+  ]
+}
+
+source_set("pci_ids") {
+  public_configs = [ ":include_config" ]
+  sources = [
+    "pci_ids/i810_pci_ids.h",
+    "pci_ids/i915_pci_ids.h",
+    "pci_ids/i965_pci_ids.h",
+    "pci_ids/r200_pci_ids.h",
+    "pci_ids/r300_pci_ids.h",
+    "pci_ids/r600_pci_ids.h",
+    "pci_ids/radeon_pci_ids.h",
+    "pci_ids/radeonsi_pci_ids.h",
+    "pci_ids/virtio_gpu_pci_ids.h",
+    "pci_ids/vmwgfx_pci_ids.h",
+  ]
+}
+
+config("c_compat_public_config") {
+  defines = [
+    "_DEFAULT_SOURCE",
+    "HAVE_PTHREAD=1",
+  ]
+}
+
+source_set("c_compat") {
+  public_configs = [
+    ":include_config",
+    ":c_compat_public_config",
+  ]
+
+  sources = [
+    "c11/threads.h",
+    "c11/threads_posix.h",
+    "c99_alloca.h",
+    "c99_compat.h",
+    "c99_math.h",
+    "no_extern_c.h",
+  ]
+}
diff --git a/include/drm-uapi/drm.h b/include/drm-uapi/drm.h
index bf3674a..0f750fc 100644
--- a/include/drm-uapi/drm.h
+++ b/include/drm-uapi/drm.h
@@ -42,6 +42,21 @@
 #include <asm/ioctl.h>
 typedef unsigned int drm_handle_t;
 
+#elif defined(__Fuchsia__)
+
+#include <bits/ioctl.h>
+#include <sys/types.h>
+typedef int8_t __s8;
+typedef uint8_t __u8;
+typedef int16_t __s16;
+typedef uint16_t __u16;
+typedef int32_t __s32;
+typedef uint32_t __u32;
+typedef int64_t __s64;
+typedef uint64_t __u64;
+typedef size_t __kernel_size_t;
+typedef unsigned long drm_handle_t;
+
 #else /* One of the BSDs */
 
 #include <sys/ioccom.h>
diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
index c26bf7c..e1cb682 100644
--- a/include/drm-uapi/i915_drm.h
+++ b/include/drm-uapi/i915_drm.h
@@ -694,24 +694,25 @@
 	 * User's handle for a buffer to be bound into the GTT for this
 	 * operation.
 	 */
-	__u32 handle;
+	//__u32 handle;
 
 	/** Number of relocations to be performed on this buffer */
-	__u32 relocation_count;
+	//__u32 relocation_count;
 	/**
 	 * Pointer to array of struct drm_i915_gem_relocation_entry containing
 	 * the relocations to be performed in this buffer.
 	 */
-	__u64 relocs_ptr;
+	//__u64 relocs_ptr;
 
 	/** Required alignment in graphics aperture */
-	__u64 alignment;
+	//__u64 alignment;
 
 	/**
 	 * Returned value of the updated offset of the object, for future
 	 * presumed_offset writes.
 	 */
-	__u64 offset;
+	//__u64 offset;
+	__u32 unused;
 };
 
 struct drm_i915_gem_execbuffer {
@@ -744,7 +745,7 @@
 	 * User's handle for a buffer to be bound into the GTT for this
 	 * operation.
 	 */
-	__u32 handle;
+	 __u64 handle; // magma uses 64bit buffer 'handles'
 
 	/** Number of relocations to be performed on this buffer */
 	__u32 relocation_count;
diff --git a/include/vulkan/vk_icd.h b/include/vulkan/vk_icd.h
index 7b54fb5..f0f02f2 100644
--- a/include/vulkan/vk_icd.h
+++ b/include/vulkan/vk_icd.h
@@ -64,7 +64,8 @@
     VK_ICD_WSI_PLATFORM_WIN32,
     VK_ICD_WSI_PLATFORM_XCB,
     VK_ICD_WSI_PLATFORM_XLIB,
-    VK_ICD_WSI_PLATFORM_DISPLAY
+    VK_ICD_WSI_PLATFORM_DISPLAY,
+    VK_ICD_WSI_PLATFORM_MAGMA
 } VkIcdWsiPlatform;
 
 typedef struct {
@@ -117,6 +118,14 @@
 } VkIcdSurfaceAndroid;
 #endif //VK_USE_PLATFORM_ANDROID_KHR
 
+#ifdef VK_USE_PLATFORM_MAGMA_KHR
+typedef struct _VkIcdSurfaceMagma {
+   VkIcdSurfaceBase base;
+   int fd;
+   void* connection;
+} VkIcdSurfaceMagma;
+#endif // VK_USE_PLATFORM_MAGMA_KHR
+
 typedef struct {
     VkIcdSurfaceBase base;
     VkDisplayModeKHR displayMode;
diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h
index 16434fe..42d6755 100644
--- a/include/vulkan/vulkan.h
+++ b/include/vulkan/vulkan.h
@@ -34,16 +34,16 @@
     (((major) << 22) | ((minor) << 12) | (patch))
 
 // DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead.
-//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0)
+//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0
 
 // Vulkan 1.0 version number
-#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)
+#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)// Patch version should always be set to 0
 
 #define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
 #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
 #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
 // Version of this file
-#define VK_HEADER_VERSION 54
+#define VK_HEADER_VERSION 57
 
 
 #define VK_NULL_HANDLE 0
@@ -214,6 +214,7 @@
     VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000,
     VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
     VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
+    VK_STRUCTURE_TYPE_MAGMA_SURFACE_CREATE_INFO_KHR = 1000010000,
     VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000,
     VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000,
     VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000,
@@ -333,6 +334,11 @@
     VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002,
     VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000,
     VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000,
+    VK_STRUCTURE_TYPE_IMPORT_MEMORY_FUCHSIA_HANDLE_INFO_KHR = 1001000000,
+    VK_STRUCTURE_TYPE_MEMORY_FUCHSIA_HANDLE_PROPERTIES_KHR = 1001000001,
+    VK_STRUCTURE_TYPE_MEMORY_GET_FUCHSIA_HANDLE_INFO_KHR = 1001000002,
+    VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FUCHSIA_HANDLE_INFO_KHR = 1001001000,
+    VK_STRUCTURE_TYPE_SEMAPHORE_GET_FUCHSIA_HANDLE_INFO_KHR = 1001001001,
     VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
     VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
     VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
@@ -1048,6 +1054,7 @@
     VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020,
     VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040,
     VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080,
+    VK_IMAGE_USAGE_SCANOUT_BIT_GOOGLE = 0x00010000,
     VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
 } VkImageUsageFlagBits;
 typedef VkFlags VkImageUsageFlags;
@@ -1366,6 +1373,27 @@
 } VkStencilFaceFlagBits;
 typedef VkFlags VkStencilFaceFlags;
 
+typedef struct VkApplicationInfo {
+    VkStructureType    sType;
+    const void*        pNext;
+    const char*        pApplicationName;
+    uint32_t           applicationVersion;
+    const char*        pEngineName;
+    uint32_t           engineVersion;
+    uint32_t           apiVersion;
+} VkApplicationInfo;
+
+typedef struct VkInstanceCreateInfo {
+    VkStructureType             sType;
+    const void*                 pNext;
+    VkInstanceCreateFlags       flags;
+    const VkApplicationInfo*    pApplicationInfo;
+    uint32_t                    enabledLayerCount;
+    const char* const*          ppEnabledLayerNames;
+    uint32_t                    enabledExtensionCount;
+    const char* const*          ppEnabledExtensionNames;
+} VkInstanceCreateInfo;
+
 typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)(
     void*                                       pUserData,
     size_t                                      size,
@@ -1395,29 +1423,6 @@
     VkInternalAllocationType                    allocationType,
     VkSystemAllocationScope                     allocationScope);
 
-typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void);
-
-typedef struct VkApplicationInfo {
-    VkStructureType    sType;
-    const void*        pNext;
-    const char*        pApplicationName;
-    uint32_t           applicationVersion;
-    const char*        pEngineName;
-    uint32_t           engineVersion;
-    uint32_t           apiVersion;
-} VkApplicationInfo;
-
-typedef struct VkInstanceCreateInfo {
-    VkStructureType             sType;
-    const void*                 pNext;
-    VkInstanceCreateFlags       flags;
-    const VkApplicationInfo*    pApplicationInfo;
-    uint32_t                    enabledLayerCount;
-    const char* const*          ppEnabledLayerNames;
-    uint32_t                    enabledExtensionCount;
-    const char* const*          ppEnabledExtensionNames;
-} VkInstanceCreateInfo;
-
 typedef struct VkAllocationCallbacks {
     void*                                   pUserData;
     PFN_vkAllocationFunction                pfnAllocation;
@@ -1658,6 +1663,7 @@
     VkMemoryHeap    memoryHeaps[VK_MAX_MEMORY_HEAPS];
 } VkPhysicalDeviceMemoryProperties;
 
+typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void);
 typedef struct VkDeviceQueueCreateInfo {
     VkStructureType             sType;
     const void*                 pNext;
@@ -3433,6 +3439,7 @@
     VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011,
     VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012,
     VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013,
+    VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014,
     VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
     VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
     VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1),
@@ -3970,6 +3977,38 @@
 #endif
 #endif /* VK_USE_PLATFORM_WIN32_KHR */
 
+#ifdef VK_USE_PLATFORM_MAGMA_KHR
+#define VK_KHR_magma_surface 1
+#define VK_KHR_MAGMA_SURFACE_SPEC_VERSION 1
+#define VK_KHR_MAGMA_SURFACE_EXTENSION_NAME "VK_KHR_magma_surface"
+
+typedef VkFlags VkMagmaSurfaceCreateFlagsKHR;
+
+typedef struct VkMagmaSurfaceCreateInfoKHR {
+    VkStructureType    sType;
+    const void*        pNext;
+    uint32_t           imagePipeHandle;
+    uint32_t           width;
+    uint32_t           height;
+} VkMagmaSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateMagmaSurfaceKHR)(VkInstance instance, const VkMagmaSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMagmaPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateMagmaSurfaceKHR(
+    VkInstance                                  instance,
+    const VkMagmaSurfaceCreateInfoKHR*          pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSurfaceKHR*                               pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMagmaPresentationSupportKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t                                    queueFamilyIndex);
+#endif
+#endif /* VK_USE_PLATFORM_MAGMA_KHR */
+
 #define VK_KHR_sampler_mirror_clamp_to_edge 1
 #define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1
 #define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge"
@@ -4119,6 +4158,7 @@
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 0x00000010,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 0x00000020,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 0x00000040,
+    VK_EXTERNAL_MEMORY_HANDLE_TYPE_FUCHSIA_VMO_BIT_KHR = 0x00000080,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
 } VkExternalMemoryHandleTypeFlagBitsKHR;
 typedef VkFlags VkExternalMemoryHandleTypeFlagsKHR;
@@ -4332,6 +4372,7 @@
     VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004,
     VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = 0x00000008,
     VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000010,
+    VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FUCHSIA_FENCE_BIT_KHR = 0x00000020,
     VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
 } VkExternalSemaphoreHandleTypeFlagBitsKHR;
 typedef VkFlags VkExternalSemaphoreHandleTypeFlagsKHR;
@@ -4851,6 +4892,11 @@
 #define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class"
 
 
+#define VK_KHR_relaxed_block_layout 1
+#define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1
+#define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout"
+
+
 #define VK_KHR_get_memory_requirements2 1
 #define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1
 #define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2"
@@ -4908,6 +4954,82 @@
     VkSparseImageMemoryRequirements2KHR*        pSparseMemoryRequirements);
 #endif
 
+#define VK_KHR_external_memory_fuchsia 1
+#define VK_KHR_EXTERNAL_MEMORY_FUCHSIA_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME "VK_KHR_external_memory_fuchsia"
+
+typedef struct VkImportMemoryFuchsiaHandleInfoKHR {
+    VkStructureType                          sType;
+    const void*                              pNext;
+    VkExternalMemoryHandleTypeFlagBitsKHR    handleType;
+    uint32_t                                 handle;
+} VkImportMemoryFuchsiaHandleInfoKHR;
+
+typedef struct VkMemoryFuchsiaHandlePropertiesKHR {
+    VkStructureType    sType;
+    void*              pNext;
+    uint32_t           memoryTypeBits;
+} VkMemoryFuchsiaHandlePropertiesKHR;
+
+typedef struct VkMemoryGetFuchsiaHandleInfoKHR {
+    VkStructureType                          sType;
+    const void*                              pNext;
+    VkDeviceMemory                           memory;
+    VkExternalMemoryHandleTypeFlagBitsKHR    handleType;
+} VkMemoryGetFuchsiaHandleInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFuchsiaHandleKHR)(VkDevice device, const VkMemoryGetFuchsiaHandleInfoKHR* pGetFuchsiaHandleInfo, uint32_t* pFuchsiaHandle);
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFuchsiaHandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, uint32_t fuchsiaHandle, VkMemoryFuchsiaHandlePropertiesKHR* pMemoryFuchsiaHandleProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFuchsiaHandleKHR(
+    VkDevice                                    device,
+    const VkMemoryGetFuchsiaHandleInfoKHR*      pGetFuchsiaHandleInfo,
+    uint32_t*                                   pFuchsiaHandle);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFuchsiaHandlePropertiesKHR(
+    VkDevice                                    device,
+    VkExternalMemoryHandleTypeFlagBitsKHR       handleType,
+    uint32_t                                    fuchsiaHandle,
+    VkMemoryFuchsiaHandlePropertiesKHR*         pMemoryFuchsiaHandleProperties);
+#endif
+
+#define VK_KHR_external_semaphore_fuchsia 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_EXTENSION_NAME "VK_KHR_external_semaphore_fuchsia"
+
+typedef struct VkImportSemaphoreFuchsiaHandleInfoKHR {
+    VkStructureType                             sType;
+    const void*                                 pNext;
+    VkSemaphore                                 semaphore;
+    VkSemaphoreImportFlagsKHR                   flags;
+    VkExternalSemaphoreHandleTypeFlagBitsKHR    handleType;
+    uint32_t                                    handle;
+} VkImportSemaphoreFuchsiaHandleInfoKHR;
+
+typedef struct VkSemaphoreGetFuchsiaHandleInfoKHR {
+    VkStructureType                             sType;
+    const void*                                 pNext;
+    VkSemaphore                                 semaphore;
+    VkExternalSemaphoreHandleTypeFlagBitsKHR    handleType;
+} VkSemaphoreGetFuchsiaHandleInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreFuchsiaHandleKHR)(VkDevice device, const VkImportSemaphoreFuchsiaHandleInfoKHR* pImportSemaphoreFuchsiaHandleInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreFuchsiaHandleKHR)(VkDevice device, const VkSemaphoreGetFuchsiaHandleInfoKHR* pGetFuchsiaHandleInfo, uint32_t* pFuchsiaHandle);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFuchsiaHandleKHR(
+    VkDevice                                    device,
+    const VkImportSemaphoreFuchsiaHandleInfoKHR* pImportSemaphoreFuchsiaHandleInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFuchsiaHandleKHR(
+    VkDevice                                    device,
+    const VkSemaphoreGetFuchsiaHandleInfoKHR*   pGetFuchsiaHandleInfo,
+    uint32_t*                                   pFuchsiaHandle);
+#endif
+
 #define VK_EXT_debug_report 1
 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
 
@@ -4979,7 +5101,6 @@
     const char*                                 pMessage,
     void*                                       pUserData);
 
-
 typedef struct VkDebugReportCallbackCreateInfoEXT {
     VkStructureType                 sType;
     const void*                     pNext;
@@ -5021,6 +5142,11 @@
 #define VK_NV_GLSL_SHADER_EXTENSION_NAME  "VK_NV_glsl_shader"
 
 
+#define VK_EXT_depth_range_unrestricted 1
+#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1
+#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted"
+
+
 #define VK_IMG_filter_cubic 1
 #define VK_IMG_FILTER_CUBIC_SPEC_VERSION  1
 #define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic"
@@ -5088,31 +5214,31 @@
 } VkDebugMarkerMarkerInfoEXT;
 
 
-typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, VkDebugMarkerObjectTagInfoEXT* pTagInfo);
-typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, VkDebugMarkerObjectNameInfoEXT* pNameInfo);
-typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, const VkDebugMarkerObjectTagInfoEXT* pTagInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, const VkDebugMarkerObjectNameInfoEXT* pNameInfo);
+typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
 typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer);
-typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
 
 #ifndef VK_NO_PROTOTYPES
 VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT(
     VkDevice                                    device,
-    VkDebugMarkerObjectTagInfoEXT*              pTagInfo);
+    const VkDebugMarkerObjectTagInfoEXT*        pTagInfo);
 
 VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT(
     VkDevice                                    device,
-    VkDebugMarkerObjectNameInfoEXT*             pNameInfo);
+    const VkDebugMarkerObjectNameInfoEXT*       pNameInfo);
 
 VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT(
     VkCommandBuffer                             commandBuffer,
-    VkDebugMarkerMarkerInfoEXT*                 pMarkerInfo);
+    const VkDebugMarkerMarkerInfoEXT*           pMarkerInfo);
 
 VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT(
     VkCommandBuffer                             commandBuffer);
 
 VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT(
     VkCommandBuffer                             commandBuffer,
-    VkDebugMarkerMarkerInfoEXT*                 pMarkerInfo);
+    const VkDebugMarkerMarkerInfoEXT*           pMarkerInfo);
 #endif
 
 #define VK_AMD_gcn_shader 1
@@ -6204,7 +6330,7 @@
 #endif
 
 #define VK_EXT_swapchain_colorspace 1
-#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 2
+#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 3
 #define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace"
 
 
@@ -6328,6 +6454,11 @@
 #define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16"
 
 
+#define VK_AMD_mixed_attachment_samples 1
+#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1
+#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples"
+
+
 #define VK_EXT_blend_operation_advanced 1
 #define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2
 #define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced"
@@ -6421,6 +6552,16 @@
 #define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle"
 
 
+#define VK_EXT_post_depth_coverage 1
+#define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1
+#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage"
+
+
+#define VK_GOOGLE_image_usage_scanout 1
+#define VK_GOOGLE_IMAGE_USAGE_SCANOUT_SPEC_VERSION 1
+#define VK_GOOGLE_IMAGE_USAGE_SCANOUT_EXTENSION_NAME "VK_GOOGLE_image_usage_scanout"
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/scripts/gn_script_wrapper.py b/scripts/gn_script_wrapper.py
new file mode 100755
index 0000000..cb49150
--- /dev/null
+++ b/scripts/gn_script_wrapper.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+#all this script does is execute the second argument and pipe its output to the file specified by the first argument
+#this is to let GN use the mesa python scripts that generate headers and barf them to stdout
+import subprocess
+import sys
+
+if __name__ == '__main__':
+    f = open(sys.argv[2], 'w')
+    exec_string = "PYTHONPATH=" + sys.argv[1] + " python " + " ".join(sys.argv[3:])
+    child = subprocess.Popen(exec_string, shell=True, stdout=subprocess.PIPE)
+    f.write(child.stdout.read())
+    exit(child.returncode)
\ No newline at end of file
diff --git a/src/BUILD.gn b/src/BUILD.gn
new file mode 100644
index 0000000..cec7e6d
--- /dev/null
+++ b/src/BUILD.gn
@@ -0,0 +1,90 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("common_config") {
+  defines = [
+    "STDC_HEADERS=1",
+    "HAVE_SYS_TYPES_H=1",
+    "HAVE_SYS_STAT_H=1",
+    "HAVE_STDLIB_H=1",
+    "HAVE_STRING_H=1",
+    "HAVE_MEMORY_H=1",
+    "HAVE_STRINGS_H=1",
+    "HAVE_INTTYPES_H=1",
+    "HAVE_STDINT_H=1",
+    "HAVE_UNISTD_H=1",
+    "HAVE_DLFCN_H=1",
+    "YYTEXT_POINTER=1",
+    "HAVE___BUILTIN_BSWAP32=1",
+    "HAVE___BUILTIN_BSWAP64=1",
+    "HAVE___BUILTIN_CLZ=1",
+    "HAVE___BUILTIN_CLZLL=1",
+    "HAVE___BUILTIN_CTZ=1",
+    "HAVE___BUILTIN_EXPECT=1",
+    "HAVE___BUILTIN_FFS=1",
+    "HAVE___BUILTIN_FFSLL=1",
+    "HAVE___BUILTIN_POPCOUNT=1",
+    "HAVE___BUILTIN_POPCOUNTLL=1",
+    "HAVE___BUILTIN_UNREACHABLE=1",
+    "HAVE_FUNC_ATTRIBUTE_CONST=1",
+    "HAVE_FUNC_ATTRIBUTE_FLATTEN=1",
+    "HAVE_FUNC_ATTRIBUTE_FORMAT=1",
+    "HAVE_FUNC_ATTRIBUTE_MALLOC=1",
+    "HAVE_FUNC_ATTRIBUTE_PACKED=1",
+    "HAVE_FUNC_ATTRIBUTE_PURE=1",
+    "HAVE_FUNC_ATTRIBUTE_UNUSED=1",
+    "HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1",
+    "HAVE_DLADDR=1",
+    "HAVE_CLOCK_GETTIME=1",
+    "PACKAGE_NAME=\"Mesa\" ",
+    "PACKAGE_TARNAME=\"mesa\" ",
+    "PACKAGE_VERSION=\"11.2.1\" ",
+    "PACKAGE_STRING=\"Mesa\ 11.2.1\" ",
+    "PACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi\?product=Mesa\" ",
+    "PACKAGE_URL=\"\" ",
+    "PACKAGE=\"mesa\" ",
+    "VERSION=\"11.2.1\"",
+    "_DEFAULT_SOURCE",
+  ]
+
+  if (is_debug) {
+    defines += [ "DEBUG=1" ]
+  }
+
+  # TODO(MA-18) fix these warnings and remove the -Wno*
+  cflags = [
+    "-Wall",
+    "-Wno-missing-field-initializers",
+    "-Wno-initializer-overrides",
+    "-Wno-sign-compare",
+    "-Wno-overloaded-virtual",
+    "-Wno-absolute-value",
+    "-Wno-missing-braces",
+    "-Wno-unused-function",
+    "-Wno-mismatched-tags",
+    "-Wno-enum-conversion",
+    "-Wno-unused-variable",
+    "-Wno-unused-private-field",
+    "-Wno-sometimes-uninitialized",
+  ]
+}
diff --git a/src/compiler/BUILD.gn b/src/compiler/BUILD.gn
new file mode 100644
index 0000000..6f1f4f4
--- /dev/null
+++ b/src/compiler/BUILD.gn
@@ -0,0 +1,47 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+source_set("compiler") {
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  sources = [
+    "builtin_type_macros.h",
+    "glsl_types.cpp",
+    "glsl_types.h",
+    "nir_types.cpp",
+    "nir_types.h",
+    "shader_enums.c",
+    "shader_enums.h",
+  ]
+
+  include_dirs = [
+    "$mesa_build_root/src/mesa",
+    "$mesa_build_root/src/mapi",
+  ]
+
+  deps = [
+    "$mesa_build_root/src/util",
+    "glsl:ir_expression_operation",
+    "nir",
+  ]
+}
diff --git a/src/compiler/glsl/BUILD.gn b/src/compiler/glsl/BUILD.gn
new file mode 100644
index 0000000..a85d4cc
--- /dev/null
+++ b/src/compiler/glsl/BUILD.gn
@@ -0,0 +1,52 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+action("gen_ir_expression_operation") {
+  output_name = "ir_expression_operation.h"
+  script_name = "ir_expression_operation.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "enum",
+  ]
+}
+
+config("gen_includes") {
+  include_dirs = [ target_gen_dir ]
+}
+
+group("ir_expression_operation") {
+  public_configs = [ ":gen_includes" ]
+
+  deps = [
+    ":gen_ir_expression_operation",
+  ]
+}
diff --git a/src/compiler/glsl/bash_script_wrapper.py b/src/compiler/glsl/bash_script_wrapper.py
new file mode 100755
index 0000000..28da00b
--- /dev/null
+++ b/src/compiler/glsl/bash_script_wrapper.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import subprocess
+import sys
+
+if __name__ == '__main__':
+    child = subprocess.Popen(" ".join(sys.argv[1:]), shell=True)
+    exit(child.returncode)
\ No newline at end of file
diff --git a/src/compiler/glsl/generate_parser_and_lexer.sh b/src/compiler/glsl/generate_parser_and_lexer.sh
new file mode 100644
index 0000000..767a630
--- /dev/null
+++ b/src/compiler/glsl/generate_parser_and_lexer.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+# This script generates the glsl and glcpp lexer and parser
+
+echo "$1"
\ No newline at end of file
diff --git a/src/compiler/glsl/glcpp/BUILD.gn b/src/compiler/glsl/glcpp/BUILD.gn
new file mode 100644
index 0000000..57cf278
--- /dev/null
+++ b/src/compiler/glsl/glcpp/BUILD.gn
@@ -0,0 +1,39 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+source_set("glcpp") {
+  include_dirs = [
+    "$mesa_build_root/src",
+    "$mesa_build_root/src/mesa",
+    "$mesa_build_root/src/mapi",
+  ]
+
+  deps = [
+    "$mesa_build_root/include:c_compat",
+  ]
+
+  sources = [
+    "glcpp.h",
+    "pp.c",
+  ]
+}
diff --git a/src/compiler/nir/BUILD.gn b/src/compiler/nir/BUILD.gn
new file mode 100644
index 0000000..6f3955f
--- /dev/null
+++ b/src/compiler/nir/BUILD.gn
@@ -0,0 +1,298 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("nir_public_config") {
+  include_dirs = [ "." ]
+}
+
+source_set("nir") {
+  public_configs = [
+    "$mesa_build_root/src:common_config",
+    ":nir_public_config",
+  ]
+
+  public_deps = [
+    ":gen",
+  ]
+
+  deps = [
+    ":nir_compiler_workaround",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/compiler/glsl:ir_expression_operation",
+    "$mesa_build_root/src/util",
+  ]
+
+  include_dirs = [
+    "..",
+    "$mesa_build_root/src/mapi",
+    "$mesa_build_root/src/mesa",
+  ]
+
+  sources = [
+    "nir.c",
+    "nir.h",
+    "nir_builder.h",
+    "nir_clone.c",
+    "nir_constant_expressions.h",
+    "nir_control_flow.c",
+    "nir_control_flow.h",
+    "nir_control_flow_private.h",
+    "nir_dominance.c",
+    "nir_from_ssa.c",
+    "nir_gather_info.c",
+    "nir_gs_count_vertices.c",
+    "nir_inline_functions.c",
+    "nir_instr_set.c",
+    "nir_instr_set.h",
+    "nir_intrinsics.c",
+    "nir_intrinsics.h",
+    "nir_liveness.c",
+    "nir_loop_analyze.c",
+    "nir_lower_64bit_packing.c",
+    "nir_lower_alu_to_scalar.c",
+    "nir_lower_atomics.c",
+    "nir_lower_clip.c",
+    "nir_lower_clip_cull_distance_arrays.c",
+    "nir_lower_constant_initializers.c",
+    "nir_lower_double_ops.c",
+    "nir_lower_global_vars_to_local.c",
+    "nir_lower_gs_intrinsics.c",
+    "nir_lower_idiv.c",
+    "nir_lower_indirect_derefs.c",
+    "nir_lower_int64.c",
+    "nir_lower_io.c",
+    "nir_lower_io_to_temporaries.c",
+    "nir_lower_load_const_to_scalar.c",
+    "nir_lower_locals_to_regs.c",
+    "nir_lower_patch_vertices.c",
+    "nir_lower_phis_to_scalar.c",
+    "nir_lower_read_invocation_to_scalar.c",
+    "nir_lower_regs_to_ssa.c",
+    "nir_lower_returns.c",
+    "nir_lower_samplers.c",
+    "nir_lower_system_values.c",
+    "nir_lower_tex.c",
+    "nir_lower_to_source_mods.c",
+    "nir_lower_two_sided_color.c",
+    "nir_lower_var_copies.c",
+    "nir_lower_vars_to_ssa.c",
+    "nir_lower_vec_to_movs.c",
+    "nir_lower_wpos_center.c",
+    "nir_metadata.c",
+    "nir_move_vec_src_uses_to_dest.c",
+    "nir_normalize_cubemap_coords.c",
+    "nir_opt_constant_folding.c",
+    "nir_opt_copy_prop_vars.c",
+    "nir_opt_copy_propagate.c",
+    "nir_opt_cse.c",
+    "nir_opt_dce.c",
+    "nir_opt_dead_cf.c",
+    "nir_opt_gcm.c",
+    "nir_opt_global_to_local.c",
+    "nir_opt_if.c",
+    "nir_opt_intrinsics.c",
+    "nir_opt_loop_unroll.c",
+    "nir_opt_move_comparisons.c",
+    "nir_opt_peephole_select.c",
+    "nir_opt_remove_phis.c",
+    "nir_opt_trivial_continues.c",
+    "nir_opt_undef.c",
+    "nir_phi_builder.c",
+    "nir_print.c",
+    "nir_propagate_invariant.c",
+    "nir_remove_dead_variables.c",
+    "nir_repair_ssa.c",
+    "nir_search.c",
+    "nir_search.h",
+    "nir_split_var_copies.c",
+    "nir_sweep.c",
+    "nir_to_lcssa.c",
+    "nir_validate.c",
+    "nir_vla.h",
+    "nir_worklist.c",
+    "nir_worklist.h",
+  ]
+}
+
+# With -O2 this file causes an infinite loop with clang 3.9.0
+source_set("nir_compiler_workaround") {
+  sources = [
+    "nir_lower_wpos_ytransform.c",
+  ]
+
+  cflags_c = [ "-O1" ]
+
+  include_dirs = [ "$mesa_build_root/src/mesa" ]
+
+  deps = [
+    ":gen",
+    "$mesa_build_root/src/util",
+  ]
+}
+
+group("nir_headers") {
+  public_configs = [ ":nir_public_config" ]
+
+  public_deps = [
+    ":gen",
+  ]
+}
+
+action("nir_opcodes") {
+  output_name = "nir_opcodes.h"
+  script_name = "nir_opcodes_h.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "nir_opcodes.py",
+    script_name,
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+  ]
+}
+
+action("nir_builder_opcodes") {
+  output_name = "nir_builder_opcodes.h"
+  script_name = "nir_builder_opcodes_h.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "nir_opcodes.py",
+    script_name,
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+  ]
+}
+
+action("nir_constant_expressions") {
+  output_name = "nir_constant_expressions.c"
+  script_name = "nir_constant_expressions.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "nir_opcodes.py",
+    script_name,
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+  ]
+}
+
+action("nir_opcodes_c") {
+  output_name = "nir_opcodes.c"
+  script_name = "nir_opcodes_c.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "nir_opcodes.py",
+    script_name,
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+  ]
+}
+
+action("nir_opt_algebraic") {
+  output_name = "nir_opt_algebraic.c"
+  script_name = "nir_opt_algebraic.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "nir_algebraic.py",
+    script_name,
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+  ]
+}
+
+config("gen_public_config") {
+  include_dirs = [ target_gen_dir ]
+}
+
+source_set("gen") {
+  public_configs = [ ":gen_public_config" ]
+
+  public_deps = [
+    ":nir_builder_opcodes",
+    ":nir_constant_expressions",
+    ":nir_opcodes",
+    ":nir_opcodes_c",
+    ":nir_opt_algebraic",
+    "$mesa_build_root/src/util",
+  ]
+
+  include_dirs = [
+    "$mesa_build_root/src/mesa",
+    "$mesa_build_root/src/mapi",
+    ".",
+  ]
+
+  sources = [
+    "$target_gen_dir/nir_constant_expressions.c",
+    "$target_gen_dir/nir_opcodes.c",
+    "$target_gen_dir/nir_opt_algebraic.c",
+  ]
+}
diff --git a/src/compiler/spirv/BUILD.gn b/src/compiler/spirv/BUILD.gn
new file mode 100644
index 0000000..388c458
--- /dev/null
+++ b/src/compiler/spirv/BUILD.gn
@@ -0,0 +1,76 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("spirv_public_config") {
+  include_dirs = [ "." ]
+}
+
+source_set("spirv") {
+  public_configs = [
+    "$mesa_build_root/src:common_config",
+    ":spirv_public_config",
+  ]
+
+  deps = [
+    ":spirv_info",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/compiler/nir",
+    "$mesa_build_root/src/util",
+  ]
+
+  include_dirs = [ ".." ]
+
+  sources = [
+    "$target_gen_dir/spirv_info.c",
+    "spirv_to_nir.c",
+    "vtn_alu.c",
+    "vtn_cfg.c",
+    "vtn_glsl450.c",
+    "vtn_private.h",
+    "vtn_variables.c",
+  ]
+}
+
+action("spirv_info") {
+  output_name = "spirv_info.c"
+  script_name = "spirv_info_c.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "spirv.core.grammar.json",
+    script_name,
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/stdout",
+    rebase_path(".") + "/$script_name",
+    rebase_path(".") + "/spirv.core.grammar.json",
+    rebase_path(target_gen_dir) + "/$output_name",
+  ]
+}
\ No newline at end of file
diff --git a/src/egl/BUILD.gn b/src/egl/BUILD.gn
new file mode 100644
index 0000000..4272147
--- /dev/null
+++ b/src/egl/BUILD.gn
@@ -0,0 +1,129 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+shared_library("EGL") {
+  public_deps = [
+    "$mesa_build_root/include:EGL",
+  ]
+
+  deps = [
+    ":dri2_driver",
+    ":main",
+  ]
+}
+
+source_set("EGL_source") {
+  public_deps = [
+    "$mesa_build_root/include:EGL",
+  ]
+
+  deps = [
+    ":dri2_driver",
+    ":main",
+  ]
+}
+
+source_set("main") {
+  public_deps = [
+    "$mesa_build_root/include:EGL",
+  ]
+
+  deps = [
+    "$mesa_build_root/include:c_compat",
+  ]
+
+  include_dirs = [ "main" ]
+
+  cflags = [ "-fPIC" ]
+
+  sources = [
+    "main/egl.def",
+    "main/egl.pc.in",
+    "main/eglapi.c",
+    "main/eglapi.h",
+    "main/eglarray.c",
+    "main/eglarray.h",
+    "main/eglcompiler.h",
+    "main/eglconfig.c",
+    "main/eglconfig.h",
+    "main/eglcontext.c",
+    "main/eglcontext.h",
+    "main/eglcurrent.c",
+    "main/eglcurrent.h",
+    "main/egldefines.h",
+    "main/egldisplay.c",
+    "main/egldisplay.h",
+    "main/egldriver.c",
+    "main/egldriver.h",
+    "main/eglfallbacks.c",
+    "main/eglglobals.c",
+    "main/eglglobals.h",
+    "main/eglimage.c",
+    "main/eglimage.h",
+    "main/egllog.c",
+    "main/egllog.h",
+    "main/eglsurface.c",
+    "main/eglsurface.h",
+    "main/eglsync.c",
+    "main/eglsync.h",
+    "main/egltypedefs.h",
+  ]
+}
+
+source_set("dri2_driver") {
+  include_dirs = [
+    "main",
+    "$mesa_build_root/src",
+  ]
+
+  cflags = [
+    "-fPIC",
+  ]
+
+  driver_path = rebase_path("$root_out_dir")
+  defines = [
+    "DEFAULT_DRIVER_DIR=\"$driver_path\"",
+    "HAVE_DRM_PLATFORM",
+    "HAVE_LIBDRM",
+    "_EGL_BUILT_IN_DRIVER_DRI2",
+  ]
+
+  sources = [
+    "drivers/dri2/egl_dri2.c",
+    "drivers/dri2/egl_dri2.h",
+    "drivers/dri2/egl_dri2_fallbacks.h",
+    "drivers/dri2/platform_drm.c",
+    "drivers/dri2/platform_surfaceless.c",
+  ]
+
+  deps = [
+    ":main",
+    "$mesa_build_root/include:GL",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/gbm:gbm_source",
+    "$mesa_build_root/src/loader",
+    "$mesa_build_root/src/mesa/drivers/dri/i965:i965_dri",
+    "$mesa_build_root/src/util:headers",
+    "$magma_build_root/hacks:drm_headers_hacks", #todo(MA-8)
+  ]
+}
diff --git a/src/gbm/BUILD.gn b/src/gbm/BUILD.gn
new file mode 100644
index 0000000..47fc909
--- /dev/null
+++ b/src/gbm/BUILD.gn
@@ -0,0 +1,86 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+shared_library("gbm") {
+  public_deps = [
+    ":dri_backend",
+    ":main",
+  ]
+}
+
+source_set("gbm_source") {
+  public_deps = [
+    ":dri_backend",
+    ":main",
+  ]
+}
+
+config("gbm_main_config") {
+  include_dirs = [ "$mesa_build_root/src/gbm/main" ]
+}
+
+source_set("main") {
+  cflags = [ "-fPIC" ]
+
+  public_configs = [ ":gbm_main_config" ]
+
+  sources = [
+    "main/backend.c",
+    "main/backend.h",
+    "main/common_drm.h",
+    "main/gbm.c",
+    "main/gbm.h",
+    "main/gbmint.h",
+  ]
+}
+
+config("gbm_dri_backend_config") {
+  include_dirs = [ "$mesa_build_root/src/gbm/backends/dri" ]
+}
+
+source_set("dri_backend") {
+  public_configs = [ ":gbm_dri_backend_config" ]
+
+  cflags = [
+   "-fPIC",
+  ]
+
+  driver_path = rebase_path("$root_out_dir")
+  defines = [
+    "DEFAULT_DRIVER_DIR=\"$driver_path\"",
+  ]
+
+  sources = [
+    "backends/dri/gbm_dri.c",
+    "backends/dri/gbm_driint.h",
+  ]
+
+  deps = [
+    ":main",
+    "$mesa_build_root/include:GL",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/loader",
+    "$magma_build_root/hacks:libdl_stubs", #todo(MA-7)
+    "$magma_build_root/hacks:drm_headers_hacks", #todo(MA-8)
+  ]
+}
diff --git a/src/intel/BUILD.gn b/src/intel/BUILD.gn
new file mode 100644
index 0000000..577f958
--- /dev/null
+++ b/src/intel/BUILD.gn
@@ -0,0 +1,191 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("intel_config") {
+  include_dirs = [
+    "$mesa_build_root/src/intel",
+    "$mesa_build_root/src/intel/isl",
+  ]
+}
+
+source_set("isl") {
+  public_configs = [ ":intel_config" ]
+
+  sources = [
+    "$target_gen_dir/isl_format_layout.c",
+    "isl/isl.c",
+    "isl/isl.h",
+    "isl/isl_format.c",
+    "isl/isl_gen4.c",
+    "isl/isl_gen4.h",
+    "isl/isl_gen6.c",
+    "isl/isl_gen6.h",
+    "isl/isl_priv.h",
+    "isl/isl_storage_image.c",
+  ]
+
+  include_dirs = [
+    "$mesa_build_root/src/mesa",
+    "$mesa_build_root/src/mapi",
+  ]
+
+  deps = [
+    ":gen_format_layout",
+    ":genxml",
+    ":isl_gen7",
+    ":isl_gen75",
+    ":isl_gen8",
+    ":isl_gen9",
+    ":isl_gen10",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util",
+  ]
+}
+
+source_set("isl_gen7") {
+  configs += [ ":intel_config" ]
+
+  sources = [
+    "isl/isl_emit_depth_stencil.c",
+    "isl/isl_gen7.c",
+    "isl/isl_gen7.h",
+    "isl/isl_surface_state.c",
+  ]
+
+  defines = [ "GEN_VERSIONx10=70" ]
+
+  deps = [
+    ":genxml",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util",
+  ]
+}
+
+source_set("isl_gen75") {
+  configs += [ ":intel_config" ]
+
+  sources = [
+    "isl/isl_emit_depth_stencil.c",
+    "isl/isl_surface_state.c",
+  ]
+
+  defines = [ "GEN_VERSIONx10=75" ]
+
+  deps = [
+    ":genxml",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util",
+  ]
+}
+
+source_set("isl_gen8") {
+  configs += [ ":intel_config" ]
+
+  sources = [
+    "isl/isl_emit_depth_stencil.c",
+    "isl/isl_gen8.c",
+    "isl/isl_gen8.h",
+    "isl/isl_surface_state.c",
+  ]
+
+  defines = [ "GEN_VERSIONx10=80" ]
+
+  deps = [
+    ":genxml",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util",
+  ]
+}
+
+source_set("isl_gen9") {
+  configs += [ ":intel_config" ]
+
+  sources = [
+    "isl/isl_emit_depth_stencil.c",
+    "isl/isl_gen9.c",
+    "isl/isl_gen9.h",
+    "isl/isl_surface_state.c",
+  ]
+
+  defines = [ "GEN_VERSIONx10=90" ]
+
+  deps = [
+    ":genxml",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util",
+  ]
+}
+
+source_set("isl_gen10") {
+  configs += [ ":intel_config" ]
+
+  sources = [
+    "isl/isl_emit_depth_stencil.c",
+    "isl/isl_surface_state.c",
+  ]
+
+  defines = [ "GEN_VERSIONx10=100" ]
+
+  deps = [
+    ":genxml",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util",
+  ]
+}
+
+config("gen_public_config") {
+  include_dirs = [ "$target_gen_dir" ]
+}
+
+group("genxml") {
+  public_configs = [ ":gen_public_config" ]
+  deps = [
+    "genxml:gen_pack75_header",
+    "genxml:gen_pack7_header",
+    "genxml:gen_pack8_header",
+    "genxml:gen_pack9_header",
+    "genxml:gen_pack10_header",
+    "genxml:gen_bits_header",
+  ]
+}
+
+action("gen_format_layout") {
+  output_name = "isl_format_layout.c"
+  script = "isl/gen_format_layout.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "isl/isl_format_layout.csv",
+  ]
+
+  args = [ "--pythonpath", "$magma_python_path" ]
+  args += [ "--csv" ]
+  args += rebase_path(inputs, root_build_dir)
+  args += [
+    "--out",
+    rebase_path("$target_gen_dir") + "/$output_name",
+  ]
+}
diff --git a/src/intel/blorp/BUILD.gn b/src/intel/blorp/BUILD.gn
new file mode 100644
index 0000000..c43dd6b
--- /dev/null
+++ b/src/intel/blorp/BUILD.gn
@@ -0,0 +1,54 @@
+# Copyright 2017 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("local_config") {
+  include_dirs = [
+    "$mesa_build_root/src/mesa",  # for program/
+    "$mesa_build_root/src",  # for compiler/
+  ]
+}
+
+source_set("blorp") {
+  public_deps = [
+    "$mesa_build_root/src/compiler/nir",
+  ]
+
+  public_configs = [ ":local_config" ]
+
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  deps = [
+    "$mesa_build_root/include:GL",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/intel/compiler",
+    "$mesa_build_root/src/util:headers",
+  ]
+
+  sources = [
+    "blorp.c",
+    "blorp_blit.c",
+    "blorp_clear.c",
+    "blorp_genX_exec.h",
+    "blorp_priv.h",
+  ]
+}
diff --git a/src/intel/common/BUILD.gn b/src/intel/common/BUILD.gn
new file mode 100644
index 0000000..6d347ed
--- /dev/null
+++ b/src/intel/common/BUILD.gn
@@ -0,0 +1,51 @@
+# Copyright 2017 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("common_config") {
+  include_dirs = [
+    ".",
+    "..",
+    "$mesa_build_root/src/mapi",
+  ]
+}
+
+source_set("common") {
+  sources = [
+    "gen_debug.c",
+    "gen_debug.h",
+    "gen_device_info.c",
+    "gen_device_info.h",
+    "gen_l3_config.c",
+    "gen_l3_config.h",
+    "gen_sample_positions.h",
+    "gen_urb_config.c",
+  ]
+
+  public_configs = [ ":common_config" ]
+
+  include_dirs = [ "$mesa_build_root/src/mesa" ]
+
+  deps = [
+    "$mesa_build_root/src/util",
+  ]
+}
diff --git a/src/intel/common/gen_clflush.h b/src/intel/common/gen_clflush.h
index d39f158..806564f 100644
--- a/src/intel/common/gen_clflush.h
+++ b/src/intel/common/gen_clflush.h
@@ -30,8 +30,8 @@
 static inline void
 gen_clflush_range(void *start, size_t size)
 {
-   void *p = (void *) (((uintptr_t) start) & ~CACHELINE_MASK);
-   void *end = start + size;
+   char *p = (char *) (((uintptr_t) start) & ~CACHELINE_MASK);
+   char *end = (char*) start + size;
 
    while (p < end) {
       __builtin_ia32_clflush(p);
@@ -61,7 +61,7 @@
     * ("drm: Restore double clflush on the last partial cacheline")
     * and https://bugs.freedesktop.org/show_bug.cgi?id=92845.
     */
-   __builtin_ia32_clflush(start + size - 1);
+   __builtin_ia32_clflush((char*) start + size - 1);
    __builtin_ia32_mfence();
 }
 
diff --git a/src/intel/compiler/BUILD.gn b/src/intel/compiler/BUILD.gn
new file mode 100644
index 0000000..fa3a7c8
--- /dev/null
+++ b/src/intel/compiler/BUILD.gn
@@ -0,0 +1,160 @@
+# Copyright 2017 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("compiler_config") {
+  include_dirs = [
+    ".",
+    "$mesa_build_root/src/mesa",  # because brw_compiler.h includes main/mtypes.h
+    "$mesa_build_root/src/gallium/auxiliary",  # because main/macros.h includes gallium/auxiliary/util/u_math.h
+    "$mesa_build_root/src/gallium/include",  # because u_math.h includes pipe/p_compiler.h
+    "$mesa_build_root/src/intel",  # because brw_compiler.h includes common/gen_device_info.h
+  ]
+}
+
+source_set("compiler") {
+  public_configs = [
+    ":compiler_config",
+    "$mesa_build_root/src:common_config",
+  ]
+
+  deps = [
+    ":gen_brw_nir_trig_workarounds",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/compiler",
+    "$mesa_build_root/src/compiler/glsl:ir_expression_operation",
+    "$mesa_build_root/src/compiler/nir",
+    "$mesa_build_root/src/intel:isl",
+    "$mesa_build_root/src/util",
+  ]
+
+  sources = [
+    "$target_gen_dir/brw_nir_trig_workarounds.c",
+    "brw_cfg.cpp",
+    "brw_cfg.h",
+    "brw_compiler.c",
+    "brw_compiler.h",
+    "brw_compile_sf.c",
+    "brw_dead_control_flow.cpp",
+    "brw_dead_control_flow.h",
+    "brw_disasm.c",
+    "brw_eu.c",
+    "brw_eu.h",
+    "brw_eu_compact.c",
+    "brw_eu_emit.c",
+    "brw_eu_util.c",
+    "brw_eu_validate.c",
+    "brw_fs.cpp",
+    "brw_fs.h",
+    "brw_fs_builder.h",
+    "brw_fs_cmod_propagation.cpp",
+    "brw_fs_combine_constants.cpp",
+    "brw_fs_copy_propagation.cpp",
+    "brw_fs_cse.cpp",
+    "brw_fs_dead_code_eliminate.cpp",
+    "brw_fs_generator.cpp",
+    "brw_fs_live_variables.cpp",
+    "brw_fs_live_variables.h",
+    "brw_fs_lower_conversions.cpp",
+    "brw_fs_lower_pack.cpp",
+    "brw_fs_nir.cpp",
+    "brw_fs_reg_allocate.cpp",
+    "brw_fs_register_coalesce.cpp",
+    "brw_fs_saturate_propagation.cpp",
+    "brw_fs_sel_peephole.cpp",
+    "brw_fs_surface_builder.cpp",
+    "brw_fs_surface_builder.h",
+    "brw_fs_validate.cpp",
+    "brw_fs_visitor.cpp",
+    "brw_inst.h",
+    "brw_interpolation_map.c",
+    "brw_ir_allocator.h",
+    "brw_ir_fs.h",
+    "brw_ir_vec4.h",
+    "brw_nir.c",
+    "brw_nir.h",
+    "brw_nir_analyze_boolean_resolves.c",
+    "brw_nir_attribute_workarounds.c",
+    "brw_nir_intrinsics.c",
+    "brw_nir_opt_peephole_ffma.c",
+    "brw_nir_tcs_workarounds.c",
+    "brw_packed_float.c",
+    "brw_predicated_break.cpp",
+    "brw_reg.h",
+    "brw_schedule_instructions.cpp",
+    "brw_shader.cpp",
+    "brw_shader.h",
+    "brw_vec4.cpp",
+    "brw_vec4.h",
+    "brw_vec4_builder.h",
+    "brw_vec4_cmod_propagation.cpp",
+    "brw_vec4_copy_propagation.cpp",
+    "brw_vec4_cse.cpp",
+    "brw_vec4_dead_code_eliminate.cpp",
+    "brw_vec4_generator.cpp",
+    "brw_vec4_gs_nir.cpp",
+    "brw_vec4_gs_visitor.cpp",
+    "brw_vec4_gs_visitor.h",
+    "brw_vec4_live_variables.cpp",
+    "brw_vec4_live_variables.h",
+    "brw_vec4_nir.cpp",
+    "brw_vec4_reg_allocate.cpp",
+    "brw_vec4_surface_builder.cpp",
+    "brw_vec4_surface_builder.h",
+    "brw_vec4_tcs.cpp",
+    "brw_vec4_tcs.h",
+    "brw_vec4_tes.cpp",
+    "brw_vec4_tes.h",
+    "brw_vec4_visitor.cpp",
+    "brw_vec4_vs_visitor.cpp",
+    "brw_vue_map.c",
+    "brw_wm_iz.cpp",
+    "gen6_gs_visitor.cpp",
+    "gen6_gs_visitor.h",
+    "intel_asm_annotation.c",
+    "intel_asm_annotation.h",
+  ]
+}
+
+action("gen_brw_nir_trig_workarounds") {
+  output_name = "brw_nir_trig_workarounds.c"
+  script_name = "brw_nir_trig_workarounds.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "$mesa_build_root/src/compiler/nir/nir_algebraic.py",
+  ]
+
+  python_path = "$magma_python_path:" + rebase_path("$mesa_build_root") +
+                "/src/compiler/nir"
+
+  args = [
+    "$python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+  ]
+}
diff --git a/src/intel/compiler/brw_schedule_instructions.cpp b/src/intel/compiler/brw_schedule_instructions.cpp
index b3f7e87..15b750a 100644
--- a/src/intel/compiler/brw_schedule_instructions.cpp
+++ b/src/intel/compiler/brw_schedule_instructions.cpp
@@ -977,7 +977,11 @@
     * After register allocation, reg_offsets are gone and we track individual
     * GRF registers.
     */
-   schedule_node *last_grf_write[grf_count * 16];
+   const uint32_t last_grf_write_size = sizeof(schedule_node*) * grf_count * 16;
+   /* This array can be larger than the default stack size on some platforms,
+    * so heap allocate instead.
+    */
+   schedule_node **last_grf_write = (schedule_node**) malloc(last_grf_write_size);
    schedule_node *last_mrf_write[BRW_MAX_MRF(v->devinfo->gen)];
    schedule_node *last_conditional_mod[4] = {};
    schedule_node *last_accumulator_write = NULL;
@@ -988,7 +992,7 @@
     */
    schedule_node *last_fixed_grf_write = NULL;
 
-   memset(last_grf_write, 0, sizeof(last_grf_write));
+   memset(last_grf_write, 0, last_grf_write_size);
    memset(last_mrf_write, 0, sizeof(last_mrf_write));
 
    /* top-to-bottom dependencies: RAW and WAW. */
@@ -1115,7 +1119,7 @@
    }
 
    /* bottom-to-top dependencies: WAR */
-   memset(last_grf_write, 0, sizeof(last_grf_write));
+   memset(last_grf_write, 0, last_grf_write_size);
    memset(last_mrf_write, 0, sizeof(last_mrf_write));
    memset(last_conditional_mod, 0, sizeof(last_conditional_mod));
    last_accumulator_write = NULL;
@@ -1231,6 +1235,8 @@
          last_accumulator_write = n;
       }
    }
+
+   free(last_grf_write);
 }
 
 static bool
diff --git a/src/intel/compiler/brw_vec4_reg_allocate.cpp b/src/intel/compiler/brw_vec4_reg_allocate.cpp
index a0ba77b..09b74b7 100644
--- a/src/intel/compiler/brw_vec4_reg_allocate.cpp
+++ b/src/intel/compiler/brw_vec4_reg_allocate.cpp
@@ -375,7 +375,7 @@
    /* Spilling of a 64-bit register involves emitting 2 32-bit scratch
     * messages plus the 64b/32b shuffling code.
     */
-   return type_sz(type) == 8 ? 2.25f : 1.0f;
+   return type_sz(type) == 8 ? (unsigned) 2.25f : 1.0f;
 }
 
 void
diff --git a/src/intel/genxml/BUILD.gn b/src/intel/genxml/BUILD.gn
new file mode 100644
index 0000000..d041bee
--- /dev/null
+++ b/src/intel/genxml/BUILD.gn
@@ -0,0 +1,184 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+action("gen_pack7_header") {
+  output_name = "gen7_pack.h"
+  script_name = "gen_pack_header.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  sources = [
+    "gen7.xml",
+  ]
+
+  inputs = [
+    "$script_name",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    rebase_path(".") + "/gen7.xml",
+  ]
+}
+
+action("gen_pack75_header") {
+  output_name = "gen75_pack.h"
+  script_name = "gen_pack_header.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  sources = [
+    "gen75.xml",
+  ]
+
+  inputs = [
+    "$script_name",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    rebase_path(".") + "/gen75.xml",
+  ]
+}
+
+action("gen_pack8_header") {
+  output_name = "gen8_pack.h"
+  script_name = "gen_pack_header.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  sources = [
+    "gen8.xml",
+  ]
+
+  inputs = [
+    "$script_name",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    rebase_path(".") + "/gen8.xml",
+  ]
+}
+
+action("gen_pack9_header") {
+  output_name = "gen9_pack.h"
+  script_name = "gen_pack_header.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  sources = [
+    "gen9.xml",
+  ]
+
+  inputs = [
+    "$script_name",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    rebase_path(".") + "/gen9.xml",
+  ]
+}
+
+action("gen_pack10_header") {
+  output_name = "gen10_pack.h"
+  script_name = "gen_pack_header.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  sources = [
+    "gen10.xml",
+  ]
+
+  inputs = [
+    "$script_name",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    rebase_path(".") + "/gen10.xml",
+  ]
+}
+
+action("gen_bits_header") {
+  output_name = "genX_bits.h"
+  script_name = "gen_bits_header.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  sources = [
+    "gen7.xml",
+    "gen75.xml",
+    "gen8.xml",
+    "gen9.xml",
+  ]
+
+  inputs = [
+    "$script_name",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    rebase_path(".") + "/gen7.xml",
+    rebase_path(".") + "/gen75.xml",
+    rebase_path(".") + "/gen8.xml",
+    rebase_path(".") + "/gen9.xml",
+  ]
+}
diff --git a/src/intel/isl/gen_format_layout.py b/src/intel/isl/gen_format_layout.py
old mode 100644
new mode 100755
index 0ca42db..cdf8e13
--- a/src/intel/isl/gen_format_layout.py
+++ b/src/intel/isl/gen_format_layout.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 # encoding=utf-8
 # Copyright © 2016 Intel Corporation
 
@@ -26,6 +27,10 @@
 import csv
 import re
 import textwrap
+import sys
+
+# --pythonpath must be the first argument
+sys.path.append(sys.argv[2])
 
 from mako import template
 
@@ -212,6 +217,7 @@
 def main():
     """Main function."""
     parser = argparse.ArgumentParser()
+    parser.add_argument('--pythonpath')
     parser.add_argument('--csv', action='store', help='The CSV file to parse.')
     parser.add_argument(
         '--out',
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 1339867..a10f2c9 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1766,27 +1766,6 @@
    }
 
    switch (ISL_DEV_GEN(dev)) {
-   case 4:
-      if (ISL_DEV_IS_G4X(dev)) {
-         /* G45 surface state is the same as gen5 */
-         isl_gen5_surf_fill_state_s(dev, state, info);
-      } else {
-         isl_gen4_surf_fill_state_s(dev, state, info);
-      }
-      break;
-   case 5:
-      isl_gen5_surf_fill_state_s(dev, state, info);
-      break;
-   case 6:
-      isl_gen6_surf_fill_state_s(dev, state, info);
-      break;
-   case 7:
-      if (ISL_DEV_IS_HASWELL(dev)) {
-         isl_gen75_surf_fill_state_s(dev, state, info);
-      } else {
-         isl_gen7_surf_fill_state_s(dev, state, info);
-      }
-      break;
    case 8:
       isl_gen8_surf_fill_state_s(dev, state, info);
       break;
@@ -1806,21 +1785,6 @@
                         const struct isl_buffer_fill_state_info *restrict info)
 {
    switch (ISL_DEV_GEN(dev)) {
-   case 4:
-   case 5:
-      /* Gen 4-5 are all the same when it comes to buffer surfaces */
-      isl_gen5_buffer_fill_state_s(state, info);
-      break;
-   case 6:
-      isl_gen6_buffer_fill_state_s(state, info);
-      break;
-   case 7:
-      if (ISL_DEV_IS_HASWELL(dev)) {
-         isl_gen75_buffer_fill_state_s(state, info);
-      } else {
-         isl_gen7_buffer_fill_state_s(state, info);
-      }
-      break;
    case 8:
       isl_gen8_buffer_fill_state_s(state, info);
       break;
@@ -1870,20 +1834,6 @@
    }
 
    switch (ISL_DEV_GEN(dev)) {
-   case 4:
-      if (ISL_DEV_IS_G4X(dev)) {
-         /* G45 surface state is the same as gen5 */
-         isl_gen5_emit_depth_stencil_hiz_s(dev, batch, info);
-      } else {
-         isl_gen4_emit_depth_stencil_hiz_s(dev, batch, info);
-      }
-      break;
-   case 5:
-      isl_gen5_emit_depth_stencil_hiz_s(dev, batch, info);
-      break;
-   case 6:
-      isl_gen6_emit_depth_stencil_hiz_s(dev, batch, info);
-      break;
    case 7:
       if (ISL_DEV_IS_HASWELL(dev)) {
          isl_gen75_emit_depth_stencil_hiz_s(dev, batch, info);
diff --git a/src/intel/vulkan/BUILD.gn b/src/intel/vulkan/BUILD.gn
new file mode 100644
index 0000000..f108694
--- /dev/null
+++ b/src/intel/vulkan/BUILD.gn
@@ -0,0 +1,229 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+declare_args() {
+  use_mock_magma = false
+}
+
+config("vulkan_internal_config") {
+  include_dirs = [
+    ".",
+    "..",  # because  anv_private.h includes isl/isl.h
+    "$mesa_build_root/include/drm-uapi",  # because anv_private.h includes i915_drm.h
+    "$mesa_build_root/src/compiler",  # because anv_nir.h includes nir/nir.h
+    "$mesa_build_root/src",  # because isl.h includes util/macros.h
+    "$mesa_build_root/src/vulkan/util",  # because anv_private.h includes vk_alloc.h
+    "$root_gen_dir/third_party/mesa/src/intel/vulkan",
+  ]
+
+  defines = [ "FFS_DEFINED=1" ]
+}
+
+shared_library("vulkan_intel") {
+  deps = [
+    ":vulkan_internal",
+  ]
+
+  if (use_mock_magma) {
+    deps += [ "$magma_build_root/tests/mock:magma_system" ]
+  } else {
+    deps += [ "$magma_build_root:libmagma" ]
+  }
+}
+
+# Also used by testing targets
+source_set("vulkan_internal") {
+  public_deps = [
+    "$mesa_build_root/include:vulkan",
+    "$mesa_build_root/src/intel/compiler",
+    "$mesa_build_root/src/vulkan/wsi",
+  ]
+
+  public_configs = [
+    ":vulkan_internal_config",
+    "$mesa_build_root/src:common_config",
+  ]
+
+  deps = [
+    ":anv_entrypoints",
+    ":gen",
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/src/magma_util",
+    "$magma_build_root/src/magma_util/platform:futex",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/compiler/nir",
+    "$mesa_build_root/src/compiler/spirv",
+    "$mesa_build_root/src/intel:genxml",
+    "$mesa_build_root/src/intel:isl",
+    "$mesa_build_root/src/intel/blorp",
+    "$mesa_build_root/src/intel/common",
+    "$mesa_build_root/src/vulkan/util",
+    "$mesa_build_root/src/magma",
+    "$mesa_build_root/src/util",
+  ]
+
+  sources = [
+    "$target_gen_dir/anv_entrypoints.c",
+    "$target_gen_dir/anv_entrypoints.h",
+    "anv_allocator.c",
+    "anv_batch_chain.c",
+    "anv_blorp.c",
+    "anv_cmd_buffer.c",
+    "anv_descriptor_set.c",
+    "anv_device.c",
+    "anv_dump.c",
+    "anv_formats.c",
+    "anv_genX.h",
+    "anv_image.c",
+    "anv_intel.c",
+    "anv_magma.cc",
+    "anv_nir.h",
+    "anv_nir_apply_pipeline_layout.c",
+    "anv_nir_lower_push_constants.c",
+    "anv_nir_lower_input_attachments.c",
+    "anv_nir_lower_multiview.c",
+    "anv_pass.c",
+    "anv_pipeline.c",
+    "anv_pipeline_cache.c",
+    "anv_platform.cc",
+    "anv_private.h",
+    "anv_queue.c",
+    "anv_util.c",
+    "anv_wsi.c",
+    "anv_wsi_magma.cc",
+    "vk_format_info.h",
+  ]
+}
+
+group("gen") {
+  deps = [
+    ":gen7",
+    ":gen75",
+    ":gen8",
+    ":gen9",
+    ":gen10",
+  ]
+}
+
+template("vulkan_gen8") {
+  source_set(target_name) {
+    defines = [ invoker.defines ]
+
+    configs += [
+      ":vulkan_internal_config",
+      "$mesa_build_root/src:common_config",
+    ]
+
+    sources = [
+      "gen8_cmd_buffer.c",
+      "genX_blorp_exec.c",
+      "genX_cmd_buffer.c",
+      "genX_gpu_memcpy.c",
+      "genX_pipeline.c",
+      "genX_query.c",
+      "genX_state.c",
+    ]
+
+    deps = [
+      ":anv_entrypoints",
+      "$magma_build_root/include:magma_abi",
+      "$mesa_build_root/include:c_compat",
+      "$mesa_build_root/src/intel:genxml",
+      "$mesa_build_root/src/intel:isl",
+      "$mesa_build_root/src/intel/blorp",
+      "$mesa_build_root/src/vulkan/wsi",
+    ]
+  }
+}
+
+vulkan_gen8("gen8") {
+  defines = "GEN_VERSIONx10=80"
+}
+
+vulkan_gen8("gen9") {
+  defines = "GEN_VERSIONx10=90"
+}
+
+vulkan_gen8("gen10") {
+  defines = "GEN_VERSIONx10=100"
+}
+
+template("vulkan_gen7") {
+  source_set(target_name) {
+    defines = [ invoker.defines ]
+
+    configs += [
+      ":vulkan_internal_config",
+      "$mesa_build_root/src:common_config",
+    ]
+
+    sources = [
+      "gen7_cmd_buffer.c",
+      "genX_blorp_exec.c",
+      "genX_cmd_buffer.c",
+      "genX_gpu_memcpy.c",
+      "genX_pipeline.c",
+      "genX_query.c",
+      "genX_state.c",
+    ]
+
+    deps = [
+      ":anv_entrypoints",
+      "$magma_build_root/include:magma_abi",
+      "$mesa_build_root/include:c_compat",
+      "$mesa_build_root/src/intel:genxml",
+      "$mesa_build_root/src/intel:isl",
+      "$mesa_build_root/src/intel/blorp",
+      "$mesa_build_root/src/vulkan/wsi",
+    ]
+  }
+}
+
+vulkan_gen7("gen7") {
+  defines = "GEN_VERSIONx10=70"
+}
+
+vulkan_gen7("gen75") {
+  defines = "GEN_VERSIONx10=75"
+}
+
+action("anv_entrypoints") {
+  outputs = [ "$target_gen_dir/anv_entrypoints.h",
+    "$target_gen_dir/anv_entrypoints.c",
+  ]
+
+  script = "anv_entrypoints_gen.py"
+
+  inputs = [
+    "$mesa_build_root/src/vulkan/registry/vk.xml",
+  ]
+
+  args = [
+    "--pythonpath", 
+    rebase_path("$magma_python_path"),
+    "--xml",
+    rebase_path("$mesa_build_root") + "/src/vulkan/registry/vk.xml",
+    "--outdir",
+    rebase_path("$target_gen_dir")
+  ]
+}
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index a11d661..7ac99d3 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -26,11 +26,6 @@
 #include <unistd.h>
 #include <limits.h>
 #include <assert.h>
-#include <linux/futex.h>
-#include <linux/memfd.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
 
 #include "anv_private.h"
 
@@ -107,34 +102,23 @@
 struct anv_mmap_cleanup {
    void *map;
    size_t size;
-   uint32_t gem_handle;
+   anv_buffer_handle_t gem_handle;
 };
 
 #define ANV_MMAP_CLEANUP_INIT ((struct anv_mmap_cleanup){0})
 
-static inline long
-sys_futex(void *addr1, int op, int val1,
-          struct timespec *timeout, void *addr2, int val3)
-{
-   return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
-}
-
 static inline int
 futex_wake(uint32_t *addr, int count)
 {
-   return sys_futex(addr, FUTEX_WAKE, count, NULL, NULL, 0);
+  return anv_platform_futex_wake(addr, count);
 }
 
-static inline int
+/* Changed to return void because no caller is checking the return code;
+ * futex_wait must always be used in a loop. */
+static inline void
 futex_wait(uint32_t *addr, int32_t value)
 {
-   return sys_futex(addr, FUTEX_WAIT, value, NULL, NULL, 0);
-}
-
-static inline int
-memfd_create(const char *name, unsigned int flags)
-{
-   return syscall(SYS_memfd_create, name, flags);
+  (void) anv_platform_futex_wait(addr, value);
 }
 
 static inline uint32_t
@@ -270,18 +254,10 @@
    pool->device = device;
    anv_bo_init(&pool->bo, 0, 0);
 
-   pool->fd = memfd_create("block pool", MFD_CLOEXEC);
-   if (pool->fd == -1)
-      return vk_error(VK_ERROR_INITIALIZATION_FAILED);
-
-   /* Just make it 2GB up-front.  The Linux kernel won't actually back it
-    * with pages until we either map and fault on one of them or we use
-    * userptr and send a chunk of it off to the GPU.
-    */
-   if (ftruncate(pool->fd, BLOCK_POOL_MEMFD_SIZE) == -1) {
-      result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
-      goto fail_fd;
-   }
+   // Start with a large (2GB) size, assuming that the kernel won't commit pages
+   // until map+fault or commit.
+   pool->bo.gem_handle = anv_gem_create(device, BLOCK_POOL_MEMFD_SIZE);
+   assert(pool->bo.gem_handle);
 
    if (!u_vector_init(&pool->mmap_cleanups,
                       round_to_power_of_two(sizeof(struct anv_mmap_cleanup)),
@@ -304,8 +280,6 @@
  fail_mmap_cleanups:
    u_vector_finish(&pool->mmap_cleanups);
  fail_fd:
-   close(pool->fd);
-
    return result;
 }
 
@@ -316,14 +290,12 @@
 
    u_vector_foreach(cleanup, &pool->mmap_cleanups) {
       if (cleanup->map)
-         munmap(cleanup->map, cleanup->size);
+         anv_gem_munmap(pool->device, cleanup->gem_handle, cleanup->map, cleanup->size);
       if (cleanup->gem_handle)
          anv_gem_close(pool->device, cleanup->gem_handle);
    }
 
    u_vector_finish(&pool->mmap_cleanups);
-
-   close(pool->fd);
 }
 
 #define PAGE_SIZE 4096
@@ -333,7 +305,6 @@
                             uint32_t center_bo_offset, uint32_t size)
 {
    void *map;
-   uint32_t gem_handle;
    struct anv_mmap_cleanup *cleanup;
 
    /* Assert that we only ever grow the pool */
@@ -345,34 +316,31 @@
    assert(size - center_bo_offset <=
           BLOCK_POOL_MEMFD_SIZE - BLOCK_POOL_MEMFD_CENTER);
 
-   cleanup = u_vector_add(&pool->mmap_cleanups);
-   if (!cleanup)
-      return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
-
-   *cleanup = ANV_MMAP_CLEANUP_INIT;
-
-   /* Just leak the old map until we destroy the pool.  We can't munmap it
-    * without races or imposing locking on the block allocate fast path. On
-    * the whole the leaked maps adds up to less than the size of the
-    * current map.  MAP_POPULATE seems like the right thing to do, but we
-    * should try to get some numbers.
+   /* Code below expects that map points to the start of the new used portion
+    * as defined by the new center_bo_offset.  But we only map once for magma
+    * so we use math to adjust map appropriately.
     */
-   map = mmap(NULL, size, PROT_READ | PROT_WRITE,
-              MAP_SHARED | MAP_POPULATE, pool->fd,
-              BLOCK_POOL_MEMFD_CENTER - center_bo_offset);
-   if (map == MAP_FAILED)
-      return vk_errorf(VK_ERROR_MEMORY_MAP_FAILED, "mmap failed: %m");
+   if (pool->bo.map) {
+      map = (uint8_t*)pool->bo.map + pool->center_bo_offset - center_bo_offset;
+   } else {
+      cleanup = u_vector_add(&pool->mmap_cleanups);
+      if (!cleanup)
+         return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
 
-   gem_handle = anv_gem_userptr(pool->device, map, size);
-   if (gem_handle == 0) {
-      munmap(map, size);
-      return vk_errorf(VK_ERROR_TOO_MANY_OBJECTS, "userptr failed: %m");
+      *cleanup = ANV_MMAP_CLEANUP_INIT;
+
+      map = anv_gem_mmap(pool->device, pool->bo.gem_handle, 0, BLOCK_POOL_MEMFD_SIZE, 0);
+      cleanup->map = map;
+      cleanup->size = size;
+      cleanup->gem_handle = pool->bo.gem_handle;
+
+      if (!map)
+         return vk_errorf(VK_ERROR_MEMORY_MAP_FAILED, "mmap failed: %m");
+
+      /* Pretend we mapped only the used portion */
+      map = (uint8_t*)map + BLOCK_POOL_MEMFD_CENTER - center_bo_offset;
    }
 
-   cleanup->map = map;
-   cleanup->size = size;
-   cleanup->gem_handle = gem_handle;
-
 #if 0
    /* Regular objects are created I915_CACHING_CACHED on LLC platforms and
     * I915_CACHING_NONE on non-LLC platforms. However, userptr objects are
@@ -417,8 +385,9 @@
     * the EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag and the kernel does all of the
     * hard work for us.
     */
-   anv_bo_init(&pool->bo, gem_handle, size);
+   anv_bo_init(&pool->bo, pool->bo.gem_handle, size);
    pool->bo.map = map;
+   pool->bo.start_offset = BLOCK_POOL_MEMFD_CENTER - center_bo_offset;
 
    return VK_SUCCESS;
 }
@@ -987,7 +956,7 @@
       while (link != NULL) {
          struct bo_pool_bo_link link_copy = VG_NOACCESS_READ(link);
 
-         anv_gem_munmap(link_copy.bo.map, link_copy.bo.size);
+         anv_gem_munmap(pool->device, link_copy.bo.gem_handle, link_copy.bo.map, link_copy.bo.size);
          anv_gem_close(pool->device, link_copy.bo.gem_handle);
          link = link_copy.next;
       }
@@ -1205,7 +1174,7 @@
 }
 
 static struct anv_cached_bo *
-anv_bo_cache_lookup_locked(struct anv_bo_cache *cache, uint32_t gem_handle)
+anv_bo_cache_lookup_locked(struct anv_bo_cache *cache, anv_buffer_handle_t gem_handle)
 {
    struct hash_entry *entry =
       _mesa_hash_table_search(cache->bo_map,
@@ -1220,7 +1189,7 @@
 }
 
 static struct anv_bo *
-anv_bo_cache_lookup(struct anv_bo_cache *cache, uint32_t gem_handle)
+anv_bo_cache_lookup(struct anv_bo_cache *cache, anv_buffer_handle_t gem_handle)
 {
    pthread_mutex_lock(&cache->mutex);
 
@@ -1267,22 +1236,11 @@
    return VK_SUCCESS;
 }
 
-VkResult
-anv_bo_cache_import(struct anv_device *device,
-                    struct anv_bo_cache *cache,
-                    int fd, uint64_t size, struct anv_bo **bo_out)
+VkResult anv_bo_cache_import_buffer_handle(struct anv_device* device, struct anv_bo_cache* cache,
+                                           anv_buffer_handle_t gem_handle, uint64_t size,
+                                           uint64_t import_size, struct anv_bo** bo_out)
 {
    pthread_mutex_lock(&cache->mutex);
-
-   /* The kernel is going to give us whole pages anyway */
-   size = align_u64(size, 4096);
-
-   uint32_t gem_handle = anv_gem_fd_to_handle(device, fd);
-   if (!gem_handle) {
-      pthread_mutex_unlock(&cache->mutex);
-      return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR);
-   }
-
    struct anv_cached_bo *bo = anv_bo_cache_lookup_locked(cache, gem_handle);
    if (bo) {
       if (bo->bo.size != size) {
@@ -1299,7 +1257,8 @@
        * in the trusted client.  The trusted client can protect itself against
        * this sort of attack but only if it can trust the buffer size.
        */
-      off_t import_size = lseek(fd, 0, SEEK_END);
+      //NOTE: got import_size from anv_gem_fd_to_handle, above
+      //off_t import_size = lseek(fd, 0, SEEK_END);
       if (import_size == (off_t)-1 || import_size < size) {
          anv_gem_close(device, gem_handle);
          pthread_mutex_unlock(&cache->mutex);
@@ -1323,6 +1282,30 @@
 
    pthread_mutex_unlock(&cache->mutex);
 
+   *bo_out = &bo->bo;
+
+   return VK_SUCCESS;
+}
+
+VkResult anv_bo_cache_import(struct anv_device* device, struct anv_bo_cache* cache, int fd,
+                             uint64_t size, struct anv_bo** bo_out)
+{
+   /* The kernel is going to give us whole pages anyway */
+   size = align_u64(size, 4096);
+
+   // The anv_buffer_handle_t isn't a unique handle per object, so the cache
+   // lookup in the import will always fail.
+   // TODO(MA-320) - get a unique id for this object and use that as the cache key;
+   // then clients will be able to import a buffer more than once.
+   uint64_t import_size;
+   anv_buffer_handle_t gem_handle = anv_gem_fd_to_handle(device, fd, &import_size);
+   if (!gem_handle) {
+      return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR);
+   }
+
+   VkResult result = anv_bo_cache_import_buffer_handle(device, cache, gem_handle, size,
+                                                       import_size, bo_out);
+
    /* From the Vulkan spec:
     *
     *    "Importing memory from a file descriptor transfers ownership of
@@ -1332,11 +1315,9 @@
     *
     * If the import fails, we leave the file descriptor open.
     */
-   close(fd);
-
-   *bo_out = &bo->bo;
-
-   return VK_SUCCESS;
+   if (result == VK_SUCCESS)
+      close(fd);
+   return result;
 }
 
 VkResult
@@ -1409,7 +1390,7 @@
    _mesa_hash_table_remove(cache->bo_map, entry);
 
    if (bo->bo.map)
-      anv_gem_munmap(bo->bo.map, bo->bo.size);
+      anv_gem_munmap(device, bo->bo.gem_handle, bo->bo.map, bo->bo.size);
 
    anv_gem_close(device, bo->bo.gem_handle);
 
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index ad76dc1..eb4b9e7 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -156,7 +156,7 @@
    index = list->num_relocs++;
    list->reloc_bos[index] = target_bo;
    entry = &list->relocs[index];
-   entry->target_handle = target_bo->gem_handle;
+   entry->target_handle = 0; // Set in anv_cmd_buffer_process_relocs
    entry->delta = delta;
    entry->offset = offset;
    entry->presumed_offset = target_bo->offset;
@@ -1033,8 +1033,8 @@
       obj->alignment = 0;
       obj->offset = bo->offset;
       obj->flags = bo->flags | extra_flags;
-      obj->rsvd1 = 0;
-      obj->rsvd2 = 0;
+      obj->rsvd1 = bo->start_offset;
+      obj->rsvd2 = bo->size;
    }
 
    if (relocs != NULL && obj->relocation_count == 0) {
@@ -1402,8 +1402,8 @@
    VkResult result = VK_SUCCESS;
    for (uint32_t i = 0; i < num_in_semaphores; i++) {
       ANV_FROM_HANDLE(anv_semaphore, semaphore, in_semaphores[i]);
-      assert(semaphore->temporary.type == ANV_SEMAPHORE_TYPE_NONE);
-      struct anv_semaphore_impl *impl = &semaphore->permanent;
+      //assert(semaphore->temporary.type == ANV_SEMAPHORE_TYPE_NONE);
+      struct anv_semaphore_impl *impl = semaphore->current;
 
       switch (impl->type) {
       case ANV_SEMAPHORE_TYPE_BO:
@@ -1419,8 +1419,8 @@
 
    for (uint32_t i = 0; i < num_out_semaphores; i++) {
       ANV_FROM_HANDLE(anv_semaphore, semaphore, out_semaphores[i]);
-      assert(semaphore->temporary.type == ANV_SEMAPHORE_TYPE_NONE);
-      struct anv_semaphore_impl *impl = &semaphore->permanent;
+      //assert(semaphore->temporary.type == ANV_SEMAPHORE_TYPE_NONE);
+      struct anv_semaphore_impl *impl = semaphore->current;
 
       switch (impl->type) {
       case ANV_SEMAPHORE_TYPE_BO:
@@ -1438,7 +1438,10 @@
    if (result != VK_SUCCESS)
       return result;
 
-   result = anv_device_execbuf(device, &execbuf.execbuf, execbuf.bos);
+   // Fuchsia: pass semaphores down
+   result = anv_device_execbuf(device, &execbuf.execbuf, execbuf.bos,
+                               num_in_semaphores, (struct anv_semaphore**)in_semaphores,
+                               num_out_semaphores, (struct anv_semaphore**)out_semaphores);
 
    anv_execbuf_finish(&execbuf, &device->alloc);
 
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index f69ebfc..d4bfc2d 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -22,13 +22,13 @@
  */
 
 #include <assert.h>
+#include <dirent.h>
+#include <fcntl.h>
 #include <stdbool.h>
 #include <string.h>
 #include <sys/mman.h>
-#include <sys/sysinfo.h>
+#include <sys/stat.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <xf86drm.h>
 
 #include "anv_private.h"
 #include "util/strtod.h"
@@ -73,10 +73,11 @@
    }
 
    /* Query the total ram from the system */
-   struct sysinfo info;
-   sysinfo(&info);
+   // struct sysinfo info;
+   // sysinfo(&info);
 
-   uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit;
+   // uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit;
+   uint64_t total_ram = 8ull * 1024ull * 1024ull * 1024ull;
 
    /* We don't want to burn too much ram with the GPU.  If the user has 4GiB
     * or less, we use at most half.  If they have more than 4GiB, we use 3/4.
@@ -207,17 +208,18 @@
 static VkResult
 anv_physical_device_init_uuids(struct anv_physical_device *device)
 {
-   const struct build_id_note *note = build_id_find_nhdr("libvulkan_intel.so");
-   if (!note) {
-      return vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
-                       "Failed to find build-id");
-   }
+   //TODO(MA-319)
+   // const struct build_id_note *note = build_id_find_nhdr("libvulkan_intel.so");
+   // if (!note) {
+   //    return vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+   //                     "Failed to find build-id");
+   // }
 
-   unsigned build_id_len = build_id_length(note);
-   if (build_id_len < 20) {
-      return vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
-                       "build-id too short.  It needs to be a SHA");
-   }
+   // unsigned build_id_len = build_id_length(note);
+   // if (build_id_len < 20) {
+   //    return vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+   //                     "build-id too short.  It needs to be a SHA");
+   // }
 
    struct mesa_sha1 sha1_ctx;
    uint8_t sha1[20];
@@ -227,7 +229,7 @@
     * invalid.  It needs both a driver build and the PCI ID of the device.
     */
    _mesa_sha1_init(&sha1_ctx);
-   _mesa_sha1_update(&sha1_ctx, build_id_data(note), build_id_len);
+   // _mesa_sha1_update(&sha1_ctx, build_id_data(note), build_id_len);
    _mesa_sha1_update(&sha1_ctx, &device->chipset_id,
                      sizeof(device->chipset_id));
    _mesa_sha1_final(&sha1_ctx, sha1);
@@ -238,7 +240,7 @@
     * share memory need to also check the device UUID (below) so all this
     * needs to be is the build-id.
     */
-   memcpy(device->driver_uuid, build_id_data(note), VK_UUID_SIZE);
+   //memcpy(device->driver_uuid, build_id_data(note), VK_UUID_SIZE);
 
    /* The device UUID uniquely identifies the given device within the machine.
     * Since we never have more than one device, this doesn't need to be a real
@@ -265,7 +267,7 @@
    VkResult result;
    int fd;
 
-   fd = open(path, O_RDWR | O_CLOEXEC);
+   fd = open(path, O_RDONLY);
    if (fd < 0)
       return vk_error(VK_ERROR_INCOMPATIBLE_DRIVER);
 
@@ -350,8 +352,9 @@
        * many platforms, but otherwise, things will just work.
        */
       if (device->subslice_total < 1 || device->eu_total < 1) {
-         fprintf(stderr, "WARNING: Kernel 4.1 required to properly"
-                         " query GPU properties.\n");
+         fprintf(stderr, "WARNING: Unknown subslice/eu totals for device 0x%x\n",
+                 device->chipset_id);
+         assert(false);
       }
    } else if (device->info.gen == 7) {
       device->subslice_total = 1 << (device->info.gt - 1);
@@ -408,13 +411,21 @@
 
 static const VkExtensionProperties global_extensions[] = {
    {
+      .extensionName = VK_GOOGLE_IMAGE_USAGE_SCANOUT_EXTENSION_NAME,
+      .specVersion = 1,
+   },
+   {
       .extensionName = VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME,
       .specVersion = 1,
    },
    {
-      .extensionName = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
+      .extensionName = VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME,
       .specVersion = 1,
-   },
+   },   
+   {
+       .extensionName = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
+       .specVersion = 1,
+   },   
    {
       .extensionName = VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME,
       .specVersion = 1,
@@ -423,6 +434,12 @@
       .extensionName = VK_KHR_SURFACE_EXTENSION_NAME,
       .specVersion = 25,
    },
+#ifdef VK_USE_PLATFORM_MAGMA_KHR
+   {
+      .extensionName = VK_KHR_MAGMA_SURFACE_EXTENSION_NAME,
+      .specVersion = 1,
+   },
+#endif
 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
    {
       .extensionName = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
@@ -461,6 +478,18 @@
       .specVersion = 1,
    },
    {
+      .extensionName = VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME,
+      .specVersion = 1,
+   },
+   {
+      .extensionName = VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME,
+      .specVersion = 1,
+   },
+   {
+      .extensionName = VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_EXTENSION_NAME,
+      .specVersion = 1,
+   },
+   {
       .extensionName = VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
       .specVersion = 1,
    },
@@ -613,35 +642,35 @@
 static VkResult
 anv_enumerate_devices(struct anv_instance *instance)
 {
-   /* TODO: Check for more devices ? */
-   drmDevicePtr devices[8];
-   VkResult result = VK_ERROR_INCOMPATIBLE_DRIVER;
-   int max_devices;
-
-   instance->physicalDeviceCount = 0;
-
-   max_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
-   if (max_devices < 1)
-      return VK_ERROR_INCOMPATIBLE_DRIVER;
-
-   for (unsigned i = 0; i < (unsigned)max_devices; i++) {
-      if (devices[i]->available_nodes & 1 << DRM_NODE_RENDER &&
-          devices[i]->bustype == DRM_BUS_PCI &&
-          devices[i]->deviceinfo.pci->vendor_id == 0x8086) {
-
-         result = anv_physical_device_init(&instance->physicalDevice,
-                        instance,
-                        devices[i]->nodes[DRM_NODE_RENDER]);
-         if (result != VK_ERROR_INCOMPATIBLE_DRIVER)
-            break;
-      }
-   }
-   drmFreeDevices(devices, max_devices);
-
-   if (result == VK_SUCCESS)
-      instance->physicalDeviceCount = 1;
-
-   return result;
+    struct dirent* de;
+    const char DEV_GPU[] = "/dev/class/gpu";
+    DIR* dir = opendir(DEV_GPU);
+    if (!dir) {
+        printf("Error opening %s\n", DEV_GPU);
+        return VK_ERROR_INITIALIZATION_FAILED;
+    }
+    
+    instance->physicalDeviceCount = 0;
+    VkResult result = VK_SUCCESS;
+    
+    while ((de = readdir(dir)) != NULL) {
+        // extra +1 ensures space for null termination
+        char name[sizeof(DEV_GPU) + sizeof('/') + (NAME_MAX + 1) + 1];
+        snprintf(name, sizeof(name), "%s/%s", DEV_GPU, de->d_name);
+        
+        struct stat path_stat;
+        stat(name, &path_stat);
+        if (!S_ISDIR(path_stat.st_mode)) {
+            result = anv_physical_device_init(&instance->physicalDevice, instance, name);
+            if (result == VK_SUCCESS) {
+                instance->physicalDeviceCount = 1;
+                break;
+            }
+        }
+    }
+    
+    closedir(dir);
+    return result;
 }
 
 
@@ -1168,12 +1197,17 @@
       device->alloc = physical_device->instance->alloc;
 
    /* XXX(chadv): Can we dup() physicalDevice->fd here? */
-   device->fd = open(physical_device->path, O_RDWR | O_CLOEXEC);
+   device->fd = open(physical_device->path, O_RDONLY);
    if (device->fd == -1) {
       result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
       goto fail_device;
    }
 
+   if (anv_gem_connect(device) != 0) {
+      result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
+      goto fail_device;
+   }
+
    device->context_id = anv_gem_create_context(device);
    if (device->context_id == -1) {
       result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
@@ -1276,7 +1310,7 @@
  fail_workaround_bo:
    anv_queue_finish(&device->queue);
    anv_scratch_pool_finish(device, &device->scratch_pool);
-   anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size);
+   anv_gem_munmap(device, device->workaround_bo.gem_handle, device->workaround_bo.map, device->workaround_bo.size);
    anv_gem_close(device, device->workaround_bo.gem_handle);
  fail_surface_state_pool:
    anv_state_pool_finish(&device->surface_state_pool);
@@ -1323,7 +1357,7 @@
 
    anv_scratch_pool_finish(device, &device->scratch_pool);
 
-   anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size);
+   anv_gem_munmap(device, device->workaround_bo.gem_handle, device->workaround_bo.map, device->workaround_bo.size);
    anv_gem_close(device, device->workaround_bo.gem_handle);
 
    anv_state_pool_finish(&device->surface_state_pool);
@@ -1338,6 +1372,7 @@
    pthread_mutex_destroy(&device->mutex);
 
    anv_gem_destroy_context(device, device->context_id);
+   anv_gem_disconnect(device);
 
    close(device->fd);
 
@@ -1522,7 +1557,7 @@
 VkResult
 anv_bo_init_new(struct anv_bo *bo, struct anv_device *device, uint64_t size)
 {
-   uint32_t gem_handle = anv_gem_create(device, size);
+   anv_buffer_handle_t gem_handle = anv_gem_create(device, size);
    if (!gem_handle)
       return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
 
@@ -1582,6 +1617,9 @@
    const VkImportMemoryFdInfoKHR *fd_info =
       vk_find_struct_const(pAllocateInfo->pNext, IMPORT_MEMORY_FD_INFO_KHR);
 
+   const VkImportMemoryFuchsiaHandleInfoKHR *fuchsia_info =
+      vk_find_struct_const(pAllocateInfo->pNext, IMPORT_MEMORY_FUCHSIA_HANDLE_INFO_KHR);
+
    /* The Vulkan spec permits handleType to be 0, in which case the struct is
     * ignored.
     */
@@ -1597,6 +1635,24 @@
                                    &mem->bo);
       if (result != VK_SUCCESS)
          goto fail;
+   } else if (fuchsia_info && fuchsia_info->handleType) {
+      assert(fuchsia_info->handleType ==
+             VK_EXTERNAL_MEMORY_HANDLE_TYPE_FUCHSIA_VMO_BIT_KHR);
+
+      // The anv_buffer_handle_t isn't a unique handle per object, so the cache
+      // lookup in the import will always fail.
+      // TODO(MA-320) - get a unique id for this object and use that as the cache key;
+      // then clients will be able to import a buffer more than once.
+      anv_buffer_handle_t buffer;
+      uint64_t import_size;
+      int status = anv_platform_import_buffer(device, fuchsia_info->handle, &buffer, &import_size);
+      if (status != 0)
+         return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR);
+
+      VkResult result = anv_bo_cache_import_buffer_handle(
+          device, &device->bo_cache, buffer, pAllocateInfo->allocationSize, import_size, &mem->bo);
+      if (result != VK_SUCCESS)
+         goto fail;
    } else {
       result = anv_bo_cache_alloc(device, &device->bo_cache,
                                   pAllocateInfo->allocationSize,
@@ -1740,11 +1796,12 @@
     VkDeviceMemory                              _memory)
 {
    ANV_FROM_HANDLE(anv_device_memory, mem, _memory);
+   ANV_FROM_HANDLE(anv_device, device, _device);
 
    if (mem == NULL)
       return;
 
-   anv_gem_munmap(mem->map, mem->map_size);
+   anv_gem_munmap(device, mem->bo->gem_handle, mem->map, mem->map_size);
 
    mem->map = NULL;
    mem->map_size = 0;
@@ -1938,7 +1995,6 @@
    ANV_FROM_HANDLE(anv_buffer, buffer, _buffer);
 
    if (mem) {
-      assert((buffer->usage & mem->type->valid_buffer_usage) == buffer->usage);
       buffer->bo = mem->bo;
       buffer->offset = memoryOffset;
    } else {
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
old mode 100644
new mode 100755
index e2ced38..b6f95ff
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 # coding=utf-8
 #
 # Copyright © 2015, 2017 Intel Corporation
@@ -27,6 +28,10 @@
 import os
 import textwrap
 import xml.etree.cElementTree as et
+import sys
+
+# --pythonpath must be the first argument
+sys.path.append(sys.argv[2])
 
 from mako.template import Template
 
@@ -38,6 +43,7 @@
     'VK_KHR_external_memory',
     'VK_KHR_external_memory_capabilities',
     'VK_KHR_external_memory_fd',
+    'VK_KHR_external_memory_fuchsia',
     'VK_KHR_get_memory_requirements2',
     'VK_KHR_get_physical_device_properties2',
     'VK_KHR_get_surface_capabilities2',
@@ -53,7 +59,13 @@
     'VK_KHR_wayland_surface',
     'VK_KHR_xcb_surface',
     'VK_KHR_xlib_surface',
-    'VK_KHX_multiview',
+    'VK_KHR_magma_surface',
+    'VK_GOOGLE_external_memory_magma',
+    'VK_KHR_external_semaphore_capabilities',
+    'VK_KHR_external_semaphore',
+    'VK_KHR_external_semaphore_fd',
+    'VK_KHR_external_semaphore_fuchsia',
+    'VK_KHX_multiview'
 ]
 
 # We generate a static hash table for entry point lookup
@@ -181,11 +193,11 @@
     static void * __attribute__ ((noinline))
     anv_resolve_entrypoint(const struct gen_device_info *devinfo, uint32_t index)
     {
-       if (devinfo == NULL) {
-          return anv_layer.entrypoints[index];
-       }
+       int gen = (devinfo == NULL) ? 9 : devinfo->gen;
+       bool is_haswell = (devinfo == NULL) ? false : devinfo->is_haswell;
+       assert(gen == 9 && !is_haswell);
 
-       switch (devinfo->gen) {
+       switch (gen) {
        case 10:
           if (gen10_layer.entrypoints[index])
              return gen10_layer.entrypoints[index];
@@ -199,7 +211,7 @@
              return gen8_layer.entrypoints[index];
           /* fall through */
        case 7:
-          if (devinfo->is_haswell && gen75_layer.entrypoints[index])
+          if (is_haswell && gen75_layer.entrypoints[index])
              return gen75_layer.entrypoints[index];
 
           if (gen7_layer.entrypoints[index])
@@ -365,6 +377,7 @@
 
 def main():
     parser = argparse.ArgumentParser()
+    parser.add_argument('--pythonpath')
     parser.add_argument('--outdir', help='Where to write the files.',
                         required=True)
     parser.add_argument('--xml', help='Vulkan API XML file.', required=True)
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 4f0a818..51f432c 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -216,9 +216,20 @@
    /* Translate the Vulkan tiling to an equivalent ISL tiling, then filter the
     * result with an optionally provided ISL tiling argument.
     */
-   isl_tiling_flags_t tiling_flags =
-      (vk_info->tiling == VK_IMAGE_TILING_LINEAR) ?
-      ISL_TILING_LINEAR_BIT : ISL_TILING_ANY_MASK;
+   VkImageTiling tiling = vk_info->tiling;
+
+   isl_tiling_flags_t tiling_flags;
+   switch (tiling) {
+      case VK_IMAGE_TILING_LINEAR:
+        tiling_flags = ISL_TILING_LINEAR_BIT;
+        break;
+      default:
+        if (image->usage & VK_IMAGE_USAGE_SCANOUT_BIT_GOOGLE) {
+          tiling_flags = ISL_TILING_X_BIT;
+        } else {
+          tiling_flags = ISL_TILING_ANY_MASK;
+        }
+   }
 
    if (anv_info->isl_tiling_flags)
       tiling_flags &= anv_info->isl_tiling_flags;
@@ -231,7 +242,7 @@
                                              vk_info->extent);
 
    enum isl_format format = anv_get_isl_format(&dev->info, vk_info->format,
-                                               aspect, vk_info->tiling);
+                                               aspect, tiling);
    assert(format != ISL_FORMAT_UNSUPPORTED);
 
    ok = isl_surf_init(&dev->isl_dev, &anv_surf->isl,
@@ -674,7 +685,8 @@
                           VK_IMAGE_USAGE_STORAGE_BIT |
                           VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
                           VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT |
-                          VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT));
+                          VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT |
+                          VK_IMAGE_USAGE_SCANOUT_BIT_GOOGLE));
 
    switch (image->type) {
    default:
diff --git a/src/intel/vulkan/anv_magma.cc b/src/intel/vulkan/anv_magma.cc
new file mode 100644
index 0000000..886a82b
--- /dev/null
+++ b/src/intel/vulkan/anv_magma.cc
@@ -0,0 +1,378 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "drm_command_buffer.h"
+#include "magma.h"
+#include "magma_util/dlog.h"
+#include "magma_util/macros.h"
+#include "magma_util/sleep.h"
+// clang-format off
+#include "anv_private.h"
+// clang-format on
+
+static magma_connection_t* magma_connection(anv_device* device)
+{
+   DASSERT(device);
+   DASSERT(device->connection);
+   return device->connection;
+}
+
+int anv_gem_connect(anv_device* device)
+{
+   device->connection = magma_create_connection(device->fd, MAGMA_CAPABILITY_RENDERING);
+   if (!device->connection)
+      return DRET_MSG(-1, "magma_system_open failed");
+
+   DLOG("opened a magma system connection");
+   return 0;
+}
+
+void anv_gem_disconnect(anv_device* device)
+{
+   magma_release_connection(magma_connection(device));
+   DLOG("closed the magma system connection");
+}
+
+// Return handle, or 0 on failure. Gem handles are never 0.
+anv_buffer_handle_t anv_gem_create(anv_device* device, size_t size)
+{
+   magma_buffer_t buffer;
+   uint64_t magma_size = size;
+   if (magma_create_buffer(magma_connection(device), magma_size, &magma_size, &buffer) != 0) {
+      DLOG("magma_system_alloc failed size 0x%zx", magma_size);
+      return 0;
+   }
+   DLOG("magma_system_alloc size 0x%zx returning buffer 0x%lx", magma_size, buffer);
+
+   DASSERT(buffer != 0);
+   return buffer;
+}
+
+void anv_gem_close(anv_device* device, anv_buffer_handle_t handle)
+{
+   DLOG("anv_gem_close handle 0x%lx", handle);
+   magma_release_buffer(magma_connection(device), handle);
+}
+
+void* anv_gem_mmap(anv_device* device, anv_buffer_handle_t handle, uint64_t offset, uint64_t size,
+                   uint32_t flags)
+{
+   DASSERT(flags == 0);
+   void* addr;
+   magma_status_t status = magma_map(magma_connection(device), handle, &addr);
+   if (status != MAGMA_STATUS_OK) {
+      DLOG("magma_system_map failed: status %d", status);
+      return MAP_FAILED;
+   }
+   DLOG("magma_system_map handle 0x%lx size 0x%zx returning %p", handle, size, addr);
+   return reinterpret_cast<uint8_t*>(addr) + offset;
+}
+
+void anv_gem_munmap(anv_device* device, anv_buffer_handle_t gem_handle, void* addr, uint64_t size)
+{
+   if (!addr)
+      return;
+
+   if (magma_unmap(magma_connection(device), gem_handle) != 0) {
+      DLOG("magma_system_unmap failed");
+      return;
+   }
+
+   DLOG("magma_system_unmap handle 0x%lx", gem_handle);
+}
+
+uint32_t anv_gem_userptr(anv_device* device, void* mem, size_t size)
+{
+   DLOG("anv_gem_userptr - STUB");
+   DASSERT(false);
+   return 0;
+}
+
+int anv_gem_set_caching(anv_device* device, anv_buffer_handle_t gem_handle, uint32_t caching)
+{
+   DLOG("anv_get_set_caching - STUB");
+   return 0;
+}
+
+int anv_gem_set_domain(anv_device* device, anv_buffer_handle_t gem_handle, uint32_t read_domains,
+                       uint32_t write_domain)
+{
+   DLOG("anv_gem_set_domain - STUB");
+   return 0;
+}
+
+/**
+ * On error, \a timeout_ns holds the remaining time.
+ */
+int anv_gem_wait(anv_device* device, anv_buffer_handle_t handle, int64_t* timeout_ns)
+{
+   magma_wait_rendering(magma_connection(device), handle);
+   return 0;
+}
+
+/**
+ * Returns 0, 1, or negative to indicate error
+ */
+int anv_gem_busy(anv_device* device, anv_buffer_handle_t handle)
+{
+   // Magma doesn't have a means to poll buffer busy.
+   // Upper layers should be changed to check semaphore signal status.
+   magma_wait_rendering(magma_connection(device), handle);
+   return 0;
+}
+
+bool anv_gem_supports_48b_addresses(int fd)
+{
+   // TODO(MA-310)
+   return false;
+}
+
+int anv_gem_get_context_param(int fd, int context, uint32_t param, uint64_t* value)
+{
+   if (param == I915_CONTEXT_PARAM_GTT_SIZE) {
+      // TODO(MA-311) - query for this
+      *value = 8ull * 1024ull * 1024ull;
+      return 0;
+   }
+   DLOG("anv_gem_get_context_param: unhandled param 0x%x", param);
+   return -1;
+}
+
+int anv_gem_execbuffer(anv_device* device, drm_i915_gem_execbuffer2* execbuf,
+                       uint32_t wait_semaphore_count, anv_semaphore* wait_semaphores[],
+                       uint32_t signal_semaphore_count, anv_semaphore* signal_semaphores[])
+{
+   DLOG("anv_gem_execbuffer");
+
+   if (execbuf->buffer_count == 0)
+      return 0;
+
+   uint64_t required_size =
+       DrmCommandBuffer::RequiredSize(execbuf, wait_semaphore_count, signal_semaphore_count);
+
+   uint64_t cmd_buf_id;
+   magma_status_t status =
+       magma_create_command_buffer(magma_connection(device), required_size, &cmd_buf_id);
+   if (status != MAGMA_STATUS_OK)
+      return DRET_MSG(-1, "magma_alloc_command_buffer failed size 0x%" PRIx64 " : %d",
+                      required_size, status);
+
+   void* cmd_buf_data;
+   status = magma_map(magma_connection(device), cmd_buf_id, &cmd_buf_data);
+   if (status != MAGMA_STATUS_OK) {
+      magma_release_command_buffer(magma_connection(device), cmd_buf_id);
+      return DRET_MSG(-1, "magma_system_map failed: %d", status);
+   }
+
+   std::vector<uint64_t> wait_semaphore_ids(wait_semaphore_count);
+   for (uint32_t i = 0; i < wait_semaphore_count; i++) {
+      wait_semaphore_ids[i] = magma_get_semaphore_id(
+          reinterpret_cast<magma_semaphore_t>(wait_semaphores[i]->current->platform_semaphore));
+   }
+
+   std::vector<uint64_t> signal_semaphore_ids(signal_semaphore_count);
+   for (uint32_t i = 0; i < signal_semaphore_count; i++) {
+      signal_semaphore_ids[i] = magma_get_semaphore_id(
+          reinterpret_cast<magma_semaphore_t>(signal_semaphores[i]->current->platform_semaphore));
+   }
+
+   if (!DrmCommandBuffer::Translate(execbuf, std::move(wait_semaphore_ids),
+                                    std::move(signal_semaphore_ids), cmd_buf_data)) {
+      status = magma_unmap(magma_connection(device), cmd_buf_id);
+      DASSERT(status == MAGMA_STATUS_OK);
+      magma_release_command_buffer(magma_connection(device), cmd_buf_id);
+      return DRET_MSG(-1, "DrmCommandBuffer::Translate failed");
+   }
+
+   status = magma_unmap(magma_connection(device), cmd_buf_id);
+   DASSERT(status == MAGMA_STATUS_OK);
+
+   magma_submit_command_buffer(magma_connection(device), cmd_buf_id, device->context_id);
+
+   return 0;
+}
+
+int anv_gem_set_tiling(anv_device* device, anv_buffer_handle_t gem_handle, uint32_t stride,
+                       uint32_t tiling)
+{
+   DLOG("anv_gem_set_tiling - STUB");
+   return 0;
+}
+
+constexpr uint32_t kQuerySubsliceAndEuTotalId = MAGMA_QUERY_VENDOR_PARAM_0;
+
+int anv_gem_get_param(int fd, uint32_t param)
+{
+   magma_status_t status = MAGMA_STATUS_OK;
+   uint64_t value;
+
+   switch (param) {
+   case I915_PARAM_CHIPSET_ID:
+      status = magma_query(fd, MAGMA_QUERY_DEVICE_ID, &value);
+      break;
+   case I915_PARAM_SUBSLICE_TOTAL:
+      status = magma_query(fd, kQuerySubsliceAndEuTotalId, &value);
+      value >>= 32;
+      break;
+   case I915_PARAM_EU_TOTAL:
+      status = magma_query(fd, kQuerySubsliceAndEuTotalId, &value);
+      value = static_cast<uint32_t>(value);
+      break;
+   case I915_PARAM_HAS_WAIT_TIMEOUT:
+   case I915_PARAM_HAS_EXECBUF2:
+      value = 1;
+      break;
+   default:
+      status = MAGMA_STATUS_INVALID_ARGS;
+   }
+
+   if (status != MAGMA_STATUS_OK)
+      value = 0;
+
+   uint32_t result = static_cast<uint32_t>(value);
+   DASSERT(result == value);
+   DLOG("anv_gem_get_param(%u, %u) returning %d", fd, param, result);
+   return result;
+}
+
+bool anv_gem_get_bit6_swizzle(int fd, uint32_t tiling)
+{
+   DLOG("anv_gem_get_bit6_swizzle - STUB");
+   return 0;
+}
+
+int anv_gem_create_context(anv_device* device)
+{
+   uint32_t context_id;
+   magma_create_context(magma_connection(device), &context_id);
+   DLOG("magma_system_create_context returned context_id %u", context_id);
+
+   return static_cast<int>(context_id);
+}
+
+int anv_gem_destroy_context(anv_device* device, int context_id)
+{
+   magma_release_context(magma_connection(device), context_id);
+   return 0;
+}
+
+int anv_gem_get_aperture(int fd, uint64_t* size)
+{
+   DLOG("anv_gem_get_aperture - STUB");
+   return 0;
+}
+
+int anv_gem_handle_to_fd(anv_device* device, anv_buffer_handle_t gem_handle)
+{
+   int fd;
+   auto result = magma_export_fd(magma_connection(device), gem_handle, &fd);
+   DASSERT(result == MAGMA_STATUS_OK);
+   return fd;
+}
+
+anv_buffer_handle_t anv_gem_fd_to_handle(anv_device* device, int fd, uint64_t* size_out)
+{
+   magma_buffer_t buffer;
+   magma_status_t status = magma_import_fd(magma_connection(device), fd, &buffer);
+   if (status != MAGMA_STATUS_OK)
+      return 0;
+
+   *size_out = magma_get_buffer_size(buffer);
+   return buffer;
+}
+
+int anv_gem_gpu_get_reset_stats(struct anv_device* device, uint32_t* active, uint32_t* pending)
+{
+   DLOG("anv_gem_gpu_get_reset_stats - STUB");
+   *active = 0;
+   *pending = 0;
+   return 0;
+}
+
+VkResult anv_GetMemoryFuchsiaHandleKHR(VkDevice vk_device,
+                                       const VkMemoryGetFuchsiaHandleInfoKHR* pGetFuchsiaHandleInfo,
+                                       uint32_t* pHandle)
+{
+   ANV_FROM_HANDLE(anv_device, device, vk_device);
+   ANV_FROM_HANDLE(anv_device_memory, memory, pGetFuchsiaHandleInfo->memory);
+
+   assert(pGetFuchsiaHandleInfo->sType == VK_STRUCTURE_TYPE_MEMORY_GET_FUCHSIA_HANDLE_INFO_KHR);
+   assert(pGetFuchsiaHandleInfo->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_FUCHSIA_VMO_BIT_KHR);
+
+   auto result = magma_export(magma_connection(device), memory->bo->gem_handle, pHandle);
+   DASSERT(result == MAGMA_STATUS_OK);
+
+   return VK_SUCCESS;
+}
+
+VkResult anv_GetMemoryFuchsiaHandlePropertiesKHR(
+    VkDevice vk_device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, uint32_t handle,
+    VkMemoryFuchsiaHandlePropertiesKHR* pMemoryFuchsiaHandleProperties)
+{
+   ANV_FROM_HANDLE(anv_device, device, vk_device);
+
+   assert(handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_FUCHSIA_VMO_BIT_KHR);
+   assert(pMemoryFuchsiaHandleProperties->sType ==
+          VK_STRUCTURE_TYPE_MEMORY_FUCHSIA_HANDLE_PROPERTIES_KHR);
+
+   struct anv_physical_device* pdevice = &device->instance->physicalDevice;
+   // All memory types supported
+   pMemoryFuchsiaHandleProperties->memoryTypeBits = (1ull << pdevice->memory.type_count) - 1;
+
+   return VK_SUCCESS;
+}
+
+VkResult anv_ImportSemaphoreFuchsiaHandleKHR(VkDevice vk_device,
+                                             const VkImportSemaphoreFuchsiaHandleInfoKHR* info)
+{
+   assert(info->sType == VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FUCHSIA_HANDLE_INFO_KHR);
+   assert(info->handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FUCHSIA_FENCE_BIT_KHR);
+
+   bool permanent = (info->flags & VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR) == 0;
+   ANV_FROM_HANDLE(anv_device, device, vk_device);
+
+   anv_platform_semaphore_t imported_semaphore;
+   if (anv_platform_import_semaphore(device, info->handle, &imported_semaphore) != 0)
+      return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR);
+
+   struct anv_semaphore* semaphore = (struct anv_semaphore*)info->semaphore;
+   assert(semaphore);
+
+   if (semaphore->temporary.platform_semaphore) {
+      anv_platform_destroy_semaphore(device, semaphore->temporary.platform_semaphore);
+      semaphore->temporary.platform_semaphore = 0;
+   }
+
+   if (permanent) {
+      anv_platform_destroy_semaphore(device, semaphore->permanent.platform_semaphore);
+      semaphore->permanent.platform_semaphore = imported_semaphore;
+      semaphore->current = &semaphore->permanent;
+   } else {
+      semaphore->temporary.platform_semaphore = imported_semaphore;
+      semaphore->current = &semaphore->temporary;
+   }
+
+   return VK_SUCCESS;
+}
+
+VkResult anv_GetSemaphoreFuchsiaHandleKHR(VkDevice vk_device,
+                                          const VkSemaphoreGetFuchsiaHandleInfoKHR* info,
+                                          uint32_t* pFuchsiaHandle)
+{
+   ANV_FROM_HANDLE(anv_device, device, vk_device);
+   assert(info->sType == VK_STRUCTURE_TYPE_SEMAPHORE_GET_FUCHSIA_HANDLE_INFO_KHR);
+
+   if (info->handleType != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FUCHSIA_FENCE_BIT_KHR)
+      return VK_SUCCESS;
+
+   anv_platform_semaphore_t semaphore =
+       ((struct anv_semaphore*)info->semaphore)->current->platform_semaphore;
+
+   uint32_t handle;
+   if (anv_platform_export_semaphore(device, semaphore, &handle) != 0)
+      return vk_error(VK_ERROR_TOO_MANY_OBJECTS);
+
+   *pFuchsiaHandle = handle;
+   return VK_SUCCESS;
+}
diff --git a/src/intel/vulkan/anv_platform.cc b/src/intel/vulkan/anv_platform.cc
new file mode 100644
index 0000000..a458905
--- /dev/null
+++ b/src/intel/vulkan/anv_platform.cc
@@ -0,0 +1,99 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "anv_private.h"
+#include "magma.h"
+#include "magma_util/dlog.h"
+#include "magma_util/macros.h"
+#include "platform_futex.h"
+#include <errno.h>
+
+int anv_platform_futex_wake(uint32_t* addr, int count)
+{
+   if (!magma::PlatformFutex::Wake(addr, count))
+      return DRET_MSG(-1, "Wake failed");
+   return 0;
+}
+
+int anv_platform_futex_wait(uint32_t* addr, int32_t value)
+{
+  magma::PlatformFutex::WaitResult result;
+  if (!magma::PlatformFutex::WaitForever(addr, value, &result))
+    return DRET_MSG(-EINVAL, "WaitForever failed");
+  if (result == magma::PlatformFutex::WaitResult::RETRY)
+    return -EAGAIN;
+  assert(result == magma::PlatformFutex::WaitResult::AWOKE);
+  return 0;
+}
+
+int anv_platform_create_semaphore(anv_device* device, anv_platform_semaphore_t* semaphore_out)
+{
+   DLOG("anv_platform_create_semaphore");
+   magma_semaphore_t semaphore;
+   magma_status_t status = magma_create_semaphore(device->connection, &semaphore);
+   if (status != MAGMA_STATUS_OK)
+      return DRET_MSG(-EINVAL, "magma_system_create_semaphore failed: %d", status);
+   *semaphore_out = reinterpret_cast<anv_platform_semaphore_t>(semaphore);
+   return 0;
+}
+
+void anv_platform_destroy_semaphore(anv_device* device, anv_platform_semaphore_t semaphore)
+{
+   DLOG("anv_platform_destroy_semaphore");
+   magma_release_semaphore(device->connection, reinterpret_cast<magma_semaphore_t>(semaphore));
+}
+
+void anv_platform_reset_semaphore(anv_platform_semaphore_t semaphore)
+{
+   DLOG("anv_platform_reset_semaphore");
+   magma_reset_semaphore(reinterpret_cast<magma_semaphore_t>(semaphore));
+}
+
+int anv_platform_wait_semaphore(anv_platform_semaphore_t semaphore, uint64_t timeout)
+{
+   DLOG("anv_platform_wait_semaphore");
+   magma_status_t status =
+       magma_wait_semaphore(reinterpret_cast<magma_semaphore_t>(semaphore), timeout);
+   switch (status) {
+   case MAGMA_STATUS_OK:
+      return 0;
+   case MAGMA_STATUS_TIMED_OUT:
+      return -ETIME;
+   }
+   return DRET_MSG(-EINVAL, "unhandled magma status: %d", status);
+}
+
+int anv_platform_import_semaphore(anv_device* device, uint32_t semaphore_handle,
+                                  anv_platform_semaphore_t* semaphore_out)
+{
+   DLOG("anv_platform_import_semaphore");
+   magma_status_t status = magma_import_semaphore(
+       device->connection, semaphore_handle, reinterpret_cast<magma_semaphore_t*>(semaphore_out));
+   // TODO() - distinguish case where connection/device lost vs invalid argument
+   if (status != MAGMA_STATUS_OK)
+      return DRET_MSG(-EINVAL, "magma_import_semaphore failed: %d", status);
+   return 0;
+}
+
+int anv_platform_export_semaphore(anv_device* device, anv_platform_semaphore_t semaphore,
+                                  uint32_t* semaphore_handle_out)
+{
+   DLOG("anv_platform_export_semaphore");
+   magma_status_t status = magma_export_semaphore(
+       device->connection, reinterpret_cast<magma_semaphore_t>(semaphore), semaphore_handle_out);
+   if (status != MAGMA_STATUS_OK)
+      return DRET_MSG(-EINVAL, "magma_export_semaphore failed: %d", status);
+   return 0;
+}
+
+int anv_platform_import_buffer(struct anv_device* device, uint32_t handle,
+                               anv_buffer_handle_t* buffer_out, uint64_t* size_out)
+{
+   magma_status_t status = magma_import(device->connection, handle, buffer_out);
+   if (status != MAGMA_STATUS_OK)
+      return DRET_MSG(-EINVAL, "magma_import failed: %d", status);
+
+   *size_out = magma_get_buffer_size(*buffer_out);
+   return 0;
+}
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index d374b87..4e87514 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -31,6 +31,7 @@
 #include <assert.h>
 #include <stdint.h>
 #include <i915_drm.h>
+#include <sys/mman.h> // for MAP_FAILED
 
 #ifdef HAVE_VALGRIND
 #include <valgrind.h>
@@ -68,6 +69,10 @@
 #include <vulkan/vulkan_intel.h>
 #include <vulkan/vk_icd.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "anv_entrypoints.h"
 #include "isl/isl.h"
 
@@ -327,7 +332,7 @@
                      const VkAllocationCallbacks *alloc,
                      VkSystemAllocationScope scope)
 {
-   void *ptr = vk_alloc(alloc, ma->size, ma->align, scope);
+   uint8_t *ptr = (uint8_t*) vk_alloc(alloc, ma->size, ma->align, scope);
    if (!ptr)
       return NULL;
 
@@ -375,8 +380,10 @@
  * wraparound.
  */
 
+typedef uintptr_t anv_buffer_handle_t;
+
 struct anv_bo {
-   uint32_t gem_handle;
+   anv_buffer_handle_t gem_handle;
 
    /* Index into the current validation list.  This is used by the
     * validation list building alrogithm to track which buffers are already
@@ -392,13 +399,18 @@
 
    uint64_t size;
    void *map;
-
+    
    /** Flags to pass to the kernel through drm_i915_exec_object2::flags */
    uint32_t flags;
+
+   /* Since vulkan sub-allocates from large buffer pools, track the offset
+    * where this buffer starts within the system buffer.
+    */
+   uint64_t start_offset;
 };
 
 static inline void
-anv_bo_init(struct anv_bo *bo, uint32_t gem_handle, uint64_t size)
+anv_bo_init(struct anv_bo *bo, anv_buffer_handle_t gem_handle, uint64_t size)
 {
    bo->gem_handle = gem_handle;
    bo->index = 0;
@@ -406,6 +418,7 @@
    bo->size = size;
    bo->map = NULL;
    bo->flags = 0;
+   bo->start_offset = 0;
 }
 
 /* Represents a lock-free linked list of "free" things.  This is used by
@@ -455,7 +468,6 @@
     * In particular, map == bo.map + center_offset
     */
    void *map;
-   int fd;
 
    /**
     * Array of mmaps and gem handles owned by the block pool, reclaimed when
@@ -606,6 +618,9 @@
 VkResult anv_bo_cache_import(struct anv_device *device,
                              struct anv_bo_cache *cache,
                              int fd, uint64_t size, struct anv_bo **bo);
+VkResult anv_bo_cache_import_buffer_handle(struct anv_device* device, struct anv_bo_cache* cache,
+                                           anv_buffer_handle_t gem_handle, uint64_t size,
+                                           uint64_t import_size, struct anv_bo** bo_out);
 VkResult anv_bo_cache_export(struct anv_device *device,
                              struct anv_bo_cache *cache,
                              struct anv_bo *bo_in, int *fd_out);
@@ -636,7 +651,7 @@
 
     struct anv_instance *                       instance;
     uint32_t                                    chipset_id;
-    char                                        path[20];
+    char                                        path[64];
     const char *                                name;
     struct gen_device_info                      info;
     /** Amount of "GPU memory" we want to advertise
@@ -751,10 +766,13 @@
     struct anv_scratch_pool                     scratch_pool;
 
     uint32_t                                    default_mocs;
+    uint32_t                                    uncached_mocs;
 
     pthread_mutex_t                             mutex;
     pthread_cond_t                              queue_submit;
     bool                                        lost;
+    
+    struct magma_connection_t* connection;
 };
 
 static void inline
@@ -766,28 +784,38 @@
    gen_flush_range(state.map, state.alloc_size);
 }
 
+typedef uintptr_t anv_platform_semaphore_t;
+
+struct anv_semaphore;
+typedef struct anv_semaphore* anv_semaphore_t;
+    
 void anv_device_init_blorp(struct anv_device *device);
 void anv_device_finish_blorp(struct anv_device *device);
 
-VkResult anv_device_execbuf(struct anv_device *device,
-                            struct drm_i915_gem_execbuffer2 *execbuf,
-                            struct anv_bo **execbuf_bos);
+VkResult anv_device_execbuf(struct anv_device* device, struct drm_i915_gem_execbuffer2* execbuf,
+                            struct anv_bo** execbuf_bos, uint32_t wait_semaphore_count,
+                            anv_semaphore_t* wait_semaphores, uint32_t signal_semaphore_count,
+                            anv_semaphore_t* signal_semaphores);
 VkResult anv_device_query_status(struct anv_device *device);
 VkResult anv_device_bo_busy(struct anv_device *device, struct anv_bo *bo);
 VkResult anv_device_wait(struct anv_device *device, struct anv_bo *bo,
-                         int64_t timeout);
+                             int64_t timeout);
+    
+int anv_gem_connect(struct anv_device* device);
+void anv_gem_disconnect(struct anv_device* device);
 
-void* anv_gem_mmap(struct anv_device *device,
-                   uint32_t gem_handle, uint64_t offset, uint64_t size, uint32_t flags);
-void anv_gem_munmap(void *p, uint64_t size);
-uint32_t anv_gem_create(struct anv_device *device, uint64_t size);
-void anv_gem_close(struct anv_device *device, uint32_t gem_handle);
+void* anv_gem_mmap(struct anv_device* device, anv_buffer_handle_t gem_handle, uint64_t offset,
+                   uint64_t size, uint32_t flags);
+void anv_gem_munmap(struct anv_device* device, anv_buffer_handle_t gem_handle, void *p, uint64_t size);
+anv_buffer_handle_t anv_gem_create(struct anv_device* device, uint64_t size);
+void anv_gem_close(struct anv_device* device, anv_buffer_handle_t gem_handle);
 uint32_t anv_gem_userptr(struct anv_device *device, void *mem, size_t size);
-int anv_gem_busy(struct anv_device *device, uint32_t gem_handle);
-int anv_gem_wait(struct anv_device *device, uint32_t gem_handle, int64_t *timeout_ns);
-int anv_gem_execbuffer(struct anv_device *device,
-                       struct drm_i915_gem_execbuffer2 *execbuf);
-int anv_gem_set_tiling(struct anv_device *device, uint32_t gem_handle,
+int anv_gem_busy(struct anv_device *device, anv_buffer_handle_t gem_handle);
+int anv_gem_wait(struct anv_device* device, anv_buffer_handle_t gem_handle, int64_t* timeout_ns);
+int anv_gem_execbuffer(struct anv_device* device, struct drm_i915_gem_execbuffer2* execbuf,
+                       uint32_t wait_semaphore_count, anv_semaphore_t* wait_semaphores,
+                       uint32_t signal_semaphore_count, anv_semaphore_t* signal_semaphores);
+int anv_gem_set_tiling(struct anv_device* device, anv_buffer_handle_t gem_handle,
                        uint32_t stride, uint32_t tiling);
 int anv_gem_create_context(struct anv_device *device);
 int anv_gem_destroy_context(struct anv_device *device, int context);
@@ -799,12 +827,26 @@
 bool anv_gem_supports_48b_addresses(int fd);
 int anv_gem_gpu_get_reset_stats(struct anv_device *device,
                                 uint32_t *active, uint32_t *pending);
-int anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle);
-uint32_t anv_gem_fd_to_handle(struct anv_device *device, int fd);
-int anv_gem_set_caching(struct anv_device *device, uint32_t gem_handle, uint32_t caching);
+int anv_gem_handle_to_fd(struct anv_device *device, anv_buffer_handle_t gem_handle);
+anv_buffer_handle_t anv_gem_fd_to_handle(struct anv_device *device, int fd, uint64_t* size_out);
+int anv_gem_set_caching(struct anv_device *device, anv_buffer_handle_t gem_handle, uint32_t caching);
 int anv_gem_set_domain(struct anv_device *device, uint32_t gem_handle,
                        uint32_t read_domains, uint32_t write_domain);
 
+int anv_platform_futex_wake(uint32_t *addr, int count);
+int anv_platform_futex_wait(uint32_t *addr, int32_t value);
+
+int anv_platform_create_semaphore(struct anv_device* device,
+                                  anv_platform_semaphore_t* semaphore_out);
+void anv_platform_destroy_semaphore(struct anv_device* device, anv_platform_semaphore_t semaphore);
+void anv_platform_reset_semaphore(anv_platform_semaphore_t semaphore);
+int anv_platform_wait_semaphore(anv_platform_semaphore_t semaphore, uint64_t timeout);
+int anv_platform_import_semaphore(struct anv_device* device, uint32_t semaphore_handle,
+                                  anv_platform_semaphore_t* semaphore_out);
+int anv_platform_export_semaphore(struct anv_device* device, anv_platform_semaphore_t semaphore,
+                                  uint32_t* semaphore_handle_out);
+int anv_platform_import_buffer(struct anv_device *device, uint32_t handle, anv_buffer_handle_t* buffer_out, uint64_t* size_out);
+
 VkResult anv_bo_init_new(struct anv_bo *bo, struct anv_device *device, uint64_t size);
 
 struct anv_reloc_list {
@@ -1206,7 +1248,7 @@
 anv_descriptor_set_write_template(struct anv_descriptor_set *set,
                                   struct anv_device *device,
                                   struct anv_state_stream *alloc_stream,
-                                  const struct anv_descriptor_update_template *template,
+                                  const struct anv_descriptor_update_template *update_template,
                                   const void *data);
 
 VkResult
@@ -1336,10 +1378,10 @@
    ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT | \
    ANV_PIPE_INSTRUCTION_CACHE_INVALIDATE_BIT)
 
-static inline enum anv_pipe_bits
+static inline uint32_t
 anv_pipe_flush_bits_for_access_flags(VkAccessFlags flags)
 {
-   enum anv_pipe_bits pipe_bits = 0;
+   uint32_t pipe_bits = 0;
 
    unsigned b;
    for_each_bit(b, flags) {
@@ -1365,10 +1407,10 @@
    return pipe_bits;
 }
 
-static inline enum anv_pipe_bits
+static inline uint32_t
 anv_pipe_invalidate_bits_for_access_flags(VkAccessFlags flags)
 {
-   enum anv_pipe_bits pipe_bits = 0;
+   uint32_t pipe_bits = 0;
 
    unsigned b;
    for_each_bit(b, flags) {
@@ -1631,8 +1673,7 @@
 void anv_cmd_buffer_add_secondary(struct anv_cmd_buffer *primary,
                                   struct anv_cmd_buffer *secondary);
 void anv_cmd_buffer_prepare_execbuf(struct anv_cmd_buffer *cmd_buffer);
-VkResult anv_cmd_buffer_execbuf(struct anv_device *device,
-                                struct anv_cmd_buffer *cmd_buffer,
+VkResult anv_cmd_buffer_execbuf(struct anv_device* device, struct anv_cmd_buffer* cmd_buffer,
                                 const VkSemaphore *in_semaphores,
                                 uint32_t num_in_semaphores,
                                 const VkSemaphore *out_semaphores,
@@ -1717,6 +1758,7 @@
    struct drm_i915_gem_execbuffer2 execbuf;
    struct drm_i915_gem_exec_object2 exec2_objects[1];
    enum anv_fence_state state;
+   struct anv_semaphore* semaphore;
 };
 
 struct anv_event {
@@ -1739,6 +1781,8 @@
     * a signal fence, the EXEC_OBJECT_WRITE flag will be set.
     */
    struct anv_bo *bo;
+
+   anv_platform_semaphore_t platform_semaphore;
 };
 
 struct anv_semaphore {
@@ -1757,6 +1801,8 @@
     * the semaphore in the other process and imported here.
     */
    struct anv_semaphore_impl temporary;
+
+   struct anv_semaphore_impl* current;
 };
 
 struct anv_shader_module {
@@ -1765,17 +1811,23 @@
    char                                         data[0];
 };
 
+#ifdef __cplusplus
+#define ENUM_FROM_INT(type, val) static_cast<type>(val)
+#else
+#define ENUM_FROM_INT(type, val) (val)
+#endif
+
 static inline gl_shader_stage
 vk_to_mesa_shader_stage(VkShaderStageFlagBits vk_stage)
 {
    assert(__builtin_popcount(vk_stage) == 1);
-   return ffs(vk_stage) - 1;
+   return ENUM_FROM_INT(gl_shader_stage, ffs(vk_stage) - 1);
 }
 
 static inline VkShaderStageFlagBits
 mesa_to_vk_shader_stage(gl_shader_stage mesa_stage)
 {
-   return (1 << mesa_stage);
+   return ENUM_FROM_INT(VkShaderStageFlagBits, 1 << mesa_stage);
 }
 
 #define ANV_STAGE_MASK ((1 << MESA_SHADER_STAGES) - 1)
@@ -2440,4 +2492,8 @@
 #  undef genX
 #endif
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif /* ANV_PRIVATE_H */
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index 2c10e9d..f38953d 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -25,21 +25,37 @@
  * This file implements VkQueue, VkFence, and VkSemaphore
  */
 
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/eventfd.h>
-
 #include "anv_private.h"
 #include "vk_util.h"
 
 #include "genxml/gen7_pack.h"
 
+static void restore_temporary_semaphore_imports(struct anv_device* device,
+                                                struct anv_semaphore* semaphores[], uint32_t count)
+{
+   for (uint32_t i = 0; i < count; i++) {
+      if (semaphores[i]->temporary.platform_semaphore) {
+         anv_platform_destroy_semaphore(device, semaphores[i]->temporary.platform_semaphore);
+         semaphores[i]->temporary.platform_semaphore = 0;
+         semaphores[i]->current = &semaphores[i]->permanent;
+      }
+   }
+}
+
 VkResult
 anv_device_execbuf(struct anv_device *device,
                    struct drm_i915_gem_execbuffer2 *execbuf,
-                   struct anv_bo **execbuf_bos)
+                   struct anv_bo **execbuf_bos, 
+                   uint32_t wait_semaphore_count,
+                   anv_semaphore_t* wait_semaphores,
+                   uint32_t signal_semaphore_count,
+                   anv_semaphore_t* signal_semaphores)
 {
-   int ret = anv_gem_execbuffer(device, execbuf);
+   int ret = anv_gem_execbuffer(device, execbuf, wait_semaphore_count, wait_semaphores, signal_semaphore_count, signal_semaphores);
+
+   restore_temporary_semaphore_imports(device, wait_semaphores, wait_semaphore_count);
+   restore_temporary_semaphore_imports(device, signal_semaphores, signal_semaphore_count);
+
    if (ret != 0) {
       /* We don't know the real error. */
       device->lost = true;
@@ -82,7 +98,7 @@
    exec2_objects[0].offset = bo.offset;
    exec2_objects[0].flags = 0;
    exec2_objects[0].rsvd1 = 0;
-   exec2_objects[0].rsvd2 = 0;
+   exec2_objects[0].rsvd2 = bo.size;
 
    execbuf.buffers_ptr = (uintptr_t) exec2_objects;
    execbuf.buffer_count = 1;
@@ -98,7 +114,7 @@
    execbuf.rsvd1 = device->context_id;
    execbuf.rsvd2 = 0;
 
-   result = anv_device_execbuf(device, &execbuf, exec_bos);
+   result = anv_device_execbuf(device, &execbuf, exec_bos, 0, NULL, 0, NULL);
    if (result != VK_SUCCESS)
       goto fail;
 
@@ -167,16 +183,36 @@
 
          const VkSemaphore *in_semaphores = NULL, *out_semaphores = NULL;
          uint32_t num_in_semaphores = 0, num_out_semaphores = 0;
+
          if (j == 0) {
             /* Only the first batch gets the in semaphores */
             in_semaphores = pSubmits[i].pWaitSemaphores;
             num_in_semaphores = pSubmits[i].waitSemaphoreCount;
          }
 
+         VkSemaphore semaphore_array_with_fence[pSubmits[i].signalSemaphoreCount + 1];
+
          if (j == pSubmits[i].commandBufferCount - 1) {
             /* Only the last batch gets the out semaphores */
             out_semaphores = pSubmits[i].pSignalSemaphores;
             num_out_semaphores = pSubmits[i].signalSemaphoreCount;
+
+            // Fuchsia: optimize fence
+            if (fence && i == submitCount - 1) {
+               memcpy(semaphore_array_with_fence, out_semaphores,
+                      num_out_semaphores * sizeof(VkSemaphore));
+               semaphore_array_with_fence[num_out_semaphores] = anv_semaphore_to_handle(fence->semaphore);
+               num_out_semaphores++;
+               out_semaphores = semaphore_array_with_fence;
+
+               assert(fence->state == ANV_FENCE_STATE_RESET);
+               fence->state = ANV_FENCE_STATE_SUBMITTED;
+               pthread_cond_broadcast(&device->queue_submit);
+
+               // Signal that fence has been handled so we don't execute the extra command buffer
+               // below
+               fence = NULL;
+            }
          }
 
          result = anv_cmd_buffer_execbuf(device, cmd_buffer,
@@ -189,7 +225,7 @@
 
    if (fence) {
       struct anv_bo *fence_bo = &fence->bo;
-      result = anv_device_execbuf(device, &fence->execbuf, &fence_bo);
+      result = anv_device_execbuf(device, &fence->execbuf, &fence_bo, 0, NULL, 1, &fence->semaphore);
       if (result != VK_SUCCESS)
          goto out;
 
@@ -249,10 +285,20 @@
    struct anv_bo fence_bo;
    struct anv_fence *fence;
    struct anv_batch batch;
+   VkSemaphore semaphore;
    VkResult result;
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO);
 
+   VkSemaphoreCreateInfo semaphore_create_info;
+   semaphore_create_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
+   semaphore_create_info.pNext = NULL;
+   semaphore_create_info.flags = 0;
+
+   result = anv_CreateSemaphore(_device, &semaphore_create_info, pAllocator, &semaphore);
+   if (result != VK_SUCCESS)
+      return result;
+
    result = anv_bo_pool_alloc(&device->batch_bo_pool, &fence_bo, 4096);
    if (result != VK_SUCCESS)
       return result;
@@ -282,7 +328,7 @@
    fence->exec2_objects[0].offset = fence->bo.offset;
    fence->exec2_objects[0].flags = 0;
    fence->exec2_objects[0].rsvd1 = 0;
-   fence->exec2_objects[0].rsvd2 = 0;
+   fence->exec2_objects[0].rsvd2 = fence->bo.size;
 
    fence->execbuf.buffers_ptr = (uintptr_t) fence->exec2_objects;
    fence->execbuf.buffer_count = 1;
@@ -304,6 +350,8 @@
       fence->state = ANV_FENCE_STATE_RESET;
    }
 
+   fence->semaphore = (struct anv_semaphore*)semaphore;
+
    *pFence = anv_fence_to_handle(fence);
 
    return VK_SUCCESS;
@@ -321,6 +369,8 @@
       return;
 
    assert(fence->bo.map == fence);
+   anv_DestroySemaphore(_device, (VkSemaphore)fence->semaphore, pAllocator);
+
    anv_bo_pool_free(&device->batch_bo_pool, &fence->bo);
 }
 
@@ -332,6 +382,7 @@
    for (uint32_t i = 0; i < fenceCount; i++) {
       ANV_FROM_HANDLE(anv_fence, fence, pFences[i]);
       fence->state = ANV_FENCE_STATE_RESET;
+      anv_platform_reset_semaphore(fence->semaphore->current->platform_semaphore);
    }
 
    return VK_SUCCESS;
@@ -343,6 +394,8 @@
 {
    ANV_FROM_HANDLE(anv_device, device, _device);
    ANV_FROM_HANDLE(anv_fence, fence, _fence);
+   uint64_t t = 0;
+   int ret;
 
    if (unlikely(device->lost))
       return VK_ERROR_DEVICE_LOST;
@@ -357,12 +410,18 @@
       return VK_SUCCESS;
 
    case ANV_FENCE_STATE_SUBMITTED: {
-      VkResult result = anv_device_bo_busy(device, &fence->bo);
-      if (result == VK_SUCCESS) {
+      /* It's been submitted to the GPU but we don't know if it's done yet. */
+      ret = anv_platform_wait_semaphore(fence->semaphore->current->platform_semaphore, t);
+      switch (ret) {
+      case 0:
          fence->state = ANV_FENCE_STATE_SIGNALED;
          return VK_SUCCESS;
-      } else {
-         return result;
+      case -ETIME:
+         return VK_NOT_READY;
+      default:
+         /* We don't know the real error. */
+         device->lost = true;
+         return VK_ERROR_DEVICE_LOST;
       }
    }
    default:
@@ -426,20 +485,23 @@
             /* These are the fences we really care about.  Go ahead and wait
              * on it until we hit a timeout.
              */
-            result = anv_device_wait(device, &fence->bo, timeout);
-            switch (result) {
-            case VK_SUCCESS:
+            ret = anv_platform_wait_semaphore(fence->semaphore->current->platform_semaphore,
+                                              _timeout == UINT64_MAX ? UINT64_MAX
+                                                                     : _timeout / 1000000);
+            switch (ret) {
+            case 0:
                fence->state = ANV_FENCE_STATE_SIGNALED;
                signaled_fences = true;
                if (!waitAll)
                   goto done;
                break;
-
-            case VK_TIMEOUT:
+            case -ETIME:
+               result = VK_TIMEOUT;
                goto done;
-
             default:
-               return result;
+               /* We don't know the real error. */
+               device->lost = true;
+               goto done;
             }
          }
       }
@@ -523,41 +585,33 @@
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO);
 
-   semaphore = vk_alloc2(&device->alloc, pAllocator, sizeof(*semaphore), 8,
-                         VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
-   if (semaphore == NULL)
+   anv_platform_semaphore_t platform_semaphore;
+   if (anv_platform_create_semaphore(device, &platform_semaphore) != 0)
       return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
 
-   /* The DRM execbuffer ioctl always execute in-oder so long as you stay
-    * on the same ring.  Since we don't expose the blit engine as a DMA
-    * queue, a dummy no-op semaphore is a perfectly valid implementation.
+   semaphore = vk_alloc2(&device->alloc, pAllocator, sizeof(*semaphore), 8,
+                         VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+   if (semaphore == NULL) {
+      anv_platform_destroy_semaphore(device, platform_semaphore);
+      return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+   }
+
+   /* The DRM execbuffer ioctl always execute in-oder, even between
+    * different rings. As such, a dummy no-op semaphore is a perfectly
+    * valid implementation.
     */
    semaphore->permanent.type = ANV_SEMAPHORE_TYPE_DUMMY;
    semaphore->temporary.type = ANV_SEMAPHORE_TYPE_NONE;
 
+   semaphore->permanent.platform_semaphore = platform_semaphore;
+   semaphore->temporary.platform_semaphore = 0;
+   semaphore->current = &semaphore->permanent;
+
    *pSemaphore = anv_semaphore_to_handle(semaphore);
 
    return VK_SUCCESS;
 }
 
-static void
-anv_semaphore_impl_cleanup(struct anv_device *device,
-                           struct anv_semaphore_impl *impl)
-{
-   switch (impl->type) {
-   case ANV_SEMAPHORE_TYPE_NONE:
-   case ANV_SEMAPHORE_TYPE_DUMMY:
-      /* Dummy.  Nothing to do */
-      return;
-
-   case ANV_SEMAPHORE_TYPE_BO:
-      anv_bo_cache_release(device, &device->bo_cache, impl->bo);
-      return;
-   }
-
-   unreachable("Invalid semaphore type");
-}
-
 void anv_DestroySemaphore(
     VkDevice                                    _device,
     VkSemaphore                                 _semaphore,
@@ -569,8 +623,35 @@
    if (semaphore == NULL)
       return;
 
-   anv_semaphore_impl_cleanup(device, &semaphore->temporary);
-   anv_semaphore_impl_cleanup(device, &semaphore->permanent);
+   if (semaphore->temporary.platform_semaphore)
+      anv_platform_destroy_semaphore(device, semaphore->temporary.platform_semaphore);
+
+   assert(semaphore->permanent.platform_semaphore);
+   anv_platform_destroy_semaphore(device, semaphore->permanent.platform_semaphore);
 
    vk_free2(&device->alloc, pAllocator, semaphore);
 }
+
+void anv_GetPhysicalDeviceExternalSemaphorePropertiesKHR(
+    VkPhysicalDevice physicalDevice,
+    const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo,
+    VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties)
+{
+   pExternalSemaphoreProperties->sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR;
+   pExternalSemaphoreProperties->pNext = NULL;
+   pExternalSemaphoreProperties->compatibleHandleTypes = 0;
+   pExternalSemaphoreProperties->exportFromImportedHandleTypes =
+       VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR|
+       VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FUCHSIA_FENCE_BIT_KHR;
+
+   switch (pExternalSemaphoreInfo->handleType) {
+   case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR:
+   case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FUCHSIA_FENCE_BIT_KHR:
+      pExternalSemaphoreProperties->externalSemaphoreFeatures =
+          VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR |
+          VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR;
+      break;
+   default:
+      pExternalSemaphoreProperties->externalSemaphoreFeatures = 0;
+   }
+}
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 9369f26..83b94a9 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -32,6 +32,19 @@
 };
 #endif
 
+#ifdef VK_USE_PLATFORM_MAGMA_KHR
+#include "anv_wsi_magma.h"
+
+static const struct wsi_magma_callbacks wsi_magma_cbs = {
+    .get_render_connection = anv_wsi_magma_get_render_connection,
+    .destroy_surface = anv_wsi_magma_destroy_surface,
+    .create_wsi_image = anv_wsi_magma_image_create,
+    .free_wsi_image = anv_wsi_magma_image_free,
+    .get_platform_semaphore = anv_wsi_magma_get_platform_semaphore,
+    .vk_import_semaphore_fuchsia_handle_khr = anv_ImportSemaphoreFuchsiaHandleKHR,
+};
+#endif
+
 VkResult
 anv_init_wsi(struct anv_physical_device *physical_device)
 {
@@ -39,6 +52,13 @@
 
    memset(physical_device->wsi_device.wsi, 0, sizeof(physical_device->wsi_device.wsi));
 
+#ifdef VK_USE_PLATFORM_MAGMA_KHR
+   result = wsi_magma_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc,
+                               &wsi_magma_cbs);
+   if (result != VK_SUCCESS)
+      return result;
+#endif
+
 #ifdef VK_USE_PLATFORM_XCB_KHR
    result = wsi_x11_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
    if (result != VK_SUCCESS)
@@ -63,6 +83,9 @@
 void
 anv_finish_wsi(struct anv_physical_device *physical_device)
 {
+#ifdef VK_USE_PLATFORM_MAGMA_KHR
+  wsi_magma_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
+#endif
 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
    wsi_wl_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
 #endif
@@ -82,6 +105,10 @@
    if (!surface)
       return;
 
+#ifdef VK_USE_PLATFORM_MAGMA_KHR
+   wsi_magma_cbs.destroy_surface(surface);
+#endif
+
    vk_free2(&instance->alloc, pAllocator, surface);
 }
 
@@ -167,7 +194,6 @@
                                    pPresentModes);
 }
 
-
 static VkResult
 anv_wsi_image_create(VkDevice device_h,
                      const VkSwapchainCreateInfoKHR *pCreateInfo,
@@ -374,8 +400,13 @@
    ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
    ANV_FROM_HANDLE(anv_fence, fence, _fence);
 
-   VkResult result = swapchain->acquire_next_image(swapchain, timeout,
-                                                   semaphore, pImageIndex);
+#ifdef VK_USE_PLATFORM_MAGMA_KHR
+   // We don't handle fences correctly
+   if (fence)
+      printf("WARNING [%s:%d] acquire fence not supported\n", __FILE__, __LINE__);
+#endif
+
+   VkResult result = swapchain->acquire_next_image(swapchain, timeout, semaphore, pImageIndex);
 
    /* Thanks to implicit sync, the image is ready immediately. */
    if (fence)
@@ -424,7 +455,9 @@
 
       item_result = swapchain->queue_present(swapchain,
                                              pPresentInfo->pImageIndices[i],
-                                             region);
+                                             region,
+                                             pPresentInfo->waitSemaphoreCount,
+                                             pPresentInfo->pWaitSemaphores);
       /* TODO: What if one of them returns OUT_OF_DATE? */
       if (pPresentInfo->pResults != NULL)
          pPresentInfo->pResults[i] = item_result;
@@ -439,7 +472,7 @@
 
       if (last != VK_NULL_HANDLE) {
          anv_WaitForFences(anv_device_to_handle(queue->device),
-                           1, &last, true, 1);
+                           1, &last, true, UINT64_MAX);
       }
    }
 
diff --git a/src/intel/vulkan/anv_wsi_magma.cc b/src/intel/vulkan/anv_wsi_magma.cc
new file mode 100644
index 0000000..1753676
--- /dev/null
+++ b/src/intel/vulkan/anv_wsi_magma.cc
@@ -0,0 +1,150 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "anv_wsi_magma.h"
+#include "magma.h"
+#include "wsi_common_magma.h"
+#include <fcntl.h>
+
+#include "anv_private.h"
+#include "vk_format_info.h"
+
+VkBool32 anv_GetPhysicalDeviceMagmaPresentationSupportKHR(VkPhysicalDevice physicalDevice,
+                                                          uint32_t queueFamilyIndex)
+{
+   ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
+
+   return wsi_get_physical_device_magma_presentation_support(
+       &device->wsi_device, &device->instance->alloc, queueFamilyIndex);
+}
+
+VkResult anv_CreateMagmaSurfaceKHR(VkInstance _instance,
+                                   const VkMagmaSurfaceCreateInfoKHR* pCreateInfo,
+                                   const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface)
+{
+   ANV_FROM_HANDLE(anv_instance, instance, _instance);
+
+   assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_MAGMA_SURFACE_CREATE_INFO_KHR);
+   assert(pCreateInfo->imagePipeHandle == 0);
+
+   if (!pAllocator)
+      pAllocator = &instance->alloc;
+
+   auto surface = reinterpret_cast<VkIcdSurfaceMagma*>(
+       vk_alloc(pAllocator, sizeof(VkIcdSurfaceMagma), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
+   if (!surface)
+      return VK_ERROR_OUT_OF_HOST_MEMORY;
+
+   surface->base.platform = VK_ICD_WSI_PLATFORM_MAGMA;
+   surface->fd = open("/dev/class/display/000", O_RDONLY);
+
+   if (surface->fd >= 0)
+      surface->connection = magma_create_connection(surface->fd, MAGMA_CAPABILITY_DISPLAY);
+   else
+      surface->connection = nullptr;
+
+   *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
+
+   return VK_SUCCESS;
+}
+
+void* anv_wsi_magma_get_render_connection(VkDevice device)
+{
+   return anv_device_from_handle(device)->connection;
+}
+
+void anv_wsi_magma_destroy_surface(VkIcdSurfaceBase* icd_surface)
+{
+   auto surface = reinterpret_cast<VkIcdSurfaceMagma*>(icd_surface);
+   if (surface->connection)
+      magma_release_connection(reinterpret_cast<magma_connection_t*>(surface->connection));
+   if (surface->fd >= 0)
+      close(surface->fd);
+}
+
+VkResult anv_wsi_magma_image_create(VkDevice device_h, const VkSwapchainCreateInfoKHR* pCreateInfo,
+                                    const VkAllocationCallbacks* pAllocator, VkImage* image_p,
+                                    VkDeviceMemory* memory_p, uint32_t* size, uint32_t* offset,
+                                    uint32_t* row_pitch, uintptr_t* buffer_handle_p)
+{
+   struct anv_device* device = anv_device_from_handle(device_h);
+   VkImage image_h;
+   struct anv_image* image;
+   struct anv_surface* surface;
+   int ret;
+
+   VkImageCreateInfo create_info = {
+       .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
+       .imageType = VK_IMAGE_TYPE_2D,
+       .format = pCreateInfo->imageFormat,
+       .extent = {.width = pCreateInfo->imageExtent.width,
+                  .height = pCreateInfo->imageExtent.height,
+                  .depth = 1},
+       .mipLevels = 1,
+       .arrayLayers = 1,
+       .samples = VK_SAMPLE_COUNT_1_BIT,
+       .tiling = VK_IMAGE_TILING_OPTIMAL,
+       .usage = (pCreateInfo->imageUsage |
+          VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
+          VK_IMAGE_USAGE_SCANOUT_BIT_GOOGLE),
+       .flags = 0,
+   };
+
+   anv_image_create_info image_create_info = {
+       .isl_tiling_flags = 0, .stride = 0, .vk_info = &create_info};
+
+   VkResult result;
+   result = anv_image_create(anv_device_to_handle(device), &image_create_info, NULL, &image_h);
+
+   if (result != VK_SUCCESS)
+      return result;
+
+   image = anv_image_from_handle(image_h);
+   assert(vk_format_is_color(image->vk_format));
+
+   VkMemoryAllocateInfo allocate_info = {
+       .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
+       .allocationSize = image->size,
+       .memoryTypeIndex = 0,
+   };
+
+   VkDeviceMemory memory_h;
+   struct anv_device_memory* memory;
+   result = anv_AllocateMemory(anv_device_to_handle(device), &allocate_info,
+                               NULL /* XXX: pAllocator */, &memory_h);
+   if (result != VK_SUCCESS)
+      goto fail_create_image;
+
+   memory = anv_device_memory_from_handle(memory_h);
+
+   anv_BindImageMemory(VK_NULL_HANDLE, image_h, memory_h, 0);
+
+   surface = &image->color_surface;
+
+   *row_pitch = surface->isl.row_pitch;
+   *image_p = image_h;
+   *memory_p = memory_h;
+   *buffer_handle_p = image->bo->gem_handle;
+   *size = image->size;
+   *offset = image->offset;
+   return VK_SUCCESS;
+
+fail_create_image:
+   anv_DestroyImage(device_h, image_h, pAllocator);
+   return result;
+}
+
+void anv_wsi_magma_image_free(VkDevice device, const VkAllocationCallbacks* pAllocator,
+                              VkImage image_h, VkDeviceMemory memory_h)
+{
+   anv_DestroyImage(device, image_h, pAllocator);
+
+   anv_FreeMemory(device, memory_h, pAllocator);
+}
+
+uintptr_t anv_wsi_magma_get_platform_semaphore(VkSemaphore vk_semaphore)
+{
+   ANV_FROM_HANDLE(anv_semaphore, semaphore, vk_semaphore);
+   return semaphore->current->platform_semaphore;
+}
diff --git a/src/intel/vulkan/anv_wsi_magma.h b/src/intel/vulkan/anv_wsi_magma.h
new file mode 100644
index 0000000..b0e4a35
--- /dev/null
+++ b/src/intel/vulkan/anv_wsi_magma.h
@@ -0,0 +1,32 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANV_WSI_MAGMA_H
+#define ANV_WSI_MAGMA_H
+
+#include "anv_private.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* anv_wsi_magma_get_render_connection(VkDevice device);
+
+void anv_wsi_magma_destroy_surface(VkIcdSurfaceBase* icd_surface);
+
+VkResult anv_wsi_magma_image_create(VkDevice device_h, const VkSwapchainCreateInfoKHR* pCreateInfo,
+                                    const VkAllocationCallbacks* pAllocator, VkImage* image_p,
+                                    VkDeviceMemory* memory_p, uint32_t* size, uint32_t* offset,
+                                    uint32_t* row_pitch, uintptr_t* buffer_handle_p);
+
+void anv_wsi_magma_image_free(VkDevice device, const VkAllocationCallbacks* pAllocator,
+                              VkImage image_h, VkDeviceMemory memory_h);
+
+uintptr_t anv_wsi_magma_get_platform_semaphore(VkSemaphore semaphore);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANV_WSI_MAGMA_H
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index fd5e4ef..f342717 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -935,7 +935,9 @@
                                 .aux_surf = &iview->image->aux_surface.isl,
                                 .aux_usage = state->attachments[i].aux_usage,
                                 .clear_color = clear_color,
-                                .mocs = cmd_buffer->device->default_mocs);
+                                .mocs = (iview->image->usage & VK_IMAGE_USAGE_SCANOUT_BIT_GOOGLE)
+                                       ? cmd_buffer->device->uncached_mocs
+                                       : cmd_buffer->device->default_mocs);
 
             add_image_relocs(cmd_buffer, iview->image, iview->aspect_mask,
                              state->attachments[i].aux_usage,
diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c
index 5102412..52e4b48 100644
--- a/src/intel/vulkan/genX_query.c
+++ b/src/intel/vulkan/genX_query.c
@@ -128,7 +128,7 @@
    if (!pool)
       return;
 
-   anv_gem_munmap(pool->bo.map, pool->bo.size);
+   anv_gem_munmap(device, pool->bo.gem_handle, pool->bo.map, pool->bo.size);
    anv_gem_close(device, pool->bo.gem_handle);
    vk_free2(&device->alloc, pAllocator, pool);
 }
diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index 3e65832..8e93195 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -38,6 +38,7 @@
 {
    GENX(MEMORY_OBJECT_CONTROL_STATE_pack)(NULL, &device->default_mocs,
                                           &GENX(MOCS));
+   device->uncached_mocs = 0;
 
    struct anv_batch batch;
 
diff --git a/src/intel/vulkan/tests/BUILD.gn b/src/intel/vulkan/tests/BUILD.gn
new file mode 100644
index 0000000..28eff20
--- /dev/null
+++ b/src/intel/vulkan/tests/BUILD.gn
@@ -0,0 +1,114 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+group("tests") {
+  public_deps = [
+    ":block_pool_no_free",
+    ":state_pool",
+    ":state_pool_free_list_only",
+    ":state_pool_no_free",
+    ":test_wsi_magma",
+  ]
+}
+
+executable("block_pool_no_free") {
+  sources = [
+    "block_pool_no_free.c",
+  ]
+
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  deps = [
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/tests/mock:magma_system",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/include:vulkan",
+    "..:vulkan_internal",
+  ]
+}
+
+executable("state_pool") {
+  sources = [
+    "state_pool.c",
+  ]
+
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  deps = [
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/tests/mock:magma_system",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/include:vulkan",
+    "..:vulkan_internal",
+  ]
+}
+
+executable("state_pool_free_list_only") {
+  sources = [
+    "state_pool_free_list_only.c",
+  ]
+
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  deps = [
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/tests/mock:magma_system",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/include:vulkan",
+    "..:vulkan_internal",
+  ]
+}
+
+executable("state_pool_no_free") {
+  sources = [
+    "state_pool_no_free.c",
+  ]
+
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  deps = [
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/tests/mock:magma_system",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/include:vulkan",
+    "..:vulkan_internal",
+  ]
+}
+
+executable("test_wsi_magma") {
+  sources = [
+    "test_wsi_magma.cc",
+  ]
+
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  deps = [
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/src/magma_util",
+    "$magma_build_root/tests/mock:magma_system",
+    "$magma_build_root/tests/vulkan_shim",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/include:vulkan",
+    "..:vulkan_internal",
+  ]
+}
diff --git a/src/intel/vulkan/tests/block_pool_no_free.c b/src/intel/vulkan/tests/block_pool_no_free.c
index 4ddbbb2..9d2d111 100644
--- a/src/intel/vulkan/tests/block_pool_no_free.c
+++ b/src/intel/vulkan/tests/block_pool_no_free.c
@@ -115,6 +115,8 @@
    };
    struct anv_block_pool pool;
 
+   assert(anv_gem_connect(&device) == 0);
+
    pthread_mutex_init(&device.mutex, NULL);
    anv_block_pool_init(&pool, &device, 4096);
 
@@ -140,6 +142,8 @@
 
    anv_block_pool_finish(&pool);
    pthread_mutex_destroy(&device.mutex);
+
+   anv_gem_disconnect(&device);
 }
 
 int main(int argc, char **argv)
diff --git a/src/intel/vulkan/tests/state_pool.c b/src/intel/vulkan/tests/state_pool.c
index 249fe64..1b2abf5 100644
--- a/src/intel/vulkan/tests/state_pool.c
+++ b/src/intel/vulkan/tests/state_pool.c
@@ -40,6 +40,7 @@
    };
    struct anv_state_pool state_pool;
 
+   assert(anv_gem_connect(&device) == 0);
    pthread_mutex_init(&device.mutex, NULL);
 
    for (unsigned i = 0; i < NUM_RUNS; i++) {
@@ -54,4 +55,5 @@
    }
 
    pthread_mutex_destroy(&device.mutex);
+   anv_gem_disconnect(&device);
 }
diff --git a/src/intel/vulkan/tests/state_pool_free_list_only.c b/src/intel/vulkan/tests/state_pool_free_list_only.c
index 6a04d64..c65466e 100644
--- a/src/intel/vulkan/tests/state_pool_free_list_only.c
+++ b/src/intel/vulkan/tests/state_pool_free_list_only.c
@@ -39,6 +39,8 @@
    };
    struct anv_state_pool state_pool;
 
+   assert(anv_gem_connect(&device) == 0);
+
    pthread_mutex_init(&device.mutex, NULL);
    anv_state_pool_init(&state_pool, &device, 4096);
 
@@ -49,7 +51,7 @@
     * actually ever resize anything.
     */
    {
-      struct anv_state states[NUM_THREADS * STATES_PER_THREAD];
+      struct anv_state* states = malloc(sizeof(struct anv_state) * NUM_THREADS * STATES_PER_THREAD);
       for (unsigned i = 0; i < NUM_THREADS * STATES_PER_THREAD; i++) {
          states[i] = anv_state_pool_alloc(&state_pool, 16, 16);
          assert(states[i].offset != 0);
@@ -57,10 +59,14 @@
 
       for (unsigned i = 0; i < NUM_THREADS * STATES_PER_THREAD; i++)
          anv_state_pool_free(&state_pool, states[i]);
+
+      free(states);
    }
 
    run_state_pool_test(&state_pool);
 
    anv_state_pool_finish(&state_pool);
    pthread_mutex_destroy(&device.mutex);
+
+   anv_gem_disconnect(&device);
 }
diff --git a/src/intel/vulkan/tests/state_pool_no_free.c b/src/intel/vulkan/tests/state_pool_no_free.c
index 1ba832c..f9652bf 100644
--- a/src/intel/vulkan/tests/state_pool_no_free.c
+++ b/src/intel/vulkan/tests/state_pool_no_free.c
@@ -60,6 +60,8 @@
    };
    struct anv_state_pool state_pool;
 
+   assert(anv_gem_connect(&device) == 0);
+
    pthread_mutex_init(&device.mutex, NULL);
    anv_state_pool_init(&state_pool, &device, 64);
 
@@ -108,6 +110,8 @@
 
    anv_state_pool_finish(&state_pool);
    pthread_mutex_destroy(&device.mutex);
+
+   anv_gem_disconnect(&device);
 }
 
 int main(int argc, char **argv)
diff --git a/src/intel/vulkan/tests/test_wsi_magma.cc b/src/intel/vulkan/tests/test_wsi_magma.cc
new file mode 100644
index 0000000..9468e08
--- /dev/null
+++ b/src/intel/vulkan/tests/test_wsi_magma.cc
@@ -0,0 +1,321 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <vector>
+
+#include "magma.h"
+#include "magma_util/macros.h"
+#include "vulkan_shim.h"
+
+class TestWsiMagma {
+public:
+   ~TestWsiMagma();
+
+   bool Init();
+   bool Run(uint32_t frame_count);
+
+private:
+   VkInstance instance_;
+   VkDevice device_;
+   VkSurfaceKHR surface_;
+   VkExtent2D extent_;
+   VkSwapchainKHR swapchain_ = VK_NULL_HANDLE;
+   VkQueue queue_;
+
+   PFN_vkGetPhysicalDeviceSurfaceSupportKHR fpGetPhysicalDeviceSurfaceSupportKHR_;
+   PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR fpGetPhysicalDeviceSurfaceCapabilitiesKHR_;
+   PFN_vkGetPhysicalDeviceSurfaceFormatsKHR fpGetPhysicalDeviceSurfaceFormatsKHR_;
+   PFN_vkGetPhysicalDeviceSurfacePresentModesKHR fpGetPhysicalDeviceSurfacePresentModesKHR_;
+   PFN_vkCreateSwapchainKHR fpCreateSwapchainKHR_;
+   PFN_vkDestroySwapchainKHR fpDestroySwapchainKHR_;
+   PFN_vkGetSwapchainImagesKHR fpGetSwapchainImagesKHR_;
+   PFN_vkAcquireNextImageKHR fpAcquireNextImageKHR_;
+   PFN_vkQueuePresentKHR fpQueuePresentKHR_;
+};
+
+bool operator==(VkExtent2D& a, VkExtent2D b) { return a.width == b.width && a.height == b.height; }
+
+bool TestWsiMagma::Init()
+{
+   // Enumerate and create a device - use the anv_magma_stubs though
+   VkInstanceCreateInfo create_info{
+       VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // VkStructureType             sType;
+       nullptr,                                // const void*                 pNext;
+       0,                                      // VkInstanceCreateFlags       flags;
+       nullptr,                                // const VkApplicationInfo*    pApplicationInfo;
+       0,                                      // uint32_t                    enabledLayerCount;
+       nullptr,                                // const char* const*          ppEnabledLayerNames;
+       0,                                      // uint32_t                    enabledExtensionCount;
+       nullptr, // const char* const*          ppEnabledExtensionNames;
+   };
+
+   VkResult result;
+
+   result = vkCreateInstance(&create_info, nullptr /*allocation_callbacks*/, &instance_);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "vkCreateInstance failed %d", result);
+
+   fpGetPhysicalDeviceSurfaceSupportKHR_ =
+       reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceSupportKHR>(
+           vkGetInstanceProcAddr(instance_, "vkGetPhysicalDeviceSurfaceSupportKHR"));
+   assert(fpGetPhysicalDeviceSurfaceSupportKHR_);
+   fpGetPhysicalDeviceSurfaceCapabilitiesKHR_ =
+       reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(
+           vkGetInstanceProcAddr(instance_, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"));
+   assert(fpGetPhysicalDeviceSurfaceCapabilitiesKHR_);
+   fpGetPhysicalDeviceSurfaceFormatsKHR_ =
+       reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(
+           vkGetInstanceProcAddr(instance_, "vkGetPhysicalDeviceSurfaceFormatsKHR"));
+   assert(fpGetPhysicalDeviceSurfaceFormatsKHR_);
+   fpGetPhysicalDeviceSurfacePresentModesKHR_ =
+       reinterpret_cast<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR>(
+           vkGetInstanceProcAddr(instance_, "vkGetPhysicalDeviceSurfacePresentModesKHR"));
+   assert(fpGetPhysicalDeviceSurfacePresentModesKHR_);
+   fpCreateSwapchainKHR_ = reinterpret_cast<PFN_vkCreateSwapchainKHR>(
+       vkGetInstanceProcAddr(instance_, "vkCreateSwapchainKHR"));
+   assert(fpCreateSwapchainKHR_);
+   fpDestroySwapchainKHR_ = reinterpret_cast<PFN_vkDestroySwapchainKHR>(
+       vkGetInstanceProcAddr(instance_, "vkDestroySwapchainKHR"));
+   assert(fpDestroySwapchainKHR_);
+   fpGetSwapchainImagesKHR_ = reinterpret_cast<PFN_vkGetSwapchainImagesKHR>(
+       vkGetInstanceProcAddr(instance_, "vkGetSwapchainImagesKHR"));
+   assert(fpGetSwapchainImagesKHR_);
+   fpAcquireNextImageKHR_ = reinterpret_cast<PFN_vkAcquireNextImageKHR>(
+       vkGetInstanceProcAddr(instance_, "vkAcquireNextImageKHR"));
+   assert(fpAcquireNextImageKHR_);
+   fpQueuePresentKHR_ = reinterpret_cast<PFN_vkQueuePresentKHR>(
+       vkGetInstanceProcAddr(instance_, "vkQueuePresentKHR"));
+   assert(fpQueuePresentKHR_);
+
+   uint32_t physical_device_count;
+   result = vkEnumeratePhysicalDevices(instance_, &physical_device_count, nullptr);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "vkEnumeratePhysicalDevices failed %d", result);
+
+   if (physical_device_count < 1)
+      return DRETF(false, "unexpected physical_device_count %d", physical_device_count);
+
+   std::vector<VkPhysicalDevice> physical_devices(physical_device_count);
+   if ((result = vkEnumeratePhysicalDevices(instance_, &physical_device_count,
+                                            physical_devices.data())) != VK_SUCCESS)
+      return DRETF(false, "vkEnumeratePhysicalDevices failed %d", result);
+
+   uint32_t queue_family_count;
+   vkGetPhysicalDeviceQueueFamilyProperties(physical_devices[0], &queue_family_count, nullptr);
+
+   if (queue_family_count < 1)
+      return DRETF(false, "invalid queue_family_count %d", queue_family_count);
+
+   std::vector<VkQueueFamilyProperties> queue_family_properties(queue_family_count);
+   vkGetPhysicalDeviceQueueFamilyProperties(physical_devices[0], &queue_family_count,
+                                            queue_family_properties.data());
+
+   VkMagmaSurfaceCreateInfoKHR createInfo = {
+       .sType = VK_STRUCTURE_TYPE_MAGMA_SURFACE_CREATE_INFO_KHR, .pNext = nullptr,
+   };
+
+   result = vkCreateMagmaSurfaceKHR(instance_, &createInfo, nullptr, &surface_);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "vkCreateMagmaSurfaceKHR failed: %d", result);
+
+   uint32_t queue_family_index = UINT32_MAX;
+
+   for (uint32_t i = 0; i < queue_family_count; i++) {
+      VkBool32 supports_present;
+      fpGetPhysicalDeviceSurfaceSupportKHR_(physical_devices[0], i, surface_, &supports_present);
+      if (supports_present)
+         queue_family_index = i;
+   }
+
+   if (queue_family_index == UINT32_MAX)
+      return DRETF(false, "couldn't find a queue supporting present");
+
+   uint32_t formatCount;
+   result =
+       fpGetPhysicalDeviceSurfaceFormatsKHR_(physical_devices[0], surface_, &formatCount, nullptr);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "fpGetPhysicalDeviceSurfaceFormatsKHR failed %d", result);
+
+   std::vector<VkSurfaceFormatKHR> surfFormats(formatCount);
+   result = fpGetPhysicalDeviceSurfaceFormatsKHR_(physical_devices[0], surface_, &formatCount,
+                                                  surfFormats.data());
+   if (result != VK_SUCCESS)
+      return DRETF(false, "fpGetPhysicalDeviceSurfaceFormatsKHR failed %d", result);
+
+   if (surfFormats.size() != 1)
+      return DRETF(false, "unexpected number of surface formats %zd", surfFormats.size());
+
+   if (surfFormats[0].format != VK_FORMAT_B8G8R8A8_UNORM)
+      return DRETF(false, "unexpected surface format 0x%x", surfFormats[0].format);
+
+   uint32_t presentModeCount;
+   result = fpGetPhysicalDeviceSurfacePresentModesKHR_(physical_devices[0], surface_,
+                                                       &presentModeCount, nullptr);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "fpGetPhysicalDeviceSurfacePresentModesKHR failed %d", result);
+
+   std::vector<VkPresentModeKHR> presentModes(presentModeCount);
+   result = fpGetPhysicalDeviceSurfacePresentModesKHR_(physical_devices[0], surface_,
+                                                       &presentModeCount, presentModes.data());
+   if (result != VK_SUCCESS)
+      return DRETF(false, "fpGetPhysicalDeviceSurfacePresentModesKHR failed %d", result);
+
+   if (presentModes.size() != 1)
+      return DRETF(false, "unexpected number of present modes %zd", presentModes.size());
+
+   if (presentModes[0] != VK_PRESENT_MODE_FIFO_KHR)
+      return DRETF(false, "unexpected present mode 0x%x", presentModes[0]);
+
+   VkSurfaceCapabilitiesKHR surf_caps;
+   result = fpGetPhysicalDeviceSurfaceCapabilitiesKHR_(physical_devices[0], surface_, &surf_caps);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "fpGetPhysicalDeviceSurfaceCapabilitiesKHR_ failed %d", result);
+
+   if (surf_caps.currentExtent == VkExtent2D{0, 0})
+      return DRETF(false, "unexpected extent");
+
+   if (!(surf_caps.currentExtent == VkExtent2D{UINT32_MAX, UINT32_MAX}))
+      return DRETF(false, "unexpected extent");
+
+   if (!(surf_caps.minImageExtent == VkExtent2D{1,1}))
+      return DRETF(false, "unexpected minImageExtent");
+
+   if (!(surf_caps.maxImageExtent == VkExtent2D{UINT32_MAX, UINT32_MAX}))
+      return DRETF(false, "unexpected maxImageExtent");
+
+   extent_ = VkExtent2D{1024,768};
+
+   if (surf_caps.supportedCompositeAlpha !=
+       (VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR | VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR))
+      return DRETF(false, "unexpected supportedCompositeAlpha 0x%x",
+                   surf_caps.supportedCompositeAlpha);
+
+   if (surf_caps.minImageCount != 2)
+      return DRETF(false, "unexpected minImageCount %d", surf_caps.minImageCount);
+
+   if (surf_caps.maxImageCount != 3)
+      return DRETF(false, "unexpected minImageCount %d", surf_caps.maxImageCount);
+
+   if (surf_caps.supportedTransforms != VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
+      return DRETF(false, "unexpected supportedTransforms 0x%x", surf_caps.supportedTransforms);
+
+   if (surf_caps.maxImageArrayLayers != 1)
+      return DRETF(false, "unexpected maxImageArrayLayers 0x%x", surf_caps.maxImageArrayLayers);
+
+   if (surf_caps.supportedUsageFlags !=
+       (VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
+        VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT))
+      return DRETF(false, "unexpected supportedUsageFlags 0x%x", surf_caps.supportedUsageFlags);
+
+   // Create the device.
+
+   float queue_priorities[1] = {0.0};
+
+   VkDeviceQueueCreateInfo queue_create_info = {.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
+                                                .pNext = nullptr,
+                                                .flags = 0,
+                                                .queueFamilyIndex = queue_family_index,
+                                                .queueCount = 1,
+                                                .pQueuePriorities = queue_priorities};
+   VkDeviceCreateInfo device_create_info = {.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
+                                            .pNext = nullptr,
+                                            .flags = 0,
+                                            .queueCreateInfoCount = 1,
+                                            .pQueueCreateInfos = &queue_create_info,
+                                            .enabledLayerCount = 0,
+                                            .ppEnabledLayerNames = nullptr,
+                                            .enabledExtensionCount = 0,
+                                            .ppEnabledExtensionNames = nullptr,
+                                            .pEnabledFeatures = nullptr};
+
+   result = vkCreateDevice(physical_devices[0], &device_create_info,
+                           nullptr /* allocationcallbacks */, &device_);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "vkCreateDevice failed: %d", result);
+
+   vkGetDeviceQueue(device_, queue_family_index, 0, &queue_);
+
+   VkSwapchainCreateInfoKHR swapchain_create_info = {
+       .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
+       .pNext = nullptr,
+       .surface = surface_,
+       .minImageCount = 2,
+       .imageFormat = VK_FORMAT_B8G8R8A8_UNORM,
+       .imageColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR, // the only supported value?
+       .imageExtent = extent_,
+       .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
+       .preTransform = surf_caps.currentTransform,
+       .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
+       .imageArrayLayers = 1,
+       .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
+       .queueFamilyIndexCount = 0,
+       .pQueueFamilyIndices = NULL,
+       .presentMode = presentModes[0],
+       .oldSwapchain = VK_NULL_HANDLE,
+       .clipped = true,
+   };
+
+   result = fpCreateSwapchainKHR_(device_, &swapchain_create_info, nullptr, &swapchain_);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "fpCreateSwapchainKHR failed: %d", result);
+
+   return true;
+}
+
+bool TestWsiMagma::Run(uint32_t frame_count)
+{
+   uint32_t image_count;
+
+   VkResult result = fpGetSwapchainImagesKHR_(device_, swapchain_, &image_count, nullptr);
+   if (result != VK_SUCCESS)
+      return DRETF(false, "fpGetSwapchainImagesKHR failed: %d", result);
+
+   std::vector<VkImage> images(image_count);
+
+   result = fpGetSwapchainImagesKHR_(device_, swapchain_, &image_count, images.data());
+   if (result != VK_SUCCESS)
+      return DRETF(false, "fpGetSwapchainImagesKHR failed: %d", result);
+
+   uint32_t image_index;
+
+   for (uint32_t frame = 0; frame < frame_count; frame++) {
+      result = fpAcquireNextImageKHR_(device_, swapchain_, 0, VK_NULL_HANDLE, VK_NULL_HANDLE,
+                                      &image_index);
+      if (result != VK_SUCCESS)
+         return DRETF(false, "fpAcquireNextImageKHR_ failed: %d", result);
+
+      VkPresentInfoKHR present = {
+          .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
+          .pNext = nullptr,
+          .waitSemaphoreCount = 0,
+          .pWaitSemaphores = nullptr,
+          .swapchainCount = 1,
+          .pSwapchains = &swapchain_,
+          .pImageIndices = &image_index,
+      };
+
+      result = fpQueuePresentKHR_(queue_, &present);
+      if (result != VK_SUCCESS)
+         return DRETF(false, "fpQueuePresentKHR_ failed (image index %u): %d", image_index, result);
+   }
+
+   return true;
+}
+
+TestWsiMagma::~TestWsiMagma()
+{
+   if (swapchain_ != VK_NULL_HANDLE)
+      fpDestroySwapchainKHR_(device_, swapchain_, nullptr);
+}
+
+int main(int argc, char** argv)
+{
+   VulkanShimInit();
+
+   TestWsiMagma test;
+   if (!test.Init())
+      return -1;
+   if (!test.Run(100))
+      return 0;
+}
diff --git a/src/loader/BUILD.gn b/src/loader/BUILD.gn
new file mode 100644
index 0000000..46fa7ea
--- /dev/null
+++ b/src/loader/BUILD.gn
@@ -0,0 +1,44 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("loader_config") {
+  include_dirs = [ "$mesa_build_root/src/loader" ]
+}
+
+source_set("loader") {
+  public_configs = [
+    ":loader_config",
+    "$mesa_build_root/src:common_config",
+  ]
+
+  sources = [
+    "loader.c",
+    "loader.h",
+    "pci_id_driver_map.c",
+    "pci_id_driver_map.h",
+  ]
+
+  deps = [
+    "$mesa_build_root/include:pci_ids",
+  ]
+}
diff --git a/src/magma/BUILD.gn b/src/magma/BUILD.gn
new file mode 100644
index 0000000..69f519f
--- /dev/null
+++ b/src/magma/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("magma_config") {
+  include_dirs = [
+    ".",
+    "$magma_build_root/third_party/libdrm",
+  ]
+}
+
+source_set("magma") {
+  public_configs = [ ":magma_config" ]
+
+  sources = [
+    "drm_command_buffer.cc",
+    "drm_command_buffer.h",
+  ]
+
+  deps = [
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/src/magma_util",
+  ]
+}
diff --git a/src/magma/drm_command_buffer.cc b/src/magma/drm_command_buffer.cc
new file mode 100644
index 0000000..fe4985d
--- /dev/null
+++ b/src/magma/drm_command_buffer.cc
@@ -0,0 +1,104 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "drm_command_buffer.h"
+#include "magma.h"
+#include "magma_util/dlog.h"
+#include "magma_util/macros.h"
+
+uint64_t DrmCommandBuffer::RequiredSize(drm_i915_gem_execbuffer2* execbuf,
+                                        uint32_t wait_semaphore_count,
+                                        uint32_t signal_semaphore_count)
+{
+   auto execobjects = reinterpret_cast<drm_i915_gem_exec_object2*>(execbuf->buffers_ptr);
+
+   const uint32_t num_resources = execbuf->buffer_count;
+
+   uint32_t num_relocations = 0;
+   for (uint32_t res_index = 0; res_index < num_resources; res_index++) {
+      num_relocations += execobjects[res_index].relocation_count;
+   }
+
+   return sizeof(magma_system_command_buffer) +
+          (wait_semaphore_count + signal_semaphore_count) * sizeof(uint64_t) +
+          sizeof(magma_system_exec_resource) * num_resources +
+          sizeof(magma_system_relocation_entry) * num_relocations;
+}
+
+bool DrmCommandBuffer::Translate(drm_i915_gem_execbuffer2* execbuf,
+                                 std::vector<uint64_t> wait_semaphore_ids,
+                                 std::vector<uint64_t> signal_semaphore_ids,
+                                 void* command_buffer_out)
+{
+   DASSERT((execbuf->flags & I915_EXEC_HANDLE_LUT) != 0);
+
+   auto execobjects = reinterpret_cast<drm_i915_gem_exec_object2*>(execbuf->buffers_ptr);
+   const uint32_t num_resources = execbuf->buffer_count;
+
+   magma_system_command_buffer* command_buffer =
+       reinterpret_cast<magma_system_command_buffer*>(command_buffer_out);
+   uint64_t* dst_wait_semaphore_ids = reinterpret_cast<uint64_t*>(command_buffer + 1);
+   uint64_t* dst_signal_semaphore_ids =
+       reinterpret_cast<uint64_t*>(dst_wait_semaphore_ids + wait_semaphore_ids.size());
+   magma_system_exec_resource* exec_resources = reinterpret_cast<magma_system_exec_resource*>(
+       dst_signal_semaphore_ids + signal_semaphore_ids.size());
+   magma_system_relocation_entry* relocation_entries =
+       reinterpret_cast<magma_system_relocation_entry*>(exec_resources + num_resources);
+
+   for (uint32_t i = 0; i < wait_semaphore_ids.size(); i++) {
+      dst_wait_semaphore_ids[i] = wait_semaphore_ids[i];
+   }
+   for (uint32_t i = 0; i < signal_semaphore_ids.size(); i++) {
+      dst_signal_semaphore_ids[i] = signal_semaphore_ids[i];
+   }
+
+   uint32_t res_reloc_base = 0;
+
+   for (uint32_t res_index = 0; res_index < num_resources; res_index++) {
+      auto dst_res = &exec_resources[res_index];
+      auto src_res = &execobjects[res_index];
+      auto src_res_relocs = reinterpret_cast<drm_i915_gem_relocation_entry*>(src_res->relocs_ptr);
+
+      DLOG("translating res_index %u handle 0x%" PRIx64 " start_offset 0x%" PRIx64
+           " length 0x%" PRIx64,
+           res_index, src_res->handle, src_res->rsvd1, src_res->rsvd2);
+
+      uint32_t num_relocations = dst_res->num_relocations = src_res->relocation_count;
+
+      auto relocations = &relocation_entries[res_reloc_base];
+      dst_res->buffer_id = magma_get_buffer_id(src_res->handle);
+      dst_res->offset = src_res->rsvd1;
+      dst_res->length = src_res->rsvd2;
+
+      for (uint32_t reloc_index = 0; reloc_index < dst_res->num_relocations; reloc_index++) {
+         auto dst_reloc = &relocations[reloc_index];
+         auto src_reloc = &src_res_relocs[reloc_index];
+
+         DLOG("translating reloc_index %u: target_handle 0x%x", reloc_index,
+              src_reloc->target_handle);
+
+         // anvil sends indices for target_handles
+         uint32_t target_index = src_reloc->target_handle;
+         if (target_index >= num_resources)
+            return DRETF(false, "invalid target index %u", src_reloc->target_handle);
+
+         dst_reloc->offset = src_reloc->offset; // offset in the batch buffer;
+         dst_reloc->target_resource_index = src_reloc->target_handle;
+         dst_reloc->target_offset = src_reloc->delta; // offset in the target buffer
+         dst_reloc->read_domains_bitfield =
+             src_reloc->read_domains; // memory domains in which the target is readable
+         dst_reloc->write_domains_bitfield = src_reloc->write_domain; // memory
+      }
+
+      res_reloc_base += num_relocations;
+   }
+
+   command_buffer->num_resources = num_resources;
+   command_buffer->batch_buffer_resource_index = num_resources - 1; // by drm convention
+   command_buffer->batch_start_offset = execbuf->batch_start_offset;
+   command_buffer->wait_semaphore_count = wait_semaphore_ids.size();
+   command_buffer->signal_semaphore_count = signal_semaphore_ids.size();
+
+   return true;
+}
diff --git a/src/magma/drm_command_buffer.h b/src/magma/drm_command_buffer.h
new file mode 100644
index 0000000..e0e1823
--- /dev/null
+++ b/src/magma/drm_command_buffer.h
@@ -0,0 +1,30 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DRM_COMMAND_BUFFER_H
+#define DRM_COMMAND_BUFFER_H
+
+#include "i915_drm.h"
+#include <vector>
+
+class DrmCommandBuffer {
+public:
+   // Returns the number of bytes needed for the magma_system_command_buffer
+   // and the associated data structures for |execbuf| with |wait_semaphore_count| +
+   // |signal_semaphore_count| semaphores.
+   static uint64_t RequiredSize(drm_i915_gem_execbuffer2* execbuf, uint32_t wait_semaphore_count,
+                                uint32_t signal_semaphore_count);
+
+   // Writes the magma_system_command_buffer and associated data structures
+   // into |command_buffer_out|. |command_buffer_out| must point to a buffer
+   // that is sufficiently large, see RequiredSize.
+   static bool Translate(drm_i915_gem_execbuffer2* execbuf,
+                         std::vector<uint64_t> wait_semaphore_ids,
+                         std::vector<uint64_t> signal_semaphore_ids, void* command_buffer_out);
+
+private:
+   DrmCommandBuffer() {}
+};
+
+#endif // DRM_COMMAND_BUFFER_H
diff --git a/src/mapi/BUILD.gn b/src/mapi/BUILD.gn
new file mode 100644
index 0000000..e61d107
--- /dev/null
+++ b/src/mapi/BUILD.gn
@@ -0,0 +1,47 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+source_set("mapi") {
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  include_dirs = [
+    ".",
+    "..",
+  ]
+
+  defines = [ "MAPI_MODE_UTIL" ]
+
+  sources = [
+    "table.c",
+    "table.h",
+    "u_current.c",
+    "u_current.h",
+    "u_execmem.c",
+    "u_execmem.h",
+  ]
+
+  deps = [
+    "$mesa_build_root/include:c_compat",
+    "glapi",
+  ]
+}
diff --git a/src/mapi/glapi/BUILD.gn b/src/mapi/glapi/BUILD.gn
new file mode 100644
index 0000000..7f5a7e3
--- /dev/null
+++ b/src/mapi/glapi/BUILD.gn
@@ -0,0 +1,50 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+source_set("glapi") {
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  include_dirs = [
+    ".",
+    "..",
+    "../../",
+  ]
+
+  sources = [
+    "glapi.c",
+    "glapi.h",
+    "glapi_dispatch.c",
+    "glapi_entrypoint.c",
+    "glapi_getproc.c",
+    "glapi_nop.c",
+    "glapi_priv.h",
+  ]
+
+  public_deps = [
+    "gen",
+  ]
+
+  deps = [
+    "$mesa_build_root/include:c_compat",
+  ]
+}
diff --git a/src/mapi/glapi/gen/BUILD.gn b/src/mapi/glapi/gen/BUILD.gn
new file mode 100644
index 0000000..887d781
--- /dev/null
+++ b/src/mapi/glapi/gen/BUILD.gn
@@ -0,0 +1,516 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+source_set("api_xml") {
+  sources = [
+    "AMD_draw_buffers_blend.xml",
+    "AMD_performance_monitor.xml",
+    "APPLE_object_purgeable.xml",
+    "APPLE_vertex_array_object.xml",
+    "ARB_ES2_compatibility.xml",
+    "ARB_ES3_compatibility.xml",
+    "ARB_base_instance.xml",
+    "ARB_blend_func_extended.xml",
+    "ARB_clear_buffer_object.xml",
+    "ARB_clear_texture.xml",
+    "ARB_clip_control.xml",
+    "ARB_color_buffer_float.xml",
+    "ARB_compressed_texture_pixel_storage.xml",
+    "ARB_compute_shader.xml",
+    "ARB_copy_buffer.xml",
+    "ARB_copy_image.xml",
+    "ARB_debug_output.xml",
+    "ARB_depth_buffer_float.xml",
+    "ARB_depth_clamp.xml",
+    "ARB_direct_state_access.xml",
+    "ARB_draw_buffers.xml",
+    "ARB_draw_buffers_blend.xml",
+    "ARB_draw_elements_base_vertex.xml",
+    "ARB_draw_indirect.xml",
+    "ARB_draw_instanced.xml",
+    "ARB_framebuffer_no_attachments.xml",
+    "ARB_framebuffer_object.xml",
+    "ARB_get_program_binary.xml",
+    "ARB_get_texture_sub_image.xml",
+    "ARB_gpu_shader5.xml",
+    "ARB_gpu_shader_fp64.xml",
+    "ARB_indirect_parameters.xml",
+    "ARB_instanced_arrays.xml",
+    "ARB_internalformat_query.xml",
+    "ARB_invalidate_subdata.xml",
+    "ARB_map_buffer_range.xml",
+    "ARB_multi_bind.xml",
+    "ARB_pipeline_statistics_query.xml",
+    "ARB_program_interface_query.xml",
+    "ARB_robustness.xml",
+    "ARB_sample_shading.xml",
+    "ARB_sampler_objects.xml",
+    "ARB_seamless_cube_map.xml",
+    "ARB_separate_shader_objects.xml",
+    "ARB_shader_atomic_counters.xml",
+    "ARB_shader_image_load_store.xml",
+    "ARB_shader_storage_buffer_object.xml",
+    "ARB_shader_subroutine.xml",
+    "ARB_sync.xml",
+    "ARB_tessellation_shader.xml",
+    "ARB_texture_barrier.xml",
+    "ARB_texture_buffer_object.xml",
+    "ARB_texture_buffer_range.xml",
+    "ARB_texture_compression_rgtc.xml",
+    "ARB_texture_cube_map_array.xml",
+    "ARB_texture_float.xml",
+    "ARB_texture_gather.xml",
+    "ARB_texture_multisample.xml",
+    "ARB_texture_rg.xml",
+    "ARB_texture_rgb10_a2ui.xml",
+    "ARB_texture_storage.xml",
+    "ARB_texture_storage_multisample.xml",
+    "ARB_texture_view.xml",
+    "ARB_uniform_buffer_object.xml",
+    "ARB_vertex_array_object.xml",
+    "ARB_vertex_attrib_64bit.xml",
+    "ARB_vertex_attrib_binding.xml",
+    "ARB_vertex_type_2_10_10_10_rev.xml",
+    "ARB_viewport_array.xml",
+    "EXT_draw_buffers2.xml",
+    "EXT_framebuffer_object.xml",
+    "EXT_gpu_shader4.xml",
+    "EXT_packed_depth_stencil.xml",
+    "EXT_provoking_vertex.xml",
+    "EXT_separate_shader_objects.xml",
+    "EXT_texture_array.xml",
+    "EXT_texture_integer.xml",
+    "EXT_transform_feedback.xml",
+    "GL3x.xml",
+    "GL4x.xml",
+    "GREMEDY_string_marker.xml",
+    "INTEL_performance_query.xml",
+    "KHR_context_flush_control.xml",
+    "KHR_debug.xml",
+    "KHR_texture_compression_astc.xml",
+    "NV_conditional_render.xml",
+    "NV_primitive_restart.xml",
+    "NV_texture_barrier.xml",
+    "NV_vdpau_interop.xml",
+    "OES_EGL_image.xml",
+    "OES_fixed_point.xml",
+    "OES_single_precision.xml",
+    "es_EXT.xml",
+    "glX_API.xml",
+    "gl_API.xml",
+    "gl_and_es_API.xml",
+    "gl_and_glX_API.xml",
+  ]
+}
+
+action("glapi_mapi_tmp") {
+  output_name = "glapi/glapi_mapi_tmp.h"
+  script_name = "../../mapi_abi.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "--printer",
+    "es2api",
+    "--mode",
+    "lib",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+action("gl_procs") {
+  output_name = "glapi/glprocs.h"
+  script_name = "gl_procs.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-c",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+action("gl_apitemp") {
+  output_name = "glapi/glapitemp.h"
+  script_name = "gl_apitemp.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+action("gl_table") {
+  output_name = "glapi/glapitable.h"
+  script_name = "gl_table.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+action("gl_gentable") {
+  output_name = "glapi/glapi_gentable.c"
+  script_name = "gl_gentable.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+action("glapi_x86-64") {
+  output_name = "glapi/glapi_x86-64.S"
+  script_name = "gl_x86-64_asm.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+action("enums") {
+  output_name = "main/enums.c"
+  script_name = "gl_enums.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+action("api_exec") {
+  output_name = "main/api_exec.c"
+  script_name = "gl_genexec.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+    "apiexec.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+action("dispatch") {
+  output_name = "main/dispatch.h"
+  script_name = "gl_table.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+    "-m",
+    "remap_table",
+  ]
+}
+
+action("remap_helper") {
+  output_name = "main/remap_helper.h"
+  script_name = "remap_helper.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  deps = [
+    ":api_xml",
+  ]
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+    "gl_XML.py",
+    "license.py",
+    "static_data.py",
+    "typeexpr.py",
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+    "-f",
+    rebase_path(".") + "/gl_and_es_API.xml",
+  ]
+}
+
+config("gen_public_config") {
+  include_dirs = [
+    "$mesa_build_root/src",
+    "$mesa_build_root/src/mapi",
+    "$mesa_build_root/src/mapi/glapi",
+    "$mesa_build_root/src/mesa",
+    rebase_path(target_gen_dir),
+    rebase_path("$target_gen_dir/main"),
+  ]
+
+  defines = [
+    "MAPI_MODE_BRIDGE",
+    "MAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\"",
+  ]
+}
+
+source_set("glapi_gen") {
+  cflags = [ "-std=c11" ]
+
+  public_configs = [
+    ":gen_public_config",
+    "$mesa_build_root/src:common_config",
+  ]
+
+  include_dirs = [ "$mesa_build_root/src/mapi" ]
+
+  sources = [
+    "$target_gen_dir/glapi/glapi_gentable.c",
+    "$target_gen_dir/glapi/glapi_mapi_tmp.h",
+    "$target_gen_dir/glapi/glapitable.h",
+    "$target_gen_dir/glapi/glapitemp.h",
+    "$target_gen_dir/glapi/glprocs.h",
+  ]
+
+  deps = [
+    ":gl_apitemp",
+    ":gl_gentable",
+    ":gl_procs",
+    ":gl_table",
+    ":glapi_mapi_tmp",
+    ":glapi_x86-64",
+    "$mesa_build_root/include:GL",
+  ]
+}
+
+source_set("main_gen") {
+  configs += [ "$mesa_build_root/src:common_config" ]
+
+  public_configs = [ ":gen_public_config" ]
+
+  sources = [
+    "$target_gen_dir/main/api_exec.c",
+    "$target_gen_dir/main/dispatch.h",
+    "$target_gen_dir/main/enums.c",
+    "$target_gen_dir/main/remap_helper.h",
+  ]
+
+  deps = [
+    ":api_exec",
+    ":dispatch",
+    ":enums",
+    ":remap_helper",
+    "$mesa_build_root/include:GL",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util:headers",
+  ]
+}
+
+source_set("gen") {
+  public_deps = [
+    ":glapi_gen",
+    ":main_gen",
+  ]
+}
diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
index 2f54d1d..650db61 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -43,7 +43,7 @@
 #endif
 
 #if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
-	|| (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__))
+	|| (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)) && !defined(__Fuchsia__)
 #define USE_BACKTRACE
 #endif
 
diff --git a/src/mesa/BUILD.gn b/src/mesa/BUILD.gn
new file mode 100644
index 0000000..940106f
--- /dev/null
+++ b/src/mesa/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+group("mesa") {
+  deps = [
+    "main",
+  ]
+}
diff --git a/src/mesa/drivers/common/BUILD.gn b/src/mesa/drivers/common/BUILD.gn
new file mode 100644
index 0000000..dc132f8
--- /dev/null
+++ b/src/mesa/drivers/common/BUILD.gn
@@ -0,0 +1,52 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("common_public_config") {
+  include_dirs = [ "." ]
+}
+
+source_set("common") {
+  public_configs = [
+    "$mesa_build_root/src:common_config",
+    ":common_public_config",
+  ]
+
+  deps = [
+    "$mesa_build_root/include:GL",
+    "$mesa_build_root/src/mapi/glapi",
+    "$mesa_build_root/src/util",
+  ]
+
+  include_dirs = [ "$mesa_build_root/src/mesa/main" ]
+
+  sources = [
+    "driverfuncs.c",
+    "driverfuncs.h",
+    "meta.c",
+    "meta.h",
+    "meta_blit.c",
+    "meta_copy_image.c",
+    "meta_generate_mipmap.c",
+    "meta_tex_subimage.c",
+  ]
+}
diff --git a/src/mesa/drivers/dri/common/BUILD.gn b/src/mesa/drivers/dri/common/BUILD.gn
new file mode 100644
index 0000000..a5b661e
--- /dev/null
+++ b/src/mesa/drivers/dri/common/BUILD.gn
@@ -0,0 +1,55 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("common_public_config") {
+  include_dirs = [ "." ]
+}
+
+source_set("common") {
+  public_configs = [
+    "$mesa_build_root/src:common_config",
+    ":common_public_config",
+  ]
+
+  deps = [
+    "$mesa_build_root/include:GL",
+    "$mesa_build_root/src/mapi/glapi",
+    "$mesa_build_root/src/util",
+    "$expat_build_root:expat",
+  ]
+
+  include_dirs = [ "$mesa_build_root/src/mesa" ]
+
+  sources = [
+    "dri_util.c",
+    "dri_util.h",
+    "drirc",
+    "megadriver_stub.c",
+    "utils.c",
+    "utils.h",
+    "xmlconfig.c",
+    "xmlconfig.h",
+    "xmlpool",
+    "xmlpool.h",
+  ]
+}
diff --git a/src/mesa/drivers/dri/i965/BUILD.gn b/src/mesa/drivers/dri/i965/BUILD.gn
new file mode 100644
index 0000000..9231127
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/BUILD.gn
@@ -0,0 +1,175 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("i965_config") {
+  include_dirs = [
+    ".",
+    "$magma_build_root/third_party/libdrm",
+    "$mesa_build_root/src/mesa",  # because brw_compiler.h includes main/mtypes.h
+    "$mesa_build_root/src/gallium/auxiliary",  # because main/macros.h includes gallium/auxiliary/util/u_math.h
+    "$mesa_build_root/src/gallium/include",  # because u_math.h includes pipe/p_compiler.h
+    "$mesa_build_root/src/intel",  # because brw_compiler.h includes common/gen_device_info.h
+  ]
+}
+
+source_set("i965_compiler") {
+  public_configs = [
+    ":i965_config",
+    "$mesa_build_root/src:common_config",
+  ]
+
+  deps = [
+    ":gen_brw_nir_trig_workarounds",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/compiler",
+    "$mesa_build_root/src/compiler/glsl:ir_expression_operation",
+    "$mesa_build_root/src/compiler/nir",
+    "$mesa_build_root/src/intel:isl",
+    "$mesa_build_root/src/util",
+  ]
+
+  sources = [
+    "$target_gen_dir/brw_nir_trig_workarounds.c",
+    "brw_cfg.cpp",
+    "brw_cfg.h",
+    "brw_compiler.c",
+    "brw_compiler.h",
+    "brw_cs.h",
+    "brw_dead_control_flow.cpp",
+    "brw_dead_control_flow.h",
+    "brw_defines.h",
+    "brw_disasm.c",
+    "brw_eu.c",
+    "brw_eu.h",
+    "brw_eu_compact.c",
+    "brw_eu_emit.c",
+    "brw_eu_util.c",
+    "brw_eu_validate.c",
+    "brw_fs.cpp",
+    "brw_fs.h",
+    "brw_fs_builder.h",
+    "brw_fs_cmod_propagation.cpp",
+    "brw_fs_combine_constants.cpp",
+    "brw_fs_copy_propagation.cpp",
+    "brw_fs_cse.cpp",
+    "brw_fs_dead_code_eliminate.cpp",
+    "brw_fs_generator.cpp",
+    "brw_fs_live_variables.cpp",
+    "brw_fs_live_variables.h",
+    "brw_fs_lower_d2x.cpp",
+    "brw_fs_lower_pack.cpp",
+    "brw_fs_nir.cpp",
+    "brw_fs_reg_allocate.cpp",
+    "brw_fs_register_coalesce.cpp",
+    "brw_fs_saturate_propagation.cpp",
+    "brw_fs_sel_peephole.cpp",
+    "brw_fs_surface_builder.cpp",
+    "brw_fs_surface_builder.h",
+    "brw_fs_validate.cpp",
+    "brw_fs_visitor.cpp",
+    "brw_inst.h",
+    "brw_interpolation_map.c",
+    "brw_ir_allocator.h",
+    "brw_ir_fs.h",
+    "brw_ir_vec4.h",
+    "brw_nir.c",
+    "brw_nir.h",
+    "brw_nir_analyze_boolean_resolves.c",
+    "brw_nir_attribute_workarounds.c",
+    "brw_nir_intrinsics.c",
+    "brw_nir_opt_peephole_ffma.c",
+    "brw_nir_tcs_workarounds.c",
+    "brw_packed_float.c",
+    "brw_predicated_break.cpp",
+    "brw_program.h",
+    "brw_reg.h",
+    "brw_schedule_instructions.cpp",
+    "brw_shader.cpp",
+    "brw_shader.h",
+    "brw_state.h",
+    "brw_structs.h",
+    "brw_util.c",
+    "brw_util.h",
+    "brw_vec4.cpp",
+    "brw_vec4.h",
+    "brw_vec4_builder.h",
+    "brw_vec4_cmod_propagation.cpp",
+    "brw_vec4_copy_propagation.cpp",
+    "brw_vec4_cse.cpp",
+    "brw_vec4_dead_code_eliminate.cpp",
+    "brw_vec4_generator.cpp",
+    "brw_vec4_gs_nir.cpp",
+    "brw_vec4_gs_visitor.cpp",
+    "brw_vec4_gs_visitor.h",
+    "brw_vec4_live_variables.cpp",
+    "brw_vec4_live_variables.h",
+    "brw_vec4_nir.cpp",
+    "brw_vec4_reg_allocate.cpp",
+    "brw_vec4_surface_builder.cpp",
+    "brw_vec4_surface_builder.h",
+    "brw_vec4_tcs.cpp",
+    "brw_vec4_tcs.h",
+    "brw_vec4_tes.cpp",
+    "brw_vec4_tes.h",
+    "brw_vec4_visitor.cpp",
+    "brw_vec4_vs_visitor.cpp",
+    "brw_vs.h",
+    "brw_vue_map.c",
+    "brw_wm.h",
+    "brw_wm_iz.cpp",
+    "gen6_gs_visitor.cpp",
+    "gen6_gs_visitor.h",
+    "intel_asm_annotation.c",
+    "intel_asm_annotation.h",
+    "intel_debug.c",
+    "intel_debug.h",
+    "intel_resolve_map.c",
+    "intel_resolve_map.h",
+    "intel_screen.h",
+    "intel_tex_obj.h",
+  ]
+}
+
+action("gen_brw_nir_trig_workarounds") {
+  output_name = "brw_nir_trig_workarounds.c"
+  script_name = "brw_nir_trig_workarounds.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    "$mesa_build_root/src/compiler/nir/nir_algebraic.py",
+  ]
+
+  python_path = "$magma_python_path:" + rebase_path("$mesa_build_root") +
+                "/src/compiler/nir"
+
+  args = [
+    "$python_path",
+    rebase_path("$target_gen_dir") + "/$output_name",
+    rebase_path(".") + "/$script_name",
+  ]
+}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0cb0024..22c8799 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -40,7 +40,6 @@
 
 #include "main/glheader.h"
 #include "main/config.h"
-#include "glapi/glapi.h"
 #include "math/m_matrix.h"	/* GLmatrix */
 #include "compiler/shader_enums.h"
 #include "compiler/shader_info.h"
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 34f8bbb..7bed569 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -28,7 +28,6 @@
 #include "imports.h"
 #include "mtypes.h"
 #include "version.h"
-#include "git_sha1.h"
 
 /**
  * Scans 'string' to see if it ends with 'ending'.
diff --git a/src/mesa/math/BUILD.gn b/src/mesa/math/BUILD.gn
new file mode 100644
index 0000000..00c6410
--- /dev/null
+++ b/src/mesa/math/BUILD.gn
@@ -0,0 +1,67 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("math_public_config") {
+  include_dirs = [
+    ".",
+    "..",
+  ]
+}
+
+source_set("math") {
+  public_configs = [
+    ":math_public_config",
+    "$mesa_build_root/src:common_config",
+  ]
+
+  include_dirs = [ "$mesa_build_root/src/mapi" ]
+
+  deps = [
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util",
+  ]
+
+  sources = [
+    "m_clip_tmp.h",
+    "m_copy_tmp.h",
+    "m_debug.h",
+    "m_debug_clip.c",
+    "m_debug_norm.c",
+    "m_debug_util.h",
+    "m_debug_xform.c",
+    "m_dotprod_tmp.h",
+    "m_eval.c",
+    "m_eval.h",
+    "m_matrix.c",
+    "m_matrix.h",
+    "m_norm_tmp.h",
+    "m_trans_tmp.h",
+    "m_translate.c",
+    "m_translate.h",
+    "m_vector.c",
+    "m_vector.h",
+    "m_xform.c",
+    "m_xform.h",
+    "m_xform_tmp.h",
+  ]
+}
diff --git a/src/mesa/program/BUILD.gn b/src/mesa/program/BUILD.gn
new file mode 100644
index 0000000..c06e81d
--- /dev/null
+++ b/src/mesa/program/BUILD.gn
@@ -0,0 +1,167 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("program_public_config") {
+  include_dirs = [
+    ".",
+    "..",
+  ]
+}
+
+source_set("program") {
+  public_configs = [ ":program_public_config" ]
+
+  include_dirs = [
+    "$mesa_build_root/src/mesa",
+    "$mesa_build_root/src/mapi",
+  ]
+
+  deps = [
+    ":gen",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/compiler/glsl",
+    "$mesa_build_root/src/compiler/nir:gen",
+    "$mesa_build_root/src/mesa/main",
+    "$mesa_build_root/src/util",
+  ]
+
+  sources = [
+    "arbprogparse.c",
+    "arbprogparse.h",
+    "hash_table.h",
+    "ir_to_mesa.cpp",
+    "ir_to_mesa.h",
+    "prog_cache.c",
+    "prog_cache.h",
+    "prog_execute.c",
+    "prog_execute.h",
+    "prog_hash_table.c",
+    "prog_instruction.c",
+    "prog_instruction.h",
+    "prog_noise.c",
+    "prog_noise.h",
+    "prog_opt_constant_fold.c",
+    "prog_optimize.c",
+    "prog_optimize.h",
+    "prog_parameter.c",
+    "prog_parameter.h",
+    "prog_parameter_layout.c",
+    "prog_parameter_layout.h",
+    "prog_print.c",
+    "prog_print.h",
+    "prog_statevars.c",
+    "prog_statevars.h",
+    "prog_to_nir.c",
+    "prog_to_nir.h",
+    "program.c",
+    "program.h",
+    "program_parse_extra.c",
+    "program_parser.h",
+    "programopt.c",
+    "programopt.h",
+    "string_to_uint_map.cpp",
+    "symbol_table.c",
+    "symbol_table.h",
+  ]
+}
+
+action("program_parser") {
+  output_header_name = "program_parse.tab.h"
+  output_impl_name = "program_parse.tab.c"
+
+  script = "$mesa_build_root/src/compiler/glsl/bash_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_header_name",
+    "$target_gen_dir/$output_impl_name",
+  ]
+
+  inputs = [
+    "program_parse.y",
+  ]
+
+  args = [
+    "yacc",
+    "-o",
+    rebase_path(target_gen_dir) + "/$output_impl_name",
+    "-p",
+    "_mesa_program_",
+    "--defines=" + rebase_path(target_gen_dir) + "/$output_header_name",
+    rebase_path(".") + "/program_parse.y",
+  ]
+}
+
+action("program_lexer") {
+  input_name = "program_lexer.l"
+  output_name = "program_lexer.c"
+
+  script = "$mesa_build_root/src/compiler/glsl/bash_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    input_name,
+  ]
+
+  args = [
+    "lex",
+    "-o",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$input_name",
+  ]
+}
+
+config("gen_public_config") {
+  include_dirs = [
+    target_gen_dir,
+    "$target_gen_dir/..",
+  ]
+}
+
+source_set("gen") {
+  public_configs = [ ":gen_public_config" ]
+
+  include_dirs = [
+    ".",
+    "glcpp",
+    "$mesa_build_root/src/mesa",
+    "$mesa_build_root/src/mapi",
+  ]
+
+  cflags_cc = [ "-fpermissive" ]
+
+  deps = [
+    ":program_lexer",
+    ":program_parser",
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/util",
+  ]
+
+  sources = [
+    "$target_gen_dir/program_lexer.c",
+    "$target_gen_dir/program_parse.tab.c",
+    "$target_gen_dir/program_parse.tab.h",
+  ]
+}
diff --git a/src/mesa/swrast/BUILD.gn b/src/mesa/swrast/BUILD.gn
new file mode 100644
index 0000000..41e8e84
--- /dev/null
+++ b/src/mesa/swrast/BUILD.gn
@@ -0,0 +1,103 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("swrast_public_config") {
+  include_dirs = [ "." ]
+}
+
+source_set("swrast") {
+  public_configs = [
+    "$mesa_build_root/src:common_config",
+    ":swrast_public_config",
+  ]
+
+  deps = [
+    "../swrast_setup",
+    "$mesa_build_root/include:GL",
+    "$mesa_build_root/src/mapi/glapi",
+    "$mesa_build_root/src/util",
+  ]
+
+  include_dirs = [ "$mesa_build_root/src/mesa/main" ]
+
+  sources = [
+    "s_aaline.c",
+    "s_aaline.h",
+    "s_aalinetemp.h",
+    "s_aatriangle.c",
+    "s_aatriangle.h",
+    "s_aatritemp.h",
+    "s_alpha.c",
+    "s_alpha.h",
+    "s_atifragshader.c",
+    "s_atifragshader.h",
+    "s_bitmap.c",
+    "s_blend.c",
+    "s_blend.h",
+    "s_blit.c",
+    "s_chan.h",
+    "s_clear.c",
+    "s_context.c",
+    "s_context.h",
+    "s_copypix.c",
+    "s_depth.c",
+    "s_depth.h",
+    "s_drawpix.c",
+    "s_feedback.c",
+    "s_feedback.h",
+    "s_fog.c",
+    "s_fog.h",
+    "s_fragprog.c",
+    "s_fragprog.h",
+    "s_lines.c",
+    "s_lines.h",
+    "s_linetemp.h",
+    "s_logic.c",
+    "s_logic.h",
+    "s_masking.c",
+    "s_masking.h",
+    "s_points.c",
+    "s_points.h",
+    "s_renderbuffer.c",
+    "s_renderbuffer.h",
+    "s_span.c",
+    "s_span.h",
+    "s_stencil.c",
+    "s_stencil.h",
+    "s_texcombine.c",
+    "s_texcombine.h",
+    "s_texfetch.c",
+    "s_texfetch.h",
+    "s_texfetch_tmp.h",
+    "s_texfilter.c",
+    "s_texfilter.h",
+    "s_texrender.c",
+    "s_texture.c",
+    "s_triangle.c",
+    "s_triangle.h",
+    "s_tritemp.h",
+    "s_zoom.c",
+    "s_zoom.h",
+    "swrast.h",
+  ]
+}
diff --git a/src/mesa/swrast_setup/BUILD.gn b/src/mesa/swrast_setup/BUILD.gn
new file mode 100644
index 0000000..424279c
--- /dev/null
+++ b/src/mesa/swrast_setup/BUILD.gn
@@ -0,0 +1,51 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("swrast_setup_public_config") {
+  include_dirs = [ "." ]
+}
+
+source_set("swrast_setup") {
+  public_configs = [
+    "$mesa_build_root/src:common_config",
+    ":swrast_setup_public_config",
+  ]
+
+  deps = [
+    "$mesa_build_root/include:GL",
+    "$mesa_build_root/src/mapi/glapi",
+    "$mesa_build_root/src/util",
+  ]
+
+  include_dirs = [ "$mesa_build_root/src/mesa/main" ]
+
+  sources = [
+    "ss_context.c",
+    "ss_context.h",
+    "ss_triangle.c",
+    "ss_triangle.h",
+    "ss_tritmp.h",
+    "ss_vb.h",
+    "swrast_setup.h",
+  ]
+}
diff --git a/src/mesa/tnl/BUILD.gn b/src/mesa/tnl/BUILD.gn
new file mode 100644
index 0000000..15fdadc
--- /dev/null
+++ b/src/mesa/tnl/BUILD.gn
@@ -0,0 +1,59 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+source_set("tnl") {
+  public_configs = [ "$mesa_build_root/src:common_config" ]
+
+  deps = [
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/mapi/glapi",
+    "$mesa_build_root/src/util",
+  ]
+
+  sources = [
+    "t_context.c",
+    "t_context.h",
+    "t_draw.c",
+    "t_pipeline.c",
+    "t_pipeline.h",
+    "t_vb_cliptmp.h",
+    "t_vb_fog.c",
+    "t_vb_light.c",
+    "t_vb_lighttmp.h",
+    "t_vb_normals.c",
+    "t_vb_points.c",
+    "t_vb_program.c",
+    "t_vb_render.c",
+    "t_vb_rendertmp.h",
+    "t_vb_texgen.c",
+    "t_vb_texmat.c",
+    "t_vb_vertex.c",
+    "t_vertex.c",
+    "t_vertex.h",
+    "t_vertex_generic.c",
+    "t_vertex_sse.c",
+    "t_vp_build.c",
+    "t_vp_build.h",
+    "tnl.h",
+  ]
+}
diff --git a/src/mesa/vbo/BUILD.gn b/src/mesa/vbo/BUILD.gn
new file mode 100644
index 0000000..0026c62
--- /dev/null
+++ b/src/mesa/vbo/BUILD.gn
@@ -0,0 +1,69 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("vbo_public_config") {
+  include_dirs = [
+    ".",
+    "..",
+  ]
+}
+
+source_set("vbo") {
+  public_configs = [ ":vbo_public_config" ]
+
+  include_dirs = [ "$mesa_build_root/src/mesa" ]
+
+  deps = [
+    "$mesa_build_root/include:c_compat",
+    "$mesa_build_root/src/mapi/glapi",
+    "$mesa_build_root/src/util",
+  ]
+
+  sources = [
+    "vbo.h",
+    "vbo_attrib.h",
+    "vbo_attrib_tmp.h",
+    "vbo_context.c",
+    "vbo_context.h",
+    "vbo_exec.c",
+    "vbo_exec.h",
+    "vbo_exec_api.c",
+    "vbo_exec_array.c",
+    "vbo_exec_draw.c",
+    "vbo_exec_eval.c",
+    "vbo_minmax_index.c",
+    "vbo_noop.c",
+    "vbo_noop.h",
+    "vbo_primitive_restart.c",
+    "vbo_rebase.c",
+    "vbo_save.c",
+    "vbo_save.h",
+    "vbo_save_api.c",
+    "vbo_save_draw.c",
+    "vbo_save_loopback.c",
+    "vbo_split.c",
+    "vbo_split.h",
+    "vbo_split_copy.c",
+    "vbo_split_inplace.c",
+  ]
+}
diff --git a/src/util/BUILD.gn b/src/util/BUILD.gn
new file mode 100644
index 0000000..861f61c
--- /dev/null
+++ b/src/util/BUILD.gn
@@ -0,0 +1,130 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("util_public_config") {
+  include_dirs = [
+    "$mesa_build_root/src",
+    "$mesa_build_root/src/gallium/auxiliary/",
+    "$mesa_build_root/src/gallium/include/",
+  ]
+}
+
+source_set("headers") {
+  public_configs = [ ":util_public_config" ]
+
+  sources = [
+    "bitset.h",
+    "debug.h",
+    "format_srgb.h",
+    "half_float.h",
+    "hash_table.h",
+    "list.h",
+    "macros.h",
+    "mesa-sha1.h",
+    "ralloc.h",
+    "register_allocate.h",
+    "rgtc.h",
+    "rounding.h",
+    "set.h",
+    "simple_list.h",
+    "sha1/sha1.h",
+    "strndup.h",
+    "strtod.h",
+    "texcompress_rgtc_tmp.h",
+    "u_atomic.h",
+    "u_vector.h",
+  ]
+}
+
+source_set("util") {
+  include_dirs = [
+    "$mesa_build_root/src/mesa/",
+    "$mesa_build_root/src/mapi/",
+    "$mesa_build_root/src/gallium/auxiliary/",
+  ]
+
+  public_deps = [
+    ":gen",
+    ":headers",
+    "$mesa_build_root/include:c_compat",
+  ]
+
+  public_configs = [
+    ":util_public_config",
+    "$mesa_build_root/src:common_config",
+  ]
+
+  sources = [
+    "debug.c",
+    "half_float.c",
+    "hash_table.c",
+    "mesa-sha1.c",
+    "ralloc.c",
+    "register_allocate.c",
+    "rgtc.c",
+    "set.c",
+    "sha1/sha1.c",
+    "strtod.c",
+    "u_vector.c",
+  ]
+}
+
+action("format_srgb") {
+  output_name = "format_srgb.c"
+  script_name = "format_srgb.py"
+
+  script = "$mesa_build_root/scripts/gn_script_wrapper.py"
+
+  outputs = [
+    "$target_gen_dir/$output_name",
+  ]
+
+  inputs = [
+    script_name,
+  ]
+
+  args = [
+    "$magma_python_path",
+    rebase_path(target_gen_dir) + "/$output_name",
+    rebase_path(".") + "/$script_name",
+  ]
+}
+
+config("gen_public_config") {
+  include_dirs = [ target_gen_dir ]
+}
+
+source_set("gen") {
+  public_configs = [ ":gen_public_config" ]
+
+  deps = [
+    ":format_srgb",
+    "$mesa_build_root/include:c_compat",
+  ]
+
+  include_dirs = [ "." ]
+
+  sources = [
+    "$target_gen_dir/format_srgb.c",
+  ]
+}
diff --git a/src/vulkan/registry/vk.xml b/src/vulkan/registry/vk.xml
index a3e142f..2ed41aa 100644
--- a/src/vulkan/registry/vk.xml
+++ b/src/vulkan/registry/vk.xml
@@ -27,17 +27,16 @@
 private version is maintained in the 1.0 branch of the member gitlab server.
     </comment>
 
-    <!-- SECTION: Vulkan vendor IDs for physical devices without PCI vendor IDs -->
-    <vendorids>
+    <vendorids comment="Vulkan vendor IDs for physical devices without PCI vendor IDs">
         <vendorid name="KHR"    id="0x10000"            comment="This is the next available Khronos vendor ID"/>
         <vendorid name="VIV"    id="0x10001"            comment="Vivante vendor ID"/>
         <vendorid name="VSI"    id="0x10002"            comment="VeriSilicon vendor ID"/>
     </vendorids>
 
-    <!-- SECTION: Vulkan vendor/author tags for extensions and layers -->
-    <tags>
+    <tags comment="Vulkan vendor/author tags for extensions and layers">
         <tag name="IMG"         author="Imagination Technologies"      contact="Michael Worcester @michaelworcester"/>
         <tag name="AMD"         author="Advanced Micro Devices, Inc."  contact="Daniel Rakos @aqnuep"/>
+        <tag name="AMDX"        author="Advanced Micro Devices, Inc."  contact="Daniel Rakos @aqnuep"/>
         <tag name="ARM"         author="ARM Limited"                   contact="Jan-Harald Fredriksen @janharald"/>
         <tag name="FSL"         author="Freescale Semiconductor, Inc." contact="Norbert Nopper @FslNopper"/>
         <tag name="BRCM"        author="Broadcom Corporation"          contact="Graeme Leese @gnl21"/>
@@ -59,14 +58,15 @@
         <tag name="NN"          author="Nintendo Co., Ltd."            contact="Yasuhiro Yoshioka @yoshioka_yasuhiro"/>
         <tag name="MVK"         author="The Brenwill Workshop Ltd."    contact="Bill Hollings @billhollings"/>
         <tag name="KHR"         author="Khronos"                       contact="Tom Olson @tom.olson"/>
+        <tag name="KHX"         author="Khronos"                       contact="Tom Olson @tom.olson"/>
         <tag name="EXT"         author="Multivendor"                   contact="Jon Leech @oddhack"/>
         <tag name="MESA"        author="Mesa open source project"      contact="Chad Versace @chadversary, Daniel Stone @fooishbar, David Airlie @airlied, Jason Ekstrand @jekstrand"/>
     </tags>
 
-    <!-- SECTION: Vulkan type definitions -->
-    <types>
+    <types comment="Vulkan type definitions">
         <type name="vk_platform" category="include">#include "vk_platform.h"</type>
-            <!-- WSI extensions -->
+
+            <comment>WSI extensions</comment>
         <type category="include">#include "<name>vulkan.h</name>"</type>
         <type category="include">#include &lt;<name>X11/Xlib.h</name>&gt;</type>
         <type category="include">#include &lt;<name>X11/extensions/Xrandr.h</name>&gt;</type>
@@ -102,11 +102,11 @@
         <type category="define">#define <name>VK_VERSION_PATCH</name>(version) ((uint32_t)(version) &amp; 0xfff)</type>
 
         <type category="define">// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead.
-//#define <name>VK_API_VERSION</name> <type>VK_MAKE_VERSION</type>(1, 0, 0)</type>    <!-- The patch version here should never be set to anything other than 0 -->
+//#define <name>VK_API_VERSION</name> <type>VK_MAKE_VERSION</type>(1, 0, 0) // Patch version should always be set to 0</type>
         <type category="define">// Vulkan 1.0 version number
-#define <name>VK_API_VERSION_1_0</name> <type>VK_MAKE_VERSION</type>(1, 0, 0)</type>    <!-- The patch version here should never be set to anything other than 0 -->
+#define <name>VK_API_VERSION_1_0</name> <type>VK_MAKE_VERSION</type>(1, 0, 0)// Patch version should always be set to 0</type>
         <type category="define">// Version of this file
-#define <name>VK_HEADER_VERSION</name> 54</type>
+#define <name>VK_HEADER_VERSION</name> 57</type>
 
         <type category="define">
 #define <name>VK_DEFINE_HANDLE</name>(object) typedef struct object##_T* object;</type>
@@ -130,7 +130,7 @@
         <type category="basetype">typedef <type>uint32_t</type> <name>VkFlags</name>;</type>
         <type category="basetype">typedef <type>uint64_t</type> <name>VkDeviceSize</name>;</type>
 
-        <!-- Basic C types, pulled in via vk_platform.h -->
+            <comment>Basic C types, pulled in via vk_platform.h</comment>
         <type requires="vk_platform" name="void"/>
         <type requires="vk_platform" name="char"/>
         <type requires="vk_platform" name="float"/>
@@ -140,89 +140,92 @@
         <type requires="vk_platform" name="int32_t"/>
         <type requires="vk_platform" name="size_t"/>
         <type name="int"/>
-        <!-- Bitmask types -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkFramebufferCreateFlags</name>;</type>               <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkQueryPoolCreateFlags</name>;</type>                 <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkRenderPassCreateFlags</name>;</type>                <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkSamplerCreateFlags</name>;</type>                   <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineLayoutCreateFlags</name>;</type>            <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCacheCreateFlags</name>;</type>             <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDepthStencilStateCreateFlags</name>;</type> <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDynamicStateCreateFlags</name>;</type>      <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineColorBlendStateCreateFlags</name>;</type>   <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineMultisampleStateCreateFlags</name>;</type>  <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineRasterizationStateCreateFlags</name>;</type>       <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineViewportStateCreateFlags</name>;</type>     <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineTessellationStateCreateFlags</name>;</type> <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineInputAssemblyStateCreateFlags</name>;</type><!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineVertexInputStateCreateFlags</name>;</type>  <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineShaderStageCreateFlags</name>;</type>       <!-- creation flags -->
-        <type requires="VkDescriptorSetLayoutCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorSetLayoutCreateFlags</name>;</type>       <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkBufferViewCreateFlags</name>;</type>                <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkInstanceCreateFlags</name>;</type>                  <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceCreateFlags</name>;</type>                    <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceQueueCreateFlags</name>;</type>               <!-- creation flags -->
-        <type requires="VkQueueFlagBits"                  category="bitmask">typedef <type>VkFlags</type> <name>VkQueueFlags</name>;</type>                       <!-- Queue capabilities -->
-        <type requires="VkMemoryPropertyFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryPropertyFlags</name>;</type>              <!-- Memory properties passed into vkAllocateMemory(). -->
-        <type requires="VkMemoryHeapFlagBits"             category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryHeapFlags</name>;</type>                  <!-- Memory heap flags -->
-        <type requires="VkAccessFlagBits"                 category="bitmask">typedef <type>VkFlags</type> <name>VkAccessFlags</name>;</type>                      <!-- Memory access flags passed to barrier/dependency operations -->
-        <type requires="VkBufferUsageFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkBufferUsageFlags</name>;</type>                 <!-- Buffer usage flags -->
-        <type requires="VkBufferCreateFlagBits"           category="bitmask">typedef <type>VkFlags</type> <name>VkBufferCreateFlags</name>;</type>                <!-- Buffer creation flags -->
-        <type requires="VkShaderStageFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkShaderStageFlags</name>;</type>                 <!-- Shader stage flags -->
-        <type requires="VkImageUsageFlagBits"             category="bitmask">typedef <type>VkFlags</type> <name>VkImageUsageFlags</name>;</type>                  <!-- Image usage flags -->
-        <type requires="VkImageCreateFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkImageCreateFlags</name>;</type>                 <!-- Image creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkImageViewCreateFlags</name>;</type>             <!-- Image view creation flags (no bits yet) -->
-        <type requires="VkPipelineCreateFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCreateFlags</name>;</type>              <!-- Pipeline creation flags -->
-        <type requires="VkColorComponentFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkColorComponentFlags</name>;</type>              <!-- Color component flags -->
-        <type requires="VkFenceCreateFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkFenceCreateFlags</name>;</type>                 <!-- Fence creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkSemaphoreCreateFlags</name>;</type>             <!-- Semaphore creation flags -->
-        <type requires="VkFormatFeatureFlagBits"          category="bitmask">typedef <type>VkFlags</type> <name>VkFormatFeatureFlags</name>;</type>               <!-- Format capability flags -->
-        <type requires="VkQueryControlFlagBits"           category="bitmask">typedef <type>VkFlags</type> <name>VkQueryControlFlags</name>;</type>                <!-- Query control flags -->
-        <type requires="VkQueryResultFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkQueryResultFlags</name>;</type>                 <!-- Query result flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkShaderModuleCreateFlags</name>;</type>          <!-- Shader module creation flags (no bits yet) -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkEventCreateFlags</name>;</type>                 <!-- Event creation flags  (no bits yet) -->
-        <type requires="VkCommandPoolCreateFlagBits"          category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolCreateFlags</name>;</type>               <!-- Command pool creation flags -->
-        <type requires="VkCommandPoolResetFlagBits"           category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolResetFlags</name>;</type>                <!-- Command pool reset flags -->
-        <type requires="VkCommandBufferResetFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkCommandBufferResetFlags</name>;</type>              <!-- Command buffer reset flags -->
-        <type requires="VkCommandBufferUsageFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkCommandBufferUsageFlags</name>;</type>              <!-- Command buffer usage flags -->
-        <type requires="VkQueryPipelineStatisticFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueryPipelineStatisticFlags</name>;</type>      <!-- Pipeline statistics flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryMapFlags</name>;</type>                   <!-- Memory mapping flags (no bits yet) -->
-        <type requires="VkImageAspectFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkImageAspectFlags</name>;</type>                 <!-- Bitmask of image aspects -->
-        <type requires="VkSparseMemoryBindFlagBits"       category="bitmask">typedef <type>VkFlags</type> <name>VkSparseMemoryBindFlags</name>;</type>            <!-- Sparse memory bind flags -->
-        <type requires="VkSparseImageFormatFlagBits"      category="bitmask">typedef <type>VkFlags</type> <name>VkSparseImageFormatFlags</name>;</type>           <!-- Sparse image memory requirements flags -->
-        <type requires="VkSubpassDescriptionFlagBits"     category="bitmask">typedef <type>VkFlags</type> <name>VkSubpassDescriptionFlags</name>;</type>          <!-- Subpass description flags -->
-        <type requires="VkPipelineStageFlagBits"          category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineStageFlags</name>;</type>               <!-- Pipeline stages -->
-        <type requires="VkSampleCountFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkSampleCountFlags</name>;</type>                 <!-- Pipeline stages -->
-        <type requires="VkAttachmentDescriptionFlagBits"  category="bitmask">typedef <type>VkFlags</type> <name>VkAttachmentDescriptionFlags</name>;</type>       <!-- Render pass attachment description flags -->
-        <type requires="VkStencilFaceFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkStencilFaceFlags</name>;</type>                 <!-- Stencil face flags -->
-        <type requires="VkCullModeFlagBits"               category="bitmask">typedef <type>VkFlags</type> <name>VkCullModeFlags</name>;</type>                    <!-- Cull mode flags -->
-        <type requires="VkDescriptorPoolCreateFlagBits"   category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorPoolCreateFlags</name>;</type>        <!-- Descriptor pool creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorPoolResetFlags</name>;</type>         <!-- Descriptor pool reset flags -->
-        <type requires="VkDependencyFlagBits"             category="bitmask">typedef <type>VkFlags</type> <name>VkDependencyFlags</name>;</type>                  <!-- Pipeline barrier and subpass dependency flags -->
 
-        <type requires="VkIndirectCommandsLayoutUsageFlagBitsNVX"  category="bitmask">typedef <type>VkFlags</type> <name>VkIndirectCommandsLayoutUsageFlagsNVX</name>;</type>  <!-- Device generated commands usage flags -->
-        <type requires="VkObjectEntryUsageFlagBitsNVX"             category="bitmask">typedef <type>VkFlags</type> <name>VkObjectEntryUsageFlagsNVX</name>;</type>             <!-- Object usage flags -->
+            <comment>Bitmask types</comment>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkFramebufferCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkQueryPoolCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkRenderPassCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkSamplerCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineLayoutCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCacheCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDepthStencilStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDynamicStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineColorBlendStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineMultisampleStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineRasterizationStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineViewportStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineTessellationStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineInputAssemblyStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineVertexInputStateCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineShaderStageCreateFlags</name>;</type>
+        <type requires="VkDescriptorSetLayoutCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorSetLayoutCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkBufferViewCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkInstanceCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceQueueCreateFlags</name>;</type>
+        <type requires="VkQueueFlagBits"                  category="bitmask">typedef <type>VkFlags</type> <name>VkQueueFlags</name>;</type>
+        <type requires="VkMemoryPropertyFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryPropertyFlags</name>;</type>
+        <type requires="VkMemoryHeapFlagBits"             category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryHeapFlags</name>;</type>
+        <type requires="VkAccessFlagBits"                 category="bitmask">typedef <type>VkFlags</type> <name>VkAccessFlags</name>;</type>
+        <type requires="VkBufferUsageFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkBufferUsageFlags</name>;</type>
+        <type requires="VkBufferCreateFlagBits"           category="bitmask">typedef <type>VkFlags</type> <name>VkBufferCreateFlags</name>;</type>
+        <type requires="VkShaderStageFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkShaderStageFlags</name>;</type>
+        <type requires="VkImageUsageFlagBits"             category="bitmask">typedef <type>VkFlags</type> <name>VkImageUsageFlags</name>;</type>
+        <type requires="VkImageCreateFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkImageCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkImageViewCreateFlags</name>;</type>
+        <type requires="VkPipelineCreateFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCreateFlags</name>;</type>
+        <type requires="VkColorComponentFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkColorComponentFlags</name>;</type>
+        <type requires="VkFenceCreateFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkFenceCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkSemaphoreCreateFlags</name>;</type>
+        <type requires="VkFormatFeatureFlagBits"          category="bitmask">typedef <type>VkFlags</type> <name>VkFormatFeatureFlags</name>;</type>
+        <type requires="VkQueryControlFlagBits"           category="bitmask">typedef <type>VkFlags</type> <name>VkQueryControlFlags</name>;</type>
+        <type requires="VkQueryResultFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkQueryResultFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkShaderModuleCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkEventCreateFlags</name>;</type>
+        <type requires="VkCommandPoolCreateFlagBits"          category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolCreateFlags</name>;</type>
+        <type requires="VkCommandPoolResetFlagBits"           category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolResetFlags</name>;</type>
+        <type requires="VkCommandBufferResetFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkCommandBufferResetFlags</name>;</type>
+        <type requires="VkCommandBufferUsageFlagBits"         category="bitmask">typedef <type>VkFlags</type> <name>VkCommandBufferUsageFlags</name>;</type>
+        <type requires="VkQueryPipelineStatisticFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueryPipelineStatisticFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryMapFlags</name>;</type>
+        <type requires="VkImageAspectFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkImageAspectFlags</name>;</type>
+        <type requires="VkSparseMemoryBindFlagBits"       category="bitmask">typedef <type>VkFlags</type> <name>VkSparseMemoryBindFlags</name>;</type>
+        <type requires="VkSparseImageFormatFlagBits"      category="bitmask">typedef <type>VkFlags</type> <name>VkSparseImageFormatFlags</name>;</type>
+        <type requires="VkSubpassDescriptionFlagBits"     category="bitmask">typedef <type>VkFlags</type> <name>VkSubpassDescriptionFlags</name>;</type>
+        <type requires="VkPipelineStageFlagBits"          category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineStageFlags</name>;</type>
+        <type requires="VkSampleCountFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkSampleCountFlags</name>;</type>
+        <type requires="VkAttachmentDescriptionFlagBits"  category="bitmask">typedef <type>VkFlags</type> <name>VkAttachmentDescriptionFlags</name>;</type>
+        <type requires="VkStencilFaceFlagBits"            category="bitmask">typedef <type>VkFlags</type> <name>VkStencilFaceFlags</name>;</type>
+        <type requires="VkCullModeFlagBits"               category="bitmask">typedef <type>VkFlags</type> <name>VkCullModeFlags</name>;</type>
+        <type requires="VkDescriptorPoolCreateFlagBits"   category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorPoolCreateFlags</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorPoolResetFlags</name>;</type>
+        <type requires="VkDependencyFlagBits"             category="bitmask">typedef <type>VkFlags</type> <name>VkDependencyFlags</name>;</type>
 
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorUpdateTemplateCreateFlagsKHR</name>;</type> <!-- Descriptor update template creation flags -->
-            <!-- WSI extensions -->
+        <type requires="VkIndirectCommandsLayoutUsageFlagBitsNVX"  category="bitmask">typedef <type>VkFlags</type> <name>VkIndirectCommandsLayoutUsageFlagsNVX</name>;</type>
+        <type requires="VkObjectEntryUsageFlagBitsNVX"             category="bitmask">typedef <type>VkFlags</type> <name>VkObjectEntryUsageFlagsNVX</name>;</type>
+
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorUpdateTemplateCreateFlagsKHR</name>;</type>
+
+            <comment>WSI extensions</comment>
         <type requires="VkCompositeAlphaFlagBitsKHR"      category="bitmask">typedef <type>VkFlags</type> <name>VkCompositeAlphaFlagsKHR</name>;</type>
         <type requires="VkDisplayPlaneAlphaFlagBitsKHR"   category="bitmask">typedef <type>VkFlags</type> <name>VkDisplayPlaneAlphaFlagsKHR</name>;</type>
         <type requires="VkSurfaceTransformFlagBitsKHR"    category="bitmask">typedef <type>VkFlags</type> <name>VkSurfaceTransformFlagsKHR</name>;</type>
-        <type requires="VkSwapchainCreateFlagBitsKHR"     category="bitmask">typedef <type>VkFlags</type> <name>VkSwapchainCreateFlagsKHR</name>;</type>          <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDisplayModeCreateFlagsKHR</name>;</type>        <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDisplaySurfaceCreateFlagsKHR</name>;</type>     <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkAndroidSurfaceCreateFlagsKHR</name>;</type>     <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkMirSurfaceCreateFlagsKHR</name>;</type>         <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkViSurfaceCreateFlagsNN</name>;</type>           <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkWaylandSurfaceCreateFlagsKHR</name>;</type>     <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkWin32SurfaceCreateFlagsKHR</name>;</type>       <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkXlibSurfaceCreateFlagsKHR</name>;</type>        <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkXcbSurfaceCreateFlagsKHR</name>;</type>         <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkIOSSurfaceCreateFlagsMVK</name>;</type>         <!-- creation flags -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkMacOSSurfaceCreateFlagsMVK</name>;</type>       <!-- creation flags -->
-        <type requires="VkPeerMemoryFeatureFlagBitsKHX"   category="bitmask">typedef <type>VkFlags</type> <name>VkPeerMemoryFeatureFlagsKHX</name>;</type>        <!-- Peer memory feature flags -->
-        <type requires="VkMemoryAllocateFlagBitsKHX"      category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryAllocateFlagsKHX</name>;</type>           <!-- Memory allocation flags -->
-        <type requires="VkDeviceGroupPresentModeFlagBitsKHX" category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceGroupPresentModeFlagsKHX</name>;</type><!-- Device group present mode flags -->
+        <type requires="VkSwapchainCreateFlagBitsKHR"     category="bitmask">typedef <type>VkFlags</type> <name>VkSwapchainCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDisplayModeCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkDisplaySurfaceCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkAndroidSurfaceCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkMirSurfaceCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkViSurfaceCreateFlagsNN</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkWaylandSurfaceCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkWin32SurfaceCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkXlibSurfaceCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkXcbSurfaceCreateFlagsKHR</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkIOSSurfaceCreateFlagsMVK</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkMacOSSurfaceCreateFlagsMVK</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkMagmaSurfaceCreateFlagsKHR</name>;</type>       <!-- creation flags -->
+        <type requires="VkPeerMemoryFeatureFlagBitsKHX"   category="bitmask">typedef <type>VkFlags</type> <name>VkPeerMemoryFeatureFlagsKHX</name>;</type>
+        <type requires="VkMemoryAllocateFlagBitsKHX"      category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryAllocateFlagsKHX</name>;</type>
+        <type requires="VkDeviceGroupPresentModeFlagBitsKHX" category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceGroupPresentModeFlagsKHX</name>;</type>
 
         <type requires="VkDebugReportFlagBitsEXT"      category="bitmask">typedef <type>VkFlags</type> <name>VkDebugReportFlagsEXT</name>;</type>
         <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolTrimFlagsKHR</name>;</type>
@@ -237,12 +240,12 @@
         <type requires="VkExternalFenceFeatureFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalFenceFeatureFlagsKHR</name>;</type>
         <type requires="VkFenceImportFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkFenceImportFlagsKHR</name>;</type>
         <type requires="VkSurfaceCounterFlagBitsEXT"      category="bitmask">typedef <type>VkFlags</type> <name>VkSurfaceCounterFlagsEXT</name>;</type>
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineViewportSwizzleStateCreateFlagsNV</name>;</type>     <!-- creation flags (no bits yet) -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDiscardRectangleStateCreateFlagsEXT</name>;</type>     <!-- creation flags (no bits yet) -->
-        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCoverageToColorStateCreateFlagsNV</name>;</type>     <!-- creation flags (no bits yet) -->
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineViewportSwizzleStateCreateFlagsNV</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDiscardRectangleStateCreateFlagsEXT</name>;</type>
+        <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCoverageToColorStateCreateFlagsNV</name>;</type>
         <type                                             category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCoverageModulationStateCreateFlagsNV</name>;</type>
 
-        <!-- Types which can be void pointers or class pointers, selected at compile time -->
+            <comment>Types which can be void pointers or class pointers, selected at compile time</comment>
         <type category="handle"><type>VK_DEFINE_HANDLE</type>(<name>VkInstance</name>)</type>
         <type category="handle" parent="VkInstance"><type>VK_DEFINE_HANDLE</type>(<name>VkPhysicalDevice</name>)</type>
         <type category="handle" parent="VkPhysicalDevice"><type>VK_DEFINE_HANDLE</type>(<name>VkDevice</name>)</type>
@@ -272,14 +275,14 @@
         <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkIndirectCommandsLayoutNVX</name>)</type>
         <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDescriptorUpdateTemplateKHR</name>)</type>
 
-        <!-- WSI extensions -->
+            <comment>WSI extensions</comment>
         <type category="handle"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDisplayKHR</name>)</type>
         <type category="handle" parent="VkPhysicalDevice,VkDisplayKHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDisplayModeKHR</name>)</type>
         <type category="handle" parent="VkInstance"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSurfaceKHR</name>)</type>
         <type category="handle" parent="VkSurfaceKHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSwapchainKHR</name>)</type>
         <type category="handle" parent="VkInstance"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDebugReportCallbackEXT</name>)</type>
 
-        <!-- Types generated from corresponding <enums> tags below -->
+            <comment>Types generated from corresponding enums tags below</comment>
         <type name="VkAttachmentLoadOp" category="enum"/>
         <type name="VkAttachmentStoreOp" category="enum"/>
         <type name="VkBlendFactor" category="enum"/>
@@ -367,7 +370,8 @@
         <type name="VkDescriptorPoolCreateFlagBits" category="enum"/>
         <type name="VkDependencyFlagBits" category="enum"/>
         <type name="VkObjectType" category="enum"/>
-        <!-- Extensions -->
+
+        <comment>Extensions</comment>
         <type name="VkIndirectCommandsLayoutUsageFlagBitsNVX" category="enum"/>
         <type name="VkIndirectCommandsTokenTypeNVX" category="enum"/>
         <type name="VkObjectEntryUsageFlagBitsNVX" category="enum"/>
@@ -377,7 +381,8 @@
         <type name="VkDiscardRectangleModeEXT" category="enum"/>
         <type name="VkSubpassDescriptionFlagBits" category="enum"/>
         <type name="VkCoverageModulationModeNV" category="enum"/>
-        <!-- WSI extensions -->
+
+            <comment>WSI extensions</comment>
         <type name="VkColorSpaceKHR" category="enum"/>
         <type name="VkCompositeAlphaFlagBitsKHR" category="enum"/>
         <type name="VkDisplayPlaneAlphaFlagBitsKHR" category="enum"/>
@@ -408,7 +413,7 @@
         <type name="VkSamplerReductionModeEXT" category="enum"/>
         <type name="VkBlendOverlapEXT" category="enum"/>
 
-        <!-- The PFN_vk*Function types are used by VkAllocationCallbacks below -->
+            <comment>The PFN_vk*Function types are used by VkAllocationCallbacks below</comment>
         <type category="funcpointer">typedef void (VKAPI_PTR *<name>PFN_vkInternalAllocationNotification</name>)(
     <type>void</type>*                                       pUserData,
     <type>size_t</type>                                      size,
@@ -434,10 +439,10 @@
     <type>void</type>*                                       pUserData,
     <type>void</type>*                                       pMemory);</type>
 
-    <!-- The PFN_vkVoidFunction type are used by VkGet*ProcAddr below -->
+            <comment>The PFN_vkVoidFunction type are used by VkGet*ProcAddr below</comment>
         <type category="funcpointer">typedef void (VKAPI_PTR *<name>PFN_vkVoidFunction</name>)(void);</type>
 
-    <!-- The PFN_vkDebugReportCallbackEXT type are used by the DEBUG_REPORT extension-->
+            <comment>The PFN_vkDebugReportCallbackEXT type are used by the DEBUG_REPORT extension</comment>
         <type category="funcpointer">typedef VkBool32 (VKAPI_PTR *<name>PFN_vkDebugReportCallbackEXT</name>)(
     <type>VkDebugReportFlagsEXT</type>                       flags,
     <type>VkDebugReportObjectTypeEXT</type>                  objectType,
@@ -448,7 +453,7 @@
     const <type>char</type>*                                 pMessage,
     <type>void</type>*                                       pUserData);</type>
 
-        <!-- Struct types -->
+            <comment>Struct types</comment>
         <type category="struct" name="VkOffset2D">
             <member><type>int32_t</type>        <name>x</name></member>
             <member><type>int32_t</type>        <name>y</name></member>
@@ -506,18 +511,18 @@
             <member><type>VkPhysicalDeviceSparseProperties</type> <name>sparseProperties</name></member>
         </type>
         <type category="struct" name="VkExtensionProperties" returnedonly="true">
-            <member><type>char</type>            <name>extensionName</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]</member> <!-- extension name -->
-            <member><type>uint32_t</type>        <name>specVersion</name></member>                    <!-- version of the extension specification implemented -->
+            <member><type>char</type>            <name>extensionName</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]<comment>extension name</comment></member>
+            <member><type>uint32_t</type>        <name>specVersion</name><comment>version of the extension specification implemented</comment></member>
         </type>
         <type category="struct" name="VkLayerProperties" returnedonly="true">
-            <member><type>char</type>            <name>layerName</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]</member> <!-- layer name -->
-            <member><type>uint32_t</type>        <name>specVersion</name></member>                    <!-- version of the layer specification implemented -->
-            <member><type>uint32_t</type>        <name>implementationVersion</name></member>                    <!-- build or release version of the layer's library -->
-            <member><type>char</type>            <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member> <!-- Free-form description of the layer -->
+            <member><type>char</type>            <name>layerName</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]<comment>layer name</comment></member>
+            <member><type>uint32_t</type>        <name>specVersion</name><comment>version of the layer specification implemented</comment></member>
+            <member><type>uint32_t</type>        <name>implementationVersion</name><comment>build or release version of the layer's library</comment></member>
+            <member><type>char</type>            <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]<comment>Free-form description of the layer</comment></member>
         </type>
         <type category="struct" name="VkApplicationInfo">
             <member values="VK_STRUCTURE_TYPE_APPLICATION_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*     <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>*     <name>pNext</name></member>
             <member optional="true" len="null-terminated">const <type>char</type>*     <name>pApplicationName</name></member>
             <member><type>uint32_t</type>        <name>applicationVersion</name></member>
             <member optional="true" len="null-terminated">const <type>char</type>*     <name>pEngineName</name></member>
@@ -534,39 +539,39 @@
         </type>
         <type category="struct" name="VkDeviceQueueCreateInfo">
             <member values="VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*     <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkDeviceQueueCreateFlags</type>    <name>flags</name></member>              <!-- Reserved -->
+            <member>const <type>void</type>*     <name>pNext</name></member>
+            <member optional="true"><type>VkDeviceQueueCreateFlags</type>    <name>flags</name></member>
             <member><type>uint32_t</type>        <name>queueFamilyIndex</name></member>
             <member><type>uint32_t</type>        <name>queueCount</name></member>
             <member len="queueCount">const <type>float</type>*    <name>pQueuePriorities</name></member>
         </type>
         <type category="struct" name="VkDeviceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkPhysicalDeviceFeatures2KHR,VkPhysicalDevice16BitStorageFeaturesKHR,VkPhysicalDeviceVariablePointerFeaturesKHR,VkPhysicalDeviceMultiviewFeaturesKHX,VkDeviceGroupDeviceCreateInfoKHX">const <type>void</type>*     <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkDeviceCreateFlags</type>    <name>flags</name></member>                   <!-- Reserved -->
+            <member>const <type>void</type>*     <name>pNext</name></member>
+            <member optional="true"><type>VkDeviceCreateFlags</type>    <name>flags</name></member>
             <member><type>uint32_t</type>        <name>queueCreateInfoCount</name></member>
             <member len="queueCreateInfoCount">const <type>VkDeviceQueueCreateInfo</type>* <name>pQueueCreateInfos</name></member>
             <member optional="true"><type>uint32_t</type>               <name>enabledLayerCount</name></member>
-            <member len="enabledLayerCount,null-terminated">const <type>char</type>* const*      <name>ppEnabledLayerNames</name></member>            <!-- Ordered list of layer names to be enabled -->
+            <member len="enabledLayerCount,null-terminated">const <type>char</type>* const*      <name>ppEnabledLayerNames</name><comment>Ordered list of layer names to be enabled</comment></member>
             <member optional="true"><type>uint32_t</type>               <name>enabledExtensionCount</name></member>
             <member len="enabledExtensionCount,null-terminated">const <type>char</type>* const*      <name>ppEnabledExtensionNames</name></member>
             <member optional="true">const <type>VkPhysicalDeviceFeatures</type>* <name>pEnabledFeatures</name></member>
         </type>
         <type category="struct" name="VkInstanceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDebugReportCallbackCreateInfoEXT">const <type>void</type>*     <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkInstanceCreateFlags</type>  <name>flags</name></member>                          <!-- Reserved -->
+            <member>const <type>void</type>*     <name>pNext</name></member>
+            <member optional="true"><type>VkInstanceCreateFlags</type>  <name>flags</name></member>
             <member optional="true">const <type>VkApplicationInfo</type>* <name>pApplicationInfo</name></member>
             <member optional="true"><type>uint32_t</type>               <name>enabledLayerCount</name></member>
-            <member len="enabledLayerCount,null-terminated">const <type>char</type>* const*      <name>ppEnabledLayerNames</name></member>            <!-- Ordered list of layer names to be enabled -->
+            <member len="enabledLayerCount,null-terminated">const <type>char</type>* const*      <name>ppEnabledLayerNames</name><comment>Ordered list of layer names to be enabled</comment></member>
             <member optional="true"><type>uint32_t</type>               <name>enabledExtensionCount</name></member>
-            <member len="enabledExtensionCount,null-terminated">const <type>char</type>* const*      <name>ppEnabledExtensionNames</name></member>        <!-- Extension names to be enabled -->
+            <member len="enabledExtensionCount,null-terminated">const <type>char</type>* const*      <name>ppEnabledExtensionNames</name><comment>Extension names to be enabled</comment></member>
         </type>
         <type category="struct" name="VkQueueFamilyProperties" returnedonly="true">
-            <member optional="true"><type>VkQueueFlags</type>           <name>queueFlags</name></member>                     <!-- Queue flags -->
+            <member optional="true"><type>VkQueueFlags</type>           <name>queueFlags</name><comment>Queue flags</comment></member>
             <member><type>uint32_t</type>               <name>queueCount</name></member>
             <member><type>uint32_t</type>               <name>timestampValidBits</name></member>
-            <member><type>VkExtent3D</type>             <name>minImageTransferGranularity</name></member>    <!-- Minimum alignment requirement for image transfers -->
+            <member><type>VkExtent3D</type>             <name>minImageTransferGranularity</name><comment>Minimum alignment requirement for image transfers</comment></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceMemoryProperties" returnedonly="true">
             <member><type>uint32_t</type>               <name>memoryTypeCount</name></member>
@@ -576,14 +581,14 @@
         </type>
         <type category="struct" name="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDedicatedAllocationMemoryAllocateInfoNV,VkMemoryAllocateFlagsInfoKHX,VkMemoryDedicatedAllocateInfoKHR">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member><type>VkDeviceSize</type>           <name>allocationSize</name></member>                 <!-- Size of memory allocation -->
-            <member><type>uint32_t</type>               <name>memoryTypeIndex</name></member>                <!-- Index of the of the memory type to allocate from -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member><type>VkDeviceSize</type>           <name>allocationSize</name><comment>Size of memory allocation</comment></member>
+            <member><type>uint32_t</type>               <name>memoryTypeIndex</name><comment>Index of the of the memory type to allocate from</comment></member>
         </type>
         <type category="struct" name="VkMemoryRequirements" returnedonly="true">
-            <member><type>VkDeviceSize</type>           <name>size</name></member>                           <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>alignment</name></member>                      <!-- Specified in bytes -->
-            <member><type>uint32_t</type>               <name>memoryTypeBits</name></member>                 <!-- Bitmask of the allowed memory type indices into memoryTypes[] for this object -->
+            <member><type>VkDeviceSize</type>           <name>size</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>alignment</name><comment>Specified in bytes</comment></member>
+            <member><type>uint32_t</type>               <name>memoryTypeBits</name><comment>Bitmask of the allowed memory type indices into memoryTypes[] for this object</comment></member>
         </type>
         <type category="struct" name="VkSparseImageFormatProperties" returnedonly="true">
             <member optional="true"><type>VkImageAspectFlags</type>     <name>aspectMask</name></member>
@@ -593,88 +598,88 @@
         <type category="struct" name="VkSparseImageMemoryRequirements" returnedonly="true">
             <member><type>VkSparseImageFormatProperties</type> <name>formatProperties</name></member>
             <member><type>uint32_t</type>               <name>imageMipTailFirstLod</name></member>
-            <member><type>VkDeviceSize</type>           <name>imageMipTailSize</name></member>               <!-- Specified in bytes, must be a multiple of sparse block size in bytes / alignment -->
-            <member><type>VkDeviceSize</type>           <name>imageMipTailOffset</name></member>             <!-- Specified in bytes, must be a multiple of sparse block size in bytes / alignment -->
-            <member><type>VkDeviceSize</type>           <name>imageMipTailStride</name></member>             <!-- Specified in bytes, must be a multiple of sparse block size in bytes / alignment -->
+            <member><type>VkDeviceSize</type>           <name>imageMipTailSize</name><comment>Specified in bytes, must be a multiple of sparse block size in bytes / alignment</comment></member>
+            <member><type>VkDeviceSize</type>           <name>imageMipTailOffset</name><comment>Specified in bytes, must be a multiple of sparse block size in bytes / alignment</comment></member>
+            <member><type>VkDeviceSize</type>           <name>imageMipTailStride</name><comment>Specified in bytes, must be a multiple of sparse block size in bytes / alignment</comment></member>
         </type>
         <type category="struct" name="VkMemoryType" returnedonly="true">
-            <member optional="true"><type>VkMemoryPropertyFlags</type>  <name>propertyFlags</name></member>                  <!-- Memory properties of this memory type -->
-            <member><type>uint32_t</type>               <name>heapIndex</name></member>                      <!-- Index of the memory heap allocations of this memory type are taken from -->
+            <member optional="true"><type>VkMemoryPropertyFlags</type>  <name>propertyFlags</name><comment>Memory properties of this memory type</comment></member>
+            <member><type>uint32_t</type>               <name>heapIndex</name><comment>Index of the memory heap allocations of this memory type are taken from</comment></member>
         </type>
         <type category="struct" name="VkMemoryHeap" returnedonly="true">
-            <member><type>VkDeviceSize</type>           <name>size</name></member>                           <!-- Available memory in the heap-->
-            <member optional="true"><type>VkMemoryHeapFlags</type>      <name>flags</name></member>                          <!-- Flags for the heap-->
+            <member><type>VkDeviceSize</type>           <name>size</name><comment>Available memory in the heap</comment></member>
+            <member optional="true"><type>VkMemoryHeapFlags</type>      <name>flags</name><comment>Flags for the heap</comment></member>
         </type>
         <type category="struct" name="VkMappedMemoryRange">
             <member values="VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member><type>VkDeviceMemory</type>         <name>memory</name></member>                            <!-- Mapped memory object -->
-            <member><type>VkDeviceSize</type>           <name>offset</name></member>                         <!-- Offset within the memory object where the range starts -->
-            <member><type>VkDeviceSize</type>           <name>size</name></member>                           <!-- Size of the range within the memory object -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member><type>VkDeviceMemory</type>         <name>memory</name><comment>Mapped memory object</comment></member>
+            <member><type>VkDeviceSize</type>           <name>offset</name><comment>Offset within the memory object where the range starts</comment></member>
+            <member><type>VkDeviceSize</type>           <name>size</name><comment>Size of the range within the memory object</comment></member>
         </type>
         <type category="struct" name="VkFormatProperties" returnedonly="true">
-            <member optional="true"><type>VkFormatFeatureFlags</type>   <name>linearTilingFeatures</name></member>           <!-- Format features in case of linear tiling -->
-            <member optional="true"><type>VkFormatFeatureFlags</type>   <name>optimalTilingFeatures</name></member>          <!-- Format features in case of optimal tiling -->
-            <member optional="true"><type>VkFormatFeatureFlags</type>   <name>bufferFeatures</name></member>                 <!-- Format features supported by buffers -->
+            <member optional="true"><type>VkFormatFeatureFlags</type>   <name>linearTilingFeatures</name><comment>Format features in case of linear tiling</comment></member>
+            <member optional="true"><type>VkFormatFeatureFlags</type>   <name>optimalTilingFeatures</name><comment>Format features in case of optimal tiling</comment></member>
+            <member optional="true"><type>VkFormatFeatureFlags</type>   <name>bufferFeatures</name><comment>Format features supported by buffers</comment></member>
         </type>
         <type category="struct" name="VkImageFormatProperties" returnedonly="true">
-            <member><type>VkExtent3D</type>             <name>maxExtent</name></member>                      <!-- max image dimensions for this resource type -->
-            <member><type>uint32_t</type>               <name>maxMipLevels</name></member>                   <!-- max number of mipmap levels for this resource type -->
-            <member><type>uint32_t</type>               <name>maxArrayLayers</name></member>                 <!-- max array size for this resource type -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampleCounts</name></member>                   <!-- supported sample counts for this resource type -->
-            <member><type>VkDeviceSize</type>           <name>maxResourceSize</name></member>                <!-- max size (in bytes) of this resource type -->
+            <member><type>VkExtent3D</type>             <name>maxExtent</name><comment>max image dimensions for this resource type</comment></member>
+            <member><type>uint32_t</type>               <name>maxMipLevels</name><comment>max number of mipmap levels for this resource type</comment></member>
+            <member><type>uint32_t</type>               <name>maxArrayLayers</name><comment>max array size for this resource type</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampleCounts</name><comment>supported sample counts for this resource type</comment></member>
+            <member><type>VkDeviceSize</type>           <name>maxResourceSize</name><comment>max size (in bytes) of this resource type</comment></member>
         </type>
         <type category="struct" name="VkDescriptorBufferInfo">
-            <member><type>VkBuffer</type>               <name>buffer</name></member>                         <!-- Buffer used for this descriptor slot when the descriptor is UNIFORM_BUFFER[_DYNAMIC] or STORAGE_BUFFER[_DYNAMIC]. VK_NULL_HANDLE otherwise. -->
-            <member><type>VkDeviceSize</type>           <name>offset</name></member>                         <!-- Base offset from buffer start in bytes to update in the descriptor set. -->
-            <member><type>VkDeviceSize</type>           <name>range</name></member>                          <!-- Size in bytes of the buffer resource for this descriptor update. -->
+            <member><type>VkBuffer</type>               <name>buffer</name><comment>Buffer used for this descriptor slot when the descriptor is UNIFORM_BUFFER[_DYNAMIC] or STORAGE_BUFFER[_DYNAMIC]. VK_NULL_HANDLE otherwise.</comment></member>
+            <member><type>VkDeviceSize</type>           <name>offset</name><comment>Base offset from buffer start in bytes to update in the descriptor set.</comment></member>
+            <member><type>VkDeviceSize</type>           <name>range</name><comment>Size in bytes of the buffer resource for this descriptor update.</comment></member>
         </type>
         <type category="struct" name="VkDescriptorImageInfo">
-            <member noautovalidity="true"><type>VkSampler</type>       <name>sampler</name></member>                        <!-- Sampler to write to the descriptor in case it is a SAMPLER or COMBINED_IMAGE_SAMPLER descriptor. Ignored otherwise. -->
-            <member noautovalidity="true"><type>VkImageView</type>     <name>imageView</name></member>                      <!-- Image view to write to the descriptor in case it is a SAMPLED_IMAGE, STORAGE_IMAGE, COMBINED_IMAGE_SAMPLER, or INPUT_ATTACHMENT descriptor. Ignored otherwise. -->
-            <member noautovalidity="true"><type>VkImageLayout</type>   <name>imageLayout</name></member>                    <!-- Layout the image is expected to be in when accessed using this descriptor (only used if imageView is not VK_NULL_HANDLE). -->
+            <member noautovalidity="true"><type>VkSampler</type>       <name>sampler</name><comment>Sampler to write to the descriptor in case it is a SAMPLER or COMBINED_IMAGE_SAMPLER descriptor. Ignored otherwise.</comment></member>
+            <member noautovalidity="true"><type>VkImageView</type>     <name>imageView</name><comment>Image view to write to the descriptor in case it is a SAMPLED_IMAGE, STORAGE_IMAGE, COMBINED_IMAGE_SAMPLER, or INPUT_ATTACHMENT descriptor. Ignored otherwise.</comment></member>
+            <member noautovalidity="true"><type>VkImageLayout</type>   <name>imageLayout</name><comment>Layout the image is expected to be in when accessed using this descriptor (only used if imageView is not VK_NULL_HANDLE).</comment></member>
         </type>
         <type category="struct" name="VkWriteDescriptorSet">
             <member values="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member noautovalidity="true"><type>VkDescriptorSet</type>        <name>dstSet</name></member>                        <!-- Destination descriptor set -->
-            <member><type>uint32_t</type>               <name>dstBinding</name></member>                    <!-- Binding within the destination descriptor set to write -->
-            <member><type>uint32_t</type>               <name>dstArrayElement</name></member>               <!-- Array element within the destination binding to write -->
-            <member><type>uint32_t</type>               <name>descriptorCount</name></member>                          <!-- Number of descriptors to write (determines the size of the array pointed by pDescriptors) -->
-            <member><type>VkDescriptorType</type>       <name>descriptorType</name></member>                 <!-- Descriptor type to write (determines which members of the array pointed by pDescriptors are going to be used) -->
-            <member noautovalidity="true" len="descriptorCount">const <type>VkDescriptorImageInfo</type>* <name>pImageInfo</name></member>               <!-- Sampler, image view, and layout for SAMPLER, COMBINED_IMAGE_SAMPLER, {SAMPLED,STORAGE}_IMAGE, and INPUT_ATTACHMENT descriptor types. -->
-            <member noautovalidity="true" len="descriptorCount">const <type>VkDescriptorBufferInfo</type>* <name>pBufferInfo</name></member>             <!-- Raw buffer, size, and offset for {UNIFORM,STORAGE}_BUFFER[_DYNAMIC] descriptor types. -->
-            <member noautovalidity="true" len="descriptorCount">const <type>VkBufferView</type>*    <name>pTexelBufferView</name></member>               <!-- Buffer view to write to the descriptor for {UNIFORM,STORAGE}_TEXEL_BUFFER descriptor types. -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member noautovalidity="true"><type>VkDescriptorSet</type>        <name>dstSet</name><comment>Destination descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>dstBinding</name><comment>Binding within the destination descriptor set to write</comment></member>
+            <member><type>uint32_t</type>               <name>dstArrayElement</name><comment>Array element within the destination binding to write</comment></member>
+            <member><type>uint32_t</type>               <name>descriptorCount</name><comment>Number of descriptors to write (determines the size of the array pointed by pDescriptors)</comment></member>
+            <member><type>VkDescriptorType</type>       <name>descriptorType</name><comment>Descriptor type to write (determines which members of the array pointed by pDescriptors are going to be used)</comment></member>
+            <member noautovalidity="true" len="descriptorCount">const <type>VkDescriptorImageInfo</type>* <name>pImageInfo</name><comment>Sampler, image view, and layout for SAMPLER, COMBINED_IMAGE_SAMPLER, {SAMPLED,STORAGE}_IMAGE, and INPUT_ATTACHMENT descriptor types.</comment></member>
+            <member noautovalidity="true" len="descriptorCount">const <type>VkDescriptorBufferInfo</type>* <name>pBufferInfo</name><comment>Raw buffer, size, and offset for {UNIFORM,STORAGE}_BUFFER[_DYNAMIC] descriptor types.</comment></member>
+            <member noautovalidity="true" len="descriptorCount">const <type>VkBufferView</type>*    <name>pTexelBufferView</name><comment>Buffer view to write to the descriptor for {UNIFORM,STORAGE}_TEXEL_BUFFER descriptor types.</comment></member>
         </type>
         <type category="struct" name="VkCopyDescriptorSet">
             <member values="VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member><type>VkDescriptorSet</type>        <name>srcSet</name></member>                         <!-- Source descriptor set -->
-            <member><type>uint32_t</type>               <name>srcBinding</name></member>                     <!-- Binding within the source descriptor set to copy from -->
-            <member><type>uint32_t</type>               <name>srcArrayElement</name></member>                <!-- Array element within the source binding to copy from -->
-            <member><type>VkDescriptorSet</type>        <name>dstSet</name></member>                        <!-- Destination descriptor set -->
-            <member><type>uint32_t</type>               <name>dstBinding</name></member>                    <!-- Binding within the destination descriptor set to copy to -->
-            <member><type>uint32_t</type>               <name>dstArrayElement</name></member>               <!-- Array element within the destination binding to copy to -->
-            <member><type>uint32_t</type>               <name>descriptorCount</name></member>                <!-- Number of descriptors to write (determines the size of the array pointed by pDescriptors) -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member><type>VkDescriptorSet</type>        <name>srcSet</name><comment>Source descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>srcBinding</name><comment>Binding within the source descriptor set to copy from</comment></member>
+            <member><type>uint32_t</type>               <name>srcArrayElement</name><comment>Array element within the source binding to copy from</comment></member>
+            <member><type>VkDescriptorSet</type>        <name>dstSet</name><comment>Destination descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>dstBinding</name><comment>Binding within the destination descriptor set to copy to</comment></member>
+            <member><type>uint32_t</type>               <name>dstArrayElement</name><comment>Array element within the destination binding to copy to</comment></member>
+            <member><type>uint32_t</type>               <name>descriptorCount</name><comment>Number of descriptors to write (determines the size of the array pointed by pDescriptors)</comment></member>
         </type>
         <type category="struct" name="VkBufferCreateInfo">
             <member values="VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDedicatedAllocationBufferCreateInfoNV">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure. -->
-            <member optional="true"><type>VkBufferCreateFlags</type>    <name>flags</name></member>                          <!-- Buffer creation flags -->
-            <member><type>VkDeviceSize</type>           <name>size</name></member>                           <!-- Specified in bytes -->
-            <member><type>VkBufferUsageFlags</type>     <name>usage</name></member>                          <!-- Buffer usage flags -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkBufferCreateFlags</type>    <name>flags</name><comment>Buffer creation flags</comment></member>
+            <member><type>VkDeviceSize</type>           <name>size</name><comment>Specified in bytes</comment></member>
+            <member><type>VkBufferUsageFlags</type>     <name>usage</name><comment>Buffer usage flags</comment></member>
             <member><type>VkSharingMode</type>          <name>sharingMode</name></member>
             <member optional="true"><type>uint32_t</type>               <name>queueFamilyIndexCount</name></member>
             <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>*        <name>pQueueFamilyIndices</name></member>
         </type>
         <type category="struct" name="VkBufferViewCreateInfo">
             <member values="VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure. -->
-            <member optional="true"><type>VkBufferViewCreateFlags</type><name>flags</name></member>                          <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkBufferViewCreateFlags</type><name>flags</name></member>
             <member><type>VkBuffer</type>               <name>buffer</name></member>
-            <member><type>VkFormat</type>               <name>format</name></member>                         <!-- Optionally specifies format of elements -->
-            <member><type>VkDeviceSize</type>           <name>offset</name></member>                         <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>range</name></member>                          <!-- View size specified in bytes -->
+            <member><type>VkFormat</type>               <name>format</name><comment>Optionally specifies format of elements</comment></member>
+            <member><type>VkDeviceSize</type>           <name>offset</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>range</name><comment>View size specified in bytes</comment></member>
         </type>
         <type category="struct" name="VkImageSubresource">
             <member><type>VkImageAspectFlags</type>     <name>aspectMask</name></member>
@@ -696,37 +701,37 @@
         </type>
         <type category="struct" name="VkMemoryBarrier">
             <member values="VK_STRUCTURE_TYPE_MEMORY_BARRIER"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure. -->
-            <member optional="true"><type>VkAccessFlags</type>          <name>srcAccessMask</name></member>                  <!-- Memory accesses from the source of the dependency to synchronize -->
-            <member optional="true"><type>VkAccessFlags</type>          <name>dstAccessMask</name></member>                  <!-- Memory accesses from the destination of the dependency to synchronize -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkAccessFlags</type>          <name>srcAccessMask</name><comment>Memory accesses from the source of the dependency to synchronize</comment></member>
+            <member optional="true"><type>VkAccessFlags</type>          <name>dstAccessMask</name><comment>Memory accesses from the destination of the dependency to synchronize</comment></member>
         </type>
         <type category="struct" name="VkBufferMemoryBarrier">
             <member values="VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure. -->
-            <member optional="true"><type>VkAccessFlags</type>          <name>srcAccessMask</name></member>                  <!-- Memory accesses from the source of the dependency to synchronize -->
-            <member optional="true"><type>VkAccessFlags</type>          <name>dstAccessMask</name></member>                  <!-- Memory accesses from the destination of the dependency to synchronize -->
-            <member><type>uint32_t</type>               <name>srcQueueFamilyIndex</name></member>            <!-- Queue family to transition ownership from -->
-            <member><type>uint32_t</type>               <name>dstQueueFamilyIndex</name></member>           <!-- Queue family to transition ownership to -->
-            <member><type>VkBuffer</type>               <name>buffer</name></member>                         <!-- Buffer to sync -->
-            <member><type>VkDeviceSize</type>           <name>offset</name></member>                         <!-- Offset within the buffer to sync -->
-            <member><type>VkDeviceSize</type>           <name>size</name></member>                           <!-- Amount of bytes to sync -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkAccessFlags</type>          <name>srcAccessMask</name><comment>Memory accesses from the source of the dependency to synchronize</comment></member>
+            <member optional="true"><type>VkAccessFlags</type>          <name>dstAccessMask</name><comment>Memory accesses from the destination of the dependency to synchronize</comment></member>
+            <member><type>uint32_t</type>               <name>srcQueueFamilyIndex</name><comment>Queue family to transition ownership from</comment></member>
+            <member><type>uint32_t</type>               <name>dstQueueFamilyIndex</name><comment>Queue family to transition ownership to</comment></member>
+            <member><type>VkBuffer</type>               <name>buffer</name><comment>Buffer to sync</comment></member>
+            <member><type>VkDeviceSize</type>           <name>offset</name><comment>Offset within the buffer to sync</comment></member>
+            <member><type>VkDeviceSize</type>           <name>size</name><comment>Amount of bytes to sync</comment></member>
         </type>
         <type category="struct" name="VkImageMemoryBarrier">
             <member values="VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure. -->
-            <member optional="true"><type>VkAccessFlags</type>          <name>srcAccessMask</name></member>                  <!-- Memory accesses from the source of the dependency to synchronize -->
-            <member optional="true"><type>VkAccessFlags</type>          <name>dstAccessMask</name></member>                  <!-- Memory accesses from the destination of the dependency to synchronize -->
-            <member><type>VkImageLayout</type>          <name>oldLayout</name></member>                      <!-- Current layout of the image -->
-            <member><type>VkImageLayout</type>          <name>newLayout</name></member>                      <!-- New layout to transition the image to -->
-            <member><type>uint32_t</type>               <name>srcQueueFamilyIndex</name></member>            <!-- Queue family to transition ownership from -->
-            <member><type>uint32_t</type>               <name>dstQueueFamilyIndex</name></member>           <!-- Queue family to transition ownership to -->
-            <member><type>VkImage</type>                <name>image</name></member>                          <!-- Image to sync -->
-            <member><type>VkImageSubresourceRange</type> <name>subresourceRange</name></member>              <!-- Subresource range to sync -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkAccessFlags</type>          <name>srcAccessMask</name><comment>Memory accesses from the source of the dependency to synchronize</comment></member>
+            <member optional="true"><type>VkAccessFlags</type>          <name>dstAccessMask</name><comment>Memory accesses from the destination of the dependency to synchronize</comment></member>
+            <member><type>VkImageLayout</type>          <name>oldLayout</name><comment>Current layout of the image</comment></member>
+            <member><type>VkImageLayout</type>          <name>newLayout</name><comment>New layout to transition the image to</comment></member>
+            <member><type>uint32_t</type>               <name>srcQueueFamilyIndex</name><comment>Queue family to transition ownership from</comment></member>
+            <member><type>uint32_t</type>               <name>dstQueueFamilyIndex</name><comment>Queue family to transition ownership to</comment></member>
+            <member><type>VkImage</type>                <name>image</name><comment>Image to sync</comment></member>
+            <member><type>VkImageSubresourceRange</type> <name>subresourceRange</name><comment>Subresource range to sync</comment></member>
         </type>
         <type category="struct" name="VkImageCreateInfo">
             <member values="VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDedicatedAllocationImageCreateInfoNV,VkImageSwapchainCreateInfoKHX">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure. -->
-            <member optional="true"><type>VkImageCreateFlags</type>     <name>flags</name></member>                          <!-- Image creation flags -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkImageCreateFlags</type>     <name>flags</name><comment>Image creation flags</comment></member>
             <member><type>VkImageType</type>            <name>imageType</name></member>
             <member><type>VkFormat</type>               <name>format</name></member>
             <member><type>VkExtent3D</type>             <name>extent</name></member>
@@ -734,23 +739,23 @@
             <member><type>uint32_t</type>               <name>arrayLayers</name></member>
             <member><type>VkSampleCountFlagBits</type>  <name>samples</name></member>
             <member><type>VkImageTiling</type>          <name>tiling</name></member>
-            <member><type>VkImageUsageFlags</type>      <name>usage</name></member>                          <!-- Image usage flags -->
-            <member><type>VkSharingMode</type>          <name>sharingMode</name></member>                    <!-- Cross-queue-family sharing mode -->
-            <member optional="true"><type>uint32_t</type>               <name>queueFamilyIndexCount</name></member>          <!-- Number of queue families to share across -->
-            <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>*        <name>pQueueFamilyIndices</name></member>            <!-- Array of queue family indices to share across -->
-            <member><type>VkImageLayout</type>          <name>initialLayout</name></member>                  <!-- Initial image layout for all subresources -->
+            <member><type>VkImageUsageFlags</type>      <name>usage</name><comment>Image usage flags</comment></member>
+            <member><type>VkSharingMode</type>          <name>sharingMode</name><comment>Cross-queue-family sharing mode</comment></member>
+            <member optional="true"><type>uint32_t</type>               <name>queueFamilyIndexCount</name><comment>Number of queue families to share across</comment></member>
+            <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>*        <name>pQueueFamilyIndices</name><comment>Array of queue family indices to share across</comment></member>
+            <member><type>VkImageLayout</type>          <name>initialLayout</name><comment>Initial image layout for all subresources</comment></member>
         </type>
         <type category="struct" name="VkSubresourceLayout" returnedonly="true">
-            <member><type>VkDeviceSize</type>           <name>offset</name></member>                         <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>size</name></member>                           <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>rowPitch</name></member>                       <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>arrayPitch</name></member>                     <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>depthPitch</name></member>                     <!-- Specified in bytes -->
+            <member><type>VkDeviceSize</type>           <name>offset</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>size</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>rowPitch</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>arrayPitch</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>depthPitch</name><comment>Specified in bytes</comment></member>
         </type>
         <type category="struct" name="VkImageViewCreateInfo">
             <member values="VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkImageViewCreateFlags</type> <name>flags</name></member>                          <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkImageViewCreateFlags</type> <name>flags</name></member>
             <member><type>VkImage</type>                <name>image</name></member>
             <member><type>VkImageViewType</type>        <name>viewType</name></member>
             <member><type>VkFormat</type>               <name>format</name></member>
@@ -758,24 +763,24 @@
             <member><type>VkImageSubresourceRange</type> <name>subresourceRange</name></member>
         </type>
         <type category="struct" name="VkBufferCopy">
-            <member><type>VkDeviceSize</type>           <name>srcOffset</name></member>                      <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>dstOffset</name></member>                     <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>size</name></member>                           <!-- Specified in bytes -->
+            <member><type>VkDeviceSize</type>           <name>srcOffset</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>dstOffset</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>size</name><comment>Specified in bytes</comment></member>
         </type>
         <type category="struct" name="VkSparseMemoryBind">
-            <member><type>VkDeviceSize</type>           <name>resourceOffset</name></member>                 <!-- Specified in bytes -->
-            <member><type>VkDeviceSize</type>           <name>size</name></member>                           <!-- Specified in bytes -->
+            <member><type>VkDeviceSize</type>           <name>resourceOffset</name><comment>Specified in bytes</comment></member>
+            <member><type>VkDeviceSize</type>           <name>size</name><comment>Specified in bytes</comment></member>
             <member optional="true"><type>VkDeviceMemory</type>         <name>memory</name></member>
-            <member><type>VkDeviceSize</type>           <name>memoryOffset</name></member>                   <!-- Specified in bytes -->
-            <member optional="true"><type>VkSparseMemoryBindFlags</type><name>flags</name></member>                          <!-- Reserved for future -->
+            <member><type>VkDeviceSize</type>           <name>memoryOffset</name><comment>Specified in bytes</comment></member>
+            <member optional="true"><type>VkSparseMemoryBindFlags</type><name>flags</name></member>
         </type>
         <type category="struct" name="VkSparseImageMemoryBind">
             <member><type>VkImageSubresource</type>     <name>subresource</name></member>
             <member><type>VkOffset3D</type>             <name>offset</name></member>
             <member><type>VkExtent3D</type>             <name>extent</name></member>
             <member optional="true"><type>VkDeviceMemory</type>         <name>memory</name></member>
-            <member><type>VkDeviceSize</type>           <name>memoryOffset</name></member>                   <!-- Specified in bytes -->
-            <member optional="true"><type>VkSparseMemoryBindFlags</type><name>flags</name></member>                          <!-- Reserved for future -->
+            <member><type>VkDeviceSize</type>           <name>memoryOffset</name><comment>Specified in bytes</comment></member>
+            <member optional="true"><type>VkSparseMemoryBindFlags</type><name>flags</name></member>
         </type>
         <type category="struct" name="VkSparseBufferMemoryBindInfo">
             <member><type>VkBuffer</type> <name>buffer</name></member>
@@ -794,7 +799,7 @@
         </type>
         <type category="struct" name="VkBindSparseInfo">
             <member values="VK_STRUCTURE_TYPE_BIND_SPARSE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDeviceGroupBindSparseInfoKHX">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure. -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>               <name>waitSemaphoreCount</name></member>
             <member len="waitSemaphoreCount">const <type>VkSemaphore</type>*     <name>pWaitSemaphores</name></member>
             <member optional="true"><type>uint32_t</type>               <name>bufferBindCount</name></member>
@@ -808,24 +813,24 @@
         </type>
         <type category="struct" name="VkImageCopy">
             <member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
-            <member><type>VkOffset3D</type>             <name>srcOffset</name></member>                      <!-- Specified in pixels for both compressed and uncompressed images -->
+            <member><type>VkOffset3D</type>             <name>srcOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
             <member><type>VkImageSubresourceLayers</type> <name>dstSubresource</name></member>
-            <member><type>VkOffset3D</type>             <name>dstOffset</name></member>                     <!-- Specified in pixels for both compressed and uncompressed images -->
-            <member><type>VkExtent3D</type>             <name>extent</name></member>                         <!-- Specified in pixels for both compressed and uncompressed images -->
+            <member><type>VkOffset3D</type>             <name>dstOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+            <member><type>VkExtent3D</type>             <name>extent</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
         </type>
         <type category="struct" name="VkImageBlit">
             <member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
-            <member><type>VkOffset3D</type>             <name>srcOffsets</name>[2]</member>                      <!-- Specified in pixels for both compressed and uncompressed images -->
+            <member><type>VkOffset3D</type>             <name>srcOffsets</name>[2]<comment>Specified in pixels for both compressed and uncompressed images</comment></member>
             <member><type>VkImageSubresourceLayers</type> <name>dstSubresource</name></member>
-            <member><type>VkOffset3D</type>             <name>dstOffsets</name>[2]</member>                     <!-- Specified in pixels for both compressed and uncompressed images -->
+            <member><type>VkOffset3D</type>             <name>dstOffsets</name>[2]<comment>Specified in pixels for both compressed and uncompressed images</comment></member>
         </type>
         <type category="struct" name="VkBufferImageCopy">
-            <member><type>VkDeviceSize</type>           <name>bufferOffset</name></member>                   <!-- Specified in bytes -->
-            <member><type>uint32_t</type>               <name>bufferRowLength</name></member>                <!-- Specified in texels -->
+            <member><type>VkDeviceSize</type>           <name>bufferOffset</name><comment>Specified in bytes</comment></member>
+            <member><type>uint32_t</type>               <name>bufferRowLength</name><comment>Specified in texels</comment></member>
             <member><type>uint32_t</type>               <name>bufferImageHeight</name></member>
             <member><type>VkImageSubresourceLayers</type> <name>imageSubresource</name></member>
-            <member><type>VkOffset3D</type>             <name>imageOffset</name></member>                    <!-- Specified in pixels for both compressed and uncompressed images -->
-            <member><type>VkExtent3D</type>             <name>imageExtent</name></member>                    <!-- Specified in pixels for both compressed and uncompressed images -->
+            <member><type>VkOffset3D</type>             <name>imageOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+            <member><type>VkExtent3D</type>             <name>imageExtent</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
         </type>
         <type category="struct" name="VkImageResolve">
             <member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
@@ -836,24 +841,24 @@
         </type>
         <type category="struct" name="VkShaderModuleCreateInfo">
             <member values="VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkShaderModuleCreateFlags</type> <name>flags</name></member>                       <!-- Reserved -->
-            <member><type>size_t</type>                 <name>codeSize</name></member>                       <!-- Specified in bytes -->
-            <member len="latexmath:[codeSize \over 4]">const <type>uint32_t</type>*            <name>pCode</name></member>                          <!-- Binary code of size codeSize -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkShaderModuleCreateFlags</type> <name>flags</name></member>
+            <member><type>size_t</type>                 <name>codeSize</name><comment>Specified in bytes</comment></member>
+            <member len="latexmath:[codeSize \over 4]">const <type>uint32_t</type>*            <name>pCode</name><comment>Binary code of size codeSize</comment></member>
         </type>
         <type category="struct" name="VkDescriptorSetLayoutBinding">
-            <member><type>uint32_t</type>               <name>binding</name></member>                        <!-- Binding number for this entry -->
-            <member><type>VkDescriptorType</type>       <name>descriptorType</name></member>                 <!-- Type of the descriptors in this binding -->
-            <member optional="true"><type>uint32_t</type> <name>descriptorCount</name></member>              <!-- Number of descriptors in this binding -->
-            <member noautovalidity="true"><type>VkShaderStageFlags</type>     <name>stageFlags</name></member>                     <!-- Shader stages this binding is visible to -->
-            <member noautovalidity="true" optional="true" len="descriptorCount">const <type>VkSampler</type>*       <name>pImmutableSamplers</name></member>             <!-- Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains count number of elements) -->
+            <member><type>uint32_t</type>               <name>binding</name><comment>Binding number for this entry</comment></member>
+            <member><type>VkDescriptorType</type>       <name>descriptorType</name><comment>Type of the descriptors in this binding</comment></member>
+            <member optional="true"><type>uint32_t</type> <name>descriptorCount</name><comment>Number of descriptors in this binding</comment></member>
+            <member noautovalidity="true"><type>VkShaderStageFlags</type>     <name>stageFlags</name><comment>Shader stages this binding is visible to</comment></member>
+            <member noautovalidity="true" optional="true" len="descriptorCount">const <type>VkSampler</type>*       <name>pImmutableSamplers</name><comment>Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains count number of elements)</comment></member>
         </type>
         <type category="struct" name="VkDescriptorSetLayoutCreateInfo">
             <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkDescriptorSetLayoutCreateFlags</type>    <name>flags</name></member>             <!-- Reserved -->
-            <member optional="true"><type>uint32_t</type>               <name>bindingCount</name></member>                   <!-- Number of bindings in the descriptor set layout -->
-            <member len="bindingCount">const <type>VkDescriptorSetLayoutBinding</type>* <name>pBindings</name></member>       <!-- Array of descriptor set layout bindings -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkDescriptorSetLayoutCreateFlags</type>    <name>flags</name></member>
+            <member optional="true"><type>uint32_t</type>               <name>bindingCount</name><comment>Number of bindings in the descriptor set layout</comment></member>
+            <member len="bindingCount">const <type>VkDescriptorSetLayoutBinding</type>* <name>pBindings</name><comment>Array of descriptor set layout bindings</comment></member>
         </type>
         <type category="struct" name="VkDescriptorPoolSize">
             <member><type>VkDescriptorType</type>       <name>type</name></member>
@@ -861,7 +866,7 @@
         </type>
         <type category="struct" name="VkDescriptorPoolCreateInfo">
             <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
             <member optional="true"><type>VkDescriptorPoolCreateFlags</type>  <name>flags</name></member>
             <member><type>uint32_t</type>               <name>maxSets</name></member>
             <member><type>uint32_t</type>               <name>poolSizeCount</name></member>
@@ -869,77 +874,77 @@
         </type>
         <type category="struct" name="VkDescriptorSetAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
             <member><type>VkDescriptorPool</type>       <name>descriptorPool</name></member>
             <member><type>uint32_t</type>               <name>descriptorSetCount</name></member>
             <member len="descriptorSetCount">const <type>VkDescriptorSetLayout</type>* <name>pSetLayouts</name></member>
         </type>
         <type category="struct" name="VkSpecializationMapEntry">
-            <member><type>uint32_t</type>               <name>constantID</name></member>                     <!-- The SpecConstant ID specified in the BIL -->
-            <member><type>uint32_t</type>               <name>offset</name></member>                         <!-- Offset of the value in the data block -->
-            <member><type>size_t</type>                 <name>size</name></member>                           <!-- Size in bytes of the SpecConstant -->
+            <member><type>uint32_t</type>               <name>constantID</name><comment>The SpecConstant ID specified in the BIL</comment></member>
+            <member><type>uint32_t</type>               <name>offset</name><comment>Offset of the value in the data block</comment></member>
+            <member><type>size_t</type>                 <name>size</name><comment>Size in bytes of the SpecConstant</comment></member>
         </type>
         <type category="struct" name="VkSpecializationInfo">
-            <member optional="true"><type>uint32_t</type>               <name>mapEntryCount</name></member>                  <!-- Number of entries in the map -->
-            <member len="mapEntryCount" noautovalidity="true">const <type>VkSpecializationMapEntry</type>* <name>pMapEntries</name></member>                  <!-- Array of map entries -->
-            <member optional="true"><type>size_t</type>                 <name>dataSize</name></member>                       <!-- Size in bytes of pData -->
-            <member len="dataSize">const <type>void</type>*            <name>pData</name></member>                          <!-- Pointer to SpecConstant data -->
+            <member optional="true"><type>uint32_t</type>               <name>mapEntryCount</name><comment>Number of entries in the map</comment></member>
+            <member len="mapEntryCount" noautovalidity="true">const <type>VkSpecializationMapEntry</type>* <name>pMapEntries</name><comment>Array of map entries</comment></member>
+            <member optional="true"><type>size_t</type>                 <name>dataSize</name><comment>Size in bytes of pData</comment></member>
+            <member len="dataSize">const <type>void</type>*            <name>pData</name><comment>Pointer to SpecConstant data</comment></member>
         </type>
         <type category="struct" name="VkPipelineShaderStageCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineShaderStageCreateFlags</type>    <name>flags</name></member>             <!-- Reserved -->
-            <member><type>VkShaderStageFlagBits</type>  <name>stage</name></member>                          <!-- Shader stage -->
-            <member><type>VkShaderModule</type>         <name>module</name></member>                         <!-- Module containing entry point -->
-            <member len="null-terminated">const <type>char</type>*            <name>pName</name></member>                          <!-- Null-terminated entry point name -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineShaderStageCreateFlags</type>    <name>flags</name></member>
+            <member><type>VkShaderStageFlagBits</type>  <name>stage</name><comment>Shader stage</comment></member>
+            <member><type>VkShaderModule</type>         <name>module</name><comment>Module containing entry point</comment></member>
+            <member len="null-terminated">const <type>char</type>*            <name>pName</name><comment>Null-terminated entry point name</comment></member>
             <member optional="true">const <type>VkSpecializationInfo</type>* <name>pSpecializationInfo</name></member>
         </type>
         <type category="struct" name="VkComputePipelineCreateInfo">
             <member values="VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineCreateFlags</type>  <name>flags</name></member>                          <!-- Pipeline creation flags -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineCreateFlags</type>  <name>flags</name><comment>Pipeline creation flags</comment></member>
             <member><type>VkPipelineShaderStageCreateInfo</type> <name>stage</name></member>
-            <member><type>VkPipelineLayout</type>       <name>layout</name></member>                         <!-- Interface layout of the pipeline -->
-            <member noautovalidity="true" optional="true"><type>VkPipeline</type>      <name>basePipelineHandle</name></member>             <!-- If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of -->
-            <member><type>int32_t</type>                <name>basePipelineIndex</name></member>              <!-- If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of -->
+            <member><type>VkPipelineLayout</type>       <name>layout</name><comment>Interface layout of the pipeline</comment></member>
+            <member noautovalidity="true" optional="true"><type>VkPipeline</type>      <name>basePipelineHandle</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of</comment></member>
+            <member><type>int32_t</type>                <name>basePipelineIndex</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of</comment></member>
         </type>
         <type category="struct" name="VkVertexInputBindingDescription">
-            <member><type>uint32_t</type>               <name>binding</name></member>                        <!-- Vertex buffer binding id -->
-            <member><type>uint32_t</type>               <name>stride</name></member>                         <!-- Distance between vertices in bytes (0 = no advancement) -->
-            <member><type>VkVertexInputRate</type>      <name>inputRate</name></member>                      <!-- The rate at which the vertex data is consumed -->
+            <member><type>uint32_t</type>               <name>binding</name><comment>Vertex buffer binding id</comment></member>
+            <member><type>uint32_t</type>               <name>stride</name><comment>Distance between vertices in bytes (0 = no advancement)</comment></member>
+            <member><type>VkVertexInputRate</type>      <name>inputRate</name><comment>The rate at which the vertex data is consumed</comment></member>
         </type>
         <type category="struct" name="VkVertexInputAttributeDescription">
-            <member><type>uint32_t</type>               <name>location</name></member>                       <!-- location of the shader vertex attrib -->
-            <member><type>uint32_t</type>               <name>binding</name></member>                        <!-- Vertex buffer binding id -->
-            <member><type>VkFormat</type>               <name>format</name></member>                         <!-- format of source data -->
-            <member><type>uint32_t</type>               <name>offset</name></member>                         <!-- Offset of first element in bytes from base of vertex -->
+            <member><type>uint32_t</type>               <name>location</name><comment>location of the shader vertex attrib</comment></member>
+            <member><type>uint32_t</type>               <name>binding</name><comment>Vertex buffer binding id</comment></member>
+            <member><type>VkFormat</type>               <name>format</name><comment>format of source data</comment></member>
+            <member><type>uint32_t</type>               <name>offset</name><comment>Offset of first element in bytes from base of vertex</comment></member>
         </type>
         <type category="struct" name="VkPipelineVertexInputStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineVertexInputStateCreateFlags</type>    <name>flags</name></member>        <!-- Reserved -->
-            <member optional="true"><type>uint32_t</type>               <name>vertexBindingDescriptionCount</name></member>  <!-- number of bindings -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineVertexInputStateCreateFlags</type>    <name>flags</name></member>
+            <member optional="true"><type>uint32_t</type>               <name>vertexBindingDescriptionCount</name><comment>number of bindings</comment></member>
             <member len="vertexBindingDescriptionCount">const <type>VkVertexInputBindingDescription</type>* <name>pVertexBindingDescriptions</name></member>
-            <member optional="true"><type>uint32_t</type>               <name>vertexAttributeDescriptionCount</name></member> <!-- number of attributes -->
+            <member optional="true"><type>uint32_t</type>               <name>vertexAttributeDescriptionCount</name><comment>number of attributes</comment></member>
             <member len="vertexAttributeDescriptionCount">const <type>VkVertexInputAttributeDescription</type>* <name>pVertexAttributeDescriptions</name></member>
         </type>
         <type category="struct" name="VkPipelineInputAssemblyStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineInputAssemblyStateCreateFlags</type>    <name>flags</name></member>      <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineInputAssemblyStateCreateFlags</type>    <name>flags</name></member>
             <member><type>VkPrimitiveTopology</type>    <name>topology</name></member>
             <member><type>VkBool32</type>               <name>primitiveRestartEnable</name></member>
         </type>
         <type category="struct" name="VkPipelineTessellationStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineTessellationStateCreateFlags</type>    <name>flags</name></member>        <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineTessellationStateCreateFlags</type>    <name>flags</name></member>
             <member><type>uint32_t</type>               <name>patchControlPoints</name></member>
         </type>
         <type category="struct" name="VkPipelineViewportStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkPipelineViewportWScalingStateCreateInfoNV">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineViewportStateCreateFlags</type>    <name>flags</name></member>           <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineViewportStateCreateFlags</type>    <name>flags</name></member>
             <member><type>uint32_t</type>               <name>viewportCount</name></member>
             <member noautovalidity="true" optional="true" len="viewportCount">const <type>VkViewport</type>*      <name>pViewports</name></member>
             <member><type>uint32_t</type>               <name>scissorCount</name></member>
@@ -947,11 +952,11 @@
         </type>
         <type category="struct" name="VkPipelineRasterizationStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkPipelineRasterizationStateRasterizationOrderAMD">const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineRasterizationStateCreateFlags</type>    <name>flags</name></member>             <!-- Reserved -->
+            <member>const <type>void</type>* <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineRasterizationStateCreateFlags</type>    <name>flags</name></member>
             <member><type>VkBool32</type>               <name>depthClampEnable</name></member>
             <member><type>VkBool32</type>               <name>rasterizerDiscardEnable</name></member>
-            <member><type>VkPolygonMode</type>          <name>polygonMode</name></member>                       <!-- optional (GL45) -->
+            <member><type>VkPolygonMode</type>          <name>polygonMode</name><comment>optional (GL45)</comment></member>
             <member optional="true"><type>VkCullModeFlags</type>        <name>cullMode</name></member>
             <member><type>VkFrontFace</type>            <name>frontFace</name></member>
             <member><type>VkBool32</type>               <name>depthBiasEnable</name></member>
@@ -962,12 +967,12 @@
         </type>
         <type category="struct" name="VkPipelineMultisampleStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkPipelineCoverageToColorStateCreateInfoNV,VkPipelineCoverageModulationStateCreateInfoNV">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineMultisampleStateCreateFlags</type>    <name>flags</name></member>        <!-- Reserved -->
-            <member><type>VkSampleCountFlagBits</type>  <name>rasterizationSamples</name></member>           <!-- Number of samples used for rasterization -->
-            <member><type>VkBool32</type>               <name>sampleShadingEnable</name></member>            <!-- optional (GL45) -->
-            <member><type>float</type>                  <name>minSampleShading</name></member>               <!-- optional (GL45) -->
-            <member optional="true" len="latexmath:[\lceil{\mathit{rasterizationSamples} \over 32}\rceil]">const <type>VkSampleMask</type>*    <name>pSampleMask</name></member>                    <!-- Array of sampleMask words -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineMultisampleStateCreateFlags</type>    <name>flags</name></member>
+            <member><type>VkSampleCountFlagBits</type>  <name>rasterizationSamples</name><comment>Number of samples used for rasterization</comment></member>
+            <member><type>VkBool32</type>               <name>sampleShadingEnable</name><comment>optional (GL45)</comment></member>
+            <member><type>float</type>                  <name>minSampleShading</name><comment>optional (GL45)</comment></member>
+            <member optional="true" len="latexmath:[\lceil{\mathit{rasterizationSamples} \over 32}\rceil]">const <type>VkSampleMask</type>*    <name>pSampleMask</name><comment>Array of sampleMask words</comment></member>
             <member><type>VkBool32</type>               <name>alphaToCoverageEnable</name></member>
             <member><type>VkBool32</type>               <name>alphaToOneEnable</name></member>
         </type>
@@ -983,18 +988,18 @@
         </type>
         <type category="struct" name="VkPipelineColorBlendStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkPipelineColorBlendAdvancedStateCreateInfoEXT">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineColorBlendStateCreateFlags</type>    <name>flags</name></member>         <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineColorBlendStateCreateFlags</type>    <name>flags</name></member>
             <member><type>VkBool32</type>               <name>logicOpEnable</name></member>
             <member noautovalidity="true"><type>VkLogicOp</type>              <name>logicOp</name></member>
-            <member optional="true"><type>uint32_t</type>               <name>attachmentCount</name></member>                <!-- # of pAttachments -->
+            <member optional="true"><type>uint32_t</type>               <name>attachmentCount</name><comment># of pAttachments</comment></member>
             <member len="attachmentCount">const <type>VkPipelineColorBlendAttachmentState</type>* <name>pAttachments</name></member>
             <member><type>float</type>                  <name>blendConstants</name>[4]</member>
         </type>
         <type category="struct" name="VkPipelineDynamicStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineDynamicStateCreateFlags</type>    <name>flags</name></member>            <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineDynamicStateCreateFlags</type>    <name>flags</name></member>
             <member><type>uint32_t</type>               <name>dynamicStateCount</name></member>
             <member len="dynamicStateCount">const <type>VkDynamicState</type>*  <name>pDynamicStates</name></member>
         </type>
@@ -1009,12 +1014,12 @@
         </type>
         <type category="struct" name="VkPipelineDepthStencilStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineDepthStencilStateCreateFlags</type>    <name>flags</name></member>       <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineDepthStencilStateCreateFlags</type>    <name>flags</name></member>
             <member><type>VkBool32</type>               <name>depthTestEnable</name></member>
             <member><type>VkBool32</type>               <name>depthWriteEnable</name></member>
             <member><type>VkCompareOp</type>            <name>depthCompareOp</name></member>
-            <member><type>VkBool32</type>               <name>depthBoundsTestEnable</name></member>          <!-- optional (depth_bounds_test) -->
+            <member><type>VkBool32</type>               <name>depthBoundsTestEnable</name><comment>optional (depth_bounds_test)</comment></member>
             <member><type>VkBool32</type>               <name>stencilTestEnable</name></member>
             <member><type>VkStencilOpState</type>       <name>front</name></member>
             <member><type>VkStencilOpState</type>       <name>back</name></member>
@@ -1023,10 +1028,10 @@
         </type>
         <type category="struct" name="VkGraphicsPipelineCreateInfo">
             <member values="VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineCreateFlags</type>  <name>flags</name></member>                          <!-- Pipeline creation flags -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineCreateFlags</type>  <name>flags</name><comment>Pipeline creation flags</comment></member>
             <member><type>uint32_t</type>               <name>stageCount</name></member>
-            <member len="stageCount">const <type>VkPipelineShaderStageCreateInfo</type>* <name>pStages</name></member>        <!-- One entry for each active shader stage -->
+            <member len="stageCount">const <type>VkPipelineShaderStageCreateInfo</type>* <name>pStages</name><comment>One entry for each active shader stage</comment></member>
             <member>const <type>VkPipelineVertexInputStateCreateInfo</type>* <name>pVertexInputState</name></member>
             <member>const <type>VkPipelineInputAssemblyStateCreateInfo</type>* <name>pInputAssemblyState</name></member>
             <member noautovalidity="true" optional="true">const <type>VkPipelineTessellationStateCreateInfo</type>* <name>pTessellationState</name></member>
@@ -1036,40 +1041,40 @@
             <member noautovalidity="true" optional="true">const <type>VkPipelineDepthStencilStateCreateInfo</type>* <name>pDepthStencilState</name></member>
             <member noautovalidity="true" optional="true">const <type>VkPipelineColorBlendStateCreateInfo</type>* <name>pColorBlendState</name></member>
             <member optional="true">const <type>VkPipelineDynamicStateCreateInfo</type>* <name>pDynamicState</name></member>
-            <member><type>VkPipelineLayout</type>       <name>layout</name></member>                         <!-- Interface layout of the pipeline -->
+            <member><type>VkPipelineLayout</type>       <name>layout</name><comment>Interface layout of the pipeline</comment></member>
             <member><type>VkRenderPass</type>           <name>renderPass</name></member>
             <member><type>uint32_t</type>               <name>subpass</name></member>
-            <member noautovalidity="true" optional="true"><type>VkPipeline</type>      <name>basePipelineHandle</name></member>             <!-- If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of -->
-            <member><type>int32_t</type>                <name>basePipelineIndex</name></member>              <!-- If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of -->
+            <member noautovalidity="true" optional="true"><type>VkPipeline</type>      <name>basePipelineHandle</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of</comment></member>
+            <member><type>int32_t</type>                <name>basePipelineIndex</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of</comment></member>
         </type>
         <type category="struct" name="VkPipelineCacheCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineCacheCreateFlags</type>    <name>flags</name></member>                   <!-- Reserved -->
-            <member optional="true"><type>size_t</type>                 <name>initialDataSize</name></member>                <!-- Size of initial data to populate cache, in bytes -->
-            <member len="initialDataSize">const <type>void</type>*            <name>pInitialData</name></member>                    <!-- Initial data to populate cache -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineCacheCreateFlags</type>    <name>flags</name></member>
+            <member optional="true"><type>size_t</type>                 <name>initialDataSize</name><comment>Size of initial data to populate cache, in bytes</comment></member>
+            <member len="initialDataSize">const <type>void</type>*            <name>pInitialData</name><comment>Initial data to populate cache</comment></member>
         </type>
         <type category="struct" name="VkPushConstantRange">
-            <member><type>VkShaderStageFlags</type>     <name>stageFlags</name></member>                     <!-- Which stages use the range -->
-            <member><type>uint32_t</type>               <name>offset</name></member>                         <!-- Start of the range, in bytes -->
-            <member><type>uint32_t</type>               <name>size</name></member>                           <!-- Size of the range, in bytes -->
+            <member><type>VkShaderStageFlags</type>     <name>stageFlags</name><comment>Which stages use the range</comment></member>
+            <member><type>uint32_t</type>               <name>offset</name><comment>Start of the range, in bytes</comment></member>
+            <member><type>uint32_t</type>               <name>size</name><comment>Size of the range, in bytes</comment></member>
         </type>
         <type category="struct" name="VkPipelineLayoutCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineLayoutCreateFlags</type>    <name>flags</name></member>                  <!-- Reserved -->
-            <member optional="true"><type>uint32_t</type>               <name>setLayoutCount</name></member>                 <!-- Number of descriptor sets interfaced by the pipeline -->
-            <member len="setLayoutCount">const <type>VkDescriptorSetLayout</type>* <name>pSetLayouts</name></member>              <!-- Array of setCount number of descriptor set layout objects defining the layout of the -->
-            <member optional="true"><type>uint32_t</type>               <name>pushConstantRangeCount</name></member>         <!-- Number of push-constant ranges used by the pipeline -->
-            <member len="pushConstantRangeCount">const <type>VkPushConstantRange</type>* <name>pPushConstantRanges</name></member>        <!-- Array of pushConstantRangeCount number of ranges used by various shader stages -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineLayoutCreateFlags</type>    <name>flags</name></member>
+            <member optional="true"><type>uint32_t</type>               <name>setLayoutCount</name><comment>Number of descriptor sets interfaced by the pipeline</comment></member>
+            <member len="setLayoutCount">const <type>VkDescriptorSetLayout</type>* <name>pSetLayouts</name><comment>Array of setCount number of descriptor set layout objects defining the layout of the</comment></member>
+            <member optional="true"><type>uint32_t</type>               <name>pushConstantRangeCount</name><comment>Number of push-constant ranges used by the pipeline</comment></member>
+            <member len="pushConstantRangeCount">const <type>VkPushConstantRange</type>* <name>pPushConstantRanges</name><comment>Array of pushConstantRangeCount number of ranges used by various shader stages</comment></member>
         </type>
         <type category="struct" name="VkSamplerCreateInfo">
             <member values="VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkSamplerReductionModeCreateInfoEXT">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkSamplerCreateFlags</type>   <name>flags</name></member>                          <!-- Reserved -->
-            <member><type>VkFilter</type>               <name>magFilter</name></member>                      <!-- Filter mode for magnification -->
-            <member><type>VkFilter</type>               <name>minFilter</name></member>                      <!-- Filter mode for minifiation -->
-            <member><type>VkSamplerMipmapMode</type>    <name>mipmapMode</name></member>                     <!-- Mipmap selection mode -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkSamplerCreateFlags</type>   <name>flags</name></member>
+            <member><type>VkFilter</type>               <name>magFilter</name><comment>Filter mode for magnification</comment></member>
+            <member><type>VkFilter</type>               <name>minFilter</name><comment>Filter mode for minifiation</comment></member>
+            <member><type>VkSamplerMipmapMode</type>    <name>mipmapMode</name><comment>Mipmap selection mode</comment></member>
             <member><type>VkSamplerAddressMode</type>   <name>addressModeU</name></member>
             <member><type>VkSamplerAddressMode</type>   <name>addressModeV</name></member>
             <member><type>VkSamplerAddressMode</type>   <name>addressModeW</name></member>
@@ -1085,36 +1090,36 @@
         </type>
         <type category="struct" name="VkCommandPoolCreateInfo">
             <member values="VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkCommandPoolCreateFlags</type>   <name>flags</name></member>      <!-- Command pool creation flags -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkCommandPoolCreateFlags</type>   <name>flags</name><comment>Command pool creation flags</comment></member>
             <member><type>uint32_t</type>               <name>queueFamilyIndex</name></member>
         </type>
         <type category="struct" name="VkCommandBufferAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
             <member><type>VkCommandPool</type>          <name>commandPool</name></member>
             <member><type>VkCommandBufferLevel</type>   <name>level</name></member>
             <member><type>uint32_t</type>               <name>commandBufferCount</name></member>
         </type>
         <type category="struct" name="VkCommandBufferInheritanceInfo">
             <member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true" noautovalidity="true"><type>VkRenderPass</type>    <name>renderPass</name></member>                     <!-- Render pass for secondary command buffers -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true" noautovalidity="true"><type>VkRenderPass</type>    <name>renderPass</name><comment>Render pass for secondary command buffers</comment></member>
             <member><type>uint32_t</type>               <name>subpass</name></member>
-            <member optional="true" noautovalidity="true"><type>VkFramebuffer</type>   <name>framebuffer</name></member>                    <!-- Framebuffer for secondary command buffers -->
-            <member><type>VkBool32</type>               <name>occlusionQueryEnable</name></member>           <!-- Whether this secondary command buffer may be executed during an occlusion query -->
-            <member optional="true" noautovalidity="true"><type>VkQueryControlFlags</type>    <name>queryFlags</name></member>                     <!-- Query flags used by this secondary command buffer, if executed during an occlusion query -->
-            <member optional="true" noautovalidity="true"><type>VkQueryPipelineStatisticFlags</type> <name>pipelineStatistics</name></member>      <!-- Pipeline statistics that may be counted for this secondary command buffer -->
+            <member optional="true" noautovalidity="true"><type>VkFramebuffer</type>   <name>framebuffer</name><comment>Framebuffer for secondary command buffers</comment></member>
+            <member><type>VkBool32</type>               <name>occlusionQueryEnable</name><comment>Whether this secondary command buffer may be executed during an occlusion query</comment></member>
+            <member optional="true" noautovalidity="true"><type>VkQueryControlFlags</type>    <name>queryFlags</name><comment>Query flags used by this secondary command buffer, if executed during an occlusion query</comment></member>
+            <member optional="true" noautovalidity="true"><type>VkQueryPipelineStatisticFlags</type> <name>pipelineStatistics</name><comment>Pipeline statistics that may be counted for this secondary command buffer</comment></member>
         </type>
         <type category="struct" name="VkCommandBufferBeginInfo">
             <member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDeviceGroupCommandBufferBeginInfoKHX">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkCommandBufferUsageFlags</type>  <name>flags</name></member>                          <!-- Command buffer usage flags -->
-            <member optional="true" noautovalidity="true">const <type>VkCommandBufferInheritanceInfo</type>*       <name>pInheritanceInfo</name></member>                          <!-- Pointer to inheritance info for secondary command buffers -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkCommandBufferUsageFlags</type>  <name>flags</name><comment>Command buffer usage flags</comment></member>
+            <member optional="true" noautovalidity="true">const <type>VkCommandBufferInheritanceInfo</type>*       <name>pInheritanceInfo</name><comment>Pointer to inheritance info for secondary command buffers</comment></member>
         </type>
         <type category="struct" name="VkRenderPassBeginInfo">
             <member values="VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDeviceGroupRenderPassBeginInfoKHX">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
             <member><type>VkRenderPass</type>           <name>renderPass</name></member>
             <member><type>VkFramebuffer</type>          <name>framebuffer</name></member>
             <member><type>VkRect2D</type>               <name>renderArea</name></member>
@@ -1143,10 +1148,10 @@
             <member optional="true"><type>VkAttachmentDescriptionFlags</type> <name>flags</name></member>
             <member><type>VkFormat</type>               <name>format</name></member>
             <member><type>VkSampleCountFlagBits</type>  <name>samples</name></member>
-            <member><type>VkAttachmentLoadOp</type>     <name>loadOp</name></member>                         <!-- Load operation for color or depth data -->
-            <member><type>VkAttachmentStoreOp</type>    <name>storeOp</name></member>                        <!-- Store operation for color or depth data -->
-            <member><type>VkAttachmentLoadOp</type>     <name>stencilLoadOp</name></member>                  <!-- Load operation for stencil data -->
-            <member><type>VkAttachmentStoreOp</type>    <name>stencilStoreOp</name></member>                 <!-- Store operation for stencil data -->
+            <member><type>VkAttachmentLoadOp</type>     <name>loadOp</name><comment>Load operation for color or depth data</comment></member>
+            <member><type>VkAttachmentStoreOp</type>    <name>storeOp</name><comment>Store operation for color or depth data</comment></member>
+            <member><type>VkAttachmentLoadOp</type>     <name>stencilLoadOp</name><comment>Load operation for stencil data</comment></member>
+            <member><type>VkAttachmentStoreOp</type>    <name>stencilStoreOp</name><comment>Store operation for stencil data</comment></member>
             <member><type>VkImageLayout</type>          <name>initialLayout</name></member>
             <member><type>VkImageLayout</type>          <name>finalLayout</name></member>
         </type>
@@ -1156,7 +1161,7 @@
         </type>
         <type category="struct" name="VkSubpassDescription">
             <member optional="true"><type>VkSubpassDescriptionFlags</type> <name>flags</name></member>
-            <member><type>VkPipelineBindPoint</type>    <name>pipelineBindPoint</name></member>              <!-- Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now -->
+            <member><type>VkPipelineBindPoint</type>    <name>pipelineBindPoint</name><comment>Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now</comment></member>
             <member optional="true"><type>uint32_t</type>               <name>inputAttachmentCount</name></member>
             <member len="inputAttachmentCount">const <type>VkAttachmentReference</type>* <name>pInputAttachments</name></member>
             <member optional="true"><type>uint32_t</type>               <name>colorAttachmentCount</name></member>
@@ -1171,14 +1176,14 @@
             <member><type>uint32_t</type>               <name>dstSubpass</name></member>
             <member><type>VkPipelineStageFlags</type>   <name>srcStageMask</name></member>
             <member><type>VkPipelineStageFlags</type>   <name>dstStageMask</name></member>
-            <member optional="true"><type>VkAccessFlags</type>          <name>srcAccessMask</name></member>                  <!-- Memory accesses from the source of the dependency to synchronize -->
-            <member optional="true"><type>VkAccessFlags</type>          <name>dstAccessMask</name></member>                  <!-- Memory accesses from the destination of the dependency to synchronize -->
+            <member optional="true"><type>VkAccessFlags</type>          <name>srcAccessMask</name><comment>Memory accesses from the source of the dependency to synchronize</comment></member>
+            <member optional="true"><type>VkAccessFlags</type>          <name>dstAccessMask</name><comment>Memory accesses from the destination of the dependency to synchronize</comment></member>
             <member optional="true"><type>VkDependencyFlags</type>      <name>dependencyFlags</name></member>
         </type>
         <type category="struct" name="VkRenderPassCreateInfo">
             <member values="VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkRenderPassCreateFlags</type>    <name>flags</name></member>                      <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkRenderPassCreateFlags</type>    <name>flags</name></member>
             <member optional="true"><type>uint32_t</type>   <name>attachmentCount</name></member>
             <member len="attachmentCount">const <type>VkAttachmentDescription</type>* <name>pAttachments</name></member>
             <member><type>uint32_t</type>               <name>subpassCount</name></member>
@@ -1188,212 +1193,212 @@
         </type>
         <type category="struct" name="VkEventCreateInfo">
             <member values="VK_STRUCTURE_TYPE_EVENT_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkEventCreateFlags</type>     <name>flags</name></member>                          <!-- Event creation flags -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkEventCreateFlags</type>     <name>flags</name><comment>Event creation flags</comment></member>
         </type>
         <type category="struct" name="VkFenceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_FENCE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkExportFenceCreateInfoKHR,VkExportFenceWin32HandleInfoKHR">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkFenceCreateFlags</type>     <name>flags</name></member>                          <!-- Fence creation flags -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkFenceCreateFlags</type>     <name>flags</name><comment>Fence creation flags</comment></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceFeatures">
-            <member><type>VkBool32</type>               <name>robustBufferAccess</name></member>                <!-- out of bounds buffer accesses are well defined -->
-            <member><type>VkBool32</type>               <name>fullDrawIndexUint32</name></member>               <!-- full 32-bit range of indices for indexed draw calls -->
-            <member><type>VkBool32</type>               <name>imageCubeArray</name></member>                    <!-- image views which are arrays of cube maps -->
-            <member><type>VkBool32</type>               <name>independentBlend</name></member>                  <!-- blending operations are controlled per-attachment -->
-            <member><type>VkBool32</type>               <name>geometryShader</name></member>                    <!-- geometry stage -->
-            <member><type>VkBool32</type>               <name>tessellationShader</name></member>                <!-- tessellation control and evaluation stage -->
-            <member><type>VkBool32</type>               <name>sampleRateShading</name></member>                 <!-- per-sample shading and interpolation -->
-            <member><type>VkBool32</type>               <name>dualSrcBlend</name></member>                      <!-- blend operations which take two sources -->
-            <member><type>VkBool32</type>               <name>logicOp</name></member>                           <!-- logic operations -->
-            <member><type>VkBool32</type>               <name>multiDrawIndirect</name></member>                 <!-- multi draw indirect -->
-            <member><type>VkBool32</type>               <name>drawIndirectFirstInstance</name></member>         <!-- indirect draws can use non-zero firstInstance -->
-            <member><type>VkBool32</type>               <name>depthClamp</name></member>                        <!-- depth clamping -->
-            <member><type>VkBool32</type>               <name>depthBiasClamp</name></member>                    <!-- depth bias clamping -->
-            <member><type>VkBool32</type>               <name>fillModeNonSolid</name></member>                  <!-- point and wireframe fill modes -->
-            <member><type>VkBool32</type>               <name>depthBounds</name></member>                       <!-- depth bounds test -->
-            <member><type>VkBool32</type>               <name>wideLines</name></member>                         <!-- lines with width greater than 1 -->
-            <member><type>VkBool32</type>               <name>largePoints</name></member>                       <!-- points with size greater than 1 -->
-            <member><type>VkBool32</type>               <name>alphaToOne</name></member>                        <!-- the fragment alpha component can be forced to maximum representable alpha value -->
-            <member><type>VkBool32</type>               <name>multiViewport</name></member>                     <!-- viewport arrays -->
-            <member><type>VkBool32</type>               <name>samplerAnisotropy</name></member>                 <!-- anisotropic sampler filtering -->
-            <member><type>VkBool32</type>               <name>textureCompressionETC2</name></member>            <!-- ETC texture compression formats -->
-            <member><type>VkBool32</type>               <name>textureCompressionASTC_LDR</name></member>        <!-- ASTC LDR texture compression formats -->
-            <member><type>VkBool32</type>               <name>textureCompressionBC</name></member>              <!-- BC1-7 texture compressed formats -->
-            <member><type>VkBool32</type>               <name>occlusionQueryPrecise</name></member>             <!-- precise occlusion queries returning actual sample counts -->
-            <member><type>VkBool32</type>               <name>pipelineStatisticsQuery</name></member>           <!-- pipeline statistics query -->
-            <member><type>VkBool32</type>               <name>vertexPipelineStoresAndAtomics</name></member>    <!-- stores and atomic ops on storage buffers and images are supported in vertex, tessellation, and geometry stages -->
-            <member><type>VkBool32</type>               <name>fragmentStoresAndAtomics</name></member>          <!-- stores and atomic ops on storage buffers and images are supported in the fragment stage -->
-            <member><type>VkBool32</type>               <name>shaderTessellationAndGeometryPointSize</name></member><!-- tessellation and geometry stages can export point size -->
-            <member><type>VkBool32</type>               <name>shaderImageGatherExtended</name></member>         <!-- image gather with run-time values and independent offsets -->
-            <member><type>VkBool32</type>               <name>shaderStorageImageExtendedFormats</name></member> <!-- the extended set of formats can be used for storage images -->
-            <member><type>VkBool32</type>               <name>shaderStorageImageMultisample</name></member>     <!-- multisample images can be used for storage images -->
-            <member><type>VkBool32</type>               <name>shaderStorageImageReadWithoutFormat</name></member>       <!-- read from storage image does not require format qualifier -->
-            <member><type>VkBool32</type>               <name>shaderStorageImageWriteWithoutFormat</name></member>      <!-- write to storage image does not require format qualifier -->
-            <member><type>VkBool32</type>               <name>shaderUniformBufferArrayDynamicIndexing</name></member>   <!-- arrays of uniform buffers can be accessed with dynamically uniform indices -->
-            <member><type>VkBool32</type>               <name>shaderSampledImageArrayDynamicIndexing</name></member>    <!-- arrays of sampled images can be accessed with dynamically uniform indices -->
-            <member><type>VkBool32</type>               <name>shaderStorageBufferArrayDynamicIndexing</name></member>   <!-- arrays of storage buffers can be accessed with dynamically uniform indices -->
-            <member><type>VkBool32</type>               <name>shaderStorageImageArrayDynamicIndexing</name></member>    <!-- arrays of storage images can be accessed with dynamically uniform indices -->
-            <member><type>VkBool32</type>               <name>shaderClipDistance</name></member>                <!-- clip distance in shaders -->
-            <member><type>VkBool32</type>               <name>shaderCullDistance</name></member>                <!-- cull distance in shaders -->
-            <member><type>VkBool32</type>               <name>shaderFloat64</name></member>                     <!-- 64-bit floats (doubles) in shaders -->
-            <member><type>VkBool32</type>               <name>shaderInt64</name></member>                       <!-- 64-bit integers in shaders -->
-            <member><type>VkBool32</type>               <name>shaderInt16</name></member>                       <!-- 16-bit integers in shaders -->
-            <member><type>VkBool32</type>               <name>shaderResourceResidency</name></member>           <!-- shader can use texture operations that return resource residency information (requires sparseNonResident support) -->
-            <member><type>VkBool32</type>               <name>shaderResourceMinLod</name></member>              <!-- shader can use texture operations that specify minimum resource level of detail -->
-            <member><type>VkBool32</type>               <name>sparseBinding</name></member>                     <!-- Sparse resources support: Resource memory can be managed at opaque page level rather than object level -->
-            <member><type>VkBool32</type>               <name>sparseResidencyBuffer</name></member>             <!-- Sparse resources support: GPU can access partially resident buffers  -->
-            <member><type>VkBool32</type>               <name>sparseResidencyImage2D</name></member>            <!-- Sparse resources support: GPU can access partially resident 2D (non-MSAA non-depth/stencil) images  -->
-            <member><type>VkBool32</type>               <name>sparseResidencyImage3D</name></member>            <!-- Sparse resources support: GPU can access partially resident 3D images  -->
-            <member><type>VkBool32</type>               <name>sparseResidency2Samples</name></member>           <!-- Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples -->
-            <member><type>VkBool32</type>               <name>sparseResidency4Samples</name></member>           <!-- Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples -->
-            <member><type>VkBool32</type>               <name>sparseResidency8Samples</name></member>           <!-- Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples -->
-            <member><type>VkBool32</type>               <name>sparseResidency16Samples</name></member>          <!-- Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples -->
-            <member><type>VkBool32</type>               <name>sparseResidencyAliased</name></member>            <!-- Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in) -->
-            <member><type>VkBool32</type>               <name>variableMultisampleRate</name></member>           <!-- multisample rate must be the same for all pipelines in a subpass -->
-            <member><type>VkBool32</type>               <name>inheritedQueries</name></member>                  <!-- Queries may be inherited from primary to secondary command buffers -->
+            <member><type>VkBool32</type>               <name>robustBufferAccess</name><comment>out of bounds buffer accesses are well defined</comment></member>
+            <member><type>VkBool32</type>               <name>fullDrawIndexUint32</name><comment>full 32-bit range of indices for indexed draw calls</comment></member>
+            <member><type>VkBool32</type>               <name>imageCubeArray</name><comment>image views which are arrays of cube maps</comment></member>
+            <member><type>VkBool32</type>               <name>independentBlend</name><comment>blending operations are controlled per-attachment</comment></member>
+            <member><type>VkBool32</type>               <name>geometryShader</name><comment>geometry stage</comment></member>
+            <member><type>VkBool32</type>               <name>tessellationShader</name><comment>tessellation control and evaluation stage</comment></member>
+            <member><type>VkBool32</type>               <name>sampleRateShading</name><comment>per-sample shading and interpolation</comment></member>
+            <member><type>VkBool32</type>               <name>dualSrcBlend</name><comment>blend operations which take two sources</comment></member>
+            <member><type>VkBool32</type>               <name>logicOp</name><comment>logic operations</comment></member>
+            <member><type>VkBool32</type>               <name>multiDrawIndirect</name><comment>multi draw indirect</comment></member>
+            <member><type>VkBool32</type>               <name>drawIndirectFirstInstance</name><comment>indirect draws can use non-zero firstInstance</comment></member>
+            <member><type>VkBool32</type>               <name>depthClamp</name><comment>depth clamping</comment></member>
+            <member><type>VkBool32</type>               <name>depthBiasClamp</name><comment>depth bias clamping</comment></member>
+            <member><type>VkBool32</type>               <name>fillModeNonSolid</name><comment>point and wireframe fill modes</comment></member>
+            <member><type>VkBool32</type>               <name>depthBounds</name><comment>depth bounds test</comment></member>
+            <member><type>VkBool32</type>               <name>wideLines</name><comment>lines with width greater than 1</comment></member>
+            <member><type>VkBool32</type>               <name>largePoints</name><comment>points with size greater than 1</comment></member>
+            <member><type>VkBool32</type>               <name>alphaToOne</name><comment>the fragment alpha component can be forced to maximum representable alpha value</comment></member>
+            <member><type>VkBool32</type>               <name>multiViewport</name><comment>viewport arrays</comment></member>
+            <member><type>VkBool32</type>               <name>samplerAnisotropy</name><comment>anisotropic sampler filtering</comment></member>
+            <member><type>VkBool32</type>               <name>textureCompressionETC2</name><comment>ETC texture compression formats</comment></member>
+            <member><type>VkBool32</type>               <name>textureCompressionASTC_LDR</name><comment>ASTC LDR texture compression formats</comment></member>
+            <member><type>VkBool32</type>               <name>textureCompressionBC</name><comment>BC1-7 texture compressed formats</comment></member>
+            <member><type>VkBool32</type>               <name>occlusionQueryPrecise</name><comment>precise occlusion queries returning actual sample counts</comment></member>
+            <member><type>VkBool32</type>               <name>pipelineStatisticsQuery</name><comment>pipeline statistics query</comment></member>
+            <member><type>VkBool32</type>               <name>vertexPipelineStoresAndAtomics</name><comment>stores and atomic ops on storage buffers and images are supported in vertex, tessellation, and geometry stages</comment></member>
+            <member><type>VkBool32</type>               <name>fragmentStoresAndAtomics</name><comment>stores and atomic ops on storage buffers and images are supported in the fragment stage</comment></member>
+            <member><type>VkBool32</type>               <name>shaderTessellationAndGeometryPointSize</name><comment>tessellation and geometry stages can export point size</comment></member>
+            <member><type>VkBool32</type>               <name>shaderImageGatherExtended</name><comment>image gather with run-time values and independent offsets</comment></member>
+            <member><type>VkBool32</type>               <name>shaderStorageImageExtendedFormats</name><comment>the extended set of formats can be used for storage images</comment></member>
+            <member><type>VkBool32</type>               <name>shaderStorageImageMultisample</name><comment>multisample images can be used for storage images</comment></member>
+            <member><type>VkBool32</type>               <name>shaderStorageImageReadWithoutFormat</name><comment>read from storage image does not require format qualifier</comment></member>
+            <member><type>VkBool32</type>               <name>shaderStorageImageWriteWithoutFormat</name><comment>write to storage image does not require format qualifier</comment></member>
+            <member><type>VkBool32</type>               <name>shaderUniformBufferArrayDynamicIndexing</name><comment>arrays of uniform buffers can be accessed with dynamically uniform indices</comment></member>
+            <member><type>VkBool32</type>               <name>shaderSampledImageArrayDynamicIndexing</name><comment>arrays of sampled images can be accessed with dynamically uniform indices</comment></member>
+            <member><type>VkBool32</type>               <name>shaderStorageBufferArrayDynamicIndexing</name><comment>arrays of storage buffers can be accessed with dynamically uniform indices</comment></member>
+            <member><type>VkBool32</type>               <name>shaderStorageImageArrayDynamicIndexing</name><comment>arrays of storage images can be accessed with dynamically uniform indices</comment></member>
+            <member><type>VkBool32</type>               <name>shaderClipDistance</name><comment>clip distance in shaders</comment></member>
+            <member><type>VkBool32</type>               <name>shaderCullDistance</name><comment>cull distance in shaders</comment></member>
+            <member><type>VkBool32</type>               <name>shaderFloat64</name><comment>64-bit floats (doubles) in shaders</comment></member>
+            <member><type>VkBool32</type>               <name>shaderInt64</name><comment>64-bit integers in shaders</comment></member>
+            <member><type>VkBool32</type>               <name>shaderInt16</name><comment>16-bit integers in shaders</comment></member>
+            <member><type>VkBool32</type>               <name>shaderResourceResidency</name><comment>shader can use texture operations that return resource residency information (requires sparseNonResident support)</comment></member>
+            <member><type>VkBool32</type>               <name>shaderResourceMinLod</name><comment>shader can use texture operations that specify minimum resource level of detail</comment></member>
+            <member><type>VkBool32</type>               <name>sparseBinding</name><comment>Sparse resources support: Resource memory can be managed at opaque page level rather than object level</comment></member>
+            <member><type>VkBool32</type>               <name>sparseResidencyBuffer</name><comment>Sparse resources support: GPU can access partially resident buffers </comment></member>
+            <member><type>VkBool32</type>               <name>sparseResidencyImage2D</name><comment>Sparse resources support: GPU can access partially resident 2D (non-MSAA non-depth/stencil) images </comment></member>
+            <member><type>VkBool32</type>               <name>sparseResidencyImage3D</name><comment>Sparse resources support: GPU can access partially resident 3D images </comment></member>
+            <member><type>VkBool32</type>               <name>sparseResidency2Samples</name><comment>Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples</comment></member>
+            <member><type>VkBool32</type>               <name>sparseResidency4Samples</name><comment>Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples</comment></member>
+            <member><type>VkBool32</type>               <name>sparseResidency8Samples</name><comment>Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples</comment></member>
+            <member><type>VkBool32</type>               <name>sparseResidency16Samples</name><comment>Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples</comment></member>
+            <member><type>VkBool32</type>               <name>sparseResidencyAliased</name><comment>Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)</comment></member>
+            <member><type>VkBool32</type>               <name>variableMultisampleRate</name><comment>multisample rate must be the same for all pipelines in a subpass</comment></member>
+            <member><type>VkBool32</type>               <name>inheritedQueries</name><comment>Queries may be inherited from primary to secondary command buffers</comment></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceSparseProperties" returnedonly="true">
-            <member><type>VkBool32</type>               <name>residencyStandard2DBlockShape</name></member> <!-- Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard sparse image block shapes (based on pixel format) -->
-            <member><type>VkBool32</type>               <name>residencyStandard2DMultisampleBlockShape</name></member> <!-- Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard sparse image block shapes (based on pixel format) -->
-            <member><type>VkBool32</type>               <name>residencyStandard3DBlockShape</name></member> <!-- Sparse resources support: GPU will access all 3D sparse resources using the standard sparse image block shapes (based on pixel format) -->
-            <member><type>VkBool32</type>               <name>residencyAlignedMipSize</name></member>     <!-- Sparse resources support: Images with mip level dimensions that are NOT a multiple of the sparse image block dimensions will be placed in the mip tail -->
-            <member><type>VkBool32</type>               <name>residencyNonResidentStrict</name></member>  <!-- Sparse resources support: GPU can consistently access non-resident regions of a resource, all reads return as if data is 0, writes are discarded -->
+            <member><type>VkBool32</type>               <name>residencyStandard2DBlockShape</name><comment>Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard sparse image block shapes (based on pixel format)</comment></member>
+            <member><type>VkBool32</type>               <name>residencyStandard2DMultisampleBlockShape</name><comment>Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard sparse image block shapes (based on pixel format)</comment></member>
+            <member><type>VkBool32</type>               <name>residencyStandard3DBlockShape</name><comment>Sparse resources support: GPU will access all 3D sparse resources using the standard sparse image block shapes (based on pixel format)</comment></member>
+            <member><type>VkBool32</type>               <name>residencyAlignedMipSize</name><comment>Sparse resources support: Images with mip level dimensions that are NOT a multiple of the sparse image block dimensions will be placed in the mip tail</comment></member>
+            <member><type>VkBool32</type>               <name>residencyNonResidentStrict</name><comment>Sparse resources support: GPU can consistently access non-resident regions of a resource, all reads return as if data is 0, writes are discarded</comment></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceLimits" returnedonly="true">
-                <!-- resource maximum sizes -->
-            <member><type>uint32_t</type>               <name>maxImageDimension1D</name></member>               <!-- max 1D image dimension -->
-            <member><type>uint32_t</type>               <name>maxImageDimension2D</name></member>               <!-- max 2D image dimension -->
-            <member><type>uint32_t</type>               <name>maxImageDimension3D</name></member>               <!-- max 3D image dimension -->
-            <member><type>uint32_t</type>               <name>maxImageDimensionCube</name></member>             <!-- max cubemap image dimension -->
-            <member><type>uint32_t</type>               <name>maxImageArrayLayers</name></member>               <!-- max layers for image arrays -->
-            <member><type>uint32_t</type>               <name>maxTexelBufferElements</name></member>            <!-- max texel buffer size (fstexels) -->
-            <member><type>uint32_t</type>               <name>maxUniformBufferRange</name></member>             <!-- max uniform buffer range (bytes) -->
-            <member><type>uint32_t</type>               <name>maxStorageBufferRange</name></member>             <!-- max storage buffer range (bytes) -->
-            <member><type>uint32_t</type>               <name>maxPushConstantsSize</name></member>              <!-- max size of the push constants pool (bytes) -->
-                <!-- memory limits -->
-            <member><type>uint32_t</type>               <name>maxMemoryAllocationCount</name></member>          <!-- max number of device memory allocations supported -->
-            <member><type>uint32_t</type>               <name>maxSamplerAllocationCount</name></member>         <!-- max number of samplers that can be allocated on a device -->
-            <member><type>VkDeviceSize</type>           <name>bufferImageGranularity</name></member>            <!-- Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage -->
-            <member><type>VkDeviceSize</type>           <name>sparseAddressSpaceSize</name></member>            <!-- Total address space available for sparse allocations (bytes) -->
-                <!-- descriptor set limits -->
-            <member><type>uint32_t</type>               <name>maxBoundDescriptorSets</name></member>                <!-- max number of descriptors sets that can be bound to a pipeline -->
-            <member><type>uint32_t</type>               <name>maxPerStageDescriptorSamplers</name></member>         <!-- max number of samplers allowed per-stage in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxPerStageDescriptorUniformBuffers</name></member>   <!-- max number of uniform buffers allowed per-stage in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxPerStageDescriptorStorageBuffers</name></member>   <!-- max number of storage buffers allowed per-stage in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxPerStageDescriptorSampledImages</name></member>    <!-- max number of sampled images allowed per-stage in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxPerStageDescriptorStorageImages</name></member>    <!-- max number of storage images allowed per-stage in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxPerStageDescriptorInputAttachments</name></member> <!-- max number of input attachments allowed per-stage in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxPerStageResources</name></member>                  <!-- max number of resources allowed by a single stage -->
-            <member><type>uint32_t</type>               <name>maxDescriptorSetSamplers</name></member>              <!-- max number of samplers allowed in all stages in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxDescriptorSetUniformBuffers</name></member>        <!-- max number of uniform buffers allowed in all stages in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxDescriptorSetUniformBuffersDynamic</name></member> <!-- max number of dynamic uniform buffers allowed in all stages in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxDescriptorSetStorageBuffers</name></member>        <!-- max number of storage buffers allowed in all stages in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxDescriptorSetStorageBuffersDynamic</name></member> <!-- max number of dynamic storage buffers allowed in all stages in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxDescriptorSetSampledImages</name></member>         <!-- max number of sampled images allowed in all stages in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxDescriptorSetStorageImages</name></member>         <!-- max number of storage images allowed in all stages in a descriptor set -->
-            <member><type>uint32_t</type>               <name>maxDescriptorSetInputAttachments</name></member>      <!-- max number of input attachments allowed in all stages in a descriptor set -->
-                <!-- vertex stage limits -->
-            <member><type>uint32_t</type>               <name>maxVertexInputAttributes</name></member>          <!-- max number of vertex input attribute slots -->
-            <member><type>uint32_t</type>               <name>maxVertexInputBindings</name></member>            <!-- max number of vertex input binding slots -->
-            <member><type>uint32_t</type>               <name>maxVertexInputAttributeOffset</name></member>     <!-- max vertex input attribute offset added to vertex buffer offset -->
-            <member><type>uint32_t</type>               <name>maxVertexInputBindingStride</name></member>       <!-- max vertex input binding stride -->
-            <member><type>uint32_t</type>               <name>maxVertexOutputComponents</name></member>         <!-- max number of output components written by vertex shader -->
-                <!-- tessellation control stage limits -->
-            <member><type>uint32_t</type>               <name>maxTessellationGenerationLevel</name></member>                   <!-- max level supported by tessellation primitive generator -->
-            <member><type>uint32_t</type>               <name>maxTessellationPatchSize</name></member>                  <!-- max patch size (vertices) -->
-            <member><type>uint32_t</type>               <name>maxTessellationControlPerVertexInputComponents</name></member>    <!-- max number of input components per-vertex in TCS -->
-            <member><type>uint32_t</type>               <name>maxTessellationControlPerVertexOutputComponents</name></member>   <!-- max number of output components per-vertex in TCS -->
-            <member><type>uint32_t</type>               <name>maxTessellationControlPerPatchOutputComponents</name></member>    <!-- max number of output components per-patch in TCS -->
-            <member><type>uint32_t</type>               <name>maxTessellationControlTotalOutputComponents</name></member>       <!-- max total number of per-vertex and per-patch output components in TCS -->
-                <!-- tessellation evaluation stage limits -->
-            <member><type>uint32_t</type>               <name>maxTessellationEvaluationInputComponents</name></member>  <!-- max number of input components per vertex in TES -->
-            <member><type>uint32_t</type>               <name>maxTessellationEvaluationOutputComponents</name></member> <!-- max number of output components per vertex in TES -->
-                <!-- geometry stage limits -->
-            <member><type>uint32_t</type>               <name>maxGeometryShaderInvocations</name></member>      <!-- max invocation count supported in geometry shader -->
-            <member><type>uint32_t</type>               <name>maxGeometryInputComponents</name></member>        <!-- max number of input components read in geometry stage -->
-            <member><type>uint32_t</type>               <name>maxGeometryOutputComponents</name></member>       <!-- max number of output components written in geometry stage -->
-            <member><type>uint32_t</type>               <name>maxGeometryOutputVertices</name></member>         <!-- max number of vertices that can be emitted in geometry stage -->
-            <member><type>uint32_t</type>               <name>maxGeometryTotalOutputComponents</name></member>  <!-- max total number of components (all vertices) written in geometry stage -->
-                <!-- fragment stage limits -->
-            <member><type>uint32_t</type>               <name>maxFragmentInputComponents</name></member>        <!-- max number of input compontents read in fragment stage -->
-            <member><type>uint32_t</type>               <name>maxFragmentOutputAttachments</name></member>      <!-- max number of output attachments written in fragment stage -->
-            <member><type>uint32_t</type>               <name>maxFragmentDualSrcAttachments</name></member>     <!-- max number of output attachments written when using dual source blending -->
-            <member><type>uint32_t</type>               <name>maxFragmentCombinedOutputResources</name></member><!-- max total number of storage buffers, storage images and output buffers -->
-                <!-- compute stage limits -->
-            <member><type>uint32_t</type>               <name>maxComputeSharedMemorySize</name></member>        <!-- max total storage size of work group local storage (bytes) -->
-            <member><type>uint32_t</type>               <name>maxComputeWorkGroupCount</name>[3]</member>       <!-- max num of compute work groups that may be dispatched by a single command (x,y,z) -->
-            <member><type>uint32_t</type>               <name>maxComputeWorkGroupInvocations</name></member>    <!-- max total compute invocations in a single local work group -->
-            <member><type>uint32_t</type>               <name>maxComputeWorkGroupSize</name>[3]</member>        <!-- max local size of a compute work group (x,y,z) -->
-            <member><type>uint32_t</type>               <name>subPixelPrecisionBits</name></member>             <!-- number bits of subpixel precision in screen x and y-->
-            <member><type>uint32_t</type>               <name>subTexelPrecisionBits</name></member>             <!-- number bits of precision for selecting texel weights-->
-            <member><type>uint32_t</type>               <name>mipmapPrecisionBits</name></member>               <!-- number bits of precision for selecting mipmap weights -->
-            <member><type>uint32_t</type>               <name>maxDrawIndexedIndexValue</name></member>          <!-- max index value for indexed draw calls (for 32-bit indices) -->
-            <member><type>uint32_t</type>               <name>maxDrawIndirectCount</name></member>              <!-- max draw count for indirect draw calls -->
-            <member><type>float</type>                  <name>maxSamplerLodBias</name></member>                 <!-- max absolute sampler level of detail bias -->
-            <member><type>float</type>                  <name>maxSamplerAnisotropy</name></member>              <!-- max degree of sampler anisotropy -->
-            <member><type>uint32_t</type>               <name>maxViewports</name></member>                      <!-- max number of active viewports -->
-            <member><type>uint32_t</type>               <name>maxViewportDimensions</name>[2]</member>          <!-- max viewport dimensions (x,y) -->
-            <member><type>float</type>                  <name>viewportBoundsRange</name>[2]</member>            <!-- viewport bounds range (min,max) -->
-            <member><type>uint32_t</type>               <name>viewportSubPixelBits</name></member>              <!-- number bits of subpixel precision for viewport -->
-            <member><type>size_t</type>                 <name>minMemoryMapAlignment</name></member>             <!-- min required alignment of pointers returned by MapMemory (bytes) -->
-            <member><type>VkDeviceSize</type>           <name>minTexelBufferOffsetAlignment</name></member>     <!-- min required alignment for texel buffer offsets (bytes)  -->
-            <member><type>VkDeviceSize</type>           <name>minUniformBufferOffsetAlignment</name></member>   <!-- min required alignment for uniform buffer sizes and offsets (bytes) -->
-            <member><type>VkDeviceSize</type>           <name>minStorageBufferOffsetAlignment</name></member>   <!-- min required alignment for storage buffer offsets (bytes) -->
-            <member><type>int32_t</type>                <name>minTexelOffset</name></member>                    <!-- min texel offset for OpTextureSampleOffset -->
-            <member><type>uint32_t</type>               <name>maxTexelOffset</name></member>                    <!-- max texel offset for OpTextureSampleOffset -->
-            <member><type>int32_t</type>                <name>minTexelGatherOffset</name></member>              <!-- min texel offset for OpTextureGatherOffset -->
-            <member><type>uint32_t</type>               <name>maxTexelGatherOffset</name></member>              <!-- max texel offset for OpTextureGatherOffset -->
-            <member><type>float</type>                  <name>minInterpolationOffset</name></member>            <!-- furthest negative offset for interpolateAtOffset -->
-            <member><type>float</type>                  <name>maxInterpolationOffset</name></member>            <!-- furthest positive offset for interpolateAtOffset -->
-            <member><type>uint32_t</type>               <name>subPixelInterpolationOffsetBits</name></member>   <!-- number of subpixel bits for interpolateAtOffset -->
-            <member><type>uint32_t</type>               <name>maxFramebufferWidth</name></member>               <!-- max width for a framebuffer -->
-            <member><type>uint32_t</type>               <name>maxFramebufferHeight</name></member>              <!-- max height for a framebuffer -->
-            <member><type>uint32_t</type>               <name>maxFramebufferLayers</name></member>              <!-- max layer count for a layered framebuffer -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>framebufferColorSampleCounts</name></member>      <!-- supported color sample counts for a framebuffer -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>framebufferDepthSampleCounts</name></member>      <!-- supported depth sample counts for a framebuffer -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>framebufferStencilSampleCounts</name></member>    <!-- supported stencil sample counts for a framebuffer -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>framebufferNoAttachmentsSampleCounts</name></member> <!-- supported sample counts for a framebuffer with no attachments -->
-            <member><type>uint32_t</type>               <name>maxColorAttachments</name></member>               <!-- max number of color attachments per subpass -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampledImageColorSampleCounts</name></member>     <!-- supported color sample counts for a non-integer sampled image -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampledImageIntegerSampleCounts</name></member>   <!-- supported sample counts for an integer image -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampledImageDepthSampleCounts</name></member>     <!-- supported depth sample counts for a sampled image -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampledImageStencilSampleCounts</name></member>   <!-- supported stencil sample counts for a sampled image -->
-            <member optional="true"><type>VkSampleCountFlags</type>     <name>storageImageSampleCounts</name></member>          <!-- supported sample counts for a storage image -->
-            <member><type>uint32_t</type>               <name>maxSampleMaskWords</name></member>                <!-- max number of sample mask words -->
-            <member><type>VkBool32</type>               <name>timestampComputeAndGraphics</name></member>       <!-- timestamps on graphics and compute queues -->
-            <member><type>float</type>                  <name>timestampPeriod</name></member>                   <!-- number of nanoseconds it takes for timestamp query value to increment by 1 -->
-            <member><type>uint32_t</type>               <name>maxClipDistances</name></member>                  <!-- max number of clip distances -->
-            <member><type>uint32_t</type>               <name>maxCullDistances</name></member>                  <!-- max number of cull distances -->
-            <member><type>uint32_t</type>               <name>maxCombinedClipAndCullDistances</name></member>   <!-- max combined number of user clipping -->
-            <member><type>uint32_t</type>               <name>discreteQueuePriorities</name></member>           <!-- distinct queue priorities available  -->
-            <member><type>float</type>                  <name>pointSizeRange</name>[2]</member>                 <!-- range (min,max) of supported point sizes -->
-            <member><type>float</type>                  <name>lineWidthRange</name>[2]</member>                 <!-- range (min,max) of supported line widths -->
-            <member><type>float</type>                  <name>pointSizeGranularity</name></member>              <!-- granularity of supported point sizes -->
-            <member><type>float</type>                  <name>lineWidthGranularity</name></member>              <!-- granularity of supported line widths -->
-            <member><type>VkBool32</type>               <name>strictLines</name></member>                       <!-- line rasterization follows preferred rules -->
-            <member><type>VkBool32</type>               <name>standardSampleLocations</name></member>           <!-- supports standard sample locations for all supported sample counts -->
-            <member><type>VkDeviceSize</type>           <name>optimalBufferCopyOffsetAlignment</name></member>  <!-- optimal offset of buffer copies -->
-            <member><type>VkDeviceSize</type>           <name>optimalBufferCopyRowPitchAlignment</name></member><!-- optimal pitch of buffer copies -->
-            <member><type>VkDeviceSize</type>           <name>nonCoherentAtomSize</name></member>               <!-- minimum size and alignment for non-coherent host-mapped device memory access -->
+                <comment>resource maximum sizes</comment>
+            <member><type>uint32_t</type>               <name>maxImageDimension1D</name><comment>max 1D image dimension</comment></member>
+            <member><type>uint32_t</type>               <name>maxImageDimension2D</name><comment>max 2D image dimension</comment></member>
+            <member><type>uint32_t</type>               <name>maxImageDimension3D</name><comment>max 3D image dimension</comment></member>
+            <member><type>uint32_t</type>               <name>maxImageDimensionCube</name><comment>max cubemap image dimension</comment></member>
+            <member><type>uint32_t</type>               <name>maxImageArrayLayers</name><comment>max layers for image arrays</comment></member>
+            <member><type>uint32_t</type>               <name>maxTexelBufferElements</name><comment>max texel buffer size (fstexels)</comment></member>
+            <member><type>uint32_t</type>               <name>maxUniformBufferRange</name><comment>max uniform buffer range (bytes)</comment></member>
+            <member><type>uint32_t</type>               <name>maxStorageBufferRange</name><comment>max storage buffer range (bytes)</comment></member>
+            <member><type>uint32_t</type>               <name>maxPushConstantsSize</name><comment>max size of the push constants pool (bytes)</comment></member>
+                <comment>memory limits</comment>
+            <member><type>uint32_t</type>               <name>maxMemoryAllocationCount</name><comment>max number of device memory allocations supported</comment></member>
+            <member><type>uint32_t</type>               <name>maxSamplerAllocationCount</name><comment>max number of samplers that can be allocated on a device</comment></member>
+            <member><type>VkDeviceSize</type>           <name>bufferImageGranularity</name><comment>Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage</comment></member>
+            <member><type>VkDeviceSize</type>           <name>sparseAddressSpaceSize</name><comment>Total address space available for sparse allocations (bytes)</comment></member>
+                <comment>descriptor set limits</comment>
+            <member><type>uint32_t</type>               <name>maxBoundDescriptorSets</name><comment>max number of descriptors sets that can be bound to a pipeline</comment></member>
+            <member><type>uint32_t</type>               <name>maxPerStageDescriptorSamplers</name><comment>max number of samplers allowed per-stage in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxPerStageDescriptorUniformBuffers</name><comment>max number of uniform buffers allowed per-stage in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxPerStageDescriptorStorageBuffers</name><comment>max number of storage buffers allowed per-stage in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxPerStageDescriptorSampledImages</name><comment>max number of sampled images allowed per-stage in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxPerStageDescriptorStorageImages</name><comment>max number of storage images allowed per-stage in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxPerStageDescriptorInputAttachments</name><comment>max number of input attachments allowed per-stage in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxPerStageResources</name><comment>max number of resources allowed by a single stage</comment></member>
+            <member><type>uint32_t</type>               <name>maxDescriptorSetSamplers</name><comment>max number of samplers allowed in all stages in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxDescriptorSetUniformBuffers</name><comment>max number of uniform buffers allowed in all stages in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxDescriptorSetUniformBuffersDynamic</name><comment>max number of dynamic uniform buffers allowed in all stages in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxDescriptorSetStorageBuffers</name><comment>max number of storage buffers allowed in all stages in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxDescriptorSetStorageBuffersDynamic</name><comment>max number of dynamic storage buffers allowed in all stages in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxDescriptorSetSampledImages</name><comment>max number of sampled images allowed in all stages in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxDescriptorSetStorageImages</name><comment>max number of storage images allowed in all stages in a descriptor set</comment></member>
+            <member><type>uint32_t</type>               <name>maxDescriptorSetInputAttachments</name><comment>max number of input attachments allowed in all stages in a descriptor set</comment></member>
+                <comment>vertex stage limits</comment>
+            <member><type>uint32_t</type>               <name>maxVertexInputAttributes</name><comment>max number of vertex input attribute slots</comment></member>
+            <member><type>uint32_t</type>               <name>maxVertexInputBindings</name><comment>max number of vertex input binding slots</comment></member>
+            <member><type>uint32_t</type>               <name>maxVertexInputAttributeOffset</name><comment>max vertex input attribute offset added to vertex buffer offset</comment></member>
+            <member><type>uint32_t</type>               <name>maxVertexInputBindingStride</name><comment>max vertex input binding stride</comment></member>
+            <member><type>uint32_t</type>               <name>maxVertexOutputComponents</name><comment>max number of output components written by vertex shader</comment></member>
+                <comment>tessellation control stage limits</comment>
+            <member><type>uint32_t</type>               <name>maxTessellationGenerationLevel</name><comment>max level supported by tessellation primitive generator</comment></member>
+            <member><type>uint32_t</type>               <name>maxTessellationPatchSize</name><comment>max patch size (vertices)</comment></member>
+            <member><type>uint32_t</type>               <name>maxTessellationControlPerVertexInputComponents</name><comment>max number of input components per-vertex in TCS</comment></member>
+            <member><type>uint32_t</type>               <name>maxTessellationControlPerVertexOutputComponents</name><comment>max number of output components per-vertex in TCS</comment></member>
+            <member><type>uint32_t</type>               <name>maxTessellationControlPerPatchOutputComponents</name><comment>max number of output components per-patch in TCS</comment></member>
+            <member><type>uint32_t</type>               <name>maxTessellationControlTotalOutputComponents</name><comment>max total number of per-vertex and per-patch output components in TCS</comment></member>
+                <comment>tessellation evaluation stage limits</comment>
+            <member><type>uint32_t</type>               <name>maxTessellationEvaluationInputComponents</name><comment>max number of input components per vertex in TES</comment></member>
+            <member><type>uint32_t</type>               <name>maxTessellationEvaluationOutputComponents</name><comment>max number of output components per vertex in TES</comment></member>
+                <comment>geometry stage limits</comment>
+            <member><type>uint32_t</type>               <name>maxGeometryShaderInvocations</name><comment>max invocation count supported in geometry shader</comment></member>
+            <member><type>uint32_t</type>               <name>maxGeometryInputComponents</name><comment>max number of input components read in geometry stage</comment></member>
+            <member><type>uint32_t</type>               <name>maxGeometryOutputComponents</name><comment>max number of output components written in geometry stage</comment></member>
+            <member><type>uint32_t</type>               <name>maxGeometryOutputVertices</name><comment>max number of vertices that can be emitted in geometry stage</comment></member>
+            <member><type>uint32_t</type>               <name>maxGeometryTotalOutputComponents</name><comment>max total number of components (all vertices) written in geometry stage</comment></member>
+                <comment>fragment stage limits</comment>
+            <member><type>uint32_t</type>               <name>maxFragmentInputComponents</name><comment>max number of input compontents read in fragment stage</comment></member>
+            <member><type>uint32_t</type>               <name>maxFragmentOutputAttachments</name><comment>max number of output attachments written in fragment stage</comment></member>
+            <member><type>uint32_t</type>               <name>maxFragmentDualSrcAttachments</name><comment>max number of output attachments written when using dual source blending</comment></member>
+            <member><type>uint32_t</type>               <name>maxFragmentCombinedOutputResources</name><comment>max total number of storage buffers, storage images and output buffers</comment></member>
+                <comment>compute stage limits</comment>
+            <member><type>uint32_t</type>               <name>maxComputeSharedMemorySize</name><comment>max total storage size of work group local storage (bytes)</comment></member>
+            <member><type>uint32_t</type>               <name>maxComputeWorkGroupCount</name>[3]<comment>max num of compute work groups that may be dispatched by a single command (x,y,z)</comment></member>
+            <member><type>uint32_t</type>               <name>maxComputeWorkGroupInvocations</name><comment>max total compute invocations in a single local work group</comment></member>
+            <member><type>uint32_t</type>               <name>maxComputeWorkGroupSize</name>[3]<comment>max local size of a compute work group (x,y,z)</comment></member>
+            <member><type>uint32_t</type>               <name>subPixelPrecisionBits</name><comment>number bits of subpixel precision in screen x and y</comment></member>
+            <member><type>uint32_t</type>               <name>subTexelPrecisionBits</name><comment>number bits of precision for selecting texel weights</comment></member>
+            <member><type>uint32_t</type>               <name>mipmapPrecisionBits</name><comment>number bits of precision for selecting mipmap weights</comment></member>
+            <member><type>uint32_t</type>               <name>maxDrawIndexedIndexValue</name><comment>max index value for indexed draw calls (for 32-bit indices)</comment></member>
+            <member><type>uint32_t</type>               <name>maxDrawIndirectCount</name><comment>max draw count for indirect draw calls</comment></member>
+            <member><type>float</type>                  <name>maxSamplerLodBias</name><comment>max absolute sampler level of detail bias</comment></member>
+            <member><type>float</type>                  <name>maxSamplerAnisotropy</name><comment>max degree of sampler anisotropy</comment></member>
+            <member><type>uint32_t</type>               <name>maxViewports</name><comment>max number of active viewports</comment></member>
+            <member><type>uint32_t</type>               <name>maxViewportDimensions</name>[2]<comment>max viewport dimensions (x,y)</comment></member>
+            <member><type>float</type>                  <name>viewportBoundsRange</name>[2]<comment>viewport bounds range (min,max)</comment></member>
+            <member><type>uint32_t</type>               <name>viewportSubPixelBits</name><comment>number bits of subpixel precision for viewport</comment></member>
+            <member><type>size_t</type>                 <name>minMemoryMapAlignment</name><comment>min required alignment of pointers returned by MapMemory (bytes)</comment></member>
+            <member><type>VkDeviceSize</type>           <name>minTexelBufferOffsetAlignment</name><comment>min required alignment for texel buffer offsets (bytes) </comment></member>
+            <member><type>VkDeviceSize</type>           <name>minUniformBufferOffsetAlignment</name><comment>min required alignment for uniform buffer sizes and offsets (bytes)</comment></member>
+            <member><type>VkDeviceSize</type>           <name>minStorageBufferOffsetAlignment</name><comment>min required alignment for storage buffer offsets (bytes)</comment></member>
+            <member><type>int32_t</type>                <name>minTexelOffset</name><comment>min texel offset for OpTextureSampleOffset</comment></member>
+            <member><type>uint32_t</type>               <name>maxTexelOffset</name><comment>max texel offset for OpTextureSampleOffset</comment></member>
+            <member><type>int32_t</type>                <name>minTexelGatherOffset</name><comment>min texel offset for OpTextureGatherOffset</comment></member>
+            <member><type>uint32_t</type>               <name>maxTexelGatherOffset</name><comment>max texel offset for OpTextureGatherOffset</comment></member>
+            <member><type>float</type>                  <name>minInterpolationOffset</name><comment>furthest negative offset for interpolateAtOffset</comment></member>
+            <member><type>float</type>                  <name>maxInterpolationOffset</name><comment>furthest positive offset for interpolateAtOffset</comment></member>
+            <member><type>uint32_t</type>               <name>subPixelInterpolationOffsetBits</name><comment>number of subpixel bits for interpolateAtOffset</comment></member>
+            <member><type>uint32_t</type>               <name>maxFramebufferWidth</name><comment>max width for a framebuffer</comment></member>
+            <member><type>uint32_t</type>               <name>maxFramebufferHeight</name><comment>max height for a framebuffer</comment></member>
+            <member><type>uint32_t</type>               <name>maxFramebufferLayers</name><comment>max layer count for a layered framebuffer</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>framebufferColorSampleCounts</name><comment>supported color sample counts for a framebuffer</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>framebufferDepthSampleCounts</name><comment>supported depth sample counts for a framebuffer</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>framebufferStencilSampleCounts</name><comment>supported stencil sample counts for a framebuffer</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>framebufferNoAttachmentsSampleCounts</name><comment>supported sample counts for a framebuffer with no attachments</comment></member>
+            <member><type>uint32_t</type>               <name>maxColorAttachments</name><comment>max number of color attachments per subpass</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampledImageColorSampleCounts</name><comment>supported color sample counts for a non-integer sampled image</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampledImageIntegerSampleCounts</name><comment>supported sample counts for an integer image</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampledImageDepthSampleCounts</name><comment>supported depth sample counts for a sampled image</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>sampledImageStencilSampleCounts</name><comment>supported stencil sample counts for a sampled image</comment></member>
+            <member optional="true"><type>VkSampleCountFlags</type>     <name>storageImageSampleCounts</name><comment>supported sample counts for a storage image</comment></member>
+            <member><type>uint32_t</type>               <name>maxSampleMaskWords</name><comment>max number of sample mask words</comment></member>
+            <member><type>VkBool32</type>               <name>timestampComputeAndGraphics</name><comment>timestamps on graphics and compute queues</comment></member>
+            <member><type>float</type>                  <name>timestampPeriod</name><comment>number of nanoseconds it takes for timestamp query value to increment by 1</comment></member>
+            <member><type>uint32_t</type>               <name>maxClipDistances</name><comment>max number of clip distances</comment></member>
+            <member><type>uint32_t</type>               <name>maxCullDistances</name><comment>max number of cull distances</comment></member>
+            <member><type>uint32_t</type>               <name>maxCombinedClipAndCullDistances</name><comment>max combined number of user clipping</comment></member>
+            <member><type>uint32_t</type>               <name>discreteQueuePriorities</name><comment>distinct queue priorities available </comment></member>
+            <member><type>float</type>                  <name>pointSizeRange</name>[2]<comment>range (min,max) of supported point sizes</comment></member>
+            <member><type>float</type>                  <name>lineWidthRange</name>[2]<comment>range (min,max) of supported line widths</comment></member>
+            <member><type>float</type>                  <name>pointSizeGranularity</name><comment>granularity of supported point sizes</comment></member>
+            <member><type>float</type>                  <name>lineWidthGranularity</name><comment>granularity of supported line widths</comment></member>
+            <member><type>VkBool32</type>               <name>strictLines</name><comment>line rasterization follows preferred rules</comment></member>
+            <member><type>VkBool32</type>               <name>standardSampleLocations</name><comment>supports standard sample locations for all supported sample counts</comment></member>
+            <member><type>VkDeviceSize</type>           <name>optimalBufferCopyOffsetAlignment</name><comment>optimal offset of buffer copies</comment></member>
+            <member><type>VkDeviceSize</type>           <name>optimalBufferCopyRowPitchAlignment</name><comment>optimal pitch of buffer copies</comment></member>
+            <member><type>VkDeviceSize</type>           <name>nonCoherentAtomSize</name><comment>minimum size and alignment for non-coherent host-mapped device memory access</comment></member>
         </type>
         <type category="struct" name="VkSemaphoreCreateInfo">
             <member values="VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkExportSemaphoreCreateInfoKHR,VkExportSemaphoreWin32HandleInfoKHR">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkSemaphoreCreateFlags</type> <name>flags</name></member>                          <!-- Semaphore creation flags -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkSemaphoreCreateFlags</type> <name>flags</name><comment>Semaphore creation flags</comment></member>
         </type>
         <type category="struct" name="VkQueryPoolCreateInfo">
             <member values="VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkQueryPoolCreateFlags</type> <name>flags</name></member>                          <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkQueryPoolCreateFlags</type> <name>flags</name></member>
             <member><type>VkQueryType</type>            <name>queryType</name></member>
             <member><type>uint32_t</type>               <name>queryCount</name></member>
-            <member optional="true" noautovalidity="true"><type>VkQueryPipelineStatisticFlags</type> <name>pipelineStatistics</name></member>      <!-- Optional -->
+            <member optional="true" noautovalidity="true"><type>VkQueryPipelineStatisticFlags</type> <name>pipelineStatistics</name><comment>Optional</comment></member>
         </type>
         <type category="struct" name="VkFramebufferCreateInfo">
             <member values="VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkFramebufferCreateFlags</type>    <name>flags</name></member>                     <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkFramebufferCreateFlags</type>    <name>flags</name></member>
             <member><type>VkRenderPass</type>           <name>renderPass</name></member>
             <member optional="true"><type>uint32_t</type>               <name>attachmentCount</name></member>
             <member len="attachmentCount">const <type>VkImageView</type>*     <name>pAttachments</name></member>
@@ -1421,7 +1426,7 @@
         </type>
         <type category="struct" name="VkSubmitInfo">
             <member values="VK_STRUCTURE_TYPE_SUBMIT_INFO"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkWin32KeyedMutexAcquireReleaseInfoNV,VkWin32KeyedMutexAcquireReleaseInfoKHR,VkD3D12FenceSubmitInfoKHR,VkDeviceGroupSubmitInfoKHX">const <type>void</type>* <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>* <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>       <name>waitSemaphoreCount</name></member>
             <member len="waitSemaphoreCount">const <type>VkSemaphore</type>*     <name>pWaitSemaphores</name></member>
             <member len="waitSemaphoreCount">const <type>VkPipelineStageFlags</type>*           <name>pWaitDstStageMask</name></member>
@@ -1430,37 +1435,37 @@
             <member optional="true"><type>uint32_t</type>       <name>signalSemaphoreCount</name></member>
             <member len="signalSemaphoreCount">const <type>VkSemaphore</type>*     <name>pSignalSemaphores</name></member>
         </type>
-        <!-- WSI extensions -->
+            <comment>WSI extensions</comment>
         <type category="struct" name="VkDisplayPropertiesKHR" returnedonly="true">
-            <member><type>VkDisplayKHR</type>                     <name>display</name></member>                  <!-- Handle of the display object -->
-            <member len="null-terminated">const <type>char</type>*                      <name>displayName</name></member>              <!-- Name of the display -->
-            <member><type>VkExtent2D</type>                       <name>physicalDimensions</name></member>       <!-- In millimeters? -->
-            <member><type>VkExtent2D</type>                       <name>physicalResolution</name></member>       <!-- Max resolution for CRT? -->
-            <member optional="true"><type>VkSurfaceTransformFlagsKHR</type>       <name>supportedTransforms</name></member>      <!-- one or more bits from VkSurfaceTransformFlagsKHR -->
-            <member><type>VkBool32</type>                         <name>planeReorderPossible</name></member>     <!-- VK_TRUE if the overlay plane's z-order can be changed on this display. -->
-            <member><type>VkBool32</type>                         <name>persistentContent</name></member>        <!-- VK_TRUE if this is a "smart" display that supports self-refresh/internal buffering. -->
+            <member><type>VkDisplayKHR</type>                     <name>display</name><comment>Handle of the display object</comment></member>
+            <member len="null-terminated">const <type>char</type>*                      <name>displayName</name><comment>Name of the display</comment></member>
+            <member><type>VkExtent2D</type>                       <name>physicalDimensions</name><comment>In millimeters?</comment></member>
+            <member><type>VkExtent2D</type>                       <name>physicalResolution</name><comment>Max resolution for CRT?</comment></member>
+            <member optional="true"><type>VkSurfaceTransformFlagsKHR</type>       <name>supportedTransforms</name><comment>one or more bits from VkSurfaceTransformFlagsKHR</comment></member>
+            <member><type>VkBool32</type>                         <name>planeReorderPossible</name><comment>VK_TRUE if the overlay plane's z-order can be changed on this display.</comment></member>
+            <member><type>VkBool32</type>                         <name>persistentContent</name><comment>VK_TRUE if this is a "smart" display that supports self-refresh/internal buffering.</comment></member>
         </type>
         <type category="struct" name="VkDisplayPlanePropertiesKHR" returnedonly="true">
-            <member><type>VkDisplayKHR</type>                     <name>currentDisplay</name></member>           <!-- Display the plane is currently associated with.  Will be VK_NULL_HANDLE if the plane is not in use. -->
-            <member><type>uint32_t</type>                         <name>currentStackIndex</name></member>        <!-- Current z-order of the plane. -->
+            <member><type>VkDisplayKHR</type>                     <name>currentDisplay</name><comment>Display the plane is currently associated with.  Will be VK_NULL_HANDLE if the plane is not in use.</comment></member>
+            <member><type>uint32_t</type>                         <name>currentStackIndex</name><comment>Current z-order of the plane.</comment></member>
         </type>
         <type category="struct" name="VkDisplayModeParametersKHR">
-            <member><type>VkExtent2D</type>                       <name>visibleRegion</name></member>            <!-- Visible scanout region. -->
-            <member><type>uint32_t</type>                         <name>refreshRate</name></member>              <!-- Number of times per second the display is updated. -->
+            <member><type>VkExtent2D</type>                       <name>visibleRegion</name><comment>Visible scanout region.</comment></member>
+            <member><type>uint32_t</type>                         <name>refreshRate</name><comment>Number of times per second the display is updated.</comment></member>
         </type>
         <type category="struct" name="VkDisplayModePropertiesKHR" returnedonly="true">
-            <member><type>VkDisplayModeKHR</type>                 <name>displayMode</name></member>              <!-- Handle of this display mode. -->
-            <member><type>VkDisplayModeParametersKHR</type>       <name>parameters</name></member>               <!-- The parameters this mode uses. -->
+            <member><type>VkDisplayModeKHR</type>                 <name>displayMode</name><comment>Handle of this display mode.</comment></member>
+            <member><type>VkDisplayModeParametersKHR</type>       <name>parameters</name><comment>The parameters this mode uses.</comment></member>
         </type>
         <type category="struct" name="VkDisplayModeCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkDisplayModeCreateFlagsKHR</type>      <name>flags</name></member>                    <!-- Reserved -->
-            <member><type>VkDisplayModeParametersKHR</type>       <name>parameters</name></member>               <!-- The parameters this mode uses. -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkDisplayModeCreateFlagsKHR</type>      <name>flags</name></member>
+            <member><type>VkDisplayModeParametersKHR</type>       <name>parameters</name><comment>The parameters this mode uses.</comment></member>
         </type>
         <type category="struct" name="VkDisplayPlaneCapabilitiesKHR" returnedonly="true">
-            <member optional="true"><type>VkDisplayPlaneAlphaFlagsKHR</type>      <name>supportedAlpha</name></member>           <!-- Types of alpha blending supported, if any. -->
-            <member><type>VkOffset2D</type>                       <name>minSrcPosition</name></member>           <!-- Does the plane have any position and extent restrictions? -->
+            <member optional="true"><type>VkDisplayPlaneAlphaFlagsKHR</type>      <name>supportedAlpha</name><comment>Types of alpha blending supported, if any.</comment></member>
+            <member><type>VkOffset2D</type>                       <name>minSrcPosition</name><comment>Does the plane have any position and extent restrictions?</comment></member>
             <member><type>VkOffset2D</type>                       <name>maxSrcPosition</name></member>
             <member><type>VkExtent2D</type>                       <name>minSrcExtent</name></member>
             <member><type>VkExtent2D</type>                       <name>maxSrcExtent</name></member>
@@ -1471,171 +1476,178 @@
         </type>
         <type category="struct" name="VkDisplaySurfaceCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkDisplaySurfaceCreateFlagsKHR</type>   <name>flags</name></member>                    <!-- Reserved -->
-            <member><type>VkDisplayModeKHR</type>                 <name>displayMode</name></member>              <!-- The mode to use when displaying this surface -->
-            <member><type>uint32_t</type>                         <name>planeIndex</name></member>               <!-- The plane on which this surface appears.  Must be between 0 and the value returned by vkGetPhysicalDeviceDisplayPlanePropertiesKHR() in pPropertyCount. -->
-            <member><type>uint32_t</type>                         <name>planeStackIndex</name></member>          <!-- The z-order of the plane. -->
-            <member><type>VkSurfaceTransformFlagBitsKHR</type>    <name>transform</name></member>                <!-- Transform to apply to the images as part of the scanout operation -->
-            <member><type>float</type>                            <name>globalAlpha</name></member>              <!-- Global alpha value.  Must be between 0 and 1, inclusive.  Ignored if alphaMode is not VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR -->
-            <member><type>VkDisplayPlaneAlphaFlagBitsKHR</type>   <name>alphaMode</name></member>                <!-- What type of alpha blending to use.  Must be a bit from vkGetDisplayPlanePropertiesKHR::supportedAlpha. -->
-            <member><type>VkExtent2D</type>                       <name>imageExtent</name></member>              <!-- size of the images to use with this surface -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkDisplaySurfaceCreateFlagsKHR</type>   <name>flags</name></member>
+            <member><type>VkDisplayModeKHR</type>                 <name>displayMode</name><comment>The mode to use when displaying this surface</comment></member>
+            <member><type>uint32_t</type>                         <name>planeIndex</name><comment>The plane on which this surface appears.  Must be between 0 and the value returned by vkGetPhysicalDeviceDisplayPlanePropertiesKHR() in pPropertyCount.</comment></member>
+            <member><type>uint32_t</type>                         <name>planeStackIndex</name><comment>The z-order of the plane.</comment></member>
+            <member><type>VkSurfaceTransformFlagBitsKHR</type>    <name>transform</name><comment>Transform to apply to the images as part of the scanout operation</comment></member>
+            <member><type>float</type>                            <name>globalAlpha</name><comment>Global alpha value.  Must be between 0 and 1, inclusive.  Ignored if alphaMode is not VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR</comment></member>
+            <member><type>VkDisplayPlaneAlphaFlagBitsKHR</type>   <name>alphaMode</name><comment>What type of alpha blending to use.  Must be a bit from vkGetDisplayPlanePropertiesKHR::supportedAlpha.</comment></member>
+            <member><type>VkExtent2D</type>                       <name>imageExtent</name><comment>size of the images to use with this surface</comment></member>
         </type>
-        <type category="struct" name="VkDisplayPresentInfoKHR">
+        <type category="struct" name="VkDisplayPresentInfoKHR" structextends="VkPresentInfoKHR">
             <member values="VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*  <name>pNext</name></member> <!-- Pointer to next structure -->
-            <member><type>VkRect2D</type>                         <name>srcRect</name></member>                  <!-- Rectangle within the presentable image to read pixel data from when presenting to the display. -->
-            <member><type>VkRect2D</type>                         <name>dstRect</name></member>                  <!-- Rectangle within the current display mode's visible region to display srcRectangle in. -->
-            <member><type>VkBool32</type>                         <name>persistent</name></member>               <!-- For smart displays, use buffered mode.  If the display properties member "persistentMode" is VK_FALSE, this member must always be VK_FALSE. -->
+            <member noautovalidity="true">const <type>void</type>*  <name>pNext</name></member>
+            <member><type>VkRect2D</type>                         <name>srcRect</name><comment>Rectangle within the presentable image to read pixel data from when presenting to the display.</comment></member>
+            <member><type>VkRect2D</type>                         <name>dstRect</name><comment>Rectangle within the current display mode's visible region to display srcRectangle in.</comment></member>
+            <member><type>VkBool32</type>                         <name>persistent</name><comment>For smart displays, use buffered mode.  If the display properties member "persistentMode" is VK_FALSE, this member must always be VK_FALSE.</comment></member>
         </type>
         <type category="struct" name="VkSurfaceCapabilitiesKHR" returnedonly="true">
-            <member><type>uint32_t</type>                         <name>minImageCount</name></member>            <!-- Supported minimum number of images for the surface -->
-            <member><type>uint32_t</type>                         <name>maxImageCount</name></member>            <!-- Supported maximum number of images for the surface, 0 for unlimited -->
-            <member><type>VkExtent2D</type>                       <name>currentExtent</name></member>            <!-- Current image width and height for the surface, (0, 0) if undefined -->
-            <member><type>VkExtent2D</type>                       <name>minImageExtent</name></member>           <!-- Supported minimum image width and height for the surface -->
-            <member><type>VkExtent2D</type>                       <name>maxImageExtent</name></member>           <!-- Supported maximum image width and height for the surface -->
-            <member><type>uint32_t</type>                         <name>maxImageArrayLayers</name></member>      <!-- Supported maximum number of image layers for the surface -->
-            <member optional="true"><type>VkSurfaceTransformFlagsKHR</type>       <name>supportedTransforms</name></member>      <!-- 1 or more bits representing the transforms supported -->
-            <member><type>VkSurfaceTransformFlagBitsKHR</type>    <name>currentTransform</name></member>         <!-- The surface's current transform relative to the device's natural orientation -->
-            <member optional="true"><type>VkCompositeAlphaFlagsKHR</type>         <name>supportedCompositeAlpha</name></member>  <!-- 1 or more bits representing the alpha compositing modes supported -->
-            <member optional="true"><type>VkImageUsageFlags</type>                <name>supportedUsageFlags</name></member>      <!-- Supported image usage flags for the surface -->
+            <member><type>uint32_t</type>                         <name>minImageCount</name><comment>Supported minimum number of images for the surface</comment></member>
+            <member><type>uint32_t</type>                         <name>maxImageCount</name><comment>Supported maximum number of images for the surface, 0 for unlimited</comment></member>
+            <member><type>VkExtent2D</type>                       <name>currentExtent</name><comment>Current image width and height for the surface, (0, 0) if undefined</comment></member>
+            <member><type>VkExtent2D</type>                       <name>minImageExtent</name><comment>Supported minimum image width and height for the surface</comment></member>
+            <member><type>VkExtent2D</type>                       <name>maxImageExtent</name><comment>Supported maximum image width and height for the surface</comment></member>
+            <member><type>uint32_t</type>                         <name>maxImageArrayLayers</name><comment>Supported maximum number of image layers for the surface</comment></member>
+            <member optional="true"><type>VkSurfaceTransformFlagsKHR</type>       <name>supportedTransforms</name><comment>1 or more bits representing the transforms supported</comment></member>
+            <member><type>VkSurfaceTransformFlagBitsKHR</type>    <name>currentTransform</name><comment>The surface's current transform relative to the device's natural orientation</comment></member>
+            <member optional="true"><type>VkCompositeAlphaFlagsKHR</type>         <name>supportedCompositeAlpha</name><comment>1 or more bits representing the alpha compositing modes supported</comment></member>
+            <member optional="true"><type>VkImageUsageFlags</type>                <name>supportedUsageFlags</name><comment>Supported image usage flags for the surface</comment></member>
         </type>
         <type category="struct" name="VkAndroidSurfaceCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkAndroidSurfaceCreateFlagsKHR</type>   <name>flags</name></member>    <!-- Reserved -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkAndroidSurfaceCreateFlagsKHR</type>   <name>flags</name></member>
             <member noautovalidity="true"><type>ANativeWindow</type>*                   <name>window</name></member>
         </type>
         <type category="struct" name="VkMirSurfaceCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkMirSurfaceCreateFlagsKHR</type>   <name>flags</name></member>        <!-- Reserved -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkMirSurfaceCreateFlagsKHR</type>   <name>flags</name></member>
             <member noautovalidity="true"><type>MirConnection</type>*                   <name>connection</name></member>
             <member noautovalidity="true"><type>MirSurface</type>*                      <name>mirSurface</name></member>
         </type>
         <type category="struct" name="VkViSurfaceCreateInfoNN">
             <member values="VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkViSurfaceCreateFlagsNN</type>   <name>flags</name></member>        <!-- Reserved -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkViSurfaceCreateFlagsNN</type>   <name>flags</name></member>
             <member><type>void</type>*                            <name>window</name></member>
         </type>
         <type category="struct" name="VkWaylandSurfaceCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkWaylandSurfaceCreateFlagsKHR</type>   <name>flags</name></member>    <!-- Reserved -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkWaylandSurfaceCreateFlagsKHR</type>   <name>flags</name></member>
             <member noautovalidity="true">struct <type>wl_display</type>*               <name>display</name></member>
             <member noautovalidity="true">struct <type>wl_surface</type>*               <name>surface</name></member>
         </type>
         <type category="struct" name="VkWin32SurfaceCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkWin32SurfaceCreateFlagsKHR</type>   <name>flags</name></member>      <!-- Reserved -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkWin32SurfaceCreateFlagsKHR</type>   <name>flags</name></member>
             <member><type>HINSTANCE</type>                        <name>hinstance</name></member>
             <member><type>HWND</type>                             <name>hwnd</name></member>
         </type>
+        <type category="struct" name="VkMagmaSurfaceCreateInfoKHR">
+            <member values="VK_STRUCTURE_TYPE_MAGMA_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>uint32_t</type>                         <name>imagePipeHandle</name></member>
+            <member><type>uint32_t</type>                         <name>width</name></member>  
+            <member><type>uint32_t</type>                         <name>height</name></member>  
+        </type>
         <type category="struct" name="VkXlibSurfaceCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkXlibSurfaceCreateFlagsKHR</type>   <name>flags</name></member>       <!-- Reserved -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkXlibSurfaceCreateFlagsKHR</type>   <name>flags</name></member>
             <member noautovalidity="true"><type>Display</type>*                         <name>dpy</name></member>
             <member><type>Window</type>                           <name>window</name></member>
         </type>
         <type category="struct" name="VkXcbSurfaceCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkXcbSurfaceCreateFlagsKHR</type>   <name>flags</name></member>        <!-- Reserved -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkXcbSurfaceCreateFlagsKHR</type>   <name>flags</name></member>
             <member noautovalidity="true"><type>xcb_connection_t</type>*                <name>connection</name></member>
             <member><type>xcb_window_t</type>                     <name>window</name></member>
         </type>
         <type category="struct" name="VkSurfaceFormatKHR" returnedonly="true">
-            <member><type>VkFormat</type>                         <name>format</name></member>                   <!-- Supported pair of rendering format -->
-            <member><type>VkColorSpaceKHR</type>                  <name>colorSpace</name></member>               <!-- and color space for the surface -->
+            <member><type>VkFormat</type>                         <name>format</name><comment>Supported pair of rendering format</comment></member>
+            <member><type>VkColorSpaceKHR</type>                  <name>colorSpace</name><comment>and color space for the surface</comment></member>
         </type>
         <type category="struct" name="VkSwapchainCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDeviceGroupSwapchainCreateInfoKHX">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkSwapchainCreateFlagsKHR</type>        <name>flags</name></member>                    <!-- Reserved -->
-            <member><type>VkSurfaceKHR</type>                     <name>surface</name></member>                  <!-- The swapchain's target surface -->
-            <member><type>uint32_t</type>                         <name>minImageCount</name></member>            <!-- Minimum number of presentation images the application needs -->
-            <member><type>VkFormat</type>                         <name>imageFormat</name></member>              <!-- Format of the presentation images -->
-            <member><type>VkColorSpaceKHR</type>                  <name>imageColorSpace</name></member>          <!-- Colorspace of the presentation images -->
-            <member><type>VkExtent2D</type>                       <name>imageExtent</name></member>              <!-- Dimensions of the presentation images -->
-            <member><type>uint32_t</type>                         <name>imageArrayLayers</name></member>         <!-- Determines the number of views for multiview/stereo presentation -->
-            <member><type>VkImageUsageFlags</type>                <name>imageUsage</name></member>               <!-- Bits indicating how the presentation images will be used -->
-            <member><type>VkSharingMode</type>                    <name>imageSharingMode</name></member>         <!-- Sharing mode used for the presentation images -->
-            <member optional="true"><type>uint32_t</type>         <name>queueFamilyIndexCount</name></member>    <!-- Number of queue families having access to the images in case of concurrent sharing mode -->
-            <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>*                  <name>pQueueFamilyIndices</name></member>      <!-- Array of queue family indices having access to the images in case of concurrent sharing mode -->
-            <member><type>VkSurfaceTransformFlagBitsKHR</type>    <name>preTransform</name></member>             <!-- The transform, relative to the device's natural orientation, applied to the image content prior to presentation -->
-            <member><type>VkCompositeAlphaFlagBitsKHR</type>      <name>compositeAlpha</name></member>           <!-- The alpha blending mode used when compositing this surface with other surfaces in the window system -->
-            <member><type>VkPresentModeKHR</type>                 <name>presentMode</name></member>              <!-- Which presentation mode to use for presents on this swap chain -->
-            <member><type>VkBool32</type>                         <name>clipped</name></member>                  <!-- Specifies whether presentable images may be affected by window clip regions -->
-            <member optional="true"><type>VkSwapchainKHR</type>   <name>oldSwapchain</name></member>             <!-- Existing swap chain to replace, if any -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkSwapchainCreateFlagsKHR</type>        <name>flags</name></member>
+            <member><type>VkSurfaceKHR</type>                     <name>surface</name><comment>The swapchain's target surface</comment></member>
+            <member><type>uint32_t</type>                         <name>minImageCount</name><comment>Minimum number of presentation images the application needs</comment></member>
+            <member><type>VkFormat</type>                         <name>imageFormat</name><comment>Format of the presentation images</comment></member>
+            <member><type>VkColorSpaceKHR</type>                  <name>imageColorSpace</name><comment>Colorspace of the presentation images</comment></member>
+            <member><type>VkExtent2D</type>                       <name>imageExtent</name><comment>Dimensions of the presentation images</comment></member>
+            <member><type>uint32_t</type>                         <name>imageArrayLayers</name><comment>Determines the number of views for multiview/stereo presentation</comment></member>
+            <member><type>VkImageUsageFlags</type>                <name>imageUsage</name><comment>Bits indicating how the presentation images will be used</comment></member>
+            <member><type>VkSharingMode</type>                    <name>imageSharingMode</name><comment>Sharing mode used for the presentation images</comment></member>
+            <member optional="true"><type>uint32_t</type>         <name>queueFamilyIndexCount</name><comment>Number of queue families having access to the images in case of concurrent sharing mode</comment></member>
+            <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>*                  <name>pQueueFamilyIndices</name><comment>Array of queue family indices having access to the images in case of concurrent sharing mode</comment></member>
+            <member><type>VkSurfaceTransformFlagBitsKHR</type>    <name>preTransform</name><comment>The transform, relative to the device's natural orientation, applied to the image content prior to presentation</comment></member>
+            <member><type>VkCompositeAlphaFlagBitsKHR</type>      <name>compositeAlpha</name><comment>The alpha blending mode used when compositing this surface with other surfaces in the window system</comment></member>
+            <member><type>VkPresentModeKHR</type>                 <name>presentMode</name><comment>Which presentation mode to use for presents on this swap chain</comment></member>
+            <member><type>VkBool32</type>                         <name>clipped</name><comment>Specifies whether presentable images may be affected by window clip regions</comment></member>
+            <member optional="true"><type>VkSwapchainKHR</type>   <name>oldSwapchain</name><comment>Existing swap chain to replace, if any</comment></member>
         </type>
         <type category="struct" name="VkPresentInfoKHR">
             <member values="VK_STRUCTURE_TYPE_PRESENT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkDisplayPresentInfoKHR,VkPresentRegionsKHR,VkDeviceGroupPresentInfoKHX,VkPresentTimesInfoGOOGLE">const <type>void</type>*  <name>pNext</name></member> <!-- Pointer to next structure -->
-            <member optional="true"><type>uint32_t</type>         <name>waitSemaphoreCount</name></member>       <!-- Number of semaphores to wait for before presenting -->
-            <member optional="true" len="waitSemaphoreCount">const <type>VkSemaphore</type>* <name>pWaitSemaphores</name></member> <!-- Semaphores to wait for before presenting -->
-            <member><type>uint32_t</type>                         <name>swapchainCount</name></member>           <!-- Number of swapchains to present in this call -->
-            <member len="swapchainCount">const <type>VkSwapchainKHR</type>* <name>pSwapchains</name></member>    <!-- Swapchains to present an image from -->
-            <member len="swapchainCount">const <type>uint32_t</type>* <name>pImageIndices</name></member>        <!-- Indices of which presentable images to present -->
-            <member optional="true" len="swapchainCount"><type>VkResult</type>* <name>pResults</name></member>   <!-- Optional (i.e. if non-NULL) VkResult for each swapchain -->
+            <member>const <type>void</type>*  <name>pNext</name></member>
+            <member optional="true"><type>uint32_t</type>         <name>waitSemaphoreCount</name><comment>Number of semaphores to wait for before presenting</comment></member>
+            <member len="waitSemaphoreCount">const <type>VkSemaphore</type>* <name>pWaitSemaphores</name><comment>Semaphores to wait for before presenting</comment></member>
+            <member><type>uint32_t</type>                         <name>swapchainCount</name><comment>Number of swapchains to present in this call</comment></member>
+            <member len="swapchainCount">const <type>VkSwapchainKHR</type>* <name>pSwapchains</name><comment>Swapchains to present an image from</comment></member>
+            <member len="swapchainCount">const <type>uint32_t</type>* <name>pImageIndices</name><comment>Indices of which presentable images to present</comment></member>
+            <member optional="true" len="swapchainCount"><type>VkResult</type>* <name>pResults</name><comment>Optional (i.e. if non-NULL) VkResult for each swapchain</comment></member>
         </type>
-        <type category="struct" name="VkDebugReportCallbackCreateInfoEXT">
+        <type category="struct" name="VkDebugReportCallbackCreateInfoEXT" structextends="VkInstanceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkDebugReportFlagsEXT</type>            <name>flags</name></member>                    <!-- Indicates which events call this callback-->
-            <member><type>PFN_vkDebugReportCallbackEXT</type>     <name>pfnCallback</name></member>              <!-- Function pointer of a callback function-->
-            <member optional="true"><type>void</type>*            <name>pUserData</name></member>                <!-- User data provided to callback function -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkDebugReportFlagsEXT</type>            <name>flags</name><comment>Indicates which events call this callback</comment></member>
+            <member><type>PFN_vkDebugReportCallbackEXT</type>     <name>pfnCallback</name><comment>Function pointer of a callback function</comment></member>
+            <member optional="true"><type>void</type>*            <name>pUserData</name><comment>User data provided to callback function</comment></member>
         </type>
-        <type category="struct" name="VkValidationFlagsEXT">
-            <member values="VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT"><type>VkStructureType</type>                  <name>sType</name></member>                    <!-- Must be VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT -->
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member><type>uint32_t</type>                         <name>disabledValidationCheckCount</name></member>   <!-- Number of validation checks to disable -->
-            <member len="disabledValidationCheckCount"><type>VkValidationCheckEXT</type>* <name>pDisabledValidationChecks</name></member>   <!-- Validation checks to disable -->
+        <type category="struct" name="VkValidationFlagsEXT" structextends="VkInstanceCreateInfo">
+            <member values="VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT"><type>VkStructureType</type>                  <name>sType</name><comment>Must be VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT</comment></member>
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member><type>uint32_t</type>                         <name>disabledValidationCheckCount</name><comment>Number of validation checks to disable</comment></member>
+            <member len="disabledValidationCheckCount"><type>VkValidationCheckEXT</type>* <name>pDisabledValidationChecks</name><comment>Validation checks to disable</comment></member>
         </type>
-        <type category="struct" name="VkPipelineRasterizationStateRasterizationOrderAMD">
+        <type category="struct" name="VkPipelineRasterizationStateRasterizationOrderAMD" structextends="VkPipelineRasterizationStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member><type>VkRasterizationOrderAMD</type>          <name>rasterizationOrder</name></member>       <!-- Rasterization order to use for the pipeline -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
+            <member><type>VkRasterizationOrderAMD</type>          <name>rasterizationOrder</name><comment>Rasterization order to use for the pipeline</comment></member>
         </type>
         <type category="struct" name="VkDebugMarkerObjectNameInfoEXT">
             <member values="VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member><type>VkDebugReportObjectTypeEXT</type>       <name>objectType</name></member>               <!-- The type of the object -->
-            <member><type>uint64_t</type>                         <name>object</name></member>                   <!-- The handle of the object, cast to uint64_t -->
-            <member len="null-terminated">const <type>char</type>* <name>pObjectName</name></member>             <!-- Name to apply to the object -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member><type>VkDebugReportObjectTypeEXT</type>       <name>objectType</name><comment>The type of the object</comment></member>
+            <member><type>uint64_t</type>                         <name>object</name><comment>The handle of the object, cast to uint64_t</comment></member>
+            <member len="null-terminated">const <type>char</type>* <name>pObjectName</name><comment>Name to apply to the object</comment></member>
         </type>
         <type category="struct" name="VkDebugMarkerObjectTagInfoEXT">
             <member values="VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member><type>VkDebugReportObjectTypeEXT</type>       <name>objectType</name></member>               <!-- The type of the object -->
-            <member><type>uint64_t</type>                         <name>object</name></member>                   <!-- The handle of the object, cast to uint64_t -->
-            <member><type>uint64_t</type>                         <name>tagName</name></member>                  <!-- The name of the tag to set on the object -->
-            <member><type>size_t</type>                           <name>tagSize</name></member>                  <!-- The length in bytes of the tag data -->
-            <member len="tagSize">const <type>void</type>*        <name>pTag</name></member>                     <!-- Tag data to attach to the object -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member><type>VkDebugReportObjectTypeEXT</type>       <name>objectType</name><comment>The type of the object</comment></member>
+            <member><type>uint64_t</type>                         <name>object</name><comment>The handle of the object, cast to uint64_t</comment></member>
+            <member><type>uint64_t</type>                         <name>tagName</name><comment>The name of the tag to set on the object</comment></member>
+            <member><type>size_t</type>                           <name>tagSize</name><comment>The length in bytes of the tag data</comment></member>
+            <member len="tagSize">const <type>void</type>*        <name>pTag</name><comment>Tag data to attach to the object</comment></member>
         </type>
         <type category="struct" name="VkDebugMarkerMarkerInfoEXT">
             <member values="VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member len="null-terminated">const <type>char</type>* <name>pMarkerName</name></member>             <!-- Name of the debug marker -->
-            <member optional="true"><type>float</type>            <name>color</name>[4]</member>                 <!-- Optional color for debug marker -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member len="null-terminated">const <type>char</type>* <name>pMarkerName</name><comment>Name of the debug marker</comment></member>
+            <member optional="true"><type>float</type>            <name>color</name>[4]<comment>Optional color for debug marker</comment></member>
         </type>
-        <type category="struct" name="VkDedicatedAllocationImageCreateInfoNV">
+        <type category="struct" name="VkDedicatedAllocationImageCreateInfoNV" structextends="VkImageCreateInfo">
             <member values="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member><type>VkBool32</type>                         <name>dedicatedAllocation</name></member>      <!-- Whether this image uses a dedicated allocation -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
+            <member><type>VkBool32</type>                         <name>dedicatedAllocation</name><comment>Whether this image uses a dedicated allocation</comment></member>
         </type>
-        <type category="struct" name="VkDedicatedAllocationBufferCreateInfoNV">
+        <type category="struct" name="VkDedicatedAllocationBufferCreateInfoNV" structextends="VkBufferCreateInfo">
             <member values="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member><type>VkBool32</type>                         <name>dedicatedAllocation</name></member>      <!-- Whether this buffer uses a dedicated allocation -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
+            <member><type>VkBool32</type>                         <name>dedicatedAllocation</name><comment>Whether this buffer uses a dedicated allocation</comment></member>
         </type>
-        <type category="struct" name="VkDedicatedAllocationMemoryAllocateInfoNV">
+        <type category="struct" name="VkDedicatedAllocationMemoryAllocateInfoNV" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkImage</type>          <name>image</name></member>                    <!-- Image that this allocation will be bound to -->
-            <member optional="true"><type>VkBuffer</type>         <name>buffer</name></member>                   <!-- Buffer that this allocation will be bound to -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkImage</type>          <name>image</name><comment>Image that this allocation will be bound to</comment></member>
+            <member optional="true"><type>VkBuffer</type>         <name>buffer</name><comment>Buffer that this allocation will be bound to</comment></member>
         </type>
         <type category="struct" name="VkExternalImageFormatPropertiesNV" returnedonly="true">
             <member><type>VkImageFormatProperties</type>          <name>imageFormatProperties</name></member>
@@ -1643,29 +1655,29 @@
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>exportFromImportedHandleTypes</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>compatibleHandleTypes</name></member>
         </type>
-        <type category="struct" name="VkExternalMemoryImageCreateInfoNV">
+        <type category="struct" name="VkExternalMemoryImageCreateInfoNV" structextends="VkImageCreateInfo">
             <member values="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
             <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleTypes</name></member>
         </type>
-        <type category="struct" name="VkExportMemoryAllocateInfoNV">
+        <type category="struct" name="VkExportMemoryAllocateInfoNV" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
             <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleTypes</name></member>
         </type>
-        <type category="struct" name="VkImportMemoryWin32HandleInfoNV">
+        <type category="struct" name="VkImportMemoryWin32HandleInfoNV" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
             <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleType</name></member>
             <member optional="true"><type>HANDLE</type>                           <name>handle</name></member>
         </type>
-        <type category="struct" name="VkExportMemoryWin32HandleInfoNV">
+        <type category="struct" name="VkExportMemoryWin32HandleInfoNV" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
             <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true">const <type>SECURITY_ATTRIBUTES</type>*       <name>pAttributes</name></member>
             <member optional="true"><type>DWORD</type>                            <name>dwAccess</name></member>
         </type>
-        <type category="struct" name="VkWin32KeyedMutexAcquireReleaseInfoNV">
+        <type category="struct" name="VkWin32KeyedMutexAcquireReleaseInfoNV" structextends="VkSubmitInfo">
             <member values="VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
             <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>                         <name>acquireCount</name></member>
@@ -1692,14 +1704,14 @@
         </type>
         <type category="struct" name="VkIndirectCommandsTokenNVX">
             <member><type>VkIndirectCommandsTokenTypeNVX</type>      <name>tokenType</name></member>
-            <member><type>VkBuffer</type>                         <name>buffer</name></member>  <!-- buffer containing tableEntries and additional data for indirectCommands -->
-            <member><type>VkDeviceSize</type>                     <name>offset</name></member>  <!-- offset from the base address of the buffer -->
+            <member><type>VkBuffer</type>                         <name>buffer</name><comment>buffer containing tableEntries and additional data for indirectCommands</comment></member>
+            <member><type>VkDeviceSize</type>                     <name>offset</name><comment>offset from the base address of the buffer</comment></member>
         </type>
         <type category="struct" name="VkIndirectCommandsLayoutTokenNVX">
             <member><type>VkIndirectCommandsTokenTypeNVX</type>      <name>tokenType</name></member>
-            <member><type>uint32_t</type>                         <name>bindingUnit</name></member>  <!-- Binding unit for vertex attribute / descriptor set, offset for pushconstants -->
-            <member><type>uint32_t</type>                         <name>dynamicCount</name></member> <!-- Number of variable dynamic values for descriptor set / push constants -->
-            <member><type>uint32_t</type>                         <name>divisor</name></member>      <!-- Rate the which the array is advanced per element (must be power of 2, minimum 1) -->
+            <member><type>uint32_t</type>                         <name>bindingUnit</name><comment>Binding unit for vertex attribute / descriptor set, offset for pushconstants</comment></member>
+            <member><type>uint32_t</type>                         <name>dynamicCount</name><comment>Number of variable dynamic values for descriptor set / push constants</comment></member>
+            <member><type>uint32_t</type>                         <name>divisor</name><comment>Rate the which the array is advanced per element (must be power of 2, minimum 1)</comment></member>
         </type>
         <type category="struct" name="VkIndirectCommandsLayoutCreateInfoNVX">
             <member values="VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
@@ -1776,29 +1788,29 @@
             <member><type>VkPipelineLayout</type>             <name>pipelineLayout</name></member>
             <member><type>VkShaderStageFlags</type>           <name>stageFlags</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceFeatures2KHR">
+        <type category="struct" name="VkPhysicalDeviceFeatures2KHR" structextends="VkDeviceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkPhysicalDevice16BitStorageFeaturesKHR,VkPhysicalDeviceVariablePointerFeaturesKHR,VkPhysicalDeviceMultiviewFeaturesKHX,VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT"><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkPhysicalDeviceFeatures</type>         <name>features</name></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceProperties2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkPhysicalDevicePushDescriptorPropertiesKHR,VkPhysicalDeviceIDPropertiesKHR,VkPhysicalDeviceMultiviewPropertiesKHX,VkPhysicalDeviceDiscardRectanglePropertiesEXT,VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX,VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT,VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT"><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkPhysicalDeviceProperties</type>       <name>properties</name></member>
         </type>
         <type category="struct" name="VkFormatProperties2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkFormatProperties</type>               <name>formatProperties</name></member>
         </type>
         <type category="struct" name="VkImageFormatProperties2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkExternalImageFormatPropertiesKHR,VkTextureLODGatherFormatPropertiesAMD"><type>void</type>* <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>* <name>pNext</name></member>
             <member><type>VkImageFormatProperties</type>          <name>imageFormatProperties</name></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceImageFormatInfo2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkPhysicalDeviceExternalImageFormatInfoKHR">const <type>void</type>* <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>* <name>pNext</name></member>
             <member><type>VkFormat</type>                         <name>format</name></member>
             <member><type>VkImageType</type>                      <name>type</name></member>
             <member><type>VkImageTiling</type>                    <name>tiling</name></member>
@@ -1807,51 +1819,51 @@
         </type>
         <type category="struct" name="VkQueueFamilyProperties2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkQueueFamilyProperties</type>          <name>queueFamilyProperties</name></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceMemoryProperties2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkPhysicalDeviceMemoryProperties</type> <name>memoryProperties</name></member>
         </type>
         <type category="struct" name="VkSparseImageFormatProperties2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkSparseImageFormatProperties</type>    <name>properties</name></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceSparseImageFormatInfo2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkFormat</type>                         <name>format</name></member>
             <member><type>VkImageType</type>                      <name>type</name></member>
             <member><type>VkSampleCountFlagBits</type>            <name>samples</name></member>
             <member><type>VkImageUsageFlags</type>                <name>usage</name></member>
             <member><type>VkImageTiling</type>                    <name>tiling</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDevicePushDescriptorPropertiesKHR">
+        <type category="struct" name="VkPhysicalDevicePushDescriptorPropertiesKHR" structextends="VkPhysicalDeviceProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>maxPushDescriptors</name></member>
         </type>
-        <type category="struct" name="VkPresentRegionsKHR">
+        <type category="struct" name="VkPresentRegionsKHR" structextends="VkPresentInfoKHR">
             <member values="VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*  <name>pNext</name></member> <!-- Pointer to next structure -->
-            <member><type>uint32_t</type>                         <name>swapchainCount</name></member>           <!-- Copy of VkPresentInfoKHR::swapchainCount -->
-            <member len="swapchainCount" optional="true">const <type>VkPresentRegionKHR</type>*   <name>pRegions</name></member>       <!-- The regions that have changed -->
+            <member noautovalidity="true">const <type>void</type>*  <name>pNext</name></member>
+            <member><type>uint32_t</type>                         <name>swapchainCount</name><comment>Copy of VkPresentInfoKHR::swapchainCount</comment></member>
+            <member len="swapchainCount" optional="true">const <type>VkPresentRegionKHR</type>*   <name>pRegions</name><comment>The regions that have changed</comment></member>
         </type>
         <type category="struct" name="VkPresentRegionKHR">
-            <member optional="true"><type>uint32_t</type>         <name>rectangleCount</name></member>           <!-- Number of rectangles in pRectangles -->
-            <member optional="true" len="rectangleCount">const <type>VkRectLayerKHR</type>*   <name>pRectangles</name></member>  <!-- Array of rectangles that have changed in a swapchain's image(s) -->
+            <member optional="true"><type>uint32_t</type>         <name>rectangleCount</name><comment>Number of rectangles in pRectangles</comment></member>
+            <member optional="true" len="rectangleCount">const <type>VkRectLayerKHR</type>*   <name>pRectangles</name><comment>Array of rectangles that have changed in a swapchain's image(s)</comment></member>
         </type>
         <type category="struct" name="VkRectLayerKHR">
-            <member><type>VkOffset2D</type>                       <name>offset</name></member>                   <!-- upper-left corner of a rectangle that has not changed, in pixels of a presentation images -->
-            <member><type>VkExtent2D</type>                       <name>extent</name></member>                   <!-- Dimensions of a rectangle that has not changed, in pixels of a presentation images -->
-            <member><type>uint32_t</type>                         <name>layer</name></member>                    <!-- Layer of a swapchain's image(s), for stereoscopic-3D images -->
+            <member><type>VkOffset2D</type>                       <name>offset</name><comment>upper-left corner of a rectangle that has not changed, in pixels of a presentation images</comment></member>
+            <member><type>VkExtent2D</type>                       <name>extent</name><comment>Dimensions of a rectangle that has not changed, in pixels of a presentation images</comment></member>
+            <member><type>uint32_t</type>                         <name>layer</name><comment>Layer of a swapchain's image(s), for stereoscopic-3D images</comment></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceVariablePointerFeaturesKHR">
+        <type category="struct" name="VkPhysicalDeviceVariablePointerFeaturesKHR" structextends="VkPhysicalDeviceFeatures2KHR,VkDeviceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkBool32</type>                         <name>variablePointersStorageBuffer</name></member>
             <member><type>VkBool32</type>                         <name>variablePointers</name></member>
         </type>
@@ -1860,97 +1872,114 @@
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagsKHR</type> <name>exportFromImportedHandleTypes</name></member>
             <member><type>VkExternalMemoryHandleTypeFlagsKHR</type> <name>compatibleHandleTypes</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceExternalImageFormatInfoKHR">
+        <type category="struct" name="VkPhysicalDeviceExternalImageFormatInfoKHR"  structextends="VkPhysicalDeviceImageFormatInfo2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
         </type>
-        <type category="struct" name="VkExternalImageFormatPropertiesKHR" returnedonly="true">
+        <type category="struct" name="VkExternalImageFormatPropertiesKHR" returnedonly="true" structextends="VkImageFormatProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkExternalMemoryPropertiesKHR</type> <name>externalMemoryProperties</name></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceExternalBufferInfoKHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkBufferCreateFlags</type> <name>flags</name></member>
             <member><type>VkBufferUsageFlags</type>               <name>usage</name></member>
             <member><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
         </type>
         <type category="struct" name="VkExternalBufferPropertiesKHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkExternalMemoryPropertiesKHR</type>    <name>externalMemoryProperties</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceIDPropertiesKHR" returnedonly="true">
+        <type category="struct" name="VkPhysicalDeviceIDPropertiesKHR" returnedonly="true" structextends="VkPhysicalDeviceProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>uint8_t</type>                          <name>deviceUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
             <member><type>uint8_t</type>                          <name>driverUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
             <member><type>uint8_t</type>                          <name>deviceLUID</name>[<enum>VK_LUID_SIZE_KHR</enum>]</member>
             <member><type>uint32_t</type>                         <name>deviceNodeMask</name></member>
             <member><type>VkBool32</type>                         <name>deviceLUIDValid</name></member>
         </type>
-        <type category="struct" name="VkExternalMemoryImageCreateInfoKHR">
+        <type category="struct" name="VkExternalMemoryImageCreateInfoKHR" structextends="VkImageCreateInfo">
             <member values="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkExternalMemoryHandleTypeFlagsKHR</type> <name>handleTypes</name></member>
         </type>
-        <type category="struct" name="VkExternalMemoryBufferCreateInfoKHR">
+        <type category="struct" name="VkExternalMemoryBufferCreateInfoKHR" structextends="VkBufferCreateInfo">
             <member values="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagsKHR</type> <name>handleTypes</name></member>
         </type>
-        <type category="struct" name="VkExportMemoryAllocateInfoKHR">
+        <type category="struct" name="VkExportMemoryAllocateInfoKHR" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagsKHR</type> <name>handleTypes</name></member>
         </type>
-        <type category="struct" name="VkImportMemoryWin32HandleInfoKHR">
+        <type category="struct" name="VkImportMemoryWin32HandleInfoKHR" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
             <member optional="true"><type>HANDLE</type>           <name>handle</name></member>
             <member optional="true"><type>LPCWSTR</type>          <name>name</name></member>
         </type>
-        <type category="struct" name="VkExportMemoryWin32HandleInfoKHR">
+        <type category="struct" name="VkExportMemoryWin32HandleInfoKHR" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true">const <type>SECURITY_ATTRIBUTES</type>* <name>pAttributes</name></member>
             <member><type>DWORD</type>                            <name>dwAccess</name></member>
             <member><type>LPCWSTR</type>                          <name>name</name></member>
         </type>
+        <type category="struct" name="VkImportMemoryFuchsiaHandleInfoKHR" structextends="VkMemoryAllocateInfo">
+            <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_FUCHSIA_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
+            <member optional="true"><type>uint32_t</type>           <name>handle</name></member>
+        </type>
         <type category="struct" name="VkMemoryWin32HandlePropertiesKHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>memoryTypeBits</name></member>
         </type>
         <type category="struct" name="VkMemoryGetWin32HandleInfoKHR">
             <member values="VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkDeviceMemory</type>                   <name>memory</name></member>
             <member><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
         </type>
-        <type category="struct" name="VkImportMemoryFdInfoKHR">
+        <type category="struct" name="VkImportMemoryFdInfoKHR" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
             <member><type>int</type>                              <name>fd</name></member>
         </type>
         <type category="struct" name="VkMemoryFdPropertiesKHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>memoryTypeBits</name></member>
         </type>
         <type category="struct" name="VkMemoryGetFdInfoKHR">
             <member values="VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkDeviceMemory</type>                   <name>memory</name></member>
             <member><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
         </type>
-        <type category="struct" name="VkWin32KeyedMutexAcquireReleaseInfoKHR">
+        <type category="struct" name="VkMemoryFuchsiaHandlePropertiesKHR" returnedonly="true">
+            <member values="VK_STRUCTURE_TYPE_MEMORY_FUCHSIA_HANDLE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+            <member><type>void</type>*                            <name>pNext</name></member>
+            <member><type>uint32_t</type>                         <name>memoryTypeBits</name></member>
+        </type>
+        <type category="struct" name="VkMemoryGetFuchsiaHandleInfoKHR">
+            <member values="VK_STRUCTURE_TYPE_MEMORY_GET_FUCHSIA_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member><type>VkDeviceMemory</type>                   <name>memory</name></member>
+            <member><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
+        </type>
+        <type category="struct" name="VkWin32KeyedMutexAcquireReleaseInfoKHR" structextends="VkSubmitInfo">
             <member values="VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>         <name>acquireCount</name></member>
             <member len="acquireCount">const <type>VkDeviceMemory</type>* <name>pAcquireSyncs</name></member>
             <member len="acquireCount">const <type>uint64_t</type>* <name>pAcquireKeys</name></member>
@@ -1961,40 +1990,40 @@
         </type>
         <type category="struct" name="VkPhysicalDeviceExternalSemaphoreInfoKHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkExternalSemaphoreHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
         </type>
         <type category="struct" name="VkExternalSemaphorePropertiesKHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkExternalSemaphoreHandleTypeFlagsKHR</type> <name>exportFromImportedHandleTypes</name></member>
             <member><type>VkExternalSemaphoreHandleTypeFlagsKHR</type> <name>compatibleHandleTypes</name></member>
             <member optional="true"><type>VkExternalSemaphoreFeatureFlagsKHR</type> <name>externalSemaphoreFeatures</name></member>
         </type>
-        <type category="struct" name="VkExportSemaphoreCreateInfoKHR">
+        <type category="struct" name="VkExportSemaphoreCreateInfoKHR" structextends="VkSemaphoreCreateInfo">
             <member values="VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalSemaphoreHandleTypeFlagsKHR</type> <name>handleTypes</name></member>
         </type>
         <type category="struct" name="VkImportSemaphoreWin32HandleInfoKHR">
             <member values="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member externsync="true"><type>VkSemaphore</type>    <name>semaphore</name></member>
             <member optional="true"><type>VkSemaphoreImportFlagsKHR</type> <name>flags</name></member>
             <member optional="true"><type>VkExternalSemaphoreHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
             <member optional="true"><type>HANDLE</type>           <name>handle</name></member>
             <member optional="true"><type>LPCWSTR</type>          <name>name</name></member>
         </type>
-        <type category="struct" name="VkExportSemaphoreWin32HandleInfoKHR">
+        <type category="struct" name="VkExportSemaphoreWin32HandleInfoKHR" structextends="VkSemaphoreCreateInfo">
             <member values="VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true">const <type>SECURITY_ATTRIBUTES</type>*       <name>pAttributes</name></member>
             <member><type>DWORD</type>                            <name>dwAccess</name></member>
             <member><type>LPCWSTR</type>                          <name>name</name></member>
         </type>
-        <type category="struct" name="VkD3D12FenceSubmitInfoKHR">
+        <type category="struct" name="VkD3D12FenceSubmitInfoKHR" structextends="VkSubmitInfo">
             <member values="VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>         <name>waitSemaphoreValuesCount</name></member>
             <member optional="true" len="waitSemaphoreValuesCount">const <type>uint64_t</type>* <name>pWaitSemaphoreValues</name></member>
             <member optional="true"><type>uint32_t</type>         <name>signalSemaphoreValuesCount</name></member>
@@ -2002,13 +2031,13 @@
         </type>
         <type category="struct" name="VkSemaphoreGetWin32HandleInfoKHR">
             <member values="VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkSemaphore</type>                      <name>semaphore</name></member>
             <member><type>VkExternalSemaphoreHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
         </type>
         <type category="struct" name="VkImportSemaphoreFdInfoKHR">
             <member values="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member externsync="true"><type>VkSemaphore</type>    <name>semaphore</name></member>
             <member optional="true"><type>VkSemaphoreImportFlagsKHR</type> <name>flags</name></member>
             <member><type>VkExternalSemaphoreHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
@@ -2016,52 +2045,66 @@
         </type>
         <type category="struct" name="VkSemaphoreGetFdInfoKHR">
             <member values="VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member><type>VkSemaphore</type>                      <name>semaphore</name></member>
+            <member><type>VkExternalSemaphoreHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
+        </type>
+        <type category="struct" name="VkImportSemaphoreFuchsiaHandleInfoKHR">
+            <member values="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FUCHSIA_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member externsync="true"><type>VkSemaphore</type>    <name>semaphore</name></member>
+            <member optional="true"><type>VkSemaphoreImportFlagsKHR</type> <name>flags</name></member>
+            <member><type>VkExternalSemaphoreHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
+            <member><type>uint32_t</type>                              <name>handle</name></member>
+        </type>
+        <type category="struct" name="VkSemaphoreGetFuchsiaHandleInfoKHR">
+            <member values="VK_STRUCTURE_TYPE_SEMAPHORE_GET_FUCHSIA_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkSemaphore</type>                      <name>semaphore</name></member>
             <member><type>VkExternalSemaphoreHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceExternalFenceInfoKHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkExternalFenceHandleTypeFlagBitsKHR</type> <name>handleType</name></member>
         </type>
         <type category="struct" name="VkExternalFencePropertiesKHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkExternalFenceHandleTypeFlagsKHR</type> <name>exportFromImportedHandleTypes</name></member>
             <member><type>VkExternalFenceHandleTypeFlagsKHR</type> <name>compatibleHandleTypes</name></member>
             <member optional="true"><type>VkExternalFenceFeatureFlagsKHR</type> <name>externalFenceFeatures</name></member>
         </type>
-        <type category="struct" name="VkExportFenceCreateInfoKHR">
+        <type category="struct" name="VkExportFenceCreateInfoKHR" structextends="VkFenceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkExternalFenceHandleTypeFlagsKHR</type> <name>handleTypes</name></member>
         </type>
         <type category="struct" name="VkImportFenceWin32HandleInfoKHR">
             <member values="VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                        <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                                        <name>pNext</name></member>
             <member externsync="true"><type>VkFence</type>                          <name>fence</name></member>
             <member optional="true"><type>VkFenceImportFlagsKHR</type>              <name>flags</name></member>
             <member optional="true"><type>VkExternalFenceHandleTypeFlagBitsKHR</type>  <name>handleType</name></member>
             <member optional="true"><type>HANDLE</type>                             <name>handle</name></member>
             <member optional="true"><type>LPCWSTR</type>                            <name>name</name></member>
         </type>
-        <type category="struct" name="VkExportFenceWin32HandleInfoKHR">
+        <type category="struct" name="VkExportFenceWin32HandleInfoKHR" structextends="VkFenceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                                <name>pNext</name></member>
             <member optional="true">const <type>SECURITY_ATTRIBUTES</type>* <name>pAttributes</name></member>
             <member><type>DWORD</type>                                      <name>dwAccess</name></member>
             <member><type>LPCWSTR</type>                                    <name>name</name></member>
         </type>
         <type category="struct" name="VkFenceGetWin32HandleInfoKHR">
             <member values="VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                            <name>pNext</name></member>
             <member><type>VkFence</type>                                <name>fence</name></member>
             <member><type>VkExternalFenceHandleTypeFlagBitsKHR</type>   <name>handleType</name></member>
         </type>
         <type category="struct" name="VkImportFenceFdInfoKHR">
             <member values="VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                            <name>pNext</name></member>
             <member externsync="true"><type>VkFence</type>              <name>fence</name></member>
             <member optional="true"><type>VkFenceImportFlagsKHR</type>  <name>flags</name></member>
             <member><type>VkExternalFenceHandleTypeFlagBitsKHR</type>   <name>handleType</name></member>
@@ -2069,26 +2112,26 @@
         </type>
         <type category="struct" name="VkFenceGetFdInfoKHR">
             <member values="VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                            <name>pNext</name></member>
             <member><type>VkFence</type>                                <name>fence</name></member>
             <member><type>VkExternalFenceHandleTypeFlagBitsKHR</type>   <name>handleType</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceMultiviewFeaturesKHX">
+        <type category="struct" name="VkPhysicalDeviceMultiviewFeaturesKHX" structextends="VkPhysicalDeviceFeatures2KHR,VkDeviceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member><type>VkBool32</type>                         <name>multiview</name></member>                <!-- Multiple views in a renderpass -->
-            <member><type>VkBool32</type>                         <name>multiviewGeometryShader</name></member>  <!-- Multiple views in a renderpass w/ geometry shader -->
-            <member><type>VkBool32</type>                         <name>multiviewTessellationShader</name></member> <!-- Multiple views in a renderpass w/ tessellation shader -->
+            <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>
+            <member><type>VkBool32</type>                         <name>multiview</name><comment>Multiple views in a renderpass</comment></member>
+            <member><type>VkBool32</type>                         <name>multiviewGeometryShader</name><comment>Multiple views in a renderpass w/ geometry shader</comment></member>
+            <member><type>VkBool32</type>                         <name>multiviewTessellationShader</name><comment>Multiple views in a renderpass w/ tessellation shader</comment></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceMultiviewPropertiesKHX" returnedonly="true">
+        <type category="struct" name="VkPhysicalDeviceMultiviewPropertiesKHX" returnedonly="true" structextends="VkPhysicalDeviceProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member><type>uint32_t</type>                         <name>maxMultiviewViewCount</name></member>    <!-- max number of views in a subpass -->
-            <member><type>uint32_t</type>                         <name>maxMultiviewInstanceIndex</name></member> <!-- max instance index for a draw in a multiview subpass -->
+            <member><type>void</type>*                            <name>pNext</name></member>
+            <member><type>uint32_t</type>                         <name>maxMultiviewViewCount</name><comment>max number of views in a subpass</comment></member>
+            <member><type>uint32_t</type>                         <name>maxMultiviewInstanceIndex</name><comment>max instance index for a draw in a multiview subpass</comment></member>
         </type>
-        <type category="struct" name="VkRenderPassMultiviewCreateInfoKHX">
+        <type category="struct" name="VkRenderPassMultiviewCreateInfoKHX" structextends="VkRenderPassCreateInfo">
             <member values="VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHX"><type>VkStructureType</type>        <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>               <name>subpassCount</name></member>
             <member len="subpassCount">const <type>uint32_t</type>*     <name>pViewMasks</name></member>
             <member optional="true"><type>uint32_t</type>               <name>dependencyCount</name></member>
@@ -2099,16 +2142,16 @@
         <type category="struct" name="VkSurfaceCapabilities2EXT" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT"><type>VkStructureType</type> <name>sType</name></member>
             <member><type>void</type>*                            <name>pNext</name></member>
-            <member><type>uint32_t</type>                         <name>minImageCount</name></member>            <!-- Supported minimum number of images for the surface -->
-            <member><type>uint32_t</type>                         <name>maxImageCount</name></member>            <!-- Supported maximum number of images for the surface, 0 for unlimited -->
-            <member><type>VkExtent2D</type>                       <name>currentExtent</name></member>            <!-- Current image width and height for the surface, (0, 0) if undefined -->
-            <member><type>VkExtent2D</type>                       <name>minImageExtent</name></member>           <!-- Supported minimum image width and height for the surface -->
-            <member><type>VkExtent2D</type>                       <name>maxImageExtent</name></member>           <!-- Supported maximum image width and height for the surface -->
-            <member><type>uint32_t</type>                         <name>maxImageArrayLayers</name></member>      <!-- Supported maximum number of image layers for the surface -->
-            <member optional="true"><type>VkSurfaceTransformFlagsKHR</type>       <name>supportedTransforms</name></member>      <!-- 1 or more bits representing the transforms supported -->
-            <member><type>VkSurfaceTransformFlagBitsKHR</type>    <name>currentTransform</name></member>         <!-- The surface's current transform relative to the device's natural orientation -->
-            <member optional="true"><type>VkCompositeAlphaFlagsKHR</type>         <name>supportedCompositeAlpha</name></member>  <!-- 1 or more bits representing the alpha compositing modes supported -->
-            <member optional="true"><type>VkImageUsageFlags</type>                <name>supportedUsageFlags</name></member>      <!-- Supported image usage flags for the surface -->
+            <member><type>uint32_t</type>                         <name>minImageCount</name><comment>Supported minimum number of images for the surface</comment></member>
+            <member><type>uint32_t</type>                         <name>maxImageCount</name><comment>Supported maximum number of images for the surface, 0 for unlimited</comment></member>
+            <member><type>VkExtent2D</type>                       <name>currentExtent</name><comment>Current image width and height for the surface, (0, 0) if undefined</comment></member>
+            <member><type>VkExtent2D</type>                       <name>minImageExtent</name><comment>Supported minimum image width and height for the surface</comment></member>
+            <member><type>VkExtent2D</type>                       <name>maxImageExtent</name><comment>Supported maximum image width and height for the surface</comment></member>
+            <member><type>uint32_t</type>                         <name>maxImageArrayLayers</name><comment>Supported maximum number of image layers for the surface</comment></member>
+            <member optional="true"><type>VkSurfaceTransformFlagsKHR</type>       <name>supportedTransforms</name><comment>1 or more bits representing the transforms supported</comment></member>
+            <member><type>VkSurfaceTransformFlagBitsKHR</type>    <name>currentTransform</name><comment>The surface's current transform relative to the device's natural orientation</comment></member>
+            <member optional="true"><type>VkCompositeAlphaFlagsKHR</type>         <name>supportedCompositeAlpha</name><comment>1 or more bits representing the alpha compositing modes supported</comment></member>
+            <member optional="true"><type>VkImageUsageFlags</type>                <name>supportedUsageFlags</name><comment>Supported image usage flags for the surface</comment></member>
             <member optional="true"><type>VkSurfaceCounterFlagsEXT</type> <name>supportedSurfaceCounters</name></member>
         </type>
         <type category="struct" name="VkDisplayPowerInfoEXT">
@@ -2126,27 +2169,27 @@
             <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkDisplayEventTypeEXT</type>            <name>displayEvent</name></member>
         </type>
-        <type category="struct" name="VkSwapchainCounterCreateInfoEXT">
+        <type category="struct" name="VkSwapchainCounterCreateInfoEXT" structextends="VkSwapchainCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
             <member>const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkSurfaceCounterFlagsEXT</type>         <name>surfaceCounters</name></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceGroupPropertiesKHX" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>physicalDeviceCount</name></member>
             <member><type>VkPhysicalDevice</type>                 <name>physicalDevices</name>[<enum>VK_MAX_DEVICE_GROUP_SIZE_KHX</enum>]</member>
             <member><type>VkBool32</type>                         <name>subsetAllocation</name></member>
         </type>
-        <type category="struct" name="VkMemoryAllocateFlagsInfoKHX">
+        <type category="struct" name="VkMemoryAllocateFlagsInfoKHX" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkMemoryAllocateFlagsKHX</type> <name>flags</name></member>
             <member><type>uint32_t</type>                         <name>deviceMask</name></member>
         </type>
         <type category="struct" name="VkBindBufferMemoryInfoKHX">
             <member values="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkBuffer</type>                         <name>buffer</name></member>
             <member><type>VkDeviceMemory</type>                   <name>memory</name></member>
             <member><type>VkDeviceSize</type>                     <name>memoryOffset</name></member>
@@ -2155,7 +2198,7 @@
         </type>
         <type category="struct" name="VkBindImageMemoryInfoKHX">
             <member values="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkBindImageMemorySwapchainInfoKHX">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkImage</type>                          <name>image</name></member>
             <member><type>VkDeviceMemory</type>                   <name>memory</name></member>
             <member><type>VkDeviceSize</type>                     <name>memoryOffset</name></member>
@@ -2164,21 +2207,21 @@
             <member optional="true"><type>uint32_t</type>         <name>SFRRectCount</name></member>
             <member len="SFRRectCount">const <type>VkRect2D</type>*  <name>pSFRRects</name></member>
         </type>
-        <type category="struct" name="VkDeviceGroupRenderPassBeginInfoKHX">
+        <type category="struct" name="VkDeviceGroupRenderPassBeginInfoKHX" structextends="VkRenderPassBeginInfo">
             <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>deviceMask</name></member>
             <member optional="true"><type>uint32_t</type>         <name>deviceRenderAreaCount</name></member>
             <member len="deviceRenderAreaCount">const <type>VkRect2D</type>*  <name>pDeviceRenderAreas</name></member>
         </type>
-        <type category="struct" name="VkDeviceGroupCommandBufferBeginInfoKHX">
+        <type category="struct" name="VkDeviceGroupCommandBufferBeginInfoKHX" structextends="VkCommandBufferBeginInfo">
             <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>deviceMask</name></member>
         </type>
-        <type category="struct" name="VkDeviceGroupSubmitInfoKHX">
+        <type category="struct" name="VkDeviceGroupSubmitInfoKHX" structextends="VkSubmitInfo">
             <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>         <name>waitSemaphoreCount</name></member>
             <member len="waitSemaphoreCount">const <type>uint32_t</type>*    <name>pWaitSemaphoreDeviceIndices</name></member>
             <member optional="true"><type>uint32_t</type>         <name>commandBufferCount</name></member>
@@ -2186,135 +2229,134 @@
             <member optional="true"><type>uint32_t</type>         <name>signalSemaphoreCount</name></member>
             <member len="signalSemaphoreCount">const <type>uint32_t</type>*  <name>pSignalSemaphoreDeviceIndices</name></member>
         </type>
-        <type category="struct" name="VkDeviceGroupBindSparseInfoKHX">
+        <type category="struct" name="VkDeviceGroupBindSparseInfoKHX" structextends="VkBindSparseInfo">
             <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>resourceDeviceIndex</name></member>
             <member><type>uint32_t</type>                         <name>memoryDeviceIndex</name></member>
         </type>
         <type category="struct" name="VkDeviceGroupPresentCapabilitiesKHX" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>presentMask</name>[<enum>VK_MAX_DEVICE_GROUP_SIZE_KHX</enum>]</member>
             <member><type>VkDeviceGroupPresentModeFlagsKHX</type> <name>modes</name></member>
         </type>
-        <type category="struct" name="VkImageSwapchainCreateInfoKHX">
+        <type category="struct" name="VkImageSwapchainCreateInfoKHX" structextends="VkImageCreateInfo">
             <member values="VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>VkSwapchainKHR</type>   <name>swapchain</name></member>
         </type>
-        <type category="struct" name="VkBindImageMemorySwapchainInfoKHX">
+        <type category="struct" name="VkBindImageMemorySwapchainInfoKHX" structextends="VkBindImageMemoryInfoKHX">
             <member values="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></member>
             <member><type>uint32_t</type>                         <name>imageIndex</name></member>
         </type>
         <type category="struct" name="VkAcquireNextImageInfoKHX">
             <member values="VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
             <member externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></member>
             <member><type>uint64_t</type>                         <name>timeout</name></member>
             <member optional="true" externsync="true"><type>VkSemaphore</type> <name>semaphore</name></member>
             <member optional="true" externsync="true"><type>VkFence</type> <name>fence</name></member>
             <member><type>uint32_t</type>                         <name>deviceMask</name></member>
         </type>
-        <type category="struct" name="VkDeviceGroupPresentInfoKHX">
+        <type category="struct" name="VkDeviceGroupPresentInfoKHX" structextends="VkPresentInfoKHR">
             <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*  <name>pNext</name></member> <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*  <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>         <name>swapchainCount</name></member>
             <member len="swapchainCount">const <type>uint32_t</type>* <name>pDeviceMasks</name></member>
             <member><type>VkDeviceGroupPresentModeFlagBitsKHX</type> <name>mode</name></member>
         </type>
-        <type category="struct" name="VkDeviceGroupDeviceCreateInfoKHX">
+        <type category="struct" name="VkDeviceGroupDeviceCreateInfoKHX" structextends="VkDeviceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member optional="true"><type>uint32_t</type>                         <name>physicalDeviceCount</name></member>
             <member len="physicalDeviceCount">const <type>VkPhysicalDevice</type>*  <name>pPhysicalDevices</name></member>
         </type>
-        <type category="struct" name="VkDeviceGroupSwapchainCreateInfoKHX">
+        <type category="struct" name="VkDeviceGroupSwapchainCreateInfoKHX" structextends="VkSwapchainCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHX"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*                      <name>pNext</name></member>
             <member><type>VkDeviceGroupPresentModeFlagsKHX</type>                         <name>modes</name></member>
         </type>
         <type category="struct" name="VkDescriptorUpdateTemplateEntryKHR">
-            <member><type>uint32_t</type>                         <name>dstBinding</name></member>                     <!-- Binding within the destination descriptor set to write -->
-            <member><type>uint32_t</type>                         <name>dstArrayElement</name></member>                <!-- Array element within the destination binding to write -->
-            <member><type>uint32_t</type>                         <name>descriptorCount</name></member>                <!-- Number of descriptors to write -->
-            <member><type>VkDescriptorType</type>                 <name>descriptorType</name></member>                 <!-- Descriptor type to write -->
-            <member><type>size_t</type>                           <name>offset</name></member>                         <!-- Offset into pData where the descriptors to update are stored -->
-            <member><type>size_t</type>                           <name>stride</name></member>                         <!-- Stride between two descriptors in pData when writing more than one descriptor -->
+            <member><type>uint32_t</type>                         <name>dstBinding</name><comment>Binding within the destination descriptor set to write</comment></member>
+            <member><type>uint32_t</type>                         <name>dstArrayElement</name><comment>Array element within the destination binding to write</comment></member>
+            <member><type>uint32_t</type>                         <name>descriptorCount</name><comment>Number of descriptors to write</comment></member>
+            <member><type>VkDescriptorType</type>                 <name>descriptorType</name><comment>Descriptor type to write</comment></member>
+            <member><type>size_t</type>                           <name>offset</name><comment>Offset into pData where the descriptors to update are stored</comment></member>
+            <member><type>size_t</type>                           <name>stride</name><comment>Stride between two descriptors in pData when writing more than one descriptor</comment></member>
         </type>
         <type category="struct" name="VkDescriptorUpdateTemplateCreateInfoKHR">
             <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                                   <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkDescriptorUpdateTemplateCreateFlagsKHR</type>    <name>flags</name></member>                      <!-- Reserved -->
-            <member><type>uint32_t</type>                 <name>descriptorUpdateEntryCount</name></member>      <!-- Number of descriptor update entries to use for the update template -->
-            <member len="descriptorUpdateEntryCount">const <type>VkDescriptorUpdateTemplateEntryKHR</type>* <name>pDescriptorUpdateEntries</name></member> <!-- Descriptor update entries for the template -->
+            <member><type>void</type>*                                   <name>pNext</name></member>
+            <member optional="true"><type>VkDescriptorUpdateTemplateCreateFlagsKHR</type>    <name>flags</name></member>
+            <member><type>uint32_t</type>                 <name>descriptorUpdateEntryCount</name><comment>Number of descriptor update entries to use for the update template</comment></member>
+            <member len="descriptorUpdateEntryCount">const <type>VkDescriptorUpdateTemplateEntryKHR</type>* <name>pDescriptorUpdateEntries</name><comment>Descriptor update entries for the template</comment></member>
             <member><type>VkDescriptorUpdateTemplateTypeKHR</type> <name>templateType</name></member>
             <member optional="true"><type>VkDescriptorSetLayout</type> <name>descriptorSetLayout</name></member>
             <member optional="true"><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></member>
-            <member optional="true"><type>VkPipelineLayout</type><name>pipelineLayout</name></member>                             <!-- If used for push descriptors, this is the only allowed layout -->
+            <member optional="true"><type>VkPipelineLayout</type><name>pipelineLayout</name><comment>If used for push descriptors, this is the only allowed layout</comment></member>
             <member optional="true"><type>uint32_t</type> <name>set</name></member>
         </type>
-        <type category="struct" name="VkXYColorEXT">
-            <!-- chromaticity coordinate -->
+        <type category="struct" name="VkXYColorEXT" comment="Chromaticity coordinate">
             <member><type>float</type>   <name>x</name></member>
             <member><type>float</type>   <name>y</name></member>
         </type>
         <type category="struct" name="VkHdrMetadataEXT">
-            <!-- Display primary in chromaticity coordinates -->
+                <comment>Display primary in chromaticity coordinates</comment>
             <member values="VK_STRUCTURE_TYPE_HDR_METADATA_EXT"><type>VkStructureType</type> <name>sType</name></member>
             <member>const <type>void</type>*    <name>pNext</name></member>
-            <!-- From SMPTE 2086 -->
-            <member><type>VkXYColorEXT</type>   <name>displayPrimaryRed</name></member>   <!-- Display primary's Red -->
-            <member><type>VkXYColorEXT</type>   <name>displayPrimaryGreen</name></member> <!-- Display primary's Green -->
-            <member><type>VkXYColorEXT</type>   <name>displayPrimaryBlue</name></member>  <!-- Display primary's Blue -->
-            <member><type>VkXYColorEXT</type>   <name>whitePoint</name></member>          <!-- Display primary's Blue -->
-            <member><type>float</type>          <name>maxLuminance</name></member>        <!-- Display maximum luminance -->
-            <member><type>float</type>          <name>minLuminance</name></member>        <!-- Display minimum luminance -->
-            <!-- From CTA 861.3 -->
-            <member><type>float</type>          <name>maxContentLightLevel</name></member><!-- Content maximum luminance -->
+                <comment> From SMPTE 2086</comment>
+            <member><type>VkXYColorEXT</type>   <name>displayPrimaryRed</name><comment>Display primary's Red</comment></member>
+            <member><type>VkXYColorEXT</type>   <name>displayPrimaryGreen</name><comment>Display primary's Green</comment></member>
+            <member><type>VkXYColorEXT</type>   <name>displayPrimaryBlue</name><comment>Display primary's Blue</comment></member>
+            <member><type>VkXYColorEXT</type>   <name>whitePoint</name><comment>Display primary's Blue</comment></member>
+            <member><type>float</type>          <name>maxLuminance</name><comment>Display maximum luminance</comment></member>
+            <member><type>float</type>          <name>minLuminance</name><comment>Display minimum luminance</comment></member>
+                <comment> From CTA 861.3</comment>
+            <member><type>float</type>          <name>maxContentLightLevel</name><comment>Content maximum luminance</comment></member>
             <member><type>float</type>          <name>maxFrameAverageLightLevel</name></member>
         </type>
         <type category="struct" name="VkRefreshCycleDurationGOOGLE">
-            <member><type>uint64_t</type>                         <name>refreshDuration</name></member>          <!-- Number of nanoseconds from the start of one refresh cycle to the next -->
+            <member><type>uint64_t</type>                         <name>refreshDuration</name><comment>Number of nanoseconds from the start of one refresh cycle to the next</comment></member>
         </type>
         <type category="struct" name="VkPastPresentationTimingGOOGLE">
-            <member><type>uint32_t</type>                         <name>presentID</name></member>                <!-- Application-provided identifier, previously given to vkQueuePresentKHR -->
-            <member><type>uint64_t</type>                         <name>desiredPresentTime</name></member>       <!-- Earliest time an image should have been presented, previously given to vkQueuePresentKHR -->
-            <member><type>uint64_t</type>                         <name>actualPresentTime</name></member>        <!-- Time the image was actually displayed -->
-            <member><type>uint64_t</type>                         <name>earliestPresentTime</name></member>      <!-- Earliest time the image could have been displayed -->
-            <member><type>uint64_t</type>                         <name>presentMargin</name></member>            <!-- How early vkQueuePresentKHR was processed vs. how soon it needed to be and make earliestPresentTime -->
+            <member><type>uint32_t</type>                         <name>presentID</name><comment>Application-provided identifier, previously given to vkQueuePresentKHR</comment></member>
+            <member><type>uint64_t</type>                         <name>desiredPresentTime</name><comment>Earliest time an image should have been presented, previously given to vkQueuePresentKHR</comment></member>
+            <member><type>uint64_t</type>                         <name>actualPresentTime</name><comment>Time the image was actually displayed</comment></member>
+            <member><type>uint64_t</type>                         <name>earliestPresentTime</name><comment>Earliest time the image could have been displayed</comment></member>
+            <member><type>uint64_t</type>                         <name>presentMargin</name><comment>How early vkQueuePresentKHR was processed vs. how soon it needed to be and make earliestPresentTime</comment></member>
         </type>
-        <type category="struct" name="VkPresentTimesInfoGOOGLE">
+        <type category="struct" name="VkPresentTimesInfoGOOGLE" structextends="VkPresentInfoKHR">
             <member values="VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*  <name>pNext</name></member> <!-- Pointer to next structure -->
-            <member><type>uint32_t</type>                         <name>swapchainCount</name></member>           <!-- Copy of VkPresentInfoKHR::swapchainCount -->
-            <member len="swapchainCount" optional="true">const <type>VkPresentTimeGOOGLE</type>*   <name>pTimes</name></member> <!-- The earliest times to present images -->
+            <member noautovalidity="true">const <type>void</type>*  <name>pNext</name></member>
+            <member><type>uint32_t</type>                         <name>swapchainCount</name><comment>Copy of VkPresentInfoKHR::swapchainCount</comment></member>
+            <member len="swapchainCount" optional="true">const <type>VkPresentTimeGOOGLE</type>*   <name>pTimes</name><comment>The earliest times to present images</comment></member>
         </type>
         <type category="struct" name="VkPresentTimeGOOGLE">
-            <member><type>uint32_t</type>                         <name>presentID</name></member>                <!-- Application-provided identifier -->
-            <member><type>uint64_t</type>                         <name>desiredPresentTime</name></member>       <!-- Earliest time an image should be presented -->
+            <member><type>uint32_t</type>                         <name>presentID</name><comment>Application-provided identifier</comment></member>
+            <member><type>uint64_t</type>                         <name>desiredPresentTime</name><comment>Earliest time an image should be presented</comment></member>
         </type>
         <type category="struct" name="VkIOSSurfaceCreateInfoMVK">
             <member values="VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                    <name>pNext</name></member>     <!-- Pointer to next structure -->
-            <member optional="true"><type>VkIOSSurfaceCreateFlagsMVK</type>     <name>flags</name></member>     <!-- Reserved -->
+            <member>const <type>void</type>*                                    <name>pNext</name></member>
+            <member optional="true"><type>VkIOSSurfaceCreateFlagsMVK</type>     <name>flags</name></member>
             <member>const <type>void</type>*                                    <name>pView</name></member>
         </type>
         <type category="struct" name="VkMacOSSurfaceCreateInfoMVK">
             <member values="VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                    <name>pNext</name></member>     <!-- Pointer to next structure -->
-            <member optional="true"><type>VkMacOSSurfaceCreateFlagsMVK</type>   <name>flags</name></member>     <!-- Reserved -->
+            <member>const <type>void</type>*                                    <name>pNext</name></member>
+            <member optional="true"><type>VkMacOSSurfaceCreateFlagsMVK</type>   <name>flags</name></member>
             <member>const <type>void</type>*                                    <name>pView</name></member>
         </type>
         <type category="struct" name="VkViewportWScalingNV">
             <member><type>float</type>          <name>xcoeff</name></member>
             <member><type>float</type>          <name>ycoeff</name></member>
         </type>
-        <type category="struct" name="VkPipelineViewportWScalingStateCreateInfoNV">
+        <type category="struct" name="VkPipelineViewportWScalingStateCreateInfoNV" structextends="VkPipelineViewportStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true">const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member noautovalidity="true">const <type>void</type>*            <name>pNext</name></member>
             <member><type>VkBool32</type>               <name>viewportWScalingEnable</name></member>
             <member><type>uint32_t</type>               <name>viewportCount</name></member>
             <member noautovalidity="true" len="viewportCount">const <type>VkViewportWScalingNV</type>*      <name>pViewportWScalings</name></member>
@@ -2325,29 +2367,29 @@
             <member><type>VkViewportCoordinateSwizzleNV</type>          <name>z</name></member>
             <member><type>VkViewportCoordinateSwizzleNV</type>          <name>w</name></member>
         </type>
-        <type category="struct" name="VkPipelineViewportSwizzleStateCreateInfoNV">
+        <type category="struct" name="VkPipelineViewportSwizzleStateCreateInfoNV" structextends="VkPipelineViewportStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineViewportSwizzleStateCreateFlagsNV</type>    <name>flags</name></member>           <!-- Reserved -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineViewportSwizzleStateCreateFlagsNV</type>    <name>flags</name></member>
             <member><type>uint32_t</type>               <name>viewportCount</name></member>
             <member noautovalidity="true" optional="true" len="viewportCount">const <type>VkViewportSwizzleNV</type>*      <name>pViewportSwizzles</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceDiscardRectanglePropertiesEXT">
+        <type category="struct" name="VkPhysicalDeviceDiscardRectanglePropertiesEXT" structextends="VkPhysicalDeviceProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                  <name>pNext</name></member>                          <!-- Pointer to next structure -->
-            <member><type>uint32_t</type>               <name>maxDiscardRectangles</name></member>           <!-- max number of active discard rectangles -->
+            <member><type>void</type>*                  <name>pNext</name></member>
+            <member><type>uint32_t</type>               <name>maxDiscardRectangles</name><comment>max number of active discard rectangles</comment></member>
         </type>
-        <type category="struct" name="VkPipelineDiscardRectangleStateCreateInfoEXT">
+        <type category="struct" name="VkPipelineDiscardRectangleStateCreateInfoEXT" structextends="VkGraphicsPipelineCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                                                      <name>pNext</name></member>                 <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineDiscardRectangleStateCreateFlagsEXT</type>                    <name>flags</name></member>                 <!-- Reserved -->
+            <member>const <type>void</type>*                                                                      <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineDiscardRectangleStateCreateFlagsEXT</type>                    <name>flags</name></member>
             <member><type>VkDiscardRectangleModeEXT</type>                                                        <name>discardRectangleMode</name></member>
             <member optional="true"><type>uint32_t</type>                                                         <name>discardRectangleCount</name></member>
             <member noautovalidity="true" optional="true" len="discardRectangleCount">const <type>VkRect2D</type>* <name>pDiscardRectangles</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX" returnedonly="true">
+        <type category="struct" name="VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX" returnedonly="true" structextends="VkPhysicalDeviceProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkBool32</type>                         <name>perViewPositionAllComponents</name></member>
         </type>
         <type category="struct" name="VkPhysicalDeviceSurfaceInfo2KHR">
@@ -2357,7 +2399,7 @@
         </type>
         <type category="struct" name="VkSurfaceCapabilities2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkSharedPresentSurfaceCapabilitiesKHR"><type>void</type>*   <name>pNext</name></member> <!-- Pointer to next structure -->
+            <member><type>void</type>*   <name>pNext</name></member>
             <member><type>VkSurfaceCapabilitiesKHR</type> <name>surfaceCapabilities</name></member>
         </type>
         <type category="struct" name="VkSurfaceFormat2KHR" returnedonly="true">
@@ -2365,87 +2407,87 @@
             <member><type>void</type>* <name>pNext</name></member>
             <member><type>VkSurfaceFormatKHR</type> <name>surfaceFormat</name></member>
         </type>
-        <type category="struct" name="VkSharedPresentSurfaceCapabilitiesKHR" returnedonly="true">
+        <type category="struct" name="VkSharedPresentSurfaceCapabilitiesKHR" returnedonly="true" structextends="VkSurfaceCapabilities2KHR">
             <member values="VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkImageUsageFlags</type> <name>sharedPresentSupportedUsageFlags</name></member> <!-- Supported image usage flags if swapchain created using a shared present mode -->
+            <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>
+            <member optional="true"><type>VkImageUsageFlags</type> <name>sharedPresentSupportedUsageFlags</name><comment>Supported image usage flags if swapchain created using a shared present mode</comment></member>
         </type>
-        <type category="struct" name="VkPhysicalDevice16BitStorageFeaturesKHR">
+        <type category="struct" name="VkPhysicalDevice16BitStorageFeaturesKHR" structextends="VkPhysicalDeviceFeatures2KHR,VkDeviceCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true"><type>void</type>*      <name>pNext</name></member>                                 <!-- Pointer to next structure -->
-            <member><type>VkBool32</type>                         <name>storageBuffer16BitAccess</name></member>              <!-- 16-bit integer/floating-point variables supported in BufferBlock -->
-            <member><type>VkBool32</type>                         <name>uniformAndStorageBuffer16BitAccess</name></member>    <!-- 16-bit integer/floating-point variables supported in BufferBlock and Block -->
-            <member><type>VkBool32</type>                         <name>storagePushConstant16</name></member>                 <!-- 16-bit integer/floating-point variables supported in PushConstant -->
-            <member><type>VkBool32</type>                         <name>storageInputOutput16</name></member>                  <!-- 16-bit integer/floating-point variables supported in shader inputs and outputs -->
+            <member noautovalidity="true"><type>void</type>*      <name>pNext</name></member>
+            <member><type>VkBool32</type>                         <name>storageBuffer16BitAccess</name><comment>16-bit integer/floating-point variables supported in BufferBlock</comment></member>
+            <member><type>VkBool32</type>                         <name>uniformAndStorageBuffer16BitAccess</name><comment>16-bit integer/floating-point variables supported in BufferBlock and Block</comment></member>
+            <member><type>VkBool32</type>                         <name>storagePushConstant16</name><comment>16-bit integer/floating-point variables supported in PushConstant</comment></member>
+            <member><type>VkBool32</type>                         <name>storageInputOutput16</name><comment>16-bit integer/floating-point variables supported in shader inputs and outputs</comment></member>
         </type>
         <type category="struct" name="VkBufferMemoryRequirementsInfo2KHR">
             <member values="VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                                          <name>pNext</name></member>  <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                                                          <name>pNext</name></member>
             <member><type>VkBuffer</type>                                                             <name>buffer</name></member>
         </type>
         <type category="struct" name="VkImageMemoryRequirementsInfo2KHR">
             <member values="VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                                          <name>pNext</name></member>  <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                                                          <name>pNext</name></member>
             <member><type>VkImage</type>                                                              <name>image</name></member>
         </type>
         <type category="struct" name="VkImageSparseMemoryRequirementsInfo2KHR">
             <member values="VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                                          <name>pNext</name></member>  <!-- Pointer to next structure -->
+            <member>const <type>void</type>*                                                          <name>pNext</name></member>
             <member><type>VkImage</type>                                                              <name>image</name></member>
         </type>
         <type category="struct" name="VkMemoryRequirements2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member validextensionstructs="VkMemoryDedicatedRequirementsKHR"><type>void</type>* <name>pNext</name></member>  <!-- Pointer to next structure -->
+            <member><type>void</type>* <name>pNext</name></member>
             <member><type>VkMemoryRequirements</type>                                                 <name>memoryRequirements</name></member>
         </type>
         <type category="struct" name="VkSparseImageMemoryRequirements2KHR" returnedonly="true">
             <member values="VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                                       <name>pNext</name></member>  <!-- Pointer to next structure -->
+            <member><type>void</type>*                                       <name>pNext</name></member>
             <member><type>VkSparseImageMemoryRequirements</type>                                      <name>memoryRequirements</name></member>
         </type>
-        <type category="struct" name="VkMemoryDedicatedRequirementsKHR" returnedonly="true">
+        <type category="struct" name="VkMemoryDedicatedRequirementsKHR" returnedonly="true" structextends="VkMemoryRequirements2KHR">
             <member values="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkBool32</type>                         <name>prefersDedicatedAllocation</name></member>
             <member><type>VkBool32</type>                         <name>requiresDedicatedAllocation</name></member>
         </type>
-        <type category="struct" name="VkMemoryDedicatedAllocateInfoKHR">
+        <type category="struct" name="VkMemoryDedicatedAllocateInfoKHR" structextends="VkMemoryAllocateInfo">
             <member values="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                      <name>pNext</name></member>                    <!-- Pointer to next structure -->
-            <member optional="true"><type>VkImage</type>          <name>image</name></member>                    <!-- Image that this allocation will be bound to -->
-            <member optional="true"><type>VkBuffer</type>         <name>buffer</name></member>                   <!-- Buffer that this allocation will be bound to -->
+            <member>const <type>void</type>*                      <name>pNext</name></member>
+            <member optional="true"><type>VkImage</type>          <name>image</name><comment>Image that this allocation will be bound to</comment></member>
+            <member optional="true"><type>VkBuffer</type>         <name>buffer</name><comment>Buffer that this allocation will be bound to</comment></member>
         </type>
-        <type category="struct" name="VkTextureLODGatherFormatPropertiesAMD" returnedonly="true">
+        <type category="struct" name="VkTextureLODGatherFormatPropertiesAMD" returnedonly="true" structextends="VkImageFormatProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkBool32</type>                         <name>supportsTextureGatherLODBiasAMD</name></member>
         </type>
-        <type category="struct" name="VkPipelineCoverageToColorStateCreateInfoNV">
+        <type category="struct" name="VkPipelineCoverageToColorStateCreateInfoNV" structextends="VkPipelineMultisampleStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                                                      <name>pNext</name></member>                 <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineCoverageToColorStateCreateFlagsNV</type>                    <name>flags</name></member>                 <!-- Reserved -->
+            <member>const <type>void</type>*                                                                      <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineCoverageToColorStateCreateFlagsNV</type>                    <name>flags</name></member>
             <member><type>VkBool32</type>                         <name>coverageToColorEnable</name></member>
             <member optional="true"><type>uint32_t</type>         <name>coverageToColorLocation</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT" returnedonly="true">
+        <type category="struct" name="VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member><type>void</type>*                  <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member><type>void</type>*                  <name>pNext</name></member>
             <member><type>VkBool32</type>               <name>filterMinmaxSingleComponentFormats</name></member>
             <member><type>VkBool32</type>               <name>filterMinmaxImageComponentMapping</name></member>
         </type>
-        <type category="struct" name="VkSamplerReductionModeCreateInfoEXT">
+        <type category="struct" name="VkSamplerReductionModeCreateInfoEXT" structextends="VkSamplerCreateInfo">
             <member values="VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
             <member><type>VkSamplerReductionModeEXT</type> <name>reductionMode</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT">
+        <type category="struct" name="VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT" structextends="VkPhysicalDeviceFeatures2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>
             <member><type>VkBool32</type>                         <name>advancedBlendCoherentOperations</name></member>
         </type>
-        <type category="struct" name="VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT" returnedonly="true">
+        <type category="struct" name="VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2KHR">
             <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
+            <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>
             <member><type>uint32_t</type>                         <name>advancedBlendMaxColorAttachments</name></member>
             <member><type>VkBool32</type>                         <name>advancedBlendIndependentBlend</name></member>
             <member><type>VkBool32</type>                         <name>advancedBlendNonPremultipliedSrcColor</name></member>
@@ -2453,17 +2495,17 @@
             <member><type>VkBool32</type>                         <name>advancedBlendCorrelatedOverlap</name></member>
             <member><type>VkBool32</type>                         <name>advancedBlendAllOperations</name></member>
         </type>
-        <type category="struct" name="VkPipelineColorBlendAdvancedStateCreateInfoEXT">
+        <type category="struct" name="VkPipelineColorBlendAdvancedStateCreateInfoEXT" structextends="VkPipelineColorBlendStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*            <name>pNext</name></member>                          <!-- Pointer to next structure -->
+            <member>const <type>void</type>*            <name>pNext</name></member>
             <member><type>VkBool32</type>               <name>srcPremultiplied</name></member>
             <member><type>VkBool32</type>               <name>dstPremultiplied</name></member>
             <member><type>VkBlendOverlapEXT</type>      <name>blendOverlap</name></member>
         </type>
-        <type category="struct" name="VkPipelineCoverageModulationStateCreateInfoNV">
+        <type category="struct" name="VkPipelineCoverageModulationStateCreateInfoNV" structextends="VkPipelineMultisampleStateCreateInfo">
             <member values="VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
-            <member>const <type>void</type>*                                                                      <name>pNext</name></member>                 <!-- Pointer to next structure -->
-            <member optional="true"><type>VkPipelineCoverageModulationStateCreateFlagsNV</type>                   <name>flags</name></member>                 <!-- Reserved -->
+            <member>const <type>void</type>*                                                                      <name>pNext</name></member>
+            <member optional="true"><type>VkPipelineCoverageModulationStateCreateFlagsNV</type>                   <name>flags</name></member>
             <member><type>VkCoverageModulationModeNV</type>                                                       <name>coverageModulationMode</name></member>
             <member><type>VkBool32</type>                                                                         <name>coverageModulationTableEnable</name></member>
             <member><type>uint32_t</type>                                                                         <name>coverageModulationTableCount</name></member>
@@ -2471,17 +2513,16 @@
         </type>
     </types>
 
-    <!-- SECTION: Vulkan enumerant (token) definitions. -->
+    <comment>Vulkan enumerant (token) definitions</comment>
 
-    <enums name="API Constants" comment="Misc. hardcoded constants - not an enumerated type">
-            <!-- This is part of the header boilerplate -->
+    <enums name="API Constants" comment="Vulkan hardcoded constants - not an enumerated type, part of the header boilerplate">
         <enum value="256"   name="VK_MAX_PHYSICAL_DEVICE_NAME_SIZE"/>
         <enum value="16"    name="VK_UUID_SIZE"/>
         <enum value="8"     name="VK_LUID_SIZE_KHR"/>
         <enum value="256"   name="VK_MAX_EXTENSION_NAME_SIZE"/>
         <enum value="256"   name="VK_MAX_DESCRIPTION_SIZE"/>
         <enum value="32"    name="VK_MAX_MEMORY_TYPES"/>
-        <enum value="16"    name="VK_MAX_MEMORY_HEAPS"/> <!-- The maximum number of unique memory heaps, each of which supporting 1 or more memory types. -->
+        <enum value="16"    name="VK_MAX_MEMORY_HEAPS" comment="The maximum number of unique memory heaps, each of which supporting 1 or more memory types"/>
         <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"/>
@@ -2495,12 +2536,14 @@
         <enum value="32"    name="VK_MAX_DEVICE_GROUP_SIZE_KHX"/>
     </enums>
 
-    <!-- Unlike OpenGL, most tokens in Vulkan are actual typed enumerants in
-         their own numeric namespaces. The "name" attribute is the C enum
-         type name, and is pulled in from a <type> definition above
-         (slightly clunky, but retains the type / enum distinction). "type"
-         attributes of "enum" or "bitmask" indicate that these values should
-         be generated inside an appropriate definition. -->
+    <comment>
+        Unlike OpenGL, most tokens in Vulkan are actual typed enumerants in
+        their own numeric namespaces. The "name" attribute is the C enum
+        type name, and is pulled in from a type tag definition above
+        (slightly clunky, but retains the type / enum distinction). "type"
+        attributes of "enum" or "bitmask" indicate that these values should
+        be generated inside an appropriate definition.
+    </comment>
 
     <enums name="VkImageLayout" type="enum">
         <enum value="0"     name="VK_IMAGE_LAYOUT_UNDEFINED"                         comment="Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation)"/>
@@ -2620,7 +2663,11 @@
         <enum value="1"     name="VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT"/>
         <enum value="2"     name="VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE"/>
         <enum value="3"     name="VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER"/>
-        <!-- <enum value="4"     name="VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE" comment="Reserved for VK_KHR_sampler_mirror_clamp_to_edge, do not alias!"/> -->
+            <comment>
+                value="4" reserved for VK_KHR_sampler_mirror_clamp_to_edge
+                enum VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; do not
+                alias!
+            </comment>
     </enums>
     <enums name="VkCompareOp" type="enum">
         <enum value="0"     name="VK_COMPARE_OP_NEVER"/>
@@ -2959,22 +3006,22 @@
         <enum value="44"    name="VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER"/>
         <enum value="45"    name="VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER"/>
         <enum value="46"    name="VK_STRUCTURE_TYPE_MEMORY_BARRIER"/>
-        <enum value="47"    name="VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO"/> <!-- Reserved for internal use by the loader, layers, and ICDs -->
-        <enum value="48"    name="VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO"/> <!-- Reserved for internal use by the loader, layers, and ICDs -->
+        <enum value="47"    name="VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO" comment="Reserved for internal use by the loader, layers, and ICDs"/>
+        <enum value="48"    name="VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO" comment="Reserved for internal use by the loader, layers, and ICDs"/>
     </enums>
     <enums name="VkSubpassContents" type="enum">
         <enum value="0"     name="VK_SUBPASS_CONTENTS_INLINE"/>
         <enum value="1"     name="VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS"/>
     </enums>
-    <enums name="VkResult" type="enum" comment="Error and return codes">
-        <!-- Return codes for successful operation execution (positive values) -->
+    <enums name="VkResult" type="enum" comment="API result codes">
+            <comment>Return codes (positive values)</comment>
         <enum value="0"     name="VK_SUCCESS" comment="Command completed successfully"/>
         <enum value="1"     name="VK_NOT_READY" comment="A fence or query has not yet completed"/>
         <enum value="2"     name="VK_TIMEOUT" comment="A wait operation has not completed in the specified time"/>
         <enum value="3"     name="VK_EVENT_SET" comment="An event is signaled"/>
         <enum value="4"     name="VK_EVENT_RESET" comment="An event is unsignaled"/>
         <enum value="5"     name="VK_INCOMPLETE" comment="A return array was too small for the result"/>
-        <!-- Error codes (negative values) -->
+            <comment>Error codes (negative values)</comment>
         <enum value="-1"    name="VK_ERROR_OUT_OF_HOST_MEMORY" comment="A host memory allocation has failed"/>
         <enum value="-2"    name="VK_ERROR_OUT_OF_DEVICE_MEMORY" comment="A device memory allocation has failed"/>
         <enum value="-3"    name="VK_ERROR_INITIALIZATION_FAILED" comment="Initialization of a object has failed"/>
@@ -3033,7 +3080,7 @@
         <enum value="25" name="VK_OBJECT_TYPE_COMMAND_POOL"                          comment="VkCommandPool"/>
     </enums>
 
-    <!-- Flags -->
+        <comment>Flags</comment>
     <enums name="VkQueueFlagBits" type="bitmask">
         <enum bitpos="0"    name="VK_QUEUE_GRAPHICS_BIT"                             comment="Queue supports graphics operations"/>
         <enum bitpos="1"    name="VK_QUEUE_COMPUTE_BIT"                              comment="Queue supports compute operations"/>
@@ -3234,7 +3281,8 @@
     <enums name="VkDependencyFlagBits" type="bitmask">
         <enum bitpos="0"    name="VK_DEPENDENCY_BY_REGION_BIT"                       comment="Dependency is per pixel region "/>
     </enums>
-        <!-- WSI extensions -->
+
+        <comment>WSI Extensions</comment>
     <enums name="VkPresentModeKHR" type="enum">
         <enum value="0"     name="VK_PRESENT_MODE_IMMEDIATE_KHR"/>
         <enum value="1"     name="VK_PRESENT_MODE_MAILBOX_KHR"/>
@@ -3310,8 +3358,8 @@
         <enum value="32" name="VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT"/>
     </enums>
     <enums name="VkRasterizationOrderAMD" type="enum">
-        <enum value="0" name="VK_RASTERIZATION_ORDER_STRICT_AMD"/>      <!-- Rasterization order strictly follows API order -->
-        <enum value="1" name="VK_RASTERIZATION_ORDER_RELAXED_AMD"/>     <!-- Rasterization order may not follow API order -->
+        <enum value="0" name="VK_RASTERIZATION_ORDER_STRICT_AMD"/>
+        <enum value="1" name="VK_RASTERIZATION_ORDER_RELAXED_AMD"/>
     </enums>
     <enums name="VkExternalMemoryHandleTypeFlagBitsNV" type="bitmask">
         <enum bitpos="0" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV"/>
@@ -3327,27 +3375,27 @@
     <enums name="VkValidationCheckEXT" type="enum">
         <enum value="0" name="VK_VALIDATION_CHECK_ALL_EXT"/>
         <enum value="1" name="VK_VALIDATION_CHECK_SHADERS_EXT"/>
-        <!-- Placeholder for validation enums to be defined for VK_EXT_Validation_flags extension -->
+            <comment>Placeholder for validation enums to be defined for VK_EXT_Validation_flags extension</comment>
     </enums>
     <enums name="VkIndirectCommandsLayoutUsageFlagBitsNVX" type="bitmask">
-        <enum bitpos="0" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX"/> <!-- sequences can be processed in implementation-dependent order -->
-        <enum bitpos="1" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX"/>    <!-- likely generated with a high difference in actual sequencesCount and maxSequencesCount -->
-        <enum bitpos="2" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX"/>    <!-- likely to contain draw/dispatch calls that are zero-sized -->
-        <enum bitpos="3" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX"/>   <!-- custom sequence index permutation (32-bit) is provided -->
+        <enum bitpos="0" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX"/>
+        <enum bitpos="1" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX"/>
+        <enum bitpos="2" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX"/>
+        <enum bitpos="3" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX"/>
     </enums>
     <enums name="VkObjectEntryUsageFlagBitsNVX" type="bitmask">
         <enum bitpos="0" name="VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX"/>
         <enum bitpos="1" name="VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX"/>
     </enums>
     <enums name="VkIndirectCommandsTokenTypeNVX" type="enum">
-        <enum value="0" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX"/>        <!-- array of 32bit tableEntry in the object table -->
-        <enum value="1" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX"/>  <!-- array of (32 bit tableEntry + variable count 32bit offsets) -->
-        <enum value="2" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX"/>    <!-- array of (32 bit tableEntry + optional 32bit offset) -->
-        <enum value="3" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX"/>   <!-- array of (32 bit tableEntry + optional 32bit offset) -->
-        <enum value="4" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX"/>   <!-- array of (32 bit tableEntry + variable count 32bit values ) -->
-        <enum value="5" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX"/>    <!-- array of VkDrawIndexedIndirectCommand -->
-        <enum value="6" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX"/>            <!-- array of VkDrawIndirectCommand -->
-        <enum value="7" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX"/>        <!-- array of VkDispatchIndirectCommand -->
+        <enum value="0" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX"/>
+        <enum value="1" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX"/>
+        <enum value="2" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX"/>
+        <enum value="3" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX"/>
+        <enum value="4" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX"/>
+        <enum value="5" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX"/>
+        <enum value="6" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX"/>
+        <enum value="7" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX"/>
     </enums>
     <enums name="VkObjectEntryTypeNVX" type="enum">
         <enum value="0" name="VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX"/>
@@ -3366,6 +3414,7 @@
         <enum bitpos="4" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR"/>
         <enum bitpos="5" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR"/>
         <enum bitpos="6" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR"/>
+        <enum bitpos="7" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_FUCHSIA_VMO_BIT_KHR"/>
     </enums>
     <enums name="VkExternalMemoryFeatureFlagBitsKHR" type="bitmask">
         <enum bitpos="0" name="VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR"/>
@@ -3378,6 +3427,7 @@
         <enum bitpos="2" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR"/>
         <enum bitpos="3" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR"/>
         <enum bitpos="4" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR"/>
+        <enum bitpos="5" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FUCHSIA_FENCE_BIT_KHR"/>
     </enums>
     <enums name="VkExternalSemaphoreFeatureFlagBitsKHR" type="bitmask">
         <enum bitpos="0" name="VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR"/>
@@ -3463,8 +3513,7 @@
         <enum value="3"     name="VK_COVERAGE_MODULATION_MODE_RGBA_NV"/>
     </enums>
 
-    <!-- SECTION: Vulkan command definitions -->
-    <commands>
+    <commands comment="Vulkan command definitions">
         <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_LAYER_NOT_PRESENT,VK_ERROR_EXTENSION_NOT_PRESENT,VK_ERROR_INCOMPATIBLE_DRIVER">
             <proto><type>VkResult</type> <name>vkCreateInstance</name></proto>
             <param>const <type>VkInstanceCreateInfo</type>* <name>pCreateInfo</name></param>
@@ -4587,6 +4636,18 @@
             <param><type>uint32_t</type> <name>queueFamilyIndex</name></param>
         </command>
         <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+            <proto><type>VkResult</type> <name>vkCreateMagmaSurfaceKHR</name></proto>
+            <param><type>VkInstance</type> <name>instance</name></param>
+            <param>const <type>VkMagmaSurfaceCreateInfoKHR</type>* <name>pCreateInfo</name></param>
+            <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+            <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+        </command>
+        <command>
+            <proto><type>VkBool32</type> <name>vkGetPhysicalDeviceMagmaPresentationSupportKHR</name></proto>
+            <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+            <param><type>uint32_t</type> <name>queueFamilyIndex</name></param>
+        </command>
+        <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
             <proto><type>VkResult</type> <name>vkCreateXlibSurfaceKHR</name></proto>
             <param><type>VkInstance</type> <name>instance</name></param>
             <param>const <type>VkXlibSurfaceCreateInfoKHR</type>* <name>pCreateInfo</name></param>
@@ -4641,17 +4702,17 @@
         <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
             <proto><type>VkResult</type> <name>vkDebugMarkerSetObjectNameEXT</name></proto>
             <param><type>VkDevice</type> <name>device</name></param>
-            <param externsync="pNameInfo.object"><type>VkDebugMarkerObjectNameInfoEXT</type>* <name>pNameInfo</name></param>
+            <param externsync="pNameInfo.object">const <type>VkDebugMarkerObjectNameInfoEXT</type>* <name>pNameInfo</name></param>
         </command>
         <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
             <proto><type>VkResult</type> <name>vkDebugMarkerSetObjectTagEXT</name></proto>
             <param><type>VkDevice</type> <name>device</name></param>
-            <param externsync="pTagInfo.object"><type>VkDebugMarkerObjectTagInfoEXT</type>* <name>pTagInfo</name></param>
+            <param externsync="pTagInfo.object">const <type>VkDebugMarkerObjectTagInfoEXT</type>* <name>pTagInfo</name></param>
         </command>
         <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
             <proto><type>void</type> <name>vkCmdDebugMarkerBeginEXT</name></proto>
             <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
-            <param><type>VkDebugMarkerMarkerInfoEXT</type>* <name>pMarkerInfo</name></param>
+            <param>const <type>VkDebugMarkerMarkerInfoEXT</type>* <name>pMarkerInfo</name></param>
         </command>
         <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
             <proto><type>void</type> <name>vkCmdDebugMarkerEndEXT</name></proto>
@@ -4660,7 +4721,7 @@
         <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
             <proto><type>void</type> <name>vkCmdDebugMarkerInsertEXT</name></proto>
             <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
-            <param><type>VkDebugMarkerMarkerInfoEXT</type>* <name>pMarkerInfo</name></param>
+            <param>const <type>VkDebugMarkerMarkerInfoEXT</type>* <name>pMarkerInfo</name></param>
         </command>
         <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_FORMAT_NOT_SUPPORTED">
             <proto><type>VkResult</type> <name>vkGetPhysicalDeviceExternalImageFormatPropertiesNV</name></proto>
@@ -4845,6 +4906,19 @@
             <param><type>int</type> <name>fd</name></param>
             <param><type>VkMemoryFdPropertiesKHR</type>* <name>pMemoryFdProperties</name></param>
         </command>
+        <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+            <proto><type>VkResult</type> <name>vkGetMemoryFuchsiaHandleKHR</name></proto>
+            <param><type>VkDevice</type> <name>device</name></param>
+            <param>const <type>VkMemoryGetFuchsiaHandleInfoKHR</type>* <name>pGetFuchsiaHandleInfo</name></param>
+            <param><type>uint32_t</type>* <name>pFuchsiaHandle</name></param>
+        </command>
+        <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR">
+            <proto><type>VkResult</type> <name>vkGetMemoryFuchsiaHandlePropertiesKHR</name></proto>
+            <param><type>VkDevice</type> <name>device</name></param>
+            <param><type>VkExternalMemoryHandleTypeFlagBitsKHR</type> <name>handleType</name></param>
+            <param><type>uint32_t</type> <name>fuchsiaHandle</name></param>
+            <param><type>VkMemoryFuchsiaHandlePropertiesKHR</type>* <name>pMemoryFuchsiaHandleProperties</name></param>
+        </command>
         <command>
             <proto><type>void</type> <name>vkGetPhysicalDeviceExternalSemaphorePropertiesKHR</name></proto>
             <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
@@ -4873,6 +4947,17 @@
             <param><type>VkDevice</type> <name>device</name></param>
             <param>const <type>VkImportSemaphoreFdInfoKHR</type>* <name>pImportSemaphoreFdInfo</name></param>
         </command>
+        <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+            <proto><type>VkResult</type> <name>vkGetSemaphoreFuchsiaHandleKHR</name></proto>
+            <param><type>VkDevice</type> <name>device</name></param>
+            <param>const <type>VkSemaphoreGetFuchsiaHandleInfoKHR</type>* <name>pGetFuchsiaHandleInfo</name></param>
+            <param><type>uint32_t</type>* <name>pFuchsiaHandle</name></param>
+        </command>
+        <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR">
+            <proto><type>VkResult</type> <name>vkImportSemaphoreFuchsiaHandleKHR</name></proto>
+            <param><type>VkDevice</type> <name>device</name></param>
+            <param>const <type>VkImportSemaphoreFuchsiaHandleInfoKHR</type>* <name>pImportSemaphoreFuchsiaHandleInfo</name></param>
+        </command>
         <command>
             <proto><type>void</type> <name>vkGetPhysicalDeviceExternalFencePropertiesKHR</name></proto>
             <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
@@ -5049,8 +5134,8 @@
         <command>
             <proto><type>void</type> <name>vkSetHdrMetadataEXT</name></proto>
             <param><type>VkDevice</type> <name>device</name></param>
-            <param><type>uint32_t</type> <name>swapchainCount</name></param>    <!-- Number of swap chains to update in this call -->
-            <param len="swapchainCount">const <type>VkSwapchainKHR</type>* <name>pSwapchains</name></param>    <!-- Swapchains to present an image from -->
+            <param><type>uint32_t</type> <name>swapchainCount</name></param>
+            <param len="swapchainCount">const <type>VkSwapchainKHR</type>* <name>pSwapchains</name></param>
             <param len="swapchainCount">const <type>VkHdrMetadataEXT</type>* <name>pMetadata</name></param>
         </command>
         <command successcodes="VK_SUCCESS,VK_SUBOPTIMAL_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR">
@@ -5133,8 +5218,7 @@
         </command>
     </commands>
 
-    <!-- SECTION: Vulkan API interface definitions -->
-    <feature api="vulkan" name="VK_VERSION_1_0" number="1.0">
+    <feature api="vulkan" name="VK_VERSION_1_0" number="1.0" comment="Vulkan core API interface definitions">
         <require comment="Header boilerplate">
             <type name="vk_platform"/>
         </require>
@@ -5348,11 +5432,7 @@
             <command name="vkCmdEndRenderPass"/>
             <command name="vkCmdExecuteCommands"/>
         </require>
-        <require comment="Types not directly used by the API">
-            <!-- Include <type name="typename"/> here for e.g. structs that
-                 are not parameter types of commands, but still need to be
-                 defined in the API.
-             -->
+        <require comment="Types not directly used by the API. Include e.g. structs that are not parameter types of commands, but still defined by the API.">
             <type name="VkBufferMemoryBarrier"/>
             <type name="VkDispatchIndirectCommand"/>
             <type name="VkDrawIndexedIndirectCommand"/>
@@ -5363,9 +5443,7 @@
         </require>
     </feature>
 
-    <!-- SECTION: Vulkan extension interface definitions -->
-    <extensions>
-            <!-- WSI extensions -->
+    <extensions comment="Vulkan extension interface definitions">
         <extension name="VK_KHR_surface" number="1" type="instance" supported="vulkan">
             <require>
                 <enum value="25"                                        name="VK_KHR_SURFACE_SPEC_VERSION"/>
@@ -5499,6 +5577,17 @@
                 <command name="vkGetPhysicalDeviceWin32PresentationSupportKHR"/>
             </require>
         </extension>
+        <extension name="VK_KHR_magma_surface" number="11" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_MAGMA_KHR" supported="vulkan">
+            <require>
+                <enum value="1"                                         name="VK_KHR_MAGMA_SURFACE_SPEC_VERSION"/>
+                <enum value="&quot;VK_KHR_magma_surface&quot;"          name="VK_KHR_MAGMA_SURFACE_EXTENSION_NAME"/>
+                <enum offset="0" extends="VkStructureType"              name="VK_STRUCTURE_TYPE_MAGMA_SURFACE_CREATE_INFO_KHR"/>
+                <type name="VkMagmaSurfaceCreateFlagsKHR"/>
+                <type name="VkMagmaSurfaceCreateInfoKHR"/>
+                <command name="vkCreateMagmaSurfaceKHR"/>
+                <command name="vkGetPhysicalDeviceMagmaPresentationSupportKHR"/>
+            </require>
+        </extension>
         <extension name="VK_ANDROID_native_buffer" number="11" supported="disabled">
             <require>
                 <enum value="4"                                         name="VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION"/>
@@ -5529,13 +5618,13 @@
                 <enum offset="0" dir="-" extends="VkResult"             name="VK_ERROR_INVALID_SHADER_NV"/>
             </require>
         </extension>
-        <extension name="VK_NV_extension_1" number="14" author="NV" contact="Piers Daniell @pdaniell" supported="disabled">
+        <extension name="VK_EXT_depth_range_unrestricted" type="device" number="14" author="NV" contact="Piers Daniell @pdaniell" supported="vulkan">
             <require>
-                <enum value="0"                                         name="VK_NV_EXTENSION_1_SPEC_VERSION"/>
-                <enum value="&quot;VK_NV_extension_1&quot;"             name="VK_NV_EXTENSION_1_EXTENSION_NAME"/>
-                <enum offset="0" dir="-" extends="VkResult"             name="VK_NV_EXTENSION_1_ERROR"/>
+                <enum value="1"                                         name="VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION"/>
+                <enum value="&quot;VK_EXT_depth_range_unrestricted&quot;"             name="VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME"/>
             </require>
         </extension>
+
         <extension name="VK_KHR_sampler_mirror_clamp_to_edge" type="device" number="15" author="KHR" contact="Tobias Hector @tobias" supported="vulkan">
             <require>
                 <enum value="1"                                         name="VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION"/>
@@ -6419,7 +6508,7 @@
         </extension>
         <extension name="VK_EXT_swapchain_colorspace" number="105" type="instance" author="GOOGLE" contact="Courtney Goeltzenleuchter @courtneygo" requires="VK_KHR_surface" supported="vulkan">
             <require>
-                <enum value="2"                                         name="VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION"/>
+                <enum value="3"                                         name="VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION"/>
                 <enum value="&quot;VK_EXT_swapchain_colorspace&quot;"   name="VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME"/>
                 <enum offset="1" extends="VkColorSpaceKHR"              name="VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT"/>
                 <enum offset="2" extends="VkColorSpaceKHR"              name="VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT"/>
@@ -6434,6 +6523,7 @@
                 <enum offset="11" extends="VkColorSpaceKHR"             name="VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT"/>
                 <enum offset="12" extends="VkColorSpaceKHR"             name="VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT"/>
                 <enum offset="13" extends="VkColorSpaceKHR"             name="VK_COLOR_SPACE_PASS_THROUGH_EXT"/>
+                <enum offset="14" extends="VkColorSpaceKHR"             name="VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT"/>
             </require>
         </extension>
         <extension name="VK_EXT_hdr_metadata" number="106" type="device" author="GOOGLE" contact="Courtney Goeltzenleuchter @courtneygo" supported="vulkan">
@@ -6689,10 +6779,10 @@
                 <enum value="&quot;VK_AMD_extension_136&quot;"           name="VK_AMD_EXTENSION_136_EXTENSION_NAME"/>
             </require>
         </extension>
-        <extension name="VK_AMD_extension_137" number="137" author="AMD" contact="Mais Alnasser @malnasse" supported="disabled">
+        <extension name="VK_AMD_mixed_attachment_samples" number="137" author="AMD" contact="Matthaeus G. Chajdas @anteru" supported="vulkan">
             <require>
-                <enum value="0"                                          name="VK_AMD_EXTENSION_137_SPEC_VERSION"/>
-                <enum value="&quot;VK_AMD_extension_137&quot;"           name="VK_AMD_EXTENSION_137_EXTENSION_NAME"/>
+                <enum value="1"                                          name="VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION"/>
+                <enum value="&quot;VK_AMD_mixed_attachment_samples&quot;" name="VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME"/>
             </require>
         </extension>
         <extension name="VK_AMD_extension_138" number="138" author="AMD" contact="Mais Alnasser @malnasse" supported="disabled">
@@ -6737,10 +6827,10 @@
                 <enum value="&quot;VK_AMD_extension_144&quot;"           name="VK_AMD_EXTENSION_144_EXTENSION_NAME"/>
             </require>
         </extension>
-        <extension name="VK_KHR_relaxed_block_layout" number="145" author="KHR" contact="John Kessenich @johnk" supported="disabled">
+        <extension name="VK_KHR_relaxed_block_layout" number="145" type="device" author="KHR" contact="John Kessenich @johnk" supported="vulkan">
             <require>
-                <enum value="0"                                          name="VK_KHR_relaxed_block_layout_SPEC_VERSION"/>
-                <enum value="&quot;VK_KHR_relaxed_block_layout&quot;"    name="VK_KHR_relaxed_block_layout_EXTENSION_NAME"/>
+                <enum value="1"                                          name="VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION"/>
+                <enum value="&quot;VK_KHR_relaxed_block_layout&quot;"    name="VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME"/>
             </require>
         </extension>
         <extension name="VK_KHR_extension_146" number="146" author="KHR" contact="Bill Licea-Kane @billl" supported="disabled">
@@ -6878,10 +6968,10 @@
                 <enum value="&quot;VK_NV_extension_155&quot;"            name="VK_NV_EXTENSION_155_EXTENSION_NAME"/>
             </require>
         </extension>
-        <extension name="VK_NV_extension_156" number="156" author="NV" contact="Jeff Bolz @jbolz" supported="disabled">
+        <extension name="VK_EXT_post_depth_coverage" number="156" type="device" author="NV" contact="Daniel Koch @dgkoch" supported="vulkan">
             <require>
-                <enum value="0"                                          name="VK_NV_EXTENSION_156_SPEC_VERSION"/>
-                <enum value="&quot;VK_NV_extension_156&quot;"            name="VK_NV_EXTENSION_156_EXTENSION_NAME"/>
+                <enum value="1"                                          name="VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION"/>
+                <enum value="&quot;VK_EXT_post_depth_coverage&quot;"     name="VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME"/>
             </require>
         </extension>
         <extension name="VK_KHR_extension_157" number="157" author="KHR" contact="Andrew Garrard @fluppeteer" supported="disabled">
@@ -6908,5 +6998,50 @@
                 <enum value="&quot;VK_EXT_extension_160&quot;"           name="VK_EXT_EXTENSION_160_EXTENSION_NAME"/>
             </require>
         </extension>
+        <extension name="VK_EXT_extension_161" number="161" author="GOOGLE" contact="Cort Stratton @cdwfs" supported="disabled">
+            <require>
+                <enum value="0"                                          name="VK_EXT_EXTENSION_161_SPEC_VERSION"/>
+                <enum value="&quot;VK_EXT_extension_161&quot;"           name="VK_EXT_EXTENSION_161_EXTENSION_NAME"/>
+            </require>
+        </extension>
+        <extension name="VK_EXT_extension_162" number="162" author="NV" contact="Jeff Bolz @jbolz" supported="disabled">
+            <require>
+                <enum value="0"                                          name="VK_EXT_EXTENSION_162_SPEC_VERSION"/>
+                <enum value="&quot;VK_EXT_extension_162&quot;"           name="VK_EXT_EXTENSION_162_EXTENSION_NAME"/>
+            </require>
+        </extension>
+        <extension name="VK_GOOGLE_image_usage_scanout" number="1000" type="instance" supported="vulkan">
+            <require>
+                <enum value="1"                                          name="VK_GOOGLE_IMAGE_USAGE_SCANOUT_SPEC_VERSION"/>
+                <enum value="&quot;VK_GOOGLE_image_usage_scanout&quot;"  name="VK_GOOGLE_IMAGE_USAGE_SCANOUT_EXTENSION_NAME"/>
+                <enum bitpos="16" extends="VkImageUsageFlagBits"         name="VK_IMAGE_USAGE_SCANOUT_BIT_GOOGLE"/>
+            </require>
+        </extension>
+        <extension name="VK_KHR_external_memory_fuchsia" number="1001" type="device" requires="VK_KHR_external_memory_capabilities,VK_KHR_external_memory" author="KHR" supported="vulkan">
+            <require>
+                <enum value="1"                                           name="VK_KHR_EXTERNAL_MEMORY_FUCHSIA_SPEC_VERSION"/>
+                <enum value="&quot;VK_KHR_external_memory_fuchsia&quot;"  name="VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME"/>
+                <enum offset="0" extends="VkStructureType"                name="VK_STRUCTURE_TYPE_IMPORT_MEMORY_FUCHSIA_HANDLE_INFO_KHR"/>
+                <enum offset="1" extends="VkStructureType"                name="VK_STRUCTURE_TYPE_MEMORY_FUCHSIA_HANDLE_PROPERTIES_KHR"/>
+                <enum offset="2" extends="VkStructureType"                name="VK_STRUCTURE_TYPE_MEMORY_GET_FUCHSIA_HANDLE_INFO_KHR"/>
+                <type name="VkImportMemoryFuchsiaHandleInfoKHR"/>
+                <type name="VkMemoryFuchsiaHandlePropertiesKHR"/>
+                <type name="VkMemoryGetFuchsiaHandleInfoKHR"/>
+                <command name="vkGetMemoryFuchsiaHandleKHR"/>
+                <command name="vkGetMemoryFuchsiaHandlePropertiesKHR"/>
+            </require>
+        </extension>
+        <extension name="VK_KHR_external_semaphore_fuchsia" number="1002" type="device" requires="VK_KHR_external_semaphore_capabilities,VK_KHR_external_semaphore" author="KHR" supported="vulkan">
+            <require>
+                <enum value="1"                                              name="VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_SPEC_VERSION"/>
+                <enum value="&quot;VK_KHR_external_semaphore_fuchsia&quot;"  name="VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_EXTENSION_NAME"/>
+                <enum offset="0" extends="VkStructureType"                   name="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FUCHSIA_HANDLE_INFO_KHR"/>
+                <enum offset="1" extends="VkStructureType"                   name="VK_STRUCTURE_TYPE_SEMAPHORE_GET_FUCHSIA_HANDLE_INFO_KHR"/>
+                <type name="VkImportSemaphoreFuchsiaHandleInfoKHR"/>
+                <type name="VkSemaphoreGetFuchsiaHandleInfoKHR"/>
+                <command name="vkImportSemaphoreFuchsiaHandleKHR"/>
+                <command name="vkGetSemaphoreFuchsiaHandleKHR"/>
+            </require>
+        </extension>
     </extensions>
 </registry>
diff --git a/src/vulkan/util/BUILD.gn b/src/vulkan/util/BUILD.gn
new file mode 100644
index 0000000..41e500d
--- /dev/null
+++ b/src/vulkan/util/BUILD.gn
@@ -0,0 +1,62 @@
+# Copyright 2017 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("config_util") {
+  include_dirs = [ "$target_gen_dir" ]
+}
+
+source_set("util") {
+  public_configs = [ ":config_util" ]
+  deps = [
+    "$mesa_build_root/include:vulkan",
+    "$mesa_build_root/src/util",
+  ]
+  sources = [
+    "$target_gen_dir/vk_enum_to_str.c",
+    "vk_enum_to_str.h",
+    "vk_util.c",
+    "vk_util.h"
+  ]
+  deps += [ ":gen_enum_to_str" ]
+}
+
+action("gen_enum_to_str") {
+  outputs = [ "$target_gen_dir/vk_enum_to_str.h",
+    "$target_gen_dir/vk_enum_to_str.c",
+  ]
+
+  script = "gen_enum_to_str.py"
+
+  inputs = [
+    "$mesa_build_root/src/vulkan/registry/vk.xml",
+  ]
+
+  args = [
+    "--pythonpath", 
+    rebase_path("$magma_python_path"),
+    "--xml",
+    rebase_path("$mesa_build_root") + "/src/vulkan/registry/vk.xml",
+    "--outdir",
+    rebase_path("$target_gen_dir")
+  ]
+}
diff --git a/src/vulkan/util/gen_enum_to_str.py b/src/vulkan/util/gen_enum_to_str.py
old mode 100644
new mode 100755
index ef37972..a7dcab0
--- a/src/vulkan/util/gen_enum_to_str.py
+++ b/src/vulkan/util/gen_enum_to_str.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 # encoding=utf-8
 # Copyright © 2017 Intel Corporation
 
@@ -26,6 +27,10 @@
 import os
 import textwrap
 import xml.etree.cElementTree as et
+import sys
+
+# --pythonpath must be the first argument
+sys.path.append(sys.argv[2])
 
 from mako.template import Template
 
@@ -158,6 +163,7 @@
 
 def main():
     parser = argparse.ArgumentParser()
+    parser.add_argument('--pythonpath')
     parser.add_argument('--xml', help='Vulkan API XML file.', required=True)
     parser.add_argument('--outdir',
                         help='Directory to put the generated files in',
diff --git a/src/vulkan/wsi/BUILD.gn b/src/vulkan/wsi/BUILD.gn
new file mode 100644
index 0000000..2b465f3
--- /dev/null
+++ b/src/vulkan/wsi/BUILD.gn
@@ -0,0 +1,44 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+config("wsi_config") {
+  include_dirs = [ "." ]
+}
+
+source_set("wsi") {
+  public_configs = [ ":wsi_config" ]
+
+  sources = [
+    "wsi_common.h",
+    "wsi_common_magma.cc",
+  ]
+
+  deps = [
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/src/magma_util",
+    "$mesa_build_root/include:vulkan",
+    "$mesa_build_root/src/util"
+  ]
+
+  include_dirs = [ "$mesa_build_root/src/vulkan/util" ]
+}
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 8166b7d..ada7df0 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -68,9 +68,9 @@
    VkResult (*acquire_next_image)(struct wsi_swapchain *swap_chain,
                                   uint64_t timeout, VkSemaphore semaphore,
                                   uint32_t *image_index);
-   VkResult (*queue_present)(struct wsi_swapchain *swap_chain,
-                             uint32_t image_index,
-                             const VkPresentRegionKHR *damage);
+   VkResult (*queue_present)(struct wsi_swapchain* swap_chain, uint32_t image_index,
+                             const VkPresentRegionKHR *damage,
+                             uint32_t wait_semaphore_count, const VkSemaphore* wait_semaphores);
    void (*get_image_and_linear)(struct wsi_swapchain *swapchain,
                                 int imageIndex,
                                 VkImage *image,
@@ -112,7 +112,7 @@
                                 struct wsi_swapchain **swapchain);
 };
 
-#define VK_ICD_WSI_PLATFORM_MAX 5
+#define VK_ICD_WSI_PLATFORM_MAX 7
 
 struct wsi_device {
     struct wsi_interface *                  wsi[VK_ICD_WSI_PLATFORM_MAX];
@@ -124,6 +124,21 @@
                                              VkFormatProperties *pFormatProperties);
 };
 
+struct wsi_magma_callbacks {
+   void* (*get_render_connection)(VkDevice device);
+   void (*destroy_surface)(VkIcdSurfaceBase* surface);
+   VkResult (*create_wsi_image)(VkDevice device_h, const VkSwapchainCreateInfoKHR* pCreateInfo,
+                                const VkAllocationCallbacks* pAllocator, VkImage* image_p,
+                                VkDeviceMemory* memory_p, uint32_t* size_p, uint32_t* offset_p,
+                                uint32_t* row_pitch_p, uintptr_t* buffer_handle_p);
+   void (*free_wsi_image)(VkDevice device,
+                          const VkAllocationCallbacks *pAllocator,
+                          VkImage image_h,
+                          VkDeviceMemory memory_h);
+   uintptr_t (*get_platform_semaphore)(VkSemaphore semaphore);
+   PFN_vkImportSemaphoreFuchsiaHandleKHR vk_import_semaphore_fuchsia_handle_khr;
+};
+
 #define WSI_DEFINE_NONDISP_HANDLE_CASTS(__wsi_type, __VkType)              \
                                                                            \
    static inline struct __wsi_type *                                       \
@@ -169,6 +184,9 @@
                          const struct wsi_callbacks *cbs);
 void wsi_wl_finish_wsi(struct wsi_device *wsi_device,
                        const VkAllocationCallbacks *alloc);
-
+VkResult wsi_magma_init_wsi(struct wsi_device* wsi_device, const VkAllocationCallbacks* alloc,
+                            const struct wsi_magma_callbacks* callbacks);
+void wsi_magma_finish_wsi(struct wsi_device *wsi_device,
+                          const VkAllocationCallbacks *alloc);
 
 #endif
diff --git a/src/vulkan/wsi/wsi_common_magma.cc b/src/vulkan/wsi/wsi_common_magma.cc
new file mode 100644
index 0000000..9379f19
--- /dev/null
+++ b/src/vulkan/wsi/wsi_common_magma.cc
@@ -0,0 +1,483 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <functional>
+#include <memory>
+#include <vector>
+
+#include "util/macros.h"
+#include "wsi_common_magma.h"
+
+#include "magma.h"
+#include "magma_util/dlog.h"
+#include "magma_util/macros.h"
+
+#define typed_memcpy(dest, src, count)                                                             \
+   ({                                                                                              \
+      static_assert(sizeof(*src) == sizeof(*dest), "");                                            \
+      memcpy((dest), (src), (count) * sizeof(*(src)));                                             \
+   })
+
+static const VkSurfaceFormatKHR formats[] = {
+    {
+        .format = VK_FORMAT_B8G8R8A8_UNORM,
+    },
+};
+
+static const VkPresentModeKHR present_modes[] = {
+    VK_PRESENT_MODE_FIFO_KHR,
+};
+
+class WsiMagma : public wsi_interface {
+public:
+   WsiMagma(const wsi_magma_callbacks* callbacks) : callbacks_(callbacks) {}
+
+   const wsi_magma_callbacks* callbacks() { return callbacks_; }
+
+private:
+   const wsi_magma_callbacks* callbacks_;
+};
+
+class WsiMagmaConnections {
+public:
+   WsiMagmaConnections(magma_connection_t* render_connection,
+                       magma_connection_t* display_connection, const wsi_magma_callbacks* callbacks)
+       : callbacks_(callbacks), render_connection_(render_connection),
+         display_connection_(display_connection)
+   {
+   }
+
+   magma_connection_t* render_connection() { return render_connection_; }
+
+   magma_connection_t* display_connection() { return display_connection_; }
+
+private:
+   const wsi_magma_callbacks* callbacks_;  // not owned
+   magma_connection_t* render_connection_; // not owned
+   magma_connection_t* display_connection_;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class MagmaImage {
+public:
+   static std::unique_ptr<MagmaImage> Create(VkDevice device, const wsi_magma_callbacks* callbacks,
+                                             std::shared_ptr<WsiMagmaConnections> connections,
+                                             const VkSwapchainCreateInfoKHR* create_info,
+                                             const VkAllocationCallbacks* pAllocator);
+
+   ~MagmaImage();
+
+   magma_buffer_t display_buffer() { return display_buffer_; }
+
+   magma_semaphore_t display_semaphore() { return display_semaphore_; }
+
+   magma_semaphore_t buffer_presented_semaphore() { return buffer_presented_semaphore_; }
+
+   VkImage image() { return image_; }
+
+   VkDevice device() { return device_; }
+
+   const wsi_magma_callbacks* callbacks() { return callbacks_; }
+
+private:
+   MagmaImage(VkDevice device, const wsi_magma_callbacks* callbacks,
+              std::shared_ptr<WsiMagmaConnections> connections, magma_buffer_t render_buffer,
+              magma_buffer_t display_buffer, magma_semaphore_t display_semaphore, VkImage image,
+              VkDeviceMemory device_memory, const VkAllocationCallbacks* allocator,
+              magma_semaphore_t buffer_presented_semaphore)
+       : device_(device), image_(image), device_memory_(device_memory), callbacks_(callbacks),
+         connections_(std::move(connections)), render_buffer_(render_buffer),
+         display_buffer_(display_buffer), display_semaphore_(display_semaphore),
+         buffer_presented_semaphore_(buffer_presented_semaphore), allocator_(allocator)
+   {
+   }
+
+   VkDevice device_;
+   VkImage image_;
+   VkDeviceMemory device_memory_;
+   const wsi_magma_callbacks* callbacks_;
+   std::shared_ptr<WsiMagmaConnections> connections_;
+   magma_buffer_t render_buffer_, display_buffer_; // render_buffer is not owned
+   magma_semaphore_t display_semaphore_;
+   magma_semaphore_t buffer_presented_semaphore_;
+   const VkAllocationCallbacks* allocator_;
+};
+
+std::unique_ptr<MagmaImage> MagmaImage::Create(VkDevice device,
+                                               const wsi_magma_callbacks* callbacks,
+                                               std::shared_ptr<WsiMagmaConnections> connections,
+                                               const VkSwapchainCreateInfoKHR* pCreateInfo,
+                                               const VkAllocationCallbacks* allocator)
+{
+   VkResult result;
+   uint32_t row_pitch;
+   uint32_t offset;
+   uint32_t bpp = 32;
+   magma_buffer_t render_buffer, display_buffer;
+   magma_semaphore_t display_semaphore;
+   magma_semaphore_t buffer_presented_semaphore;
+   uint32_t buffer_handle, semaphore_handle;
+   uint32_t size;
+   VkImage image;
+   VkDeviceMemory device_memory;
+
+   result = callbacks->create_wsi_image(device, pCreateInfo, allocator, &image, &device_memory,
+                                        &size, &offset, &row_pitch, &render_buffer);
+   if (result != VK_SUCCESS)
+      return DRETP(nullptr, "create_wsi_image failed");
+
+   magma_status_t status =
+       magma_export(connections->render_connection(), render_buffer, &buffer_handle);
+   if (status != MAGMA_STATUS_OK)
+      return DRETP(nullptr, "failed to export buffer");
+
+   status = magma_import(connections->display_connection(), buffer_handle, &display_buffer);
+   if (status != MAGMA_STATUS_OK)
+      return DRETP(nullptr, "failed to import buffer");
+
+   status = magma_create_semaphore(connections->display_connection(), &display_semaphore);
+   if (status != MAGMA_STATUS_OK)
+      return DRETP(nullptr, "failed to create semaphore");
+
+   magma_signal_semaphore(display_semaphore);
+
+   status = magma_create_semaphore(connections->display_connection(), &buffer_presented_semaphore);
+   if (status != MAGMA_STATUS_OK)
+      return DRETP(nullptr, "failed to create semaphore");
+
+   return std::unique_ptr<MagmaImage>(new MagmaImage(
+       device, callbacks, std::move(connections), render_buffer, display_buffer, display_semaphore,
+       image, device_memory, allocator, buffer_presented_semaphore));
+}
+
+MagmaImage::~MagmaImage()
+{
+   callbacks_->free_wsi_image(device_, allocator_, image_, device_memory_);
+
+   magma_release_buffer(connections_->display_connection(), display_buffer_);
+   magma_release_semaphore(connections_->display_connection(), display_semaphore_);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+class MagmaSwapchain : public wsi_swapchain {
+public:
+   MagmaSwapchain(VkDevice device, std::shared_ptr<WsiMagmaConnections> connections)
+       : connections_(connections)
+   {
+      // Default-initialize the anv_swapchain base
+      wsi_swapchain* base = static_cast<wsi_swapchain*>(this);
+      *base = {};
+
+      // Make sure that did mostly what we expected
+      assert(this->alloc.pUserData == 0);
+      assert(this->fences[0] == VK_NULL_HANDLE);
+
+      this->device = device;
+      this->destroy = Destroy;
+      this->get_images = GetImages;
+      this->acquire_next_image = AcquireNextImage;
+      this->queue_present = QueuePresent;
+   }
+
+   magma_connection_t* display_connection() { return connections_->display_connection(); }
+
+   magma_connection_t* render_connection() { return connections_->render_connection(); }
+
+   uint32_t image_count() { return images_.size(); }
+
+   MagmaImage* get_image(uint32_t index)
+   {
+      assert(index < images_.size());
+      return images_[index].get();
+   }
+
+   void AddImage(std::unique_ptr<MagmaImage> image) { images_.push_back(std::move(image)); }
+
+   static VkResult Destroy(wsi_swapchain* wsi_chain, const VkAllocationCallbacks* pAllocator)
+   {
+      DLOG("Destroy");
+      MagmaSwapchain* chain = cast(wsi_chain);
+      delete chain;
+      return VK_SUCCESS;
+   }
+
+   static VkResult GetImages(wsi_swapchain* wsi_chain, uint32_t* pCount, VkImage* pSwapchainImages)
+   {
+      DLOG("GetImages");
+      MagmaSwapchain* chain = cast(wsi_chain);
+
+      if (!pSwapchainImages) {
+         *pCount = chain->image_count();
+         return VK_SUCCESS;
+      }
+
+      assert(chain->image_count() <= *pCount);
+
+      for (uint32_t i = 0; i < chain->image_count(); i++)
+         pSwapchainImages[i] = chain->get_image(i)->image();
+
+      *pCount = chain->image_count();
+
+      return VK_SUCCESS;
+   }
+
+   static VkResult AcquireNextImage(wsi_swapchain* wsi_chain, uint64_t timeout,
+                                    VkSemaphore semaphore, uint32_t* pImageIndex)
+   {
+      MagmaSwapchain* chain = cast(wsi_chain);
+
+      uint32_t index = chain->next_index_;
+      MagmaImage* image = chain->get_image(index);
+
+      DLOG("AcquireNextImage semaphore id 0x%" PRIx64,
+           magma_get_semaphore_id(image->display_semaphore()));
+
+      if (semaphore) {
+         uint32_t semaphore_handle;
+         magma_status_t status = magma_export_semaphore(
+             chain->display_connection(), image->display_semaphore(), &semaphore_handle);
+         if (status == MAGMA_STATUS_OK) {
+            VkImportSemaphoreFuchsiaHandleInfoKHR info = {
+                .sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FUCHSIA_HANDLE_INFO_KHR,
+                .semaphore = semaphore,
+                .flags = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR,
+                .handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FUCHSIA_FENCE_BIT_KHR,
+                .handle = semaphore_handle};
+            VkResult result =
+                image->callbacks()->vk_import_semaphore_fuchsia_handle_khr(image->device(), &info);
+            if (result != VK_SUCCESS)
+               DLOG("vkImportSemaphoreFuchsiaHandleKHR failed: %d", result);
+         } else {
+            DLOG("magma_export_semaphore failed: %d", status);
+         }
+      }
+
+      if (++chain->next_index_ >= chain->image_count())
+         chain->next_index_ = 0;
+
+      *pImageIndex = index;
+      DLOG("AcquireNextImage returning index %u id 0x%" PRIx64, *pImageIndex,
+           magma_get_buffer_id(image->display_buffer()));
+
+      return VK_SUCCESS;
+   }
+
+   static VkResult QueuePresent(wsi_swapchain* swapchain, uint32_t image_index,
+                                const VkPresentRegionKHR *damage,
+                                uint32_t wait_semaphore_count, const VkSemaphore* wait_semaphores)
+   {
+      MagmaSwapchain* magma_swapchain = cast(swapchain);
+      MagmaImage* image = magma_swapchain->get_image(image_index);
+
+      DLOG("QueuePresent image_index %u id 0x%" PRIx64, image_index,
+           magma_get_buffer_id(image->display_buffer()));
+
+      magma_semaphore_t display_semaphores[wait_semaphore_count];
+      magma_status_t status;
+
+      for (uint32_t i = 0; i < wait_semaphore_count; i++) {
+         uint32_t semaphore_handle;
+         status = magma_export_semaphore(
+             magma_swapchain->render_connection(),
+             image->callbacks()->get_platform_semaphore(wait_semaphores[i]), &semaphore_handle);
+         if (status != MAGMA_STATUS_OK) {
+            DLOG("Failed to export wait semaphore");
+            continue;
+         }
+         magma_semaphore_t semaphore;
+         status = magma_import_semaphore(magma_swapchain->display_connection(), semaphore_handle,
+                                         &display_semaphores[i]);
+         if (status != MAGMA_STATUS_OK)
+            DLOG("failed to import wait semaphore");
+      }
+
+      magma_semaphore_t signal_semaphores[1]{image->display_semaphore()};
+
+      magma_display_page_flip(magma_swapchain->display_connection(), image->display_buffer(),
+                              wait_semaphore_count, display_semaphores, 1, signal_semaphores,
+                              image->buffer_presented_semaphore());
+
+      for (uint32_t i = 0; i < wait_semaphore_count; i++) {
+         magma_release_semaphore(magma_swapchain->display_connection(), display_semaphores[i]);
+      }
+
+      return VK_SUCCESS;
+   }
+
+private:
+   static MagmaSwapchain* cast(wsi_swapchain* swapchain)
+   {
+      auto magma_swapchain = static_cast<MagmaSwapchain*>(swapchain);
+      assert(magma_swapchain->magic_ == kMagic);
+      return magma_swapchain;
+   }
+
+   static constexpr uint32_t kMagic = 0x6D617377; // 'masw'
+
+   const uint32_t magic_ = kMagic;
+   std::shared_ptr<WsiMagmaConnections> connections_;
+   std::vector<std::unique_ptr<MagmaImage>> images_;
+   uint32_t next_index_ = 0;
+};
+
+static VkResult magma_surface_get_support(VkIcdSurfaceBase* icd_surface,
+                                          struct wsi_device* wsi_device,
+                                          const VkAllocationCallbacks* alloc,
+                                          uint32_t queueFamilyIndex, 
+                                          int local_fd,
+                                          bool can_handle_different_gpu,
+                                          VkBool32* pSupported)
+{
+   auto surface = reinterpret_cast<VkIcdSurfaceMagma*>(icd_surface);
+   DLOG("magma_surface_get_support queue %u connection %p", queueFamilyIndex, surface->connection);
+
+   *pSupported = surface->connection != nullptr;
+   return VK_SUCCESS;
+}
+
+static VkResult magma_surface_get_capabilities(VkIcdSurfaceBase* icd_surface,
+                                               VkSurfaceCapabilitiesKHR* caps)
+{
+   auto surface = reinterpret_cast<VkIcdSurfaceMagma*>(icd_surface);
+   DLOG("magma_surface_get_capabilities connection %p", surface->connection);
+
+   VkExtent2D extent = {0xFFFFFFFF, 0xFFFFFFFF};
+
+   magma_display_size display_size;
+   magma_status_t status = magma_display_get_size(surface->fd, &display_size);
+   if (status == MAGMA_STATUS_OK)
+      extent = {display_size.width, display_size.height};
+
+   caps->minImageExtent = {1, 1};
+   caps->maxImageExtent = {extent};
+   caps->currentExtent = extent;
+
+   caps->supportedCompositeAlpha =
+       VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR | VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
+
+   caps->minImageCount = 2;
+   caps->maxImageCount = 3;
+   caps->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
+   caps->currentTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
+   caps->maxImageArrayLayers = 1;
+   caps->supportedUsageFlags = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
+                               VK_IMAGE_USAGE_TRANSFER_DST_BIT |
+                               VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+
+   return VK_SUCCESS;
+}
+
+static VkResult magma_surface_get_formats(VkIcdSurfaceBase* surface, struct wsi_device* device,
+                                          uint32_t* pSurfaceFormatCount,
+                                          VkSurfaceFormatKHR* pSurfaceFormats)
+{
+   DLOG("magma_surface_get_formats");
+
+   if (pSurfaceFormats == NULL) {
+      *pSurfaceFormatCount = ARRAY_SIZE(formats);
+      return VK_SUCCESS;
+   }
+
+   assert(*pSurfaceFormatCount >= ARRAY_SIZE(formats));
+   typed_memcpy(pSurfaceFormats, formats, *pSurfaceFormatCount);
+   *pSurfaceFormatCount = ARRAY_SIZE(formats);
+
+   return VK_SUCCESS;
+}
+
+static VkResult magma_surface_get_present_modes(VkIcdSurfaceBase* surface,
+                                                uint32_t* pPresentModeCount,
+                                                VkPresentModeKHR* pPresentModes)
+{
+   DLOG("magma_surface_get_present_modes");
+
+   if (pPresentModes == NULL) {
+      *pPresentModeCount = ARRAY_SIZE(present_modes);
+      return VK_SUCCESS;
+   }
+
+   assert(*pPresentModeCount >= ARRAY_SIZE(present_modes));
+   typed_memcpy(pPresentModes, present_modes, *pPresentModeCount);
+   *pPresentModeCount = ARRAY_SIZE(present_modes);
+
+   return VK_SUCCESS;
+}
+
+static VkResult magma_surface_create_swapchain(VkIcdSurfaceBase* icd_surface, VkDevice device,
+                                               wsi_device* wsi_device,
+                                               int local_fd,
+                                               const VkSwapchainCreateInfoKHR* pCreateInfo,
+                                               const VkAllocationCallbacks* pAllocator,
+                                               const struct wsi_image_fns* image_fns,
+                                               struct wsi_swapchain** swapchain_out)
+{
+   DLOG("magma_surface_create_swapchain");
+
+   assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR);
+
+   auto wsi_magma = static_cast<WsiMagma*>(wsi_device->wsi[VK_ICD_WSI_PLATFORM_MAGMA]);
+   assert(wsi_magma);
+
+   auto render_connection =
+       reinterpret_cast<magma_connection_t*>(wsi_magma->callbacks()->get_render_connection(device));
+   auto magma_surface = reinterpret_cast<VkIcdSurfaceMagma*>(icd_surface);
+   auto display_connection = reinterpret_cast<magma_connection_t*>(magma_surface->connection);
+
+   // TODO(MA-115): use pAllocator here and for images (and elsewhere in magma?)
+   auto connections = std::make_shared<WsiMagmaConnections>(render_connection, display_connection,
+                                                            wsi_magma->callbacks());
+
+   auto chain = std::make_unique<MagmaSwapchain>(device, connections);
+
+   uint32_t num_images = pCreateInfo->minImageCount;
+
+   for (uint32_t i = 0; i < num_images; i++) {
+      std::unique_ptr<MagmaImage> image =
+          MagmaImage::Create(device, wsi_magma->callbacks(), connections, pCreateInfo, pAllocator);
+      if (!image)
+         return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+
+      chain->AddImage(std::move(image));
+   }
+
+   *swapchain_out = chain.release();
+
+   return VK_SUCCESS;
+}
+
+VkResult wsi_magma_init_wsi(wsi_device* device, const VkAllocationCallbacks* alloc,
+                            const wsi_magma_callbacks* callbacks)
+{
+   device->wsi[VK_ICD_WSI_PLATFORM_MAGMA] = nullptr;
+
+   auto wsi = new WsiMagma(callbacks);
+   if (!wsi)
+      return VK_ERROR_OUT_OF_HOST_MEMORY;
+
+   wsi->get_support = magma_surface_get_support;
+   wsi->get_capabilities = magma_surface_get_capabilities;
+   wsi->get_formats = magma_surface_get_formats;
+   wsi->get_present_modes = magma_surface_get_present_modes;
+   wsi->create_swapchain = magma_surface_create_swapchain;
+
+   device->wsi[VK_ICD_WSI_PLATFORM_MAGMA] = wsi;
+
+   return VK_SUCCESS;
+}
+
+void wsi_magma_finish_wsi(wsi_device* device, const VkAllocationCallbacks* alloc)
+{
+   auto wsi_magma = static_cast<WsiMagma*>(device->wsi[VK_ICD_WSI_PLATFORM_MAGMA]);
+   if (wsi_magma)
+      delete wsi_magma;
+}
+
+VkBool32 wsi_get_physical_device_magma_presentation_support(struct wsi_device* wsi_device,
+                                                            VkAllocationCallbacks* alloc,
+                                                            uint32_t queueFamilyIndex)
+{
+   return VK_TRUE;
+}
diff --git a/src/vulkan/wsi/wsi_common_magma.h b/src/vulkan/wsi/wsi_common_magma.h
new file mode 100644
index 0000000..a628c4d
--- /dev/null
+++ b/src/vulkan/wsi/wsi_common_magma.h
@@ -0,0 +1,18 @@
+// Copyright 2017 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WSI_COMMON_MAGMA_H
+#define WSI_COMMON_MAGMA_H
+
+extern "C" {
+
+#include "wsi_common.h"
+
+VkBool32 wsi_get_physical_device_magma_presentation_support(struct wsi_device* wsi_device,
+                                                            VkAllocationCallbacks* alloc,
+                                                            uint32_t queueFamilyIndex);
+
+}
+
+#endif
diff --git a/tests/BUILD.gn b/tests/BUILD.gn
new file mode 100644
index 0000000..49faa3b
--- /dev/null
+++ b/tests/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+group("tests") {
+  testonly = true
+
+  public_deps = [
+    ":mesa_unit_tests",
+  ]
+}
+
+executable("mesa_unit_tests") {
+  testonly = true
+
+  sources = [
+    "main.cc",
+  ]
+
+  deps = [
+    "unit_tests",
+    "//third_party/gtest",
+  ]
+}
diff --git a/tests/main.cc b/tests/main.cc
new file mode 100644
index 0000000..4cd0432
--- /dev/null
+++ b/tests/main.cc
@@ -0,0 +1,10 @@
+// Copyright 2016 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gtest/gtest.h"
+int main(int argc, char** argv)
+{
+   testing::InitGoogleTest(&argc, argv);
+   return RUN_ALL_TESTS();
+}
diff --git a/tests/unit_tests/BUILD.gn b/tests/unit_tests/BUILD.gn
new file mode 100644
index 0000000..f829606
--- /dev/null
+++ b/tests/unit_tests/BUILD.gn
@@ -0,0 +1,38 @@
+# Copyright 2016 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+import("//garnet/lib/magma/gnbuild/magma.gni")
+
+source_set("unit_tests") {
+  testonly = true
+
+  sources = [
+    "test_drm_command_buffer.cc",
+  ]
+
+  deps = [
+    "$magma_build_root/include:magma_abi",
+    "$magma_build_root/src/magma_util/platform:buffer",
+    "$mesa_build_root/src/magma",
+    "$magma_build_root/tests/mock:magma_system",
+    "//third_party/gtest",
+  ]
+}
diff --git a/tests/unit_tests/test_drm_command_buffer.cc b/tests/unit_tests/test_drm_command_buffer.cc
new file mode 100644
index 0000000..e85401a
--- /dev/null
+++ b/tests/unit_tests/test_drm_command_buffer.cc
@@ -0,0 +1,219 @@
+#include "drm_command_buffer.h"
+#include "magma.h"
+#include "magma_util/macros.h"
+#include "gtest/gtest.h"
+#include <vector>
+
+class Buffer {
+public:
+   Buffer(magma_connection_t* connection, magma_buffer_t handle, uint64_t size)
+       : connection_(connection), handle_(handle), size_(size)
+   {
+   }
+   ~Buffer() { magma_release_buffer(connection_, handle_); }
+
+   uint64_t size() { return size_; }
+   uint64_t id() { return magma_get_buffer_id(handle_); }
+   magma_buffer_t handle() { return handle_; }
+
+private:
+   magma_connection_t* connection_;
+   magma_buffer_t handle_;
+   uint64_t size_;
+};
+
+class TestDrmCommandBuffer {
+public:
+   TestDrmCommandBuffer() { connection_ = magma_create_connection(0, MAGMA_CAPABILITY_RENDERING); }
+
+   ~TestDrmCommandBuffer() { magma_release_connection(connection_); }
+
+   void NoBuffers()
+   {
+      drm_i915_gem_execbuffer2 execbuffer2 = {
+          .buffers_ptr = reinterpret_cast<uint64_t>(nullptr),
+          .buffer_count = 0,
+          .batch_start_offset = 0,
+          .batch_len = 0, // not used
+          .flags = I915_EXEC_HANDLE_LUT,
+      };
+
+      std::vector<uint64_t> wait_semaphores;
+      std::vector<uint64_t> signal_semaphores;
+
+      uint64_t size = DrmCommandBuffer::RequiredSize(&execbuffer2, 0, 0);
+      EXPECT_EQ(sizeof(magma_system_command_buffer), size);
+
+      std::vector<uint8_t> buffer(size);
+
+      EXPECT_TRUE(DrmCommandBuffer::Translate(&execbuffer2, wait_semaphores, signal_semaphores,
+                                              buffer.data()));
+
+      auto command_buffer = reinterpret_cast<magma_system_command_buffer*>(buffer.data());
+      EXPECT_EQ(-1, (int)command_buffer->batch_buffer_resource_index);
+      EXPECT_EQ(0u, command_buffer->batch_start_offset);
+      EXPECT_EQ(0u, command_buffer->num_resources);
+      EXPECT_EQ(0u, command_buffer->wait_semaphore_count);
+      EXPECT_EQ(0u, command_buffer->signal_semaphore_count);
+   }
+
+   std::unique_ptr<Buffer> CreateBuffer(uint64_t size)
+   {
+      magma_buffer_t handle;
+      if (magma_create_buffer(connection_, size, &size, &handle) != 0)
+         return DRETP(nullptr, "magma_system_alloc failed");
+      return std::make_unique<Buffer>(connection_, handle, size);
+   }
+
+   void WithBuffers(bool add_relocs, uint32_t wait_semaphore_count, uint32_t signal_semaphore_count)
+   {
+      std::vector<std::unique_ptr<Buffer>> buffers;
+
+      buffers.push_back(CreateBuffer(PAGE_SIZE));
+      buffers.push_back(CreateBuffer(PAGE_SIZE));
+
+      std::vector<uint64_t> wait_semaphore_ids;
+      for (uint32_t i = 0; i < wait_semaphore_count; i++) {
+         wait_semaphore_ids.push_back(10 + i);
+      }
+      std::vector<uint64_t> signal_semaphore_ids;
+      for (uint32_t i = 0; i < signal_semaphore_count; i++) {
+         signal_semaphore_ids.push_back(100 + i);
+      }
+
+      std::vector<drm_i915_gem_relocation_entry> exec_relocs_0;
+      std::vector<drm_i915_gem_relocation_entry> exec_relocs_1;
+      std::vector<drm_i915_gem_exec_object2> exec_res;
+
+      if (add_relocs) {
+         exec_relocs_0.push_back({.target_handle = 1, // index
+                                  .delta = 0xcafebeef,
+                                  .offset = buffers[0]->size() / 2,
+                                  .presumed_offset = 0, // not used
+                                  .read_domains = 0,
+                                  .write_domain = 0});
+         exec_relocs_0.push_back({.target_handle = 1, // index
+                                  .delta = 0xbeefcafe,
+                                  .offset = buffers[0]->size() / 3,
+                                  .presumed_offset = 0, // not used
+                                  .read_domains = 0,
+                                  .write_domain = 0});
+         exec_relocs_1.push_back({.target_handle = 0, // index
+                                  .delta = 0xcafebeef,
+                                  .offset = buffers[1]->size() / 2,
+                                  .presumed_offset = 0, // not used
+                                  .read_domains = 0,
+                                  .write_domain = 0});
+      }
+
+      exec_res.push_back({
+          .handle = buffers[0]->handle(),
+          .relocation_count = static_cast<uint32_t>(exec_relocs_0.size()),
+          .relocs_ptr = reinterpret_cast<uint64_t>(exec_relocs_0.data()),
+          .alignment = 0,
+          .offset = 0,
+          .flags = 0,
+          .rsvd1 = 10,                      // offset
+          .rsvd2 = buffers[0]->size() - 10, // length
+      });
+
+      exec_res.push_back({
+          .handle = buffers[1]->handle(),
+          .relocation_count = static_cast<uint32_t>(exec_relocs_1.size()),
+          .relocs_ptr = reinterpret_cast<uint64_t>(exec_relocs_1.data()),
+          .alignment = 0,
+          .offset = 0,
+          .flags = 0,
+          .rsvd1 = 20,                      // offset
+          .rsvd2 = buffers[1]->size() - 20, // length
+      });
+
+      drm_i915_gem_execbuffer2 exec_buffer = {
+          .buffers_ptr = reinterpret_cast<uint64_t>(exec_res.data()),
+          .buffer_count = static_cast<uint32_t>(exec_res.size()),
+          .batch_start_offset = static_cast<uint32_t>(buffers[1]->size()) / 2,
+          .batch_len = 0, // not used
+          .flags = I915_EXEC_HANDLE_LUT,
+      };
+
+      uint64_t size = DrmCommandBuffer::RequiredSize(&exec_buffer, wait_semaphore_ids.size(),
+                                                     signal_semaphore_ids.size());
+      uint64_t expected_size =
+          sizeof(magma_system_command_buffer) +
+          (wait_semaphore_ids.size() + signal_semaphore_ids.size()) * sizeof(uint64_t) +
+          sizeof(magma_system_exec_resource) * exec_res.size() +
+          sizeof(magma_system_relocation_entry) * (exec_relocs_0.size() + exec_relocs_1.size());
+      EXPECT_EQ(expected_size, size);
+
+      std::vector<uint8_t> buffer(size);
+      EXPECT_TRUE(DrmCommandBuffer::Translate(&exec_buffer, wait_semaphore_ids,
+                                              signal_semaphore_ids, buffer.data()));
+
+      auto command_buffer = reinterpret_cast<magma_system_command_buffer*>(buffer.data());
+      EXPECT_EQ(exec_buffer.buffer_count - 1, command_buffer->batch_buffer_resource_index);
+      EXPECT_EQ(exec_buffer.batch_start_offset, command_buffer->batch_start_offset);
+      EXPECT_EQ(exec_buffer.buffer_count, command_buffer->num_resources);
+      EXPECT_EQ(wait_semaphore_ids.size(), command_buffer->wait_semaphore_count);
+      EXPECT_EQ(signal_semaphore_ids.size(), command_buffer->signal_semaphore_count);
+
+      auto semaphores = reinterpret_cast<uint64_t*>(command_buffer + 1);
+      for (uint32_t i = 0; i < wait_semaphore_count; i++) {
+         EXPECT_EQ(wait_semaphore_ids[i], semaphores[i]);
+      }
+      semaphores += wait_semaphore_count;
+      for (uint32_t i = 0; i < signal_semaphore_count; i++) {
+         EXPECT_EQ(signal_semaphore_ids[i], semaphores[i]);
+      }
+
+      auto exec_resource =
+          reinterpret_cast<magma_system_exec_resource*>(semaphores + signal_semaphore_count);
+      for (uint32_t i = 0; i < exec_res.size(); i++) {
+         EXPECT_EQ(exec_resource->buffer_id, buffers[i]->id());
+         EXPECT_EQ(exec_resource->offset, exec_res[i].rsvd1);
+         EXPECT_EQ(exec_resource->length, exec_res[i].rsvd2);
+         EXPECT_EQ(exec_resource->num_relocations, exec_res[i].relocation_count);
+         exec_resource++;
+      }
+
+      if (add_relocs) {
+         auto reloc = reinterpret_cast<magma_system_relocation_entry*>(exec_resource);
+         for (uint32_t i = 0; i < exec_relocs_0.size(); i++) {
+            EXPECT_EQ(reloc->offset, exec_relocs_0[i].offset);
+            EXPECT_EQ(reloc->target_resource_index, exec_relocs_0[i].target_handle);
+            EXPECT_EQ(reloc->target_offset, exec_relocs_0[i].delta);
+            EXPECT_EQ(reloc->read_domains_bitfield, exec_relocs_0[i].read_domains);
+            EXPECT_EQ(reloc->write_domains_bitfield, exec_relocs_0[i].write_domain);
+            reloc++;
+         }
+         for (uint32_t i = 0; i < exec_relocs_1.size(); i++) {
+            EXPECT_EQ(reloc->offset, exec_relocs_1[i].offset);
+            EXPECT_EQ(reloc->target_resource_index, exec_relocs_1[i].target_handle);
+            EXPECT_EQ(reloc->target_offset, exec_relocs_1[i].delta);
+            EXPECT_EQ(reloc->read_domains_bitfield, exec_relocs_1[i].read_domains);
+            EXPECT_EQ(reloc->write_domains_bitfield, exec_relocs_1[i].write_domain);
+            reloc++;
+         }
+      }
+   }
+
+private:
+   magma_connection_t* connection_;
+};
+
+TEST(DrmCommandBuffer, NoBuffers)
+{
+   TestDrmCommandBuffer test;
+   test.NoBuffers();
+}
+
+TEST(DrmCommandBuffer, SomeBuffers)
+{
+   TestDrmCommandBuffer test;
+   test.WithBuffers(false, 1, 2);
+}
+
+TEST(DrmCommandBuffer, BuffersWithRelocs)
+{
+   TestDrmCommandBuffer test;
+   test.WithBuffers(true, 3, 2);
+}