Use correct extension number for Magma in vk.xml
Add instructions for auto-generating vulkan.h
and vulkan.hpp again in the future.
Change-Id: I214370cc0cfcb2e8231e1acee0b89ac6b6aea610
diff --git a/README_FUCHSIA.md b/README_FUCHSIA.md
new file mode 100644
index 0000000..60b00bd
--- /dev/null
+++ b/README_FUCHSIA.md
@@ -0,0 +1,28 @@
+# Vulkan Loader and Validation Layers on Fuchsia
+
+- The `BUILD.gn` files are for building as a part of Fuchsia using `GN`.
+- The `build-fuchsia` directory contains customized scripts to generate some of
+the necessary header files. They are used in the root `BUILD.gn` file.
+- The header files `vulkan.h` and `vulkan.hpp` are generated from `vk.xml`. If
+`vk.xml` changes, regenerate the files with the following steps:
+
+```
+# Before you start, $FUCHSIA_ROOT must point to the root of your
+# Fuchsia checkout. Then use that to set $VULKAN_LOADER_SOURCE:
+export VULKAN_LOADER_SOURCE=$FUCHSIA_ROOT/third_party/vulkan_loader_and_validation_layers
+
+# Check out Vulkan-Hpp repository
+git clone --recursive https://github.com/KhronosGroup/Vulkan-Hpp.git
+cd Vulkan-Hpp
+
+# Copy over our version of vk.xml
+cp $VULKAN_LOADER_SOURCE/scripts/vk.xml Vulkan-Docs/src/spec/vk.xml
+
+# Generate header files from vk.xml
+cmake . && make && ./VulkanHppGenerator
+(cd Vulkan-Docs/src/spec && make clobber install)
+
+# Copy the header files back to our repo
+cp vulkan/vulkan.hpp $VULKAN_LOADER_SOURCE/include/vulkan/vulkan.hpp
+cp Vulkan-Docs/src/vulkan/vulkan.h $VULKAN_LOADER_SOURCE/include/vulkan/vulkan.h
+```
diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h
index 21808f4..23a70ca 100644
--- a/include/vulkan/vulkan.h
+++ b/include/vulkan/vulkan.h
@@ -3845,6 +3845,35 @@
#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;
+} 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"
@@ -4099,35 +4128,6 @@
const void* pData);
#endif
-#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;
-} 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_EXT_debug_report 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
diff --git a/scripts/vk.xml b/scripts/vk.xml
index c63e108..847ec2b 100644
--- a/scripts/vk.xml
+++ b/scripts/vk.xml
@@ -5190,7 +5190,7 @@
<command name="vkGetPhysicalDeviceWin32PresentationSupportKHR"/>
</require>
</extension>
- <extension name="VK_KHR_magma_surface" number="210" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_MAGMA_KHR" supported="vulkan">
+ <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=""VK_KHR_magma_surface"" name="VK_KHR_MAGMA_SURFACE_EXTENSION_NAME"/>