Merge changes Ie45b097c,I4ed4c12d,I6f096f25,I2b62229c,Ieb81c64b, ...
* changes:
vulkan: Update from version 1.0.1 to 1.0.2
libvulkan: Fix dEQP-VK.api.object_management.alloc_callback_fail.device
libvulkan: Fix dEQP-VK.api.object_management.alloc_callback_fail.instance
libvulkan: Fix dEQP-VK.api.device_init.create_instance_unsupported_extensions
Fix ref count.
Activate layers when the strings match.
libvulkan: Implement VK_PRESENT_MODE_MAILBOX_KHR
libvulkan: Really only write vkCreateInstance out parameter on success
libvulkan: Return error if an unsupported instance extension is requested
libvulkan: Only write vkCreateInstance out parameter on succes
vulkan: Driver device extension enumeration and filtering
vulkan: Enumerate device layer extensions
libvulkan: Enumerate device layers
vulkan: Support VK_EXT_debug_report in loader and nulldrv
libvulkan: Only load driver functions for enabled extensions
vulkan: Add current vk_ext_debug_report.h from upstream
vulkan: Update to version 1.0.1
vkinfo: Enable VK_EXT_debug_report if available
vkinfo: improve formatting
libvulkan: Disable accidentally-enabled verbose logging
libvulkan: Load vkGetSwapchainGrallocUsageFlagsANDROID from driver
vulkan: Fix 64-bit compilation errors
vulkan: Pass vkQueuePresentKHR wait semaphores to vkQueueSignalReleaseImageANDROID
libvulkan: Filter layer and extension lists passed to drivers
diff --git a/vulkan/api/templates/vulkan_h.tmpl b/vulkan/api/templates/vulkan_h.tmpl
index c55107d..b2a77ec 100644
--- a/vulkan/api/templates/vulkan_h.tmpl
+++ b/vulkan/api/templates/vulkan_h.tmpl
@@ -158,7 +158,7 @@
{{end}}
{{end}}
¶
-#ifdef VK_PROTOTYPES
+#ifdef VK_NO_PROTOTYPES
¶
{{range $f := AllCommands $}}
{{if not (GetAnnotation $f "pfn")}}
diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api
index b74062f..9b1e684 100644
--- a/vulkan/api/vulkan.api
+++ b/vulkan/api/vulkan.api
@@ -28,7 +28,7 @@
// API version (major.minor.patch)
define VERSION_MAJOR 1
define VERSION_MINOR 0
-define VERSION_PATCH 0
+define VERSION_PATCH 2
// API limits
define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
@@ -45,7 +45,7 @@
// API keyword, but needs special handling by some templates
define NULL_HANDLE 0
-@extension("VK_KHR_surface") define VK_KHR_SURFACE_SPEC_VERSION 24
+@extension("VK_KHR_surface") define VK_KHR_SURFACE_SPEC_VERSION 25
@extension("VK_KHR_surface") define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_SPEC_VERSION 67
@@ -69,12 +69,15 @@
@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_SPEC_VERSION 4
@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_NAME "VK_KHR_mir_surface"
-@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 5
+@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_NAME "VK_KHR_android_surface"
@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_SPEC_VERSION 5
@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NAME "VK_KHR_win32_surface"
+@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
+@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_NAME "VK_EXT_debug_report"
+
/////////////
// Types //
@@ -121,6 +124,8 @@
@extension("VK_KHR_display") @nonDispatchHandle type u64 VkDisplayKHR
@extension("VK_KHR_display") @nonDispatchHandle type u64 VkDisplayModeKHR
+@extension("VK_EXT_debug_report") @nonDispatchHandle type u64 VkDebugReportCallbackEXT
+
/////////////
// Enums //
@@ -684,15 +689,15 @@
//@extension("VK_KHR_surface")
VK_ERROR_SURFACE_LOST_KHR = 0xC4653600, // -1000000000
+ //@extension("VK_KHR_surface")
+ VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = 0xC46535FF, // -1000008001
+
//@extension("VK_KHR_swapchain")
VK_ERROR_OUT_OF_DATE_KHR = 0xC4653214, // -1000001004
//@extension("VK_KHR_display_swapchain")
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC4652A47, // -1000003001
- //@extension("VK_KHR_android_surface")
- VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = 0xC46516C0, // -1000008000
-
//@extension("VK_EXT_debug_report")
VK_ERROR_VALIDATION_FAILED_EXT = 0xC4650B07, // -1000011001
}
@@ -722,6 +727,46 @@
VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
}
+@extension("VK_EXT_debug_report")
+enum VkDebugReportObjectTypeEXT {
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0,
+ VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3,
+ VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6,
+ VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9,
+ VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10,
+ VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11,
+ VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13,
+ VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17,
+ VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23,
+ VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28,
+}
+
+@extension("VK_EXT_debug_report")
+enum VkDebugReportErrorEXT {
+ VK_DEBUG_REPORT_ERROR_NONE_EXT = 0,
+ VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1,
+}
+
+
/////////////////
// Bitfields //
/////////////////
@@ -891,6 +936,7 @@
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCommandBlitImage
VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, /// Format can be used as the destination image of blits with vkCommandBlitImage
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
}
/// Query control flags
@@ -1249,6 +1295,17 @@
//bitfield VkWin32SurfaceCreateFlagBitsKHR {
//}
+@extension("VK_EXT_debug_report")
+type VkFlags VkDebugReportFlagsEXT
+@extension("VK_EXT_debug_report")
+bitfield VkDebugReportFlagBitsEXT {
+ VK_DEBUG_REPORT_INFO_BIT_EXT = 0x00000001,
+ VK_DEBUG_REPORT_WARN_BIT_EXT = 0x00000002,
+ VK_DEBUG_REPORT_PERF_WARN_BIT_EXT = 0x00000004,
+ VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
+ VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
+}
+
//////////////////
// Structures //
@@ -2534,6 +2591,15 @@
platform.HWND hwnd
}
+@extension("VK_EXT_debug_report")
+class VkDebugReportCallbackCreateInfoEXT {
+ VkStructureType sType
+ const void* pNext
+ VkDebugReportFlagsEXT flags
+ PFN_vkDebugReportCallbackEXT pfnCallback
+ void* pUserData
+}
+
////////////////
// Commands //
@@ -5068,6 +5134,49 @@
return ?
}
+@extension("VK_EXT_debug_report")
+@external type void* PFN_vkDebugReportCallbackEXT
+@extension("VK_EXT_debug_report")
+@pfn cmd VkBool32 vkDebugReportCallbackEXT(
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ u64 object,
+ platform.size_t location,
+ s32 messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage,
+ void* pUserData) {
+ return ?
+}
+
+@extension("VK_EXT_debug_report")
+cmd VkResult vkCreateDebugReportCallbackEXT(
+ VkInstance instance,
+ const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackEXT* pCallback) {
+ return ?
+}
+
+@extension("VK_EXT_debug_report")
+cmd void vkDestroyDebugReportCallbackEXT(
+ VkInstance instance,
+ VkDebugReportCallbackEXT callback,
+ const VkAllocationCallbacks* pAllocator) {
+}
+
+@extension("VK_EXT_debug_report")
+cmd void vkDebugReportMessageEXT(
+ VkInstance instance,
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ u64 object,
+ platform.size_t location,
+ s32 messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage) {
+}
+
////////////////
// Validation //
diff --git a/vulkan/doc/implementors_guide/implementors_guide.adoc b/vulkan/doc/implementors_guide/implementors_guide.adoc
index 97eff48..ae46f43 100644
--- a/vulkan/doc/implementors_guide/implementors_guide.adoc
+++ b/vulkan/doc/implementors_guide/implementors_guide.adoc
@@ -2,7 +2,7 @@
= Vulkan on Android Implementor's Guide =
:toc: right
:numbered:
-:revnumber: 4
+:revnumber: 5
This document is intended for GPU IHVs writing Vulkan drivers for Android, and OEMs integrating them for specific devices. It describes how a Vulkan driver interacts with the system, how GPU-specific tools should be installed, and Android-specific requirements.
@@ -136,12 +136,14 @@
----
VkResult VKAPI vkQueueSignalReleaseImageANDROID(
VkQueue queue,
+ uint32_t waitSemaphoreCount,
+ const VkSemaphore* pWaitSemaphores,
VkImage image,
int* pNativeFenceFd
);
----
-This will be called during +vkQueuePresentWSI+ on the provided queue. Effects are similar to +vkQueueSignalSemaphore+, except with a native fence instead of a semaphore. Unlike +vkQueueSignalSemaphore+, however, this call creates and returns the synchronization object that will be signalled rather than having it provided as input. If the queue is already idle when this function is called, it is allowed but not required to set +*pNativeFenceFd+ to -1. The file descriptor returned in +*pNativeFenceFd+ is owned and will be closed by the caller. Many drivers will be able to ignore the +image+ parameter, but some may need to prepare CPU-side data structures associated with a gralloc buffer for use by external image consumers. Preparing buffer contents for use by external consumers should have been done asynchronously as part of transitioning the image to +VK_IMAGE_LAYOUT_PRESENT_SRC_KHR+.
+This will be called during +vkQueuePresentWSI+ on the provided queue. Effects are similar to +vkQueueSignalSemaphore+, except with a native fence instead of a semaphore. The native fence must: not signal until the +waitSemaphoreCount+ semaphores in +pWaitSemaphores+ have signaled. Unlike +vkQueueSignalSemaphore+, however, this call creates and returns the synchronization object that will be signalled rather than having it provided as input. If the queue is already idle when this function is called, it is allowed but not required to set +*pNativeFenceFd+ to -1. The file descriptor returned in +*pNativeFenceFd+ is owned and will be closed by the caller. Many drivers will be able to ignore the +image+ parameter, but some may need to prepare CPU-side data structures associated with a gralloc buffer for use by external image consumers. Preparing buffer contents for use by external consumers should have been done asynchronously as part of transitioning the image to +VK_IMAGE_LAYOUT_PRESENT_SRC_KHR+.
== History ==
@@ -159,3 +161,5 @@
. *2015-12-03*
* Added a VkFence parameter to vkAcquireImageANDROID corresponding to the
parameter added to vkAcquireNextImageKHR.
+. *2016-01-08*
+ * Added waitSemaphoreCount and pWaitSemaphores parameters to vkQueueSignalReleaseImageANDROID.
\ No newline at end of file
diff --git a/vulkan/doc/implementors_guide/implementors_guide.html b/vulkan/doc/implementors_guide/implementors_guide.html
index 00efca8..58ce0dc 100644
--- a/vulkan/doc/implementors_guide/implementors_guide.html
+++ b/vulkan/doc/implementors_guide/implementors_guide.html
@@ -733,7 +733,7 @@
<body class="book">
<div id="header">
<h1>Vulkan on Android Implementor’s Guide</h1>
-<span id="revnumber">version 3</span>
+<span id="revnumber">version 5</span>
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
@@ -797,7 +797,7 @@
<div class="paragraph"><p>The <span class="monospaced">vk_wsi_swapchin</span> and <span class="monospaced">vk_wsi_device_swapchain</span> extensions will primarily be implemented by the platform and live in <span class="monospaced">libvulkan.so</span>. The <span class="monospaced">VkSwapchain</span> object and all interaction with <span class="monospaced">ANativeWindow</span> will be handled by the platform and not exposed to drivers. The WSI implementation will rely on a few private interfaces to the driver for this implementation. These will be loaded through the driver’s <span class="monospaced">vkGetDeviceProcAddr</span> functions, after passing through any enabled layers.</p></div>
<div class="paragraph"><p>Implementations may need swapchain buffers to be allocated with implementation-defined private gralloc usage flags. When creating a swapchain, the platform will ask the driver to translate the requested format and image usage flags into gralloc usage flags by calling</p></div>
<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 3.1.6
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -810,7 +810,7 @@
<div class="paragraph"><p>The <span class="monospaced">format</span> and <span class="monospaced">imageUsage</span> parameters are taken from the <span class="monospaced">VkSwapchainCreateInfoKHR</span> structure. The driver should fill <span class="monospaced">*grallocUsage</span> with the gralloc usage flags it requires for that format and usage. These will be combined with the usage flags requested by the swapchain consumer when allocating buffers.</p></div>
<div class="paragraph"><p><span class="monospaced">VkNativeBufferANDROID</span> is a <span class="monospaced">vkCreateImage</span> extension structure for creating an image backed by a gralloc buffer. This structure is provided to <span class="monospaced">vkCreateImage</span> in the <span class="monospaced">VkImageCreateInfo</span> structure chain. Calls to <span class="monospaced">vkCreateImage</span> with this structure will happen during the first call to <span class="monospaced">vkGetSwapChainInfoWSI(.. VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI ..)</span>. The WSI implementation will allocate the number of native buffers requested for the swapchain, then create a <span class="monospaced">VkImage</span> for each one.</p></div>
<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 3.1.6
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -847,7 +847,7 @@
externally-signalled native fence into both an existing VkSemaphore object
and an existing VkFence object:</p></div>
<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 3.1.6
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -875,16 +875,18 @@
is as if the native fence was already signalled.</p></div>
<div class="paragraph"><p><span class="monospaced">vkQueueSignalReleaseImageANDROID</span> prepares a swapchain image for external use, and creates a native fence and schedules it to be signalled when prior work on the queue has completed.</p></div>
<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 3.1.6
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>VkResult <span style="color: #008080">VKAPI</span> <span style="font-weight: bold"><span style="color: #000000">vkQueueSignalReleaseImageANDROID</span></span><span style="color: #990000">(</span>
<span style="color: #008080">VkQueue</span> queue<span style="color: #990000">,</span>
+ <span style="color: #008080">uint32_t</span> waitSemaphoreCount<span style="color: #990000">,</span>
+ <span style="font-weight: bold"><span style="color: #0000FF">const</span></span> VkSemaphore<span style="color: #990000">*</span> pWaitSemaphores<span style="color: #990000">,</span>
<span style="color: #008080">VkImage</span> image<span style="color: #990000">,</span>
<span style="color: #009900">int</span><span style="color: #990000">*</span> pNativeFenceFd
<span style="color: #990000">);</span></tt></pre></div></div>
-<div class="paragraph"><p>This will be called during <span class="monospaced">vkQueuePresentWSI</span> on the provided queue. Effects are similar to <span class="monospaced">vkQueueSignalSemaphore</span>, except with a native fence instead of a semaphore. Unlike <span class="monospaced">vkQueueSignalSemaphore</span>, however, this call creates and returns the synchronization object that will be signalled rather than having it provided as input. If the queue is already idle when this function is called, it is allowed but not required to set <span class="monospaced">*pNativeFenceFd</span> to -1. The file descriptor returned in <span class="monospaced">*pNativeFenceFd</span> is owned and will be closed by the caller. Many drivers will be able to ignore the <span class="monospaced">image</span> parameter, but some may need to prepare CPU-side data structures associated with a gralloc buffer for use by external image consumers. Preparing buffer contents for use by external consumers should have been done asynchronously as part of transitioning the image to <span class="monospaced">VK_IMAGE_LAYOUT_PRESENT_SRC_KHR</span>.</p></div>
+<div class="paragraph"><p>This will be called during <span class="monospaced">vkQueuePresentWSI</span> on the provided queue. Effects are similar to <span class="monospaced">vkQueueSignalSemaphore</span>, except with a native fence instead of a semaphore. The native fence must: not signal until the <span class="monospaced">waitSemaphoreCount</span> semaphores in <span class="monospaced">pWaitSemaphores</span> have signaled. Unlike <span class="monospaced">vkQueueSignalSemaphore</span>, however, this call creates and returns the synchronization object that will be signalled rather than having it provided as input. If the queue is already idle when this function is called, it is allowed but not required to set <span class="monospaced">*pNativeFenceFd</span> to -1. The file descriptor returned in <span class="monospaced">*pNativeFenceFd</span> is owned and will be closed by the caller. Many drivers will be able to ignore the <span class="monospaced">image</span> parameter, but some may need to prepare CPU-side data structures associated with a gralloc buffer for use by external image consumers. Preparing buffer contents for use by external consumers should have been done asynchronously as part of transitioning the image to <span class="monospaced">VK_IMAGE_LAYOUT_PRESENT_SRC_KHR</span>.</p></div>
</div>
</div>
<div class="sect1">
@@ -955,6 +957,18 @@
</li>
</ul></div>
</li>
+<li>
+<p>
+<strong>2016-01-08</strong>
+</p>
+<div class="ulist"><ul>
+<li>
+<p>
+Added waitSemaphoreCount and pWaitSemaphores parameters to vkQueueSignalReleaseImageANDROID.
+</p>
+</li>
+</ul></div>
+</li>
</ol></div>
</div>
</div>
@@ -962,8 +976,8 @@
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
-Version 3<br>
-Last updated 2015-12-03 15:47:36 PST
+Version 5<br>
+Last updated 2016-01-08 22:43:07 PST
</div>
</div>
</body>
diff --git a/vulkan/include/vulkan/vk_android_native_buffer.h b/vulkan/include/vulkan/vk_android_native_buffer.h
index 744ed4a..d0ebf81 100644
--- a/vulkan/include/vulkan/vk_android_native_buffer.h
+++ b/vulkan/include/vulkan/vk_android_native_buffer.h
@@ -27,7 +27,7 @@
#define VK_ANDROID_native_buffer 1
#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER 11
-#define VK_ANDROID_NATIVE_BUFFER_REVISION 4
+#define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 5
#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer"
#define VK_ANDROID_NATIVE_BUFFER_ENUM(type,id) ((type)(1000000000 + (1000 * (VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER - 1)) + (id)))
@@ -48,13 +48,9 @@
typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageANDROID)(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
typedef VkResult (VKAPI_PTR *PFN_vkAcquireImageANDROID)(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
-typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalReleaseImageANDROID)(VkQueue queue, VkImage image, int* pNativeFenceFd);
-// -- DEPRECATED --
-typedef VkResult (VKAPI_PTR *PFN_vkImportNativeFenceANDROID)(VkDevice device, VkSemaphore semaphore, int nativeFenceFd);
-typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalNativeFenceANDROID)(VkQueue queue, int* pNativeFenceFd);
-// ----------------
+typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalReleaseImageANDROID)(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageANDROID(
VkDevice device,
VkFormat format,
@@ -70,6 +66,8 @@
);
VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageANDROID(
VkQueue queue,
+ uint32_t waitSemaphoreCount,
+ const VkSemaphore* pWaitSemaphores,
VkImage image,
int* pNativeFenceFd
);
diff --git a/vulkan/include/vulkan/vk_debug_report_lunarg.h b/vulkan/include/vulkan/vk_debug_report_lunarg.h
deleted file mode 100644
index 58939c9..0000000
--- a/vulkan/include/vulkan/vk_debug_report_lunarg.h
+++ /dev/null
@@ -1,182 +0,0 @@
-//
-// File: vk_debug_report_lunarg.h
-//
-/*
- * Vulkan
- *
- * Copyright (C) 2015 LunarG, Inc.
- *
- * 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 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.
- *
- * Authors:
- * Jon Ashburn <jon@lunarg.com>
- * Courtney Goeltzenleuchter <courtney@lunarg.com>
- */
-
-#ifndef __VK_DEBUG_REPORT_LUNARG_H__
-#define __VK_DEBUG_REPORT_LUNARG_H__
-
-#include "vulkan.h"
-
-#define VK_DEBUG_REPORT_EXTENSION_NUMBER 5
-#define VK_DEBUG_REPORT_EXTENSION_REVISION 1
-#ifdef __cplusplus
-extern "C"
-{
-#endif // __cplusplus
-
-/*
-***************************************************************************************************
-* DebugReport Vulkan Extension API
-***************************************************************************************************
-*/
-typedef enum {
- VK_OBJECT_TYPE_INSTANCE = 0,
- VK_OBJECT_TYPE_PHYSICAL_DEVICE = 1,
- VK_OBJECT_TYPE_DEVICE = 2,
- VK_OBJECT_TYPE_QUEUE = 3,
- VK_OBJECT_TYPE_COMMAND_BUFFER = 4,
- VK_OBJECT_TYPE_DEVICE_MEMORY = 5,
- VK_OBJECT_TYPE_BUFFER = 6,
- VK_OBJECT_TYPE_BUFFER_VIEW = 7,
- VK_OBJECT_TYPE_IMAGE = 8,
- VK_OBJECT_TYPE_IMAGE_VIEW = 9,
- VK_OBJECT_TYPE_ATTACHMENT_VIEW = 10,
- VK_OBJECT_TYPE_SHADER_MODULE = 12,
- VK_OBJECT_TYPE_SHADER = 13,
- VK_OBJECT_TYPE_PIPELINE = 14,
- VK_OBJECT_TYPE_PIPELINE_LAYOUT = 15,
- VK_OBJECT_TYPE_SAMPLER = 16,
- VK_OBJECT_TYPE_DESCRIPTOR_SET = 17,
- VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 18,
- VK_OBJECT_TYPE_DESCRIPTOR_POOL = 19,
- VK_OBJECT_TYPE_FENCE = 20,
- VK_OBJECT_TYPE_SEMAPHORE = 21,
- VK_OBJECT_TYPE_EVENT = 22,
- VK_OBJECT_TYPE_QUERY_POOL = 23,
- VK_OBJECT_TYPE_FRAMEBUFFER = 24,
- VK_OBJECT_TYPE_RENDER_PASS = 25,
- VK_OBJECT_TYPE_PIPELINE_CACHE = 26,
- VK_OBJECT_TYPE_SWAPCHAIN_KHR = 27,
- VK_OBJECT_TYPE_CMD_POOL = 28,
- VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_INSTANCE,
- VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_CMD_POOL,
- VK_OBJECT_TYPE_NUM = (VK_OBJECT_TYPE_CMD_POOL - VK_OBJECT_TYPE_INSTANCE + 1),
- VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF
-} VkDbgObjectType;
-
-#define VK_DEBUG_REPORT_EXTENSION_NAME "DEBUG_REPORT"
-
-VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDbgMsgCallback)
-
-// ------------------------------------------------------------------------------------------------
-// Enumerations
-
-typedef enum VkDbgReportFlags_
-{
- VK_DBG_REPORT_INFO_BIT = 0x0001,
- VK_DBG_REPORT_WARN_BIT = 0x0002,
- VK_DBG_REPORT_PERF_WARN_BIT = 0x0004,
- VK_DBG_REPORT_ERROR_BIT = 0x0008,
- VK_DBG_REPORT_DEBUG_BIT = 0x0010,
-} VkDbgReportFlags;
-
-// Debug Report ERROR codes
-typedef enum _DEBUG_REPORT_ERROR
-{
- DEBUG_REPORT_NONE, // Used for INFO & other non-error messages
- DEBUG_REPORT_CALLBACK_REF, // Callbacks were not destroyed prior to calling DestroyInstance
-} DEBUG_REPORT_ERROR;
-
-#define VK_DEBUG_REPORT_ENUM_EXTEND(type, id) ((type)(VK_DEBUG_REPORT_EXTENSION_NUMBER * -1000 + (id)))
-
-#define VK_OBJECT_TYPE_MSG_CALLBACK VK_DEBUG_REPORT_ENUM_EXTEND(VkDbgObjectType, 0)
-#define VK_ERROR_VALIDATION_FAILED VK_DEBUG_REPORT_ENUM_EXTEND(VkResult, 0)
-
-// ------------------------------------------------------------------------------------------------
-// Vulkan function pointers
-
-typedef VkBool32 (VKAPI_PTR *PFN_vkDbgMsgCallback)(
- VkFlags msgFlags,
- VkDbgObjectType objType,
- uint64_t srcObject,
- size_t location,
- int32_t msgCode,
- const char* pLayerPrefix,
- const char* pMsg,
- void* pUserData);
-
-// ------------------------------------------------------------------------------------------------
-// API functions
-
-typedef VkResult (VKAPI_PTR *PFN_vkDbgCreateMsgCallback)(VkInstance instance, VkFlags msgFlags, const PFN_vkDbgMsgCallback pfnMsgCallback, void* pUserData, VkDbgMsgCallback* pMsgCallback);
-typedef VkResult (VKAPI_PTR *PFN_vkDbgDestroyMsgCallback)(VkInstance instance, VkDbgMsgCallback msgCallback);
-
-#ifdef VK_PROTOTYPES
-
-// DebugReport extension entrypoints
-VKAPI_ATTR VkResult VKAPI_CALL vkDbgCreateMsgCallback(
- VkInstance instance,
- VkFlags msgFlags,
- const PFN_vkDbgMsgCallback pfnMsgCallback,
- void* pUserData,
- VkDbgMsgCallback* pMsgCallback);
-
-VKAPI_ATTR VkResult VKAPI_CALL vkDbgDestroyMsgCallback(
- VkInstance instance,
- VkDbgMsgCallback msgCallback);
-
-// DebugReport utility callback functions
-VKAPI_ATTR void VKAPI_CALL vkDbgStringCallback(
- VkFlags msgFlags,
- VkDbgObjectType objType,
- uint64_t srcObject,
- size_t location,
- int32_t msgCode,
- const char* pLayerPrefix,
- const char* pMsg,
- void* pUserData);
-
-VKAPI_ATTR void VKAPI_CALL vkDbgStdioCallback(
- VkFlags msgFlags,
- VkDbgObjectType objType,
- uint64_t srcObject,
- size_t location,
- int32_t msgCode,
- const char* pLayerPrefix,
- const char* pMsg,
- void* pUserData);
-
-VKAPI_ATTR void VKAPI_CALL vkDbgBreakCallback(
- VkFlags msgFlags,
- VkDbgObjectType objType,
- uint64_t srcObject,
- size_t location,
- int32_t msgCode,
- const char* pLayerPrefix,
- const char* pMsg,
- void* pUserData);
-
-#endif // VK_PROTOTYPES
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // __VK_DEBUG_REPORT_LUNARG_H__
diff --git a/vulkan/include/vulkan/vk_ext_debug_report.h b/vulkan/include/vulkan/vk_ext_debug_report.h
new file mode 100644
index 0000000..c391033
--- /dev/null
+++ b/vulkan/include/vulkan/vk_ext_debug_report.h
@@ -0,0 +1,149 @@
+//
+// File: vk_ext_debug_report.h
+//
+/*
+ *
+ * Copyright (C) 2015 Valve Corporation
+ * Copyright (C) 2015 Google Inc.
+ *
+ * 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 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.
+ *
+ * Author: Cody Northrop <cody@lunarg.com>
+ * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
+ * Author: Tony Barbour <tony@LunarG.com>
+ *
+ */
+
+#pragma once
+
+#include "vulkan/vulkan.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+/*
+***************************************************************************************************
+* DebugReport Vulkan Extension API
+***************************************************************************************************
+*/
+#define VK_EXT_debug_report 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
+
+#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
+#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
+
+
+typedef enum VkDebugReportObjectTypeEXT {
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0,
+ VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3,
+ VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6,
+ VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9,
+ VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10,
+ VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11,
+ VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13,
+ VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17,
+ VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23,
+ VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28,
+} VkDebugReportObjectTypeEXT;
+
+typedef enum VkDebugReportErrorEXT {
+ VK_DEBUG_REPORT_ERROR_NONE_EXT = 0,
+ VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1,
+} VkDebugReportErrorEXT;
+
+typedef enum VkDebugReportFlagBitsEXT {
+ VK_DEBUG_REPORT_INFO_BIT_EXT = 0x00000001,
+ VK_DEBUG_REPORT_WARN_BIT_EXT = 0x00000002,
+ VK_DEBUG_REPORT_PERF_WARN_BIT_EXT = 0x00000004,
+ VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
+ VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
+} VkDebugReportFlagBitsEXT;
+typedef VkFlags VkDebugReportFlagsEXT;
+
+typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)(
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ uint64_t object,
+ size_t location,
+ int32_t messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage,
+ void* pUserData);
+
+
+typedef struct VkDebugReportCallbackCreateInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDebugReportFlagsEXT flags;
+ PFN_vkDebugReportCallbackEXT pfnCallback;
+ void* pUserData;
+} VkDebugReportCallbackCreateInfoEXT;
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
+typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(
+ VkInstance instance,
+ const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackEXT* pCallback);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(
+ VkInstance instance,
+ VkDebugReportCallbackEXT callback,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
+ VkInstance instance,
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ uint64_t object,
+ size_t location,
+ int32_t messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage);
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
diff --git a/vulkan/include/vulkan/vulkan.h b/vulkan/include/vulkan/vulkan.h
index 014f8e8..9940f85 100644
--- a/vulkan/include/vulkan/vulkan.h
+++ b/vulkan/include/vulkan/vulkan.h
@@ -41,7 +41,7 @@
((major << 22) | (minor << 12) | patch)
// Vulkan API version supported by this file
-#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0)
+#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 2)
#define VK_NULL_HANDLE 0
@@ -134,10 +134,10 @@
VK_ERROR_TOO_MANY_OBJECTS = -10,
VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
VK_ERROR_SURFACE_LOST_KHR = -1000000000,
+ VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
VK_SUBOPTIMAL_KHR = 1000001003,
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
- VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000008000,
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED,
VK_RESULT_END_RANGE = VK_INCOMPLETE,
@@ -804,6 +804,7 @@
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200,
VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400,
VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800,
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
} VkFormatFeatureFlagBits;
typedef VkFlags VkFormatFeatureFlags;
@@ -1115,392 +1116,392 @@
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;
+ 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;
+ 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;
- PFN_vkReallocationFunction pfnReallocation;
- PFN_vkFreeFunction pfnFree;
- PFN_vkInternalAllocationNotification pfnInternalAllocation;
- PFN_vkInternalFreeNotification pfnInternalFree;
+ void* pUserData;
+ PFN_vkAllocationFunction pfnAllocation;
+ PFN_vkReallocationFunction pfnReallocation;
+ PFN_vkFreeFunction pfnFree;
+ PFN_vkInternalAllocationNotification pfnInternalAllocation;
+ PFN_vkInternalFreeNotification pfnInternalFree;
} VkAllocationCallbacks;
typedef struct VkPhysicalDeviceFeatures {
- VkBool32 robustBufferAccess;
- VkBool32 fullDrawIndexUint32;
- VkBool32 imageCubeArray;
- VkBool32 independentBlend;
- VkBool32 geometryShader;
- VkBool32 tessellationShader;
- VkBool32 sampleRateShading;
- VkBool32 dualSrcBlend;
- VkBool32 logicOp;
- VkBool32 multiDrawIndirect;
- VkBool32 drawIndirectFirstInstance;
- VkBool32 depthClamp;
- VkBool32 depthBiasClamp;
- VkBool32 fillModeNonSolid;
- VkBool32 depthBounds;
- VkBool32 wideLines;
- VkBool32 largePoints;
- VkBool32 alphaToOne;
- VkBool32 multiViewport;
- VkBool32 samplerAnisotropy;
- VkBool32 textureCompressionETC2;
- VkBool32 textureCompressionASTC_LDR;
- VkBool32 textureCompressionBC;
- VkBool32 occlusionQueryPrecise;
- VkBool32 pipelineStatisticsQuery;
- VkBool32 vertexPipelineStoresAndAtomics;
- VkBool32 fragmentStoresAndAtomics;
- VkBool32 shaderTessellationAndGeometryPointSize;
- VkBool32 shaderImageGatherExtended;
- VkBool32 shaderStorageImageExtendedFormats;
- VkBool32 shaderStorageImageMultisample;
- VkBool32 shaderStorageImageReadWithoutFormat;
- VkBool32 shaderStorageImageWriteWithoutFormat;
- VkBool32 shaderUniformBufferArrayDynamicIndexing;
- VkBool32 shaderSampledImageArrayDynamicIndexing;
- VkBool32 shaderStorageBufferArrayDynamicIndexing;
- VkBool32 shaderStorageImageArrayDynamicIndexing;
- VkBool32 shaderClipDistance;
- VkBool32 shaderCullDistance;
- VkBool32 shaderFloat64;
- VkBool32 shaderInt64;
- VkBool32 shaderInt16;
- VkBool32 shaderResourceResidency;
- VkBool32 shaderResourceMinLod;
- VkBool32 sparseBinding;
- VkBool32 sparseResidencyBuffer;
- VkBool32 sparseResidencyImage2D;
- VkBool32 sparseResidencyImage3D;
- VkBool32 sparseResidency2Samples;
- VkBool32 sparseResidency4Samples;
- VkBool32 sparseResidency8Samples;
- VkBool32 sparseResidency16Samples;
- VkBool32 sparseResidencyAliased;
- VkBool32 variableMultisampleRate;
- VkBool32 inheritedQueries;
+ VkBool32 robustBufferAccess;
+ VkBool32 fullDrawIndexUint32;
+ VkBool32 imageCubeArray;
+ VkBool32 independentBlend;
+ VkBool32 geometryShader;
+ VkBool32 tessellationShader;
+ VkBool32 sampleRateShading;
+ VkBool32 dualSrcBlend;
+ VkBool32 logicOp;
+ VkBool32 multiDrawIndirect;
+ VkBool32 drawIndirectFirstInstance;
+ VkBool32 depthClamp;
+ VkBool32 depthBiasClamp;
+ VkBool32 fillModeNonSolid;
+ VkBool32 depthBounds;
+ VkBool32 wideLines;
+ VkBool32 largePoints;
+ VkBool32 alphaToOne;
+ VkBool32 multiViewport;
+ VkBool32 samplerAnisotropy;
+ VkBool32 textureCompressionETC2;
+ VkBool32 textureCompressionASTC_LDR;
+ VkBool32 textureCompressionBC;
+ VkBool32 occlusionQueryPrecise;
+ VkBool32 pipelineStatisticsQuery;
+ VkBool32 vertexPipelineStoresAndAtomics;
+ VkBool32 fragmentStoresAndAtomics;
+ VkBool32 shaderTessellationAndGeometryPointSize;
+ VkBool32 shaderImageGatherExtended;
+ VkBool32 shaderStorageImageExtendedFormats;
+ VkBool32 shaderStorageImageMultisample;
+ VkBool32 shaderStorageImageReadWithoutFormat;
+ VkBool32 shaderStorageImageWriteWithoutFormat;
+ VkBool32 shaderUniformBufferArrayDynamicIndexing;
+ VkBool32 shaderSampledImageArrayDynamicIndexing;
+ VkBool32 shaderStorageBufferArrayDynamicIndexing;
+ VkBool32 shaderStorageImageArrayDynamicIndexing;
+ VkBool32 shaderClipDistance;
+ VkBool32 shaderCullDistance;
+ VkBool32 shaderFloat64;
+ VkBool32 shaderInt64;
+ VkBool32 shaderInt16;
+ VkBool32 shaderResourceResidency;
+ VkBool32 shaderResourceMinLod;
+ VkBool32 sparseBinding;
+ VkBool32 sparseResidencyBuffer;
+ VkBool32 sparseResidencyImage2D;
+ VkBool32 sparseResidencyImage3D;
+ VkBool32 sparseResidency2Samples;
+ VkBool32 sparseResidency4Samples;
+ VkBool32 sparseResidency8Samples;
+ VkBool32 sparseResidency16Samples;
+ VkBool32 sparseResidencyAliased;
+ VkBool32 variableMultisampleRate;
+ VkBool32 inheritedQueries;
} VkPhysicalDeviceFeatures;
typedef struct VkFormatProperties {
- VkFormatFeatureFlags linearTilingFeatures;
- VkFormatFeatureFlags optimalTilingFeatures;
- VkFormatFeatureFlags bufferFeatures;
+ VkFormatFeatureFlags linearTilingFeatures;
+ VkFormatFeatureFlags optimalTilingFeatures;
+ VkFormatFeatureFlags bufferFeatures;
} VkFormatProperties;
typedef struct VkExtent3D {
- uint32_t width;
- uint32_t height;
- uint32_t depth;
+ uint32_t width;
+ uint32_t height;
+ uint32_t depth;
} VkExtent3D;
typedef struct VkImageFormatProperties {
- VkExtent3D maxExtent;
- uint32_t maxMipLevels;
- uint32_t maxArrayLayers;
- VkSampleCountFlags sampleCounts;
- VkDeviceSize maxResourceSize;
+ VkExtent3D maxExtent;
+ uint32_t maxMipLevels;
+ uint32_t maxArrayLayers;
+ VkSampleCountFlags sampleCounts;
+ VkDeviceSize maxResourceSize;
} VkImageFormatProperties;
typedef struct VkPhysicalDeviceLimits {
- uint32_t maxImageDimension1D;
- uint32_t maxImageDimension2D;
- uint32_t maxImageDimension3D;
- uint32_t maxImageDimensionCube;
- uint32_t maxImageArrayLayers;
- uint32_t maxTexelBufferElements;
- uint32_t maxUniformBufferRange;
- uint32_t maxStorageBufferRange;
- uint32_t maxPushConstantsSize;
- uint32_t maxMemoryAllocationCount;
- uint32_t maxSamplerAllocationCount;
- VkDeviceSize bufferImageGranularity;
- VkDeviceSize sparseAddressSpaceSize;
- uint32_t maxBoundDescriptorSets;
- uint32_t maxPerStageDescriptorSamplers;
- uint32_t maxPerStageDescriptorUniformBuffers;
- uint32_t maxPerStageDescriptorStorageBuffers;
- uint32_t maxPerStageDescriptorSampledImages;
- uint32_t maxPerStageDescriptorStorageImages;
- uint32_t maxPerStageDescriptorInputAttachments;
- uint32_t maxPerStageResources;
- uint32_t maxDescriptorSetSamplers;
- uint32_t maxDescriptorSetUniformBuffers;
- uint32_t maxDescriptorSetUniformBuffersDynamic;
- uint32_t maxDescriptorSetStorageBuffers;
- uint32_t maxDescriptorSetStorageBuffersDynamic;
- uint32_t maxDescriptorSetSampledImages;
- uint32_t maxDescriptorSetStorageImages;
- uint32_t maxDescriptorSetInputAttachments;
- uint32_t maxVertexInputAttributes;
- uint32_t maxVertexInputBindings;
- uint32_t maxVertexInputAttributeOffset;
- uint32_t maxVertexInputBindingStride;
- uint32_t maxVertexOutputComponents;
- uint32_t maxTessellationGenerationLevel;
- uint32_t maxTessellationPatchSize;
- uint32_t maxTessellationControlPerVertexInputComponents;
- uint32_t maxTessellationControlPerVertexOutputComponents;
- uint32_t maxTessellationControlPerPatchOutputComponents;
- uint32_t maxTessellationControlTotalOutputComponents;
- uint32_t maxTessellationEvaluationInputComponents;
- uint32_t maxTessellationEvaluationOutputComponents;
- uint32_t maxGeometryShaderInvocations;
- uint32_t maxGeometryInputComponents;
- uint32_t maxGeometryOutputComponents;
- uint32_t maxGeometryOutputVertices;
- uint32_t maxGeometryTotalOutputComponents;
- uint32_t maxFragmentInputComponents;
- uint32_t maxFragmentOutputAttachments;
- uint32_t maxFragmentDualSrcAttachments;
- uint32_t maxFragmentCombinedOutputResources;
- uint32_t maxComputeSharedMemorySize;
- uint32_t maxComputeWorkGroupCount[3];
- uint32_t maxComputeWorkGroupInvocations;
- uint32_t maxComputeWorkGroupSize[3];
- uint32_t subPixelPrecisionBits;
- uint32_t subTexelPrecisionBits;
- uint32_t mipmapPrecisionBits;
- uint32_t maxDrawIndexedIndexValue;
- uint32_t maxDrawIndirectCount;
- float maxSamplerLodBias;
- float maxSamplerAnisotropy;
- uint32_t maxViewports;
- uint32_t maxViewportDimensions[2];
- float viewportBoundsRange[2];
- uint32_t viewportSubPixelBits;
- size_t minMemoryMapAlignment;
- VkDeviceSize minTexelBufferOffsetAlignment;
- VkDeviceSize minUniformBufferOffsetAlignment;
- VkDeviceSize minStorageBufferOffsetAlignment;
- int32_t minTexelOffset;
- uint32_t maxTexelOffset;
- int32_t minTexelGatherOffset;
- uint32_t maxTexelGatherOffset;
- float minInterpolationOffset;
- float maxInterpolationOffset;
- uint32_t subPixelInterpolationOffsetBits;
- uint32_t maxFramebufferWidth;
- uint32_t maxFramebufferHeight;
- uint32_t maxFramebufferLayers;
- VkSampleCountFlags framebufferColorSampleCounts;
- VkSampleCountFlags framebufferDepthSampleCounts;
- VkSampleCountFlags framebufferStencilSampleCounts;
- VkSampleCountFlags framebufferNoAttachmentsSampleCounts;
- uint32_t maxColorAttachments;
- VkSampleCountFlags sampledImageColorSampleCounts;
- VkSampleCountFlags sampledImageIntegerSampleCounts;
- VkSampleCountFlags sampledImageDepthSampleCounts;
- VkSampleCountFlags sampledImageStencilSampleCounts;
- VkSampleCountFlags storageImageSampleCounts;
- uint32_t maxSampleMaskWords;
- VkBool32 timestampComputeAndGraphics;
- float timestampPeriod;
- uint32_t maxClipDistances;
- uint32_t maxCullDistances;
- uint32_t maxCombinedClipAndCullDistances;
- uint32_t discreteQueuePriorities;
- float pointSizeRange[2];
- float lineWidthRange[2];
- float pointSizeGranularity;
- float lineWidthGranularity;
- VkBool32 strictLines;
- VkBool32 standardSampleLocations;
- VkDeviceSize optimalBufferCopyOffsetAlignment;
- VkDeviceSize optimalBufferCopyRowPitchAlignment;
- VkDeviceSize nonCoherentAtomSize;
+ uint32_t maxImageDimension1D;
+ uint32_t maxImageDimension2D;
+ uint32_t maxImageDimension3D;
+ uint32_t maxImageDimensionCube;
+ uint32_t maxImageArrayLayers;
+ uint32_t maxTexelBufferElements;
+ uint32_t maxUniformBufferRange;
+ uint32_t maxStorageBufferRange;
+ uint32_t maxPushConstantsSize;
+ uint32_t maxMemoryAllocationCount;
+ uint32_t maxSamplerAllocationCount;
+ VkDeviceSize bufferImageGranularity;
+ VkDeviceSize sparseAddressSpaceSize;
+ uint32_t maxBoundDescriptorSets;
+ uint32_t maxPerStageDescriptorSamplers;
+ uint32_t maxPerStageDescriptorUniformBuffers;
+ uint32_t maxPerStageDescriptorStorageBuffers;
+ uint32_t maxPerStageDescriptorSampledImages;
+ uint32_t maxPerStageDescriptorStorageImages;
+ uint32_t maxPerStageDescriptorInputAttachments;
+ uint32_t maxPerStageResources;
+ uint32_t maxDescriptorSetSamplers;
+ uint32_t maxDescriptorSetUniformBuffers;
+ uint32_t maxDescriptorSetUniformBuffersDynamic;
+ uint32_t maxDescriptorSetStorageBuffers;
+ uint32_t maxDescriptorSetStorageBuffersDynamic;
+ uint32_t maxDescriptorSetSampledImages;
+ uint32_t maxDescriptorSetStorageImages;
+ uint32_t maxDescriptorSetInputAttachments;
+ uint32_t maxVertexInputAttributes;
+ uint32_t maxVertexInputBindings;
+ uint32_t maxVertexInputAttributeOffset;
+ uint32_t maxVertexInputBindingStride;
+ uint32_t maxVertexOutputComponents;
+ uint32_t maxTessellationGenerationLevel;
+ uint32_t maxTessellationPatchSize;
+ uint32_t maxTessellationControlPerVertexInputComponents;
+ uint32_t maxTessellationControlPerVertexOutputComponents;
+ uint32_t maxTessellationControlPerPatchOutputComponents;
+ uint32_t maxTessellationControlTotalOutputComponents;
+ uint32_t maxTessellationEvaluationInputComponents;
+ uint32_t maxTessellationEvaluationOutputComponents;
+ uint32_t maxGeometryShaderInvocations;
+ uint32_t maxGeometryInputComponents;
+ uint32_t maxGeometryOutputComponents;
+ uint32_t maxGeometryOutputVertices;
+ uint32_t maxGeometryTotalOutputComponents;
+ uint32_t maxFragmentInputComponents;
+ uint32_t maxFragmentOutputAttachments;
+ uint32_t maxFragmentDualSrcAttachments;
+ uint32_t maxFragmentCombinedOutputResources;
+ uint32_t maxComputeSharedMemorySize;
+ uint32_t maxComputeWorkGroupCount[3];
+ uint32_t maxComputeWorkGroupInvocations;
+ uint32_t maxComputeWorkGroupSize[3];
+ uint32_t subPixelPrecisionBits;
+ uint32_t subTexelPrecisionBits;
+ uint32_t mipmapPrecisionBits;
+ uint32_t maxDrawIndexedIndexValue;
+ uint32_t maxDrawIndirectCount;
+ float maxSamplerLodBias;
+ float maxSamplerAnisotropy;
+ uint32_t maxViewports;
+ uint32_t maxViewportDimensions[2];
+ float viewportBoundsRange[2];
+ uint32_t viewportSubPixelBits;
+ size_t minMemoryMapAlignment;
+ VkDeviceSize minTexelBufferOffsetAlignment;
+ VkDeviceSize minUniformBufferOffsetAlignment;
+ VkDeviceSize minStorageBufferOffsetAlignment;
+ int32_t minTexelOffset;
+ uint32_t maxTexelOffset;
+ int32_t minTexelGatherOffset;
+ uint32_t maxTexelGatherOffset;
+ float minInterpolationOffset;
+ float maxInterpolationOffset;
+ uint32_t subPixelInterpolationOffsetBits;
+ uint32_t maxFramebufferWidth;
+ uint32_t maxFramebufferHeight;
+ uint32_t maxFramebufferLayers;
+ VkSampleCountFlags framebufferColorSampleCounts;
+ VkSampleCountFlags framebufferDepthSampleCounts;
+ VkSampleCountFlags framebufferStencilSampleCounts;
+ VkSampleCountFlags framebufferNoAttachmentsSampleCounts;
+ uint32_t maxColorAttachments;
+ VkSampleCountFlags sampledImageColorSampleCounts;
+ VkSampleCountFlags sampledImageIntegerSampleCounts;
+ VkSampleCountFlags sampledImageDepthSampleCounts;
+ VkSampleCountFlags sampledImageStencilSampleCounts;
+ VkSampleCountFlags storageImageSampleCounts;
+ uint32_t maxSampleMaskWords;
+ VkBool32 timestampComputeAndGraphics;
+ float timestampPeriod;
+ uint32_t maxClipDistances;
+ uint32_t maxCullDistances;
+ uint32_t maxCombinedClipAndCullDistances;
+ uint32_t discreteQueuePriorities;
+ float pointSizeRange[2];
+ float lineWidthRange[2];
+ float pointSizeGranularity;
+ float lineWidthGranularity;
+ VkBool32 strictLines;
+ VkBool32 standardSampleLocations;
+ VkDeviceSize optimalBufferCopyOffsetAlignment;
+ VkDeviceSize optimalBufferCopyRowPitchAlignment;
+ VkDeviceSize nonCoherentAtomSize;
} VkPhysicalDeviceLimits;
typedef struct VkPhysicalDeviceSparseProperties {
- VkBool32 residencyStandard2DBlockShape;
- VkBool32 residencyStandard2DMultisampleBlockShape;
- VkBool32 residencyStandard3DBlockShape;
- VkBool32 residencyAlignedMipSize;
- VkBool32 residencyNonResidentStrict;
+ VkBool32 residencyStandard2DBlockShape;
+ VkBool32 residencyStandard2DMultisampleBlockShape;
+ VkBool32 residencyStandard3DBlockShape;
+ VkBool32 residencyAlignedMipSize;
+ VkBool32 residencyNonResidentStrict;
} VkPhysicalDeviceSparseProperties;
typedef struct VkPhysicalDeviceProperties {
- uint32_t apiVersion;
- uint32_t driverVersion;
- uint32_t vendorID;
- uint32_t deviceID;
- VkPhysicalDeviceType deviceType;
- char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
- uint8_t pipelineCacheUUID[VK_UUID_SIZE];
- VkPhysicalDeviceLimits limits;
- VkPhysicalDeviceSparseProperties sparseProperties;
+ uint32_t apiVersion;
+ uint32_t driverVersion;
+ uint32_t vendorID;
+ uint32_t deviceID;
+ VkPhysicalDeviceType deviceType;
+ char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
+ uint8_t pipelineCacheUUID[VK_UUID_SIZE];
+ VkPhysicalDeviceLimits limits;
+ VkPhysicalDeviceSparseProperties sparseProperties;
} VkPhysicalDeviceProperties;
typedef struct VkQueueFamilyProperties {
- VkQueueFlags queueFlags;
- uint32_t queueCount;
- uint32_t timestampValidBits;
- VkExtent3D minImageTransferGranularity;
+ VkQueueFlags queueFlags;
+ uint32_t queueCount;
+ uint32_t timestampValidBits;
+ VkExtent3D minImageTransferGranularity;
} VkQueueFamilyProperties;
typedef struct VkMemoryType {
- VkMemoryPropertyFlags propertyFlags;
- uint32_t heapIndex;
+ VkMemoryPropertyFlags propertyFlags;
+ uint32_t heapIndex;
} VkMemoryType;
typedef struct VkMemoryHeap {
- VkDeviceSize size;
- VkMemoryHeapFlags flags;
+ VkDeviceSize size;
+ VkMemoryHeapFlags flags;
} VkMemoryHeap;
typedef struct VkPhysicalDeviceMemoryProperties {
- uint32_t memoryTypeCount;
- VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES];
- uint32_t memoryHeapCount;
- VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS];
+ uint32_t memoryTypeCount;
+ VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES];
+ uint32_t memoryHeapCount;
+ VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS];
} VkPhysicalDeviceMemoryProperties;
typedef struct VkDeviceQueueCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkDeviceQueueCreateFlags flags;
- uint32_t queueFamilyIndex;
- uint32_t queueCount;
- const float* pQueuePriorities;
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceQueueCreateFlags flags;
+ uint32_t queueFamilyIndex;
+ uint32_t queueCount;
+ const float* pQueuePriorities;
} VkDeviceQueueCreateInfo;
typedef struct VkDeviceCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkDeviceCreateFlags flags;
- uint32_t queueCreateInfoCount;
- const VkDeviceQueueCreateInfo* pQueueCreateInfos;
- uint32_t enabledLayerCount;
- const char* const* ppEnabledLayerNames;
- uint32_t enabledExtensionCount;
- const char* const* ppEnabledExtensionNames;
- const VkPhysicalDeviceFeatures* pEnabledFeatures;
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceCreateFlags flags;
+ uint32_t queueCreateInfoCount;
+ const VkDeviceQueueCreateInfo* pQueueCreateInfos;
+ uint32_t enabledLayerCount;
+ const char* const* ppEnabledLayerNames;
+ uint32_t enabledExtensionCount;
+ const char* const* ppEnabledExtensionNames;
+ const VkPhysicalDeviceFeatures* pEnabledFeatures;
} VkDeviceCreateInfo;
typedef struct VkExtensionProperties {
- char extensionName[VK_MAX_EXTENSION_NAME_SIZE];
- uint32_t specVersion;
+ char extensionName[VK_MAX_EXTENSION_NAME_SIZE];
+ uint32_t specVersion;
} VkExtensionProperties;
typedef struct VkLayerProperties {
- char layerName[VK_MAX_EXTENSION_NAME_SIZE];
- uint32_t specVersion;
- uint32_t implementationVersion;
- char description[VK_MAX_DESCRIPTION_SIZE];
+ char layerName[VK_MAX_EXTENSION_NAME_SIZE];
+ uint32_t specVersion;
+ uint32_t implementationVersion;
+ char description[VK_MAX_DESCRIPTION_SIZE];
} VkLayerProperties;
typedef struct VkSubmitInfo {
- VkStructureType sType;
- const void* pNext;
- uint32_t waitSemaphoreCount;
- const VkSemaphore* pWaitSemaphores;
- const VkPipelineStageFlags* pWaitDstStageMask;
- uint32_t commandBufferCount;
- const VkCommandBuffer* pCommandBuffers;
- uint32_t signalSemaphoreCount;
- const VkSemaphore* pSignalSemaphores;
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t waitSemaphoreCount;
+ const VkSemaphore* pWaitSemaphores;
+ const VkPipelineStageFlags* pWaitDstStageMask;
+ uint32_t commandBufferCount;
+ const VkCommandBuffer* pCommandBuffers;
+ uint32_t signalSemaphoreCount;
+ const VkSemaphore* pSignalSemaphores;
} VkSubmitInfo;
typedef struct VkMemoryAllocateInfo {
- VkStructureType sType;
- const void* pNext;
- VkDeviceSize allocationSize;
- uint32_t memoryTypeIndex;
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceSize allocationSize;
+ uint32_t memoryTypeIndex;
} VkMemoryAllocateInfo;
typedef struct VkMappedMemoryRange {
- VkStructureType sType;
- const void* pNext;
- VkDeviceMemory memory;
- VkDeviceSize offset;
- VkDeviceSize size;
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceMemory memory;
+ VkDeviceSize offset;
+ VkDeviceSize size;
} VkMappedMemoryRange;
typedef struct VkMemoryRequirements {
- VkDeviceSize size;
- VkDeviceSize alignment;
- uint32_t memoryTypeBits;
+ VkDeviceSize size;
+ VkDeviceSize alignment;
+ uint32_t memoryTypeBits;
} VkMemoryRequirements;
typedef struct VkSparseImageFormatProperties {
- VkImageAspectFlags aspectMask;
- VkExtent3D imageGranularity;
- VkSparseImageFormatFlags flags;
+ VkImageAspectFlags aspectMask;
+ VkExtent3D imageGranularity;
+ VkSparseImageFormatFlags flags;
} VkSparseImageFormatProperties;
typedef struct VkSparseImageMemoryRequirements {
- VkSparseImageFormatProperties formatProperties;
- uint32_t imageMipTailFirstLod;
- VkDeviceSize imageMipTailSize;
- VkDeviceSize imageMipTailOffset;
- VkDeviceSize imageMipTailStride;
+ VkSparseImageFormatProperties formatProperties;
+ uint32_t imageMipTailFirstLod;
+ VkDeviceSize imageMipTailSize;
+ VkDeviceSize imageMipTailOffset;
+ VkDeviceSize imageMipTailStride;
} VkSparseImageMemoryRequirements;
typedef struct VkSparseMemoryBind {
- VkDeviceSize resourceOffset;
- VkDeviceSize size;
- VkDeviceMemory memory;
- VkDeviceSize memoryOffset;
- VkSparseMemoryBindFlags flags;
+ VkDeviceSize resourceOffset;
+ VkDeviceSize size;
+ VkDeviceMemory memory;
+ VkDeviceSize memoryOffset;
+ VkSparseMemoryBindFlags flags;
} VkSparseMemoryBind;
typedef struct VkSparseBufferMemoryBindInfo {
- VkBuffer buffer;
- uint32_t bindCount;
- const VkSparseMemoryBind* pBinds;
+ VkBuffer buffer;
+ uint32_t bindCount;
+ const VkSparseMemoryBind* pBinds;
} VkSparseBufferMemoryBindInfo;
typedef struct VkSparseImageOpaqueMemoryBindInfo {
- VkImage image;
- uint32_t bindCount;
- const VkSparseMemoryBind* pBinds;
+ VkImage image;
+ uint32_t bindCount;
+ const VkSparseMemoryBind* pBinds;
} VkSparseImageOpaqueMemoryBindInfo;
typedef struct VkImageSubresource {
- VkImageAspectFlags aspectMask;
- uint32_t mipLevel;
- uint32_t arrayLayer;
+ VkImageAspectFlags aspectMask;
+ uint32_t mipLevel;
+ uint32_t arrayLayer;
} VkImageSubresource;
typedef struct VkOffset3D {
- int32_t x;
- int32_t y;
- int32_t z;
+ int32_t x;
+ int32_t y;
+ int32_t z;
} VkOffset3D;
typedef struct VkSparseImageMemoryBind {
- VkImageSubresource subresource;
- VkOffset3D offset;
- VkExtent3D extent;
- VkDeviceMemory memory;
- VkDeviceSize memoryOffset;
- VkSparseMemoryBindFlags flags;
+ VkImageSubresource subresource;
+ VkOffset3D offset;
+ VkExtent3D extent;
+ VkDeviceMemory memory;
+ VkDeviceSize memoryOffset;
+ VkSparseMemoryBindFlags flags;
} VkSparseImageMemoryBind;
typedef struct VkSparseImageMemoryBindInfo {
- VkImage image;
- uint32_t bindCount;
- const VkSparseImageMemoryBind* pBinds;
+ VkImage image;
+ uint32_t bindCount;
+ const VkSparseImageMemoryBind* pBinds;
} VkSparseImageMemoryBindInfo;
typedef struct VkBindSparseInfo {
@@ -1519,155 +1520,155 @@
} VkBindSparseInfo;
typedef struct VkFenceCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkFenceCreateFlags flags;
+ VkStructureType sType;
+ const void* pNext;
+ VkFenceCreateFlags flags;
} VkFenceCreateInfo;
typedef struct VkSemaphoreCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkSemaphoreCreateFlags flags;
+ VkStructureType sType;
+ const void* pNext;
+ VkSemaphoreCreateFlags flags;
} VkSemaphoreCreateInfo;
typedef struct VkEventCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkEventCreateFlags flags;
+ VkStructureType sType;
+ const void* pNext;
+ VkEventCreateFlags flags;
} VkEventCreateInfo;
typedef struct VkQueryPoolCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkQueryPoolCreateFlags flags;
- VkQueryType queryType;
- uint32_t queryCount;
- VkQueryPipelineStatisticFlags pipelineStatistics;
+ VkStructureType sType;
+ const void* pNext;
+ VkQueryPoolCreateFlags flags;
+ VkQueryType queryType;
+ uint32_t queryCount;
+ VkQueryPipelineStatisticFlags pipelineStatistics;
} VkQueryPoolCreateInfo;
typedef struct VkBufferCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkBufferCreateFlags flags;
- VkDeviceSize size;
- VkBufferUsageFlags usage;
- VkSharingMode sharingMode;
- uint32_t queueFamilyIndexCount;
- const uint32_t* pQueueFamilyIndices;
+ VkStructureType sType;
+ const void* pNext;
+ VkBufferCreateFlags flags;
+ VkDeviceSize size;
+ VkBufferUsageFlags usage;
+ VkSharingMode sharingMode;
+ uint32_t queueFamilyIndexCount;
+ const uint32_t* pQueueFamilyIndices;
} VkBufferCreateInfo;
typedef struct VkBufferViewCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkBufferViewCreateFlags flags;
- VkBuffer buffer;
- VkFormat format;
- VkDeviceSize offset;
- VkDeviceSize range;
+ VkStructureType sType;
+ const void* pNext;
+ VkBufferViewCreateFlags flags;
+ VkBuffer buffer;
+ VkFormat format;
+ VkDeviceSize offset;
+ VkDeviceSize range;
} VkBufferViewCreateInfo;
typedef struct VkImageCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkImageCreateFlags flags;
- VkImageType imageType;
- VkFormat format;
- VkExtent3D extent;
- uint32_t mipLevels;
- uint32_t arrayLayers;
- VkSampleCountFlagBits samples;
- VkImageTiling tiling;
- VkImageUsageFlags usage;
- VkSharingMode sharingMode;
- uint32_t queueFamilyIndexCount;
- const uint32_t* pQueueFamilyIndices;
- VkImageLayout initialLayout;
+ VkStructureType sType;
+ const void* pNext;
+ VkImageCreateFlags flags;
+ VkImageType imageType;
+ VkFormat format;
+ VkExtent3D extent;
+ uint32_t mipLevels;
+ uint32_t arrayLayers;
+ VkSampleCountFlagBits samples;
+ VkImageTiling tiling;
+ VkImageUsageFlags usage;
+ VkSharingMode sharingMode;
+ uint32_t queueFamilyIndexCount;
+ const uint32_t* pQueueFamilyIndices;
+ VkImageLayout initialLayout;
} VkImageCreateInfo;
typedef struct VkSubresourceLayout {
- VkDeviceSize offset;
- VkDeviceSize size;
- VkDeviceSize rowPitch;
- VkDeviceSize arrayPitch;
- VkDeviceSize depthPitch;
+ VkDeviceSize offset;
+ VkDeviceSize size;
+ VkDeviceSize rowPitch;
+ VkDeviceSize arrayPitch;
+ VkDeviceSize depthPitch;
} VkSubresourceLayout;
typedef struct VkComponentMapping {
- VkComponentSwizzle r;
- VkComponentSwizzle g;
- VkComponentSwizzle b;
- VkComponentSwizzle a;
+ VkComponentSwizzle r;
+ VkComponentSwizzle g;
+ VkComponentSwizzle b;
+ VkComponentSwizzle a;
} VkComponentMapping;
typedef struct VkImageSubresourceRange {
- VkImageAspectFlags aspectMask;
- uint32_t baseMipLevel;
- uint32_t levelCount;
- uint32_t baseArrayLayer;
- uint32_t layerCount;
+ VkImageAspectFlags aspectMask;
+ uint32_t baseMipLevel;
+ uint32_t levelCount;
+ uint32_t baseArrayLayer;
+ uint32_t layerCount;
} VkImageSubresourceRange;
typedef struct VkImageViewCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkImageViewCreateFlags flags;
- VkImage image;
- VkImageViewType viewType;
- VkFormat format;
- VkComponentMapping components;
- VkImageSubresourceRange subresourceRange;
+ VkStructureType sType;
+ const void* pNext;
+ VkImageViewCreateFlags flags;
+ VkImage image;
+ VkImageViewType viewType;
+ VkFormat format;
+ VkComponentMapping components;
+ VkImageSubresourceRange subresourceRange;
} VkImageViewCreateInfo;
typedef struct VkShaderModuleCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkShaderModuleCreateFlags flags;
- size_t codeSize;
- const uint32_t* pCode;
+ VkStructureType sType;
+ const void* pNext;
+ VkShaderModuleCreateFlags flags;
+ size_t codeSize;
+ const uint32_t* pCode;
} VkShaderModuleCreateInfo;
typedef struct VkPipelineCacheCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineCacheCreateFlags flags;
- size_t initialDataSize;
- const void* pInitialData;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCacheCreateFlags flags;
+ size_t initialDataSize;
+ const void* pInitialData;
} VkPipelineCacheCreateInfo;
typedef struct VkSpecializationMapEntry {
- uint32_t constantID;
- uint32_t offset;
- size_t size;
+ uint32_t constantID;
+ uint32_t offset;
+ size_t size;
} VkSpecializationMapEntry;
typedef struct VkSpecializationInfo {
- uint32_t mapEntryCount;
- const VkSpecializationMapEntry* pMapEntries;
- size_t dataSize;
- const void* pData;
+ uint32_t mapEntryCount;
+ const VkSpecializationMapEntry* pMapEntries;
+ size_t dataSize;
+ const void* pData;
} VkSpecializationInfo;
typedef struct VkPipelineShaderStageCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineShaderStageCreateFlags flags;
- VkShaderStageFlagBits stage;
- VkShaderModule module;
- const char* pName;
- const VkSpecializationInfo* pSpecializationInfo;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineShaderStageCreateFlags flags;
+ VkShaderStageFlagBits stage;
+ VkShaderModule module;
+ const char* pName;
+ const VkSpecializationInfo* pSpecializationInfo;
} VkPipelineShaderStageCreateInfo;
typedef struct VkVertexInputBindingDescription {
- uint32_t binding;
- uint32_t stride;
- VkVertexInputRate inputRate;
+ uint32_t binding;
+ uint32_t stride;
+ VkVertexInputRate inputRate;
} VkVertexInputBindingDescription;
typedef struct VkVertexInputAttributeDescription {
- uint32_t location;
- uint32_t binding;
- VkFormat format;
- uint32_t offset;
+ uint32_t location;
+ uint32_t binding;
+ VkFormat format;
+ uint32_t offset;
} VkVertexInputAttributeDescription;
typedef struct VkPipelineVertexInputStateCreateInfo {
@@ -1681,512 +1682,512 @@
} VkPipelineVertexInputStateCreateInfo;
typedef struct VkPipelineInputAssemblyStateCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineInputAssemblyStateCreateFlags flags;
- VkPrimitiveTopology topology;
- VkBool32 primitiveRestartEnable;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineInputAssemblyStateCreateFlags flags;
+ VkPrimitiveTopology topology;
+ VkBool32 primitiveRestartEnable;
} VkPipelineInputAssemblyStateCreateInfo;
typedef struct VkPipelineTessellationStateCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineTessellationStateCreateFlags flags;
- uint32_t patchControlPoints;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineTessellationStateCreateFlags flags;
+ uint32_t patchControlPoints;
} VkPipelineTessellationStateCreateInfo;
typedef struct VkViewport {
- float x;
- float y;
- float width;
- float height;
- float minDepth;
- float maxDepth;
+ float x;
+ float y;
+ float width;
+ float height;
+ float minDepth;
+ float maxDepth;
} VkViewport;
typedef struct VkOffset2D {
- int32_t x;
- int32_t y;
+ int32_t x;
+ int32_t y;
} VkOffset2D;
typedef struct VkExtent2D {
- uint32_t width;
- uint32_t height;
+ uint32_t width;
+ uint32_t height;
} VkExtent2D;
typedef struct VkRect2D {
- VkOffset2D offset;
- VkExtent2D extent;
+ VkOffset2D offset;
+ VkExtent2D extent;
} VkRect2D;
typedef struct VkPipelineViewportStateCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineViewportStateCreateFlags flags;
- uint32_t viewportCount;
- const VkViewport* pViewports;
- uint32_t scissorCount;
- const VkRect2D* pScissors;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineViewportStateCreateFlags flags;
+ uint32_t viewportCount;
+ const VkViewport* pViewports;
+ uint32_t scissorCount;
+ const VkRect2D* pScissors;
} VkPipelineViewportStateCreateInfo;
typedef struct VkPipelineRasterizationStateCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineRasterizationStateCreateFlags flags;
- VkBool32 depthClampEnable;
- VkBool32 rasterizerDiscardEnable;
- VkPolygonMode polygonMode;
- VkCullModeFlags cullMode;
- VkFrontFace frontFace;
- VkBool32 depthBiasEnable;
- float depthBiasConstantFactor;
- float depthBiasClamp;
- float depthBiasSlopeFactor;
- float lineWidth;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineRasterizationStateCreateFlags flags;
+ VkBool32 depthClampEnable;
+ VkBool32 rasterizerDiscardEnable;
+ VkPolygonMode polygonMode;
+ VkCullModeFlags cullMode;
+ VkFrontFace frontFace;
+ VkBool32 depthBiasEnable;
+ float depthBiasConstantFactor;
+ float depthBiasClamp;
+ float depthBiasSlopeFactor;
+ float lineWidth;
} VkPipelineRasterizationStateCreateInfo;
typedef struct VkPipelineMultisampleStateCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineMultisampleStateCreateFlags flags;
- VkSampleCountFlagBits rasterizationSamples;
- VkBool32 sampleShadingEnable;
- float minSampleShading;
- const VkSampleMask* pSampleMask;
- VkBool32 alphaToCoverageEnable;
- VkBool32 alphaToOneEnable;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineMultisampleStateCreateFlags flags;
+ VkSampleCountFlagBits rasterizationSamples;
+ VkBool32 sampleShadingEnable;
+ float minSampleShading;
+ const VkSampleMask* pSampleMask;
+ VkBool32 alphaToCoverageEnable;
+ VkBool32 alphaToOneEnable;
} VkPipelineMultisampleStateCreateInfo;
typedef struct VkStencilOpState {
- VkStencilOp failOp;
- VkStencilOp passOp;
- VkStencilOp depthFailOp;
- VkCompareOp compareOp;
- uint32_t compareMask;
- uint32_t writeMask;
- uint32_t reference;
+ VkStencilOp failOp;
+ VkStencilOp passOp;
+ VkStencilOp depthFailOp;
+ VkCompareOp compareOp;
+ uint32_t compareMask;
+ uint32_t writeMask;
+ uint32_t reference;
} VkStencilOpState;
typedef struct VkPipelineDepthStencilStateCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineDepthStencilStateCreateFlags flags;
- VkBool32 depthTestEnable;
- VkBool32 depthWriteEnable;
- VkCompareOp depthCompareOp;
- VkBool32 depthBoundsTestEnable;
- VkBool32 stencilTestEnable;
- VkStencilOpState front;
- VkStencilOpState back;
- float minDepthBounds;
- float maxDepthBounds;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineDepthStencilStateCreateFlags flags;
+ VkBool32 depthTestEnable;
+ VkBool32 depthWriteEnable;
+ VkCompareOp depthCompareOp;
+ VkBool32 depthBoundsTestEnable;
+ VkBool32 stencilTestEnable;
+ VkStencilOpState front;
+ VkStencilOpState back;
+ float minDepthBounds;
+ float maxDepthBounds;
} VkPipelineDepthStencilStateCreateInfo;
typedef struct VkPipelineColorBlendAttachmentState {
- VkBool32 blendEnable;
- VkBlendFactor srcColorBlendFactor;
- VkBlendFactor dstColorBlendFactor;
- VkBlendOp colorBlendOp;
- VkBlendFactor srcAlphaBlendFactor;
- VkBlendFactor dstAlphaBlendFactor;
- VkBlendOp alphaBlendOp;
- VkColorComponentFlags colorWriteMask;
+ VkBool32 blendEnable;
+ VkBlendFactor srcColorBlendFactor;
+ VkBlendFactor dstColorBlendFactor;
+ VkBlendOp colorBlendOp;
+ VkBlendFactor srcAlphaBlendFactor;
+ VkBlendFactor dstAlphaBlendFactor;
+ VkBlendOp alphaBlendOp;
+ VkColorComponentFlags colorWriteMask;
} VkPipelineColorBlendAttachmentState;
typedef struct VkPipelineColorBlendStateCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineColorBlendStateCreateFlags flags;
- VkBool32 logicOpEnable;
- VkLogicOp logicOp;
- uint32_t attachmentCount;
- const VkPipelineColorBlendAttachmentState* pAttachments;
- float blendConstants[4];
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineColorBlendStateCreateFlags flags;
+ VkBool32 logicOpEnable;
+ VkLogicOp logicOp;
+ uint32_t attachmentCount;
+ const VkPipelineColorBlendAttachmentState* pAttachments;
+ float blendConstants[4];
} VkPipelineColorBlendStateCreateInfo;
typedef struct VkPipelineDynamicStateCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineDynamicStateCreateFlags flags;
- uint32_t dynamicStateCount;
- const VkDynamicState* pDynamicStates;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineDynamicStateCreateFlags flags;
+ uint32_t dynamicStateCount;
+ const VkDynamicState* pDynamicStates;
} VkPipelineDynamicStateCreateInfo;
typedef struct VkGraphicsPipelineCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineCreateFlags flags;
- uint32_t stageCount;
- const VkPipelineShaderStageCreateInfo* pStages;
- const VkPipelineVertexInputStateCreateInfo* pVertexInputState;
- const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState;
- const VkPipelineTessellationStateCreateInfo* pTessellationState;
- const VkPipelineViewportStateCreateInfo* pViewportState;
- const VkPipelineRasterizationStateCreateInfo* pRasterizationState;
- const VkPipelineMultisampleStateCreateInfo* pMultisampleState;
- const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState;
- const VkPipelineColorBlendStateCreateInfo* pColorBlendState;
- const VkPipelineDynamicStateCreateInfo* pDynamicState;
- VkPipelineLayout layout;
- VkRenderPass renderPass;
- uint32_t subpass;
- VkPipeline basePipelineHandle;
- int32_t basePipelineIndex;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCreateFlags flags;
+ uint32_t stageCount;
+ const VkPipelineShaderStageCreateInfo* pStages;
+ const VkPipelineVertexInputStateCreateInfo* pVertexInputState;
+ const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState;
+ const VkPipelineTessellationStateCreateInfo* pTessellationState;
+ const VkPipelineViewportStateCreateInfo* pViewportState;
+ const VkPipelineRasterizationStateCreateInfo* pRasterizationState;
+ const VkPipelineMultisampleStateCreateInfo* pMultisampleState;
+ const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState;
+ const VkPipelineColorBlendStateCreateInfo* pColorBlendState;
+ const VkPipelineDynamicStateCreateInfo* pDynamicState;
+ VkPipelineLayout layout;
+ VkRenderPass renderPass;
+ uint32_t subpass;
+ VkPipeline basePipelineHandle;
+ int32_t basePipelineIndex;
} VkGraphicsPipelineCreateInfo;
typedef struct VkComputePipelineCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineCreateFlags flags;
- VkPipelineShaderStageCreateInfo stage;
- VkPipelineLayout layout;
- VkPipeline basePipelineHandle;
- int32_t basePipelineIndex;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCreateFlags flags;
+ VkPipelineShaderStageCreateInfo stage;
+ VkPipelineLayout layout;
+ VkPipeline basePipelineHandle;
+ int32_t basePipelineIndex;
} VkComputePipelineCreateInfo;
typedef struct VkPushConstantRange {
- VkShaderStageFlags stageFlags;
- uint32_t offset;
- uint32_t size;
+ VkShaderStageFlags stageFlags;
+ uint32_t offset;
+ uint32_t size;
} VkPushConstantRange;
typedef struct VkPipelineLayoutCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkPipelineLayoutCreateFlags flags;
- uint32_t setLayoutCount;
- const VkDescriptorSetLayout* pSetLayouts;
- uint32_t pushConstantRangeCount;
- const VkPushConstantRange* pPushConstantRanges;
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineLayoutCreateFlags flags;
+ uint32_t setLayoutCount;
+ const VkDescriptorSetLayout* pSetLayouts;
+ uint32_t pushConstantRangeCount;
+ const VkPushConstantRange* pPushConstantRanges;
} VkPipelineLayoutCreateInfo;
typedef struct VkSamplerCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkSamplerCreateFlags flags;
- VkFilter magFilter;
- VkFilter minFilter;
- VkSamplerMipmapMode mipmapMode;
- VkSamplerAddressMode addressModeU;
- VkSamplerAddressMode addressModeV;
- VkSamplerAddressMode addressModeW;
- float mipLodBias;
- VkBool32 anisotropyEnable;
- float maxAnisotropy;
- VkBool32 compareEnable;
- VkCompareOp compareOp;
- float minLod;
- float maxLod;
- VkBorderColor borderColor;
- VkBool32 unnormalizedCoordinates;
+ VkStructureType sType;
+ const void* pNext;
+ VkSamplerCreateFlags flags;
+ VkFilter magFilter;
+ VkFilter minFilter;
+ VkSamplerMipmapMode mipmapMode;
+ VkSamplerAddressMode addressModeU;
+ VkSamplerAddressMode addressModeV;
+ VkSamplerAddressMode addressModeW;
+ float mipLodBias;
+ VkBool32 anisotropyEnable;
+ float maxAnisotropy;
+ VkBool32 compareEnable;
+ VkCompareOp compareOp;
+ float minLod;
+ float maxLod;
+ VkBorderColor borderColor;
+ VkBool32 unnormalizedCoordinates;
} VkSamplerCreateInfo;
typedef struct VkDescriptorSetLayoutBinding {
- uint32_t binding;
- VkDescriptorType descriptorType;
- uint32_t descriptorCount;
- VkShaderStageFlags stageFlags;
- const VkSampler* pImmutableSamplers;
+ uint32_t binding;
+ VkDescriptorType descriptorType;
+ uint32_t descriptorCount;
+ VkShaderStageFlags stageFlags;
+ const VkSampler* pImmutableSamplers;
} VkDescriptorSetLayoutBinding;
typedef struct VkDescriptorSetLayoutCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkDescriptorSetLayoutCreateFlags flags;
- uint32_t bindingCount;
- const VkDescriptorSetLayoutBinding* pBindings;
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorSetLayoutCreateFlags flags;
+ uint32_t bindingCount;
+ const VkDescriptorSetLayoutBinding* pBindings;
} VkDescriptorSetLayoutCreateInfo;
typedef struct VkDescriptorPoolSize {
- VkDescriptorType type;
- uint32_t descriptorCount;
+ VkDescriptorType type;
+ uint32_t descriptorCount;
} VkDescriptorPoolSize;
typedef struct VkDescriptorPoolCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkDescriptorPoolCreateFlags flags;
- uint32_t maxSets;
- uint32_t poolSizeCount;
- const VkDescriptorPoolSize* pPoolSizes;
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorPoolCreateFlags flags;
+ uint32_t maxSets;
+ uint32_t poolSizeCount;
+ const VkDescriptorPoolSize* pPoolSizes;
} VkDescriptorPoolCreateInfo;
typedef struct VkDescriptorSetAllocateInfo {
- VkStructureType sType;
- const void* pNext;
- VkDescriptorPool descriptorPool;
- uint32_t descriptorSetCount;
- const VkDescriptorSetLayout* pSetLayouts;
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorPool descriptorPool;
+ uint32_t descriptorSetCount;
+ const VkDescriptorSetLayout* pSetLayouts;
} VkDescriptorSetAllocateInfo;
typedef struct VkDescriptorImageInfo {
- VkSampler sampler;
- VkImageView imageView;
- VkImageLayout imageLayout;
+ VkSampler sampler;
+ VkImageView imageView;
+ VkImageLayout imageLayout;
} VkDescriptorImageInfo;
typedef struct VkDescriptorBufferInfo {
- VkBuffer buffer;
- VkDeviceSize offset;
- VkDeviceSize range;
+ VkBuffer buffer;
+ VkDeviceSize offset;
+ VkDeviceSize range;
} VkDescriptorBufferInfo;
typedef struct VkWriteDescriptorSet {
- VkStructureType sType;
- const void* pNext;
- VkDescriptorSet dstSet;
- uint32_t dstBinding;
- uint32_t dstArrayElement;
- uint32_t descriptorCount;
- VkDescriptorType descriptorType;
- const VkDescriptorImageInfo* pImageInfo;
- const VkDescriptorBufferInfo* pBufferInfo;
- const VkBufferView* pTexelBufferView;
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorSet dstSet;
+ uint32_t dstBinding;
+ uint32_t dstArrayElement;
+ uint32_t descriptorCount;
+ VkDescriptorType descriptorType;
+ const VkDescriptorImageInfo* pImageInfo;
+ const VkDescriptorBufferInfo* pBufferInfo;
+ const VkBufferView* pTexelBufferView;
} VkWriteDescriptorSet;
typedef struct VkCopyDescriptorSet {
- VkStructureType sType;
- const void* pNext;
- VkDescriptorSet srcSet;
- uint32_t srcBinding;
- uint32_t srcArrayElement;
- VkDescriptorSet dstSet;
- uint32_t dstBinding;
- uint32_t dstArrayElement;
- uint32_t descriptorCount;
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorSet srcSet;
+ uint32_t srcBinding;
+ uint32_t srcArrayElement;
+ VkDescriptorSet dstSet;
+ uint32_t dstBinding;
+ uint32_t dstArrayElement;
+ uint32_t descriptorCount;
} VkCopyDescriptorSet;
typedef struct VkFramebufferCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkFramebufferCreateFlags flags;
- VkRenderPass renderPass;
- uint32_t attachmentCount;
- const VkImageView* pAttachments;
- uint32_t width;
- uint32_t height;
- uint32_t layers;
+ VkStructureType sType;
+ const void* pNext;
+ VkFramebufferCreateFlags flags;
+ VkRenderPass renderPass;
+ uint32_t attachmentCount;
+ const VkImageView* pAttachments;
+ uint32_t width;
+ uint32_t height;
+ uint32_t layers;
} VkFramebufferCreateInfo;
typedef struct VkAttachmentDescription {
- VkAttachmentDescriptionFlags flags;
- VkFormat format;
- VkSampleCountFlagBits samples;
- VkAttachmentLoadOp loadOp;
- VkAttachmentStoreOp storeOp;
- VkAttachmentLoadOp stencilLoadOp;
- VkAttachmentStoreOp stencilStoreOp;
- VkImageLayout initialLayout;
- VkImageLayout finalLayout;
+ VkAttachmentDescriptionFlags flags;
+ VkFormat format;
+ VkSampleCountFlagBits samples;
+ VkAttachmentLoadOp loadOp;
+ VkAttachmentStoreOp storeOp;
+ VkAttachmentLoadOp stencilLoadOp;
+ VkAttachmentStoreOp stencilStoreOp;
+ VkImageLayout initialLayout;
+ VkImageLayout finalLayout;
} VkAttachmentDescription;
typedef struct VkAttachmentReference {
- uint32_t attachment;
- VkImageLayout layout;
+ uint32_t attachment;
+ VkImageLayout layout;
} VkAttachmentReference;
typedef struct VkSubpassDescription {
- VkSubpassDescriptionFlags flags;
- VkPipelineBindPoint pipelineBindPoint;
- uint32_t inputAttachmentCount;
- const VkAttachmentReference* pInputAttachments;
- uint32_t colorAttachmentCount;
- const VkAttachmentReference* pColorAttachments;
- const VkAttachmentReference* pResolveAttachments;
- const VkAttachmentReference* pDepthStencilAttachment;
- uint32_t preserveAttachmentCount;
- const uint32_t* pPreserveAttachments;
+ VkSubpassDescriptionFlags flags;
+ VkPipelineBindPoint pipelineBindPoint;
+ uint32_t inputAttachmentCount;
+ const VkAttachmentReference* pInputAttachments;
+ uint32_t colorAttachmentCount;
+ const VkAttachmentReference* pColorAttachments;
+ const VkAttachmentReference* pResolveAttachments;
+ const VkAttachmentReference* pDepthStencilAttachment;
+ uint32_t preserveAttachmentCount;
+ const uint32_t* pPreserveAttachments;
} VkSubpassDescription;
typedef struct VkSubpassDependency {
- uint32_t srcSubpass;
- uint32_t dstSubpass;
- VkPipelineStageFlags srcStageMask;
- VkPipelineStageFlags dstStageMask;
- VkAccessFlags srcAccessMask;
- VkAccessFlags dstAccessMask;
- VkDependencyFlags dependencyFlags;
+ uint32_t srcSubpass;
+ uint32_t dstSubpass;
+ VkPipelineStageFlags srcStageMask;
+ VkPipelineStageFlags dstStageMask;
+ VkAccessFlags srcAccessMask;
+ VkAccessFlags dstAccessMask;
+ VkDependencyFlags dependencyFlags;
} VkSubpassDependency;
typedef struct VkRenderPassCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkRenderPassCreateFlags flags;
- uint32_t attachmentCount;
- const VkAttachmentDescription* pAttachments;
- uint32_t subpassCount;
- const VkSubpassDescription* pSubpasses;
- uint32_t dependencyCount;
- const VkSubpassDependency* pDependencies;
+ VkStructureType sType;
+ const void* pNext;
+ VkRenderPassCreateFlags flags;
+ uint32_t attachmentCount;
+ const VkAttachmentDescription* pAttachments;
+ uint32_t subpassCount;
+ const VkSubpassDescription* pSubpasses;
+ uint32_t dependencyCount;
+ const VkSubpassDependency* pDependencies;
} VkRenderPassCreateInfo;
typedef struct VkCommandPoolCreateInfo {
- VkStructureType sType;
- const void* pNext;
- VkCommandPoolCreateFlags flags;
- uint32_t queueFamilyIndex;
+ VkStructureType sType;
+ const void* pNext;
+ VkCommandPoolCreateFlags flags;
+ uint32_t queueFamilyIndex;
} VkCommandPoolCreateInfo;
typedef struct VkCommandBufferAllocateInfo {
- VkStructureType sType;
- const void* pNext;
- VkCommandPool commandPool;
- VkCommandBufferLevel level;
- uint32_t commandBufferCount;
+ VkStructureType sType;
+ const void* pNext;
+ VkCommandPool commandPool;
+ VkCommandBufferLevel level;
+ uint32_t commandBufferCount;
} VkCommandBufferAllocateInfo;
typedef struct VkCommandBufferInheritanceInfo {
- VkStructureType sType;
- const void* pNext;
- VkRenderPass renderPass;
- uint32_t subpass;
- VkFramebuffer framebuffer;
- VkBool32 occlusionQueryEnable;
- VkQueryControlFlags queryFlags;
- VkQueryPipelineStatisticFlags pipelineStatistics;
+ VkStructureType sType;
+ const void* pNext;
+ VkRenderPass renderPass;
+ uint32_t subpass;
+ VkFramebuffer framebuffer;
+ VkBool32 occlusionQueryEnable;
+ VkQueryControlFlags queryFlags;
+ VkQueryPipelineStatisticFlags pipelineStatistics;
} VkCommandBufferInheritanceInfo;
typedef struct VkCommandBufferBeginInfo {
- VkStructureType sType;
- const void* pNext;
- VkCommandBufferUsageFlags flags;
- const VkCommandBufferInheritanceInfo* pInheritanceInfo;
+ VkStructureType sType;
+ const void* pNext;
+ VkCommandBufferUsageFlags flags;
+ const VkCommandBufferInheritanceInfo* pInheritanceInfo;
} VkCommandBufferBeginInfo;
typedef struct VkBufferCopy {
- VkDeviceSize srcOffset;
- VkDeviceSize dstOffset;
- VkDeviceSize size;
+ VkDeviceSize srcOffset;
+ VkDeviceSize dstOffset;
+ VkDeviceSize size;
} VkBufferCopy;
typedef struct VkImageSubresourceLayers {
- VkImageAspectFlags aspectMask;
- uint32_t mipLevel;
- uint32_t baseArrayLayer;
- uint32_t layerCount;
+ VkImageAspectFlags aspectMask;
+ uint32_t mipLevel;
+ uint32_t baseArrayLayer;
+ uint32_t layerCount;
} VkImageSubresourceLayers;
typedef struct VkImageCopy {
- VkImageSubresourceLayers srcSubresource;
- VkOffset3D srcOffset;
- VkImageSubresourceLayers dstSubresource;
- VkOffset3D dstOffset;
- VkExtent3D extent;
+ VkImageSubresourceLayers srcSubresource;
+ VkOffset3D srcOffset;
+ VkImageSubresourceLayers dstSubresource;
+ VkOffset3D dstOffset;
+ VkExtent3D extent;
} VkImageCopy;
typedef struct VkImageBlit {
- VkImageSubresourceLayers srcSubresource;
- VkOffset3D srcOffsets[2];
- VkImageSubresourceLayers dstSubresource;
- VkOffset3D dstOffsets[2];
+ VkImageSubresourceLayers srcSubresource;
+ VkOffset3D srcOffsets[2];
+ VkImageSubresourceLayers dstSubresource;
+ VkOffset3D dstOffsets[2];
} VkImageBlit;
typedef struct VkBufferImageCopy {
- VkDeviceSize bufferOffset;
- uint32_t bufferRowLength;
- uint32_t bufferImageHeight;
- VkImageSubresourceLayers imageSubresource;
- VkOffset3D imageOffset;
- VkExtent3D imageExtent;
+ VkDeviceSize bufferOffset;
+ uint32_t bufferRowLength;
+ uint32_t bufferImageHeight;
+ VkImageSubresourceLayers imageSubresource;
+ VkOffset3D imageOffset;
+ VkExtent3D imageExtent;
} VkBufferImageCopy;
typedef union VkClearColorValue {
- float float32[4];
- int32_t int32[4];
- uint32_t uint32[4];
+ float float32[4];
+ int32_t int32[4];
+ uint32_t uint32[4];
} VkClearColorValue;
typedef struct VkClearDepthStencilValue {
- float depth;
- uint32_t stencil;
+ float depth;
+ uint32_t stencil;
} VkClearDepthStencilValue;
typedef union VkClearValue {
- VkClearColorValue color;
- VkClearDepthStencilValue depthStencil;
+ VkClearColorValue color;
+ VkClearDepthStencilValue depthStencil;
} VkClearValue;
typedef struct VkClearAttachment {
- VkImageAspectFlags aspectMask;
- uint32_t colorAttachment;
- VkClearValue clearValue;
+ VkImageAspectFlags aspectMask;
+ uint32_t colorAttachment;
+ VkClearValue clearValue;
} VkClearAttachment;
typedef struct VkClearRect {
- VkRect2D rect;
- uint32_t baseArrayLayer;
- uint32_t layerCount;
+ VkRect2D rect;
+ uint32_t baseArrayLayer;
+ uint32_t layerCount;
} VkClearRect;
typedef struct VkImageResolve {
- VkImageSubresourceLayers srcSubresource;
- VkOffset3D srcOffset;
- VkImageSubresourceLayers dstSubresource;
- VkOffset3D dstOffset;
- VkExtent3D extent;
+ VkImageSubresourceLayers srcSubresource;
+ VkOffset3D srcOffset;
+ VkImageSubresourceLayers dstSubresource;
+ VkOffset3D dstOffset;
+ VkExtent3D extent;
} VkImageResolve;
typedef struct VkMemoryBarrier {
- VkStructureType sType;
- const void* pNext;
- VkAccessFlags srcAccessMask;
- VkAccessFlags dstAccessMask;
+ VkStructureType sType;
+ const void* pNext;
+ VkAccessFlags srcAccessMask;
+ VkAccessFlags dstAccessMask;
} VkMemoryBarrier;
typedef struct VkBufferMemoryBarrier {
- VkStructureType sType;
- const void* pNext;
- VkAccessFlags srcAccessMask;
- VkAccessFlags dstAccessMask;
- uint32_t srcQueueFamilyIndex;
- uint32_t dstQueueFamilyIndex;
- VkBuffer buffer;
- VkDeviceSize offset;
- VkDeviceSize size;
+ VkStructureType sType;
+ const void* pNext;
+ VkAccessFlags srcAccessMask;
+ VkAccessFlags dstAccessMask;
+ uint32_t srcQueueFamilyIndex;
+ uint32_t dstQueueFamilyIndex;
+ VkBuffer buffer;
+ VkDeviceSize offset;
+ VkDeviceSize size;
} VkBufferMemoryBarrier;
typedef struct VkImageMemoryBarrier {
- VkStructureType sType;
- const void* pNext;
- VkAccessFlags srcAccessMask;
- VkAccessFlags dstAccessMask;
- VkImageLayout oldLayout;
- VkImageLayout newLayout;
- uint32_t srcQueueFamilyIndex;
- uint32_t dstQueueFamilyIndex;
- VkImage image;
- VkImageSubresourceRange subresourceRange;
+ VkStructureType sType;
+ const void* pNext;
+ VkAccessFlags srcAccessMask;
+ VkAccessFlags dstAccessMask;
+ VkImageLayout oldLayout;
+ VkImageLayout newLayout;
+ uint32_t srcQueueFamilyIndex;
+ uint32_t dstQueueFamilyIndex;
+ VkImage image;
+ VkImageSubresourceRange subresourceRange;
} VkImageMemoryBarrier;
typedef struct VkRenderPassBeginInfo {
- VkStructureType sType;
- const void* pNext;
- VkRenderPass renderPass;
- VkFramebuffer framebuffer;
- VkRect2D renderArea;
- uint32_t clearValueCount;
- const VkClearValue* pClearValues;
+ VkStructureType sType;
+ const void* pNext;
+ VkRenderPass renderPass;
+ VkFramebuffer framebuffer;
+ VkRect2D renderArea;
+ uint32_t clearValueCount;
+ const VkClearValue* pClearValues;
} VkRenderPassBeginInfo;
typedef struct VkDispatchIndirectCommand {
- uint32_t x;
- uint32_t y;
- uint32_t z;
+ uint32_t x;
+ uint32_t y;
+ uint32_t z;
} VkDispatchIndirectCommand;
typedef struct VkDrawIndexedIndirectCommand {
- uint32_t indexCount;
- uint32_t instanceCount;
- uint32_t firstIndex;
- int32_t vertexOffset;
- uint32_t firstInstance;
+ uint32_t indexCount;
+ uint32_t instanceCount;
+ uint32_t firstIndex;
+ int32_t vertexOffset;
+ uint32_t firstInstance;
} VkDrawIndexedIndirectCommand;
typedef struct VkDrawIndirectCommand {
- uint32_t vertexCount;
- uint32_t instanceCount;
- uint32_t firstVertex;
- uint32_t firstInstance;
+ uint32_t vertexCount;
+ uint32_t instanceCount;
+ uint32_t firstVertex;
+ uint32_t firstInstance;
} VkDrawIndirectCommand;
@@ -2328,7 +2329,7 @@
typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer);
typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
const VkInstanceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
@@ -3130,7 +3131,7 @@
#define VK_KHR_surface 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
-#define VK_KHR_SURFACE_SPEC_VERSION 24
+#define VK_KHR_SURFACE_SPEC_VERSION 25
#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
@@ -3176,21 +3177,21 @@
typedef VkFlags VkCompositeAlphaFlagsKHR;
typedef struct VkSurfaceCapabilitiesKHR {
- uint32_t minImageCount;
- uint32_t maxImageCount;
- VkExtent2D currentExtent;
- VkExtent2D minImageExtent;
- VkExtent2D maxImageExtent;
- uint32_t maxImageArrayLayers;
- VkSurfaceTransformFlagsKHR supportedTransforms;
- VkSurfaceTransformFlagBitsKHR currentTransform;
- VkCompositeAlphaFlagsKHR supportedCompositeAlpha;
- VkImageUsageFlags supportedUsageFlags;
+ uint32_t minImageCount;
+ uint32_t maxImageCount;
+ VkExtent2D currentExtent;
+ VkExtent2D minImageExtent;
+ VkExtent2D maxImageExtent;
+ uint32_t maxImageArrayLayers;
+ VkSurfaceTransformFlagsKHR supportedTransforms;
+ VkSurfaceTransformFlagBitsKHR currentTransform;
+ VkCompositeAlphaFlagsKHR supportedCompositeAlpha;
+ VkImageUsageFlags supportedUsageFlags;
} VkSurfaceCapabilitiesKHR;
typedef struct VkSurfaceFormatKHR {
- VkFormat format;
- VkColorSpaceKHR colorSpace;
+ VkFormat format;
+ VkColorSpaceKHR colorSpace;
} VkSurfaceFormatKHR;
@@ -3200,7 +3201,7 @@
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats);
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(
VkInstance instance,
VkSurfaceKHR surface,
@@ -3239,35 +3240,35 @@
typedef VkFlags VkSwapchainCreateFlagsKHR;
typedef struct VkSwapchainCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkSwapchainCreateFlagsKHR flags;
- VkSurfaceKHR surface;
- uint32_t minImageCount;
- VkFormat imageFormat;
- VkColorSpaceKHR imageColorSpace;
- VkExtent2D imageExtent;
- uint32_t imageArrayLayers;
- VkImageUsageFlags imageUsage;
- VkSharingMode imageSharingMode;
- uint32_t queueFamilyIndexCount;
- const uint32_t* pQueueFamilyIndices;
- VkSurfaceTransformFlagBitsKHR preTransform;
- VkCompositeAlphaFlagBitsKHR compositeAlpha;
- VkPresentModeKHR presentMode;
- VkBool32 clipped;
- VkSwapchainKHR oldSwapchain;
+ VkStructureType sType;
+ const void* pNext;
+ VkSwapchainCreateFlagsKHR flags;
+ VkSurfaceKHR surface;
+ uint32_t minImageCount;
+ VkFormat imageFormat;
+ VkColorSpaceKHR imageColorSpace;
+ VkExtent2D imageExtent;
+ uint32_t imageArrayLayers;
+ VkImageUsageFlags imageUsage;
+ VkSharingMode imageSharingMode;
+ uint32_t queueFamilyIndexCount;
+ const uint32_t* pQueueFamilyIndices;
+ VkSurfaceTransformFlagBitsKHR preTransform;
+ VkCompositeAlphaFlagBitsKHR compositeAlpha;
+ VkPresentModeKHR presentMode;
+ VkBool32 clipped;
+ VkSwapchainKHR oldSwapchain;
} VkSwapchainCreateInfoKHR;
typedef struct VkPresentInfoKHR {
- VkStructureType sType;
- const void* pNext;
- uint32_t waitSemaphoreCount;
- const VkSemaphore* pWaitSemaphores;
- uint32_t swapchainCount;
- const VkSwapchainKHR* pSwapchains;
- const uint32_t* pImageIndices;
- VkResult* pResults;
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t waitSemaphoreCount;
+ const VkSemaphore* pWaitSemaphores;
+ uint32_t swapchainCount;
+ const VkSwapchainKHR* pSwapchains;
+ const uint32_t* pImageIndices;
+ VkResult* pResults;
} VkPresentInfoKHR;
@@ -3277,7 +3278,7 @@
typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex);
typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR* pPresentInfo);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
VkDevice device,
const VkSwapchainCreateInfoKHR* pCreateInfo,
@@ -3327,60 +3328,60 @@
typedef VkFlags VkDisplaySurfaceCreateFlagsKHR;
typedef struct VkDisplayPropertiesKHR {
- VkDisplayKHR display;
- const char* displayName;
- VkExtent2D physicalDimensions;
- VkExtent2D physicalResolution;
- VkSurfaceTransformFlagsKHR supportedTransforms;
- VkBool32 planeReorderPossible;
- VkBool32 persistentContent;
+ VkDisplayKHR display;
+ const char* displayName;
+ VkExtent2D physicalDimensions;
+ VkExtent2D physicalResolution;
+ VkSurfaceTransformFlagsKHR supportedTransforms;
+ VkBool32 planeReorderPossible;
+ VkBool32 persistentContent;
} VkDisplayPropertiesKHR;
typedef struct VkDisplayModeParametersKHR {
- VkExtent2D visibleRegion;
- uint32_t refreshRate;
+ VkExtent2D visibleRegion;
+ uint32_t refreshRate;
} VkDisplayModeParametersKHR;
typedef struct VkDisplayModePropertiesKHR {
- VkDisplayModeKHR displayMode;
- VkDisplayModeParametersKHR parameters;
+ VkDisplayModeKHR displayMode;
+ VkDisplayModeParametersKHR parameters;
} VkDisplayModePropertiesKHR;
typedef struct VkDisplayModeCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkDisplayModeCreateFlagsKHR flags;
- VkDisplayModeParametersKHR parameters;
+ VkStructureType sType;
+ const void* pNext;
+ VkDisplayModeCreateFlagsKHR flags;
+ VkDisplayModeParametersKHR parameters;
} VkDisplayModeCreateInfoKHR;
typedef struct VkDisplayPlaneCapabilitiesKHR {
- VkDisplayPlaneAlphaFlagsKHR supportedAlpha;
- VkOffset2D minSrcPosition;
- VkOffset2D maxSrcPosition;
- VkExtent2D minSrcExtent;
- VkExtent2D maxSrcExtent;
- VkOffset2D minDstPosition;
- VkOffset2D maxDstPosition;
- VkExtent2D minDstExtent;
- VkExtent2D maxDstExtent;
+ VkDisplayPlaneAlphaFlagsKHR supportedAlpha;
+ VkOffset2D minSrcPosition;
+ VkOffset2D maxSrcPosition;
+ VkExtent2D minSrcExtent;
+ VkExtent2D maxSrcExtent;
+ VkOffset2D minDstPosition;
+ VkOffset2D maxDstPosition;
+ VkExtent2D minDstExtent;
+ VkExtent2D maxDstExtent;
} VkDisplayPlaneCapabilitiesKHR;
typedef struct VkDisplayPlanePropertiesKHR {
- VkDisplayKHR currentDisplay;
- uint32_t currentStackIndex;
+ VkDisplayKHR currentDisplay;
+ uint32_t currentStackIndex;
} VkDisplayPlanePropertiesKHR;
typedef struct VkDisplaySurfaceCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkDisplaySurfaceCreateFlagsKHR flags;
- VkDisplayModeKHR displayMode;
- uint32_t planeIndex;
- uint32_t planeStackIndex;
- VkSurfaceTransformFlagBitsKHR transform;
- float globalAlpha;
- VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
- VkExtent2D imageExtent;
+ VkStructureType sType;
+ const void* pNext;
+ VkDisplaySurfaceCreateFlagsKHR flags;
+ VkDisplayModeKHR displayMode;
+ uint32_t planeIndex;
+ uint32_t planeStackIndex;
+ VkSurfaceTransformFlagBitsKHR transform;
+ float globalAlpha;
+ VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
+ VkExtent2D imageExtent;
} VkDisplaySurfaceCreateInfoKHR;
@@ -3392,7 +3393,7 @@
typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities);
typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR(
VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
@@ -3440,17 +3441,17 @@
#define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain"
typedef struct VkDisplayPresentInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkRect2D srcRect;
- VkRect2D dstRect;
- VkBool32 persistent;
+ VkStructureType sType;
+ const void* pNext;
+ VkRect2D srcRect;
+ VkRect2D dstRect;
+ VkBool32 persistent;
} VkDisplayPresentInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkCreateSharedSwapchainsKHR)(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR(
VkDevice device,
uint32_t swapchainCount,
@@ -3469,18 +3470,18 @@
typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
typedef struct VkXlibSurfaceCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkXlibSurfaceCreateFlagsKHR flags;
- Display* dpy;
- Window window;
+ VkStructureType sType;
+ const void* pNext;
+ VkXlibSurfaceCreateFlagsKHR flags;
+ Display* dpy;
+ Window window;
} VkXlibSurfaceCreateInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(
VkInstance instance,
const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
@@ -3505,18 +3506,18 @@
typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
typedef struct VkXcbSurfaceCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkXcbSurfaceCreateFlagsKHR flags;
- xcb_connection_t* connection;
- xcb_window_t window;
+ VkStructureType sType;
+ const void* pNext;
+ VkXcbSurfaceCreateFlagsKHR flags;
+ xcb_connection_t* connection;
+ xcb_window_t window;
} VkXcbSurfaceCreateInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(
VkInstance instance,
const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
@@ -3541,18 +3542,18 @@
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
typedef struct VkWaylandSurfaceCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkWaylandSurfaceCreateFlagsKHR flags;
- struct wl_display* display;
- struct wl_surface* surface;
+ VkStructureType sType;
+ const void* pNext;
+ VkWaylandSurfaceCreateFlagsKHR flags;
+ struct wl_display* display;
+ struct wl_surface* surface;
} VkWaylandSurfaceCreateInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(
VkInstance instance,
const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
@@ -3576,18 +3577,18 @@
typedef VkFlags VkMirSurfaceCreateFlagsKHR;
typedef struct VkMirSurfaceCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkMirSurfaceCreateFlagsKHR flags;
- MirConnection* connection;
- MirSurface* mirSurface;
+ VkStructureType sType;
+ const void* pNext;
+ VkMirSurfaceCreateFlagsKHR flags;
+ MirConnection* connection;
+ MirSurface* mirSurface;
} VkMirSurfaceCreateInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(
VkInstance instance,
const VkMirSurfaceCreateInfoKHR* pCreateInfo,
@@ -3605,22 +3606,22 @@
#define VK_KHR_android_surface 1
#include <android/native_window.h>
-#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 5
+#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface"
typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
typedef struct VkAndroidSurfaceCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkAndroidSurfaceCreateFlagsKHR flags;
- ANativeWindow* window;
+ VkStructureType sType;
+ const void* pNext;
+ VkAndroidSurfaceCreateFlagsKHR flags;
+ ANativeWindow* window;
} VkAndroidSurfaceCreateInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
VkInstance instance,
const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
@@ -3639,18 +3640,18 @@
typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
typedef struct VkWin32SurfaceCreateInfoKHR {
- VkStructureType sType;
- const void* pNext;
- VkWin32SurfaceCreateFlagsKHR flags;
- HINSTANCE hinstance;
- HWND hwnd;
+ VkStructureType sType;
+ const void* pNext;
+ VkWin32SurfaceCreateFlagsKHR flags;
+ HINSTANCE hinstance;
+ HWND hwnd;
} VkWin32SurfaceCreateInfoKHR;
typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
-#ifdef VK_PROTOTYPES
+#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(
VkInstance instance,
const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
diff --git a/vulkan/libvulkan/Android.mk b/vulkan/libvulkan/Android.mk
index 4241757..a196a36 100644
--- a/vulkan/libvulkan/Android.mk
+++ b/vulkan/libvulkan/Android.mk
@@ -16,10 +16,14 @@
include $(CLEAR_VARS)
LOCAL_CLANG := true
-LOCAL_CFLAGS := -std=c99 -fvisibility=hidden -fstrict-aliasing
-LOCAL_CFLAGS += -DLOG_TAG=\"vulkan\"
-LOCAL_CFLAGS += -Weverything -Werror -Wno-padded -Wno-undef
+LOCAL_CFLAGS := -DLOG_TAG=\"vulkan\" \
+ -std=c99 -fvisibility=hidden -fstrict-aliasing \
+ -Weverything -Werror \
+ -Wno-padded \
+ -Wno-undef
+#LOCAL_CFLAGS += -DLOG_NDEBUG=0
LOCAL_CPPFLAGS := -std=c++14 \
+ -fexceptions \
-Wno-c++98-compat-pedantic \
-Wno-exit-time-destructors \
-Wno-c99-extensions \
@@ -31,6 +35,7 @@
system/core/libsync/include
LOCAL_SRC_FILES := \
+ debug_report.cpp \
dispatch_gen.cpp \
layers_extensions.cpp \
loader.cpp \
@@ -38,7 +43,7 @@
vulkan_loader_data.cpp
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_SHARED_LIBRARIES := libhardware liblog libsync libcutils
+LOCAL_SHARED_LIBRARIES := libhardware liblog libsync libutils libcutils
LOCAL_MODULE := libvulkan
include $(BUILD_SHARED_LIBRARY)
diff --git a/vulkan/libvulkan/debug_report.cpp b/vulkan/libvulkan/debug_report.cpp
new file mode 100644
index 0000000..fea9f18
--- /dev/null
+++ b/vulkan/libvulkan/debug_report.cpp
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "loader.h"
+
+namespace vulkan {
+
+VkResult DebugReportCallbackList::CreateCallback(
+ VkInstance instance,
+ const VkDebugReportCallbackCreateInfoEXT* create_info,
+ const VkAllocationCallbacks* allocator,
+ VkDebugReportCallbackEXT* callback) {
+ VkDebugReportCallbackEXT driver_callback;
+ VkResult result = GetDriverDispatch(instance).CreateDebugReportCallbackEXT(
+ GetDriverInstance(instance), create_info, allocator, &driver_callback);
+ if (result != VK_SUCCESS)
+ return result;
+
+ const VkAllocationCallbacks* alloc =
+ allocator ? allocator : GetAllocator(instance);
+ void* mem =
+ alloc->pfnAllocation(alloc->pUserData, sizeof(Node), alignof(Node),
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ if (!mem) {
+ GetDriverDispatch(instance).DestroyDebugReportCallbackEXT(
+ GetDriverInstance(instance), driver_callback, allocator);
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+
+ std::lock_guard<decltype(rwmutex_)> lock(rwmutex_);
+ head_.next =
+ new (mem) Node{head_.next, create_info->flags, create_info->pfnCallback,
+ create_info->pUserData, driver_callback};
+ *callback =
+ VkDebugReportCallbackEXT(reinterpret_cast<uintptr_t>(head_.next));
+ return VK_SUCCESS;
+}
+
+void DebugReportCallbackList::DestroyCallback(
+ VkInstance instance,
+ VkDebugReportCallbackEXT callback,
+ const VkAllocationCallbacks* allocator) {
+ Node* node = reinterpret_cast<Node*>(uintptr_t(callback));
+ std::unique_lock<decltype(rwmutex_)> lock(rwmutex_);
+ Node* prev = &head_;
+ while (prev && prev->next != node)
+ prev = prev->next;
+ prev->next = node->next;
+ lock.unlock();
+
+ GetDriverDispatch(instance).DestroyDebugReportCallbackEXT(
+ GetDriverInstance(instance), node->driver_callback, allocator);
+
+ const VkAllocationCallbacks* alloc =
+ allocator ? allocator : GetAllocator(instance);
+ alloc->pfnFree(alloc->pUserData, node);
+}
+
+void DebugReportCallbackList::Message(VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT object_type,
+ uint64_t object,
+ size_t location,
+ int32_t message_code,
+ const char* layer_prefix,
+ const char* message) {
+ std::shared_lock<decltype(rwmutex_)> lock(rwmutex_);
+ Node* node = &head_;
+ while ((node = node->next)) {
+ if ((node->flags & flags) != 0) {
+ node->callback(flags, object_type, object, location, message_code,
+ layer_prefix, message, node->data);
+ }
+ }
+}
+
+VkResult CreateDebugReportCallbackEXT_Bottom(
+ VkInstance instance,
+ const VkDebugReportCallbackCreateInfoEXT* create_info,
+ const VkAllocationCallbacks* allocator,
+ VkDebugReportCallbackEXT* callback) {
+ return GetDebugReportCallbacks(instance).CreateCallback(
+ instance, create_info, allocator, callback);
+}
+
+void DestroyDebugReportCallbackEXT_Bottom(
+ VkInstance instance,
+ VkDebugReportCallbackEXT callback,
+ const VkAllocationCallbacks* allocator) {
+ if (callback)
+ GetDebugReportCallbacks(instance).DestroyCallback(instance, callback,
+ allocator);
+}
+
+void DebugReportMessageEXT_Bottom(VkInstance instance,
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT object_type,
+ uint64_t object,
+ size_t location,
+ int32_t message_code,
+ const char* layer_prefix,
+ const char* message) {
+ GetDriverDispatch(instance).DebugReportMessageEXT(
+ GetDriverInstance(instance), flags, object_type, object, location,
+ message_code, layer_prefix, message);
+ GetDebugReportCallbacks(instance).Message(flags, object_type, object,
+ location, message_code,
+ layer_prefix, message);
+}
+
+} // namespace vulkan
diff --git a/vulkan/libvulkan/debug_report.h b/vulkan/libvulkan/debug_report.h
new file mode 100644
index 0000000..5bce240
--- /dev/null
+++ b/vulkan/libvulkan/debug_report.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LIBVULKAN_DEBUG_REPORT_H
+#define LIBVULKAN_DEBUG_REPORT_H 1
+
+#include <shared_mutex>
+#include <vulkan/vk_ext_debug_report.h>
+
+namespace vulkan {
+
+// clang-format off
+VKAPI_ATTR VkResult CreateDebugReportCallbackEXT_Bottom(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
+VKAPI_ATTR void DestroyDebugReportCallbackEXT_Bottom(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR void DebugReportMessageEXT_Bottom(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage);
+// clang-format on
+
+class DebugReportCallbackList {
+ public:
+ DebugReportCallbackList()
+ : head_{nullptr, 0, nullptr, nullptr, VK_NULL_HANDLE} {}
+ DebugReportCallbackList(const DebugReportCallbackList&) = delete;
+ DebugReportCallbackList& operator=(const DebugReportCallbackList&) = delete;
+ ~DebugReportCallbackList() = default;
+
+ VkResult CreateCallback(
+ VkInstance instance,
+ const VkDebugReportCallbackCreateInfoEXT* create_info,
+ const VkAllocationCallbacks* allocator,
+ VkDebugReportCallbackEXT* callback);
+ void DestroyCallback(VkInstance instance,
+ VkDebugReportCallbackEXT callback,
+ const VkAllocationCallbacks* allocator);
+ void Message(VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT object_type,
+ uint64_t object,
+ size_t location,
+ int32_t message_code,
+ const char* layer_prefix,
+ const char* message);
+
+ private:
+ struct Node {
+ Node* next;
+ VkDebugReportFlagsEXT flags;
+ PFN_vkDebugReportCallbackEXT callback;
+ void* data;
+ VkDebugReportCallbackEXT driver_callback;
+ };
+
+ // TODO(jessehall): replace with std::shared_mutex when available in libc++
+ std::shared_timed_mutex rwmutex_;
+ Node head_;
+};
+
+} // namespace vulkan
+
+#endif // LIBVULKAN_DEBUG_REPORT_H
diff --git a/vulkan/libvulkan/dispatch.tmpl b/vulkan/libvulkan/dispatch.tmpl
index a387d81..0f1194c 100644
--- a/vulkan/libvulkan/dispatch.tmpl
+++ b/vulkan/libvulkan/dispatch.tmpl
@@ -42,9 +42,9 @@
•* limitations under the License.
•*/
¶
-#define VK_PROTOTYPES
#define VK_USE_PLATFORM_ANDROID_KHR
#include <vulkan/vk_android_native_buffer.h>
+#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vulkan.h>
¶
namespace vulkan {
@@ -156,7 +156,7 @@
const NameProc kLoaderExportProcs[] = {«
// clang-format off
{{range $f := SortBy (AllCommands $) "FunctionName"}}
- {{if (Macro "IsFunctionSupported" $f)}}
+ {{if (Macro "IsExported" $f)}}
{"{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>({{$f.Name}})},
{{end}}
{{end}}
@@ -320,19 +320,27 @@
¶
bool LoadDriverDispatchTable(VkInstance instance,
PFN_vkGetInstanceProcAddr get_proc_addr,
+ const InstanceExtensionSet& extensions,
DriverDispatchTable& dispatch) {«
bool success = true;
// clang-format off
{{range $f := AllCommands $}}
{{if (Macro "IsInstanceDispatched" $f)}}
{{if not (Macro "IsLoaderFunction" $f)}}
- dispatch.{{Macro "BaseName" $f}} = §
- reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
- get_proc_addr(instance, "{{$f.Name}}"));
- if (UNLIKELY(!dispatch.{{Macro "BaseName" $f}})) {
- ALOGE("missing driver proc: %s", "{{$f.Name}}");
- success = false;
+ {{$ext := GetAnnotation $f "extension"}}
+ {{if $ext}}
+ if (extensions[{{Macro "ExtensionConstant" $ext}}]) {
+ {{end}}
+ dispatch.{{Macro "BaseName" $f}} = §
+ reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
+ get_proc_addr(instance, "{{$f.Name}}"));
+ if (UNLIKELY(!dispatch.{{Macro "BaseName" $f}})) {
+ ALOGE("missing driver proc: %s", "{{$f.Name}}");
+ success = false;
+ }
+ {{if $ext}}
}
+ {{end}}
{{end}}
{{end}}
{{end}}
@@ -351,6 +359,11 @@
ALOGE("missing driver proc: %s", "vkDestroyImage");
success = false;
}
+ dispatch.GetSwapchainGrallocUsageANDROID = reinterpret_cast<PFN_vkGetSwapchainGrallocUsageANDROID>(get_proc_addr(instance, "vkGetSwapchainGrallocUsageANDROID"));
+ if (UNLIKELY(!dispatch.GetSwapchainGrallocUsageANDROID)) {
+ ALOGE("missing driver proc: %s", "vkGetSwapchainGrallocUsageANDROID");
+ success = false;
+ }
dispatch.AcquireImageANDROID = reinterpret_cast<PFN_vkAcquireImageANDROID>(get_proc_addr(instance, "vkAcquireImageANDROID"));
if (UNLIKELY(!dispatch.AcquireImageANDROID)) {
ALOGE("missing driver proc: %s", "vkAcquireImageANDROID");
@@ -403,6 +416,20 @@
{{/*
-------------------------------------------------------------------------------
+ Map an extension name to InstanceExtension or DeviceExtension enum value
+-------------------------------------------------------------------------------
+*/}}
+{{define "ExtensionConstant"}}
+ {{$name := index $.Arguments 0}}
+ {{ if (eq $name "VK_KHR_surface")}}kKHR_surface
+ {{else if (eq $name "VK_KHR_android_surface")}}kKHR_android_surface
+ {{else if (eq $name "VK_EXT_debug_report")}}kEXT_debug_report
+ {{end}}
+{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
Emits a function name without the "vk" prefix.
-------------------------------------------------------------------------------
*/}}
@@ -481,11 +508,13 @@
{{define "IsExported"}}
{{AssertType $ "Function"}}
- {{$ext := GetAnnotation $ "extension"}}
- {{if $ext}}
- {{Macro "IsLoaderExtension" $ext}}
- {{else}}
- true
+ {{if (Macro "IsFunctionSupported" $)}}
+ {{$ext := GetAnnotation $ "extension"}}
+ {{if $ext}}
+ {{Macro "IsLoaderExtension" $ext}}
+ {{else}}
+ true
+ {{end}}
{{end}}
{{end}}
diff --git a/vulkan/libvulkan/dispatch_gen.cpp b/vulkan/libvulkan/dispatch_gen.cpp
index f11b791..60da749 100644
--- a/vulkan/libvulkan/dispatch_gen.cpp
+++ b/vulkan/libvulkan/dispatch_gen.cpp
@@ -224,9 +224,12 @@
// clang-format off
{"vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkAcquireNextImageKHR>(AcquireNextImageKHR_Bottom))},
{"vkCreateAndroidSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateAndroidSurfaceKHR>(CreateAndroidSurfaceKHR_Bottom))},
+ {"vkCreateDebugReportCallbackEXT", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDebugReportCallbackEXT>(CreateDebugReportCallbackEXT_Bottom))},
{"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDevice>(CreateDevice_Bottom))},
{"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateInstance>(CreateInstance_Bottom))},
{"vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateSwapchainKHR>(CreateSwapchainKHR_Bottom))},
+ {"vkDebugReportMessageEXT", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDebugReportMessageEXT>(DebugReportMessageEXT_Bottom))},
+ {"vkDestroyDebugReportCallbackEXT", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyDebugReportCallbackEXT>(DestroyDebugReportCallbackEXT_Bottom))},
{"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyInstance>(DestroyInstance_Bottom))},
{"vkDestroySurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroySurfaceKHR>(DestroySurfaceKHR_Bottom))},
{"vkDestroySwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroySwapchainKHR>(DestroySwapchainKHR_Bottom))},
@@ -283,7 +286,10 @@
const NameOffset kInstanceDispatchOffsets[] = {
// clang-format off
{"vkCreateAndroidSurfaceKHR", offsetof(InstanceDispatchTable, CreateAndroidSurfaceKHR)},
+ {"vkCreateDebugReportCallbackEXT", offsetof(InstanceDispatchTable, CreateDebugReportCallbackEXT)},
{"vkCreateDevice", offsetof(InstanceDispatchTable, CreateDevice)},
+ {"vkDebugReportMessageEXT", offsetof(InstanceDispatchTable, DebugReportMessageEXT)},
+ {"vkDestroyDebugReportCallbackEXT", offsetof(InstanceDispatchTable, DestroyDebugReportCallbackEXT)},
{"vkDestroyInstance", offsetof(InstanceDispatchTable, DestroyInstance)},
{"vkDestroySurfaceKHR", offsetof(InstanceDispatchTable, DestroySurfaceKHR)},
{"vkEnumerateDeviceExtensionProperties", offsetof(InstanceDispatchTable, EnumerateDeviceExtensionProperties)},
@@ -558,6 +564,21 @@
ALOGE("missing instance proc: %s", "vkCreateAndroidSurfaceKHR");
success = false;
}
+ dispatch.CreateDebugReportCallbackEXT = reinterpret_cast<PFN_vkCreateDebugReportCallbackEXT>(get_proc_addr(instance, "vkCreateDebugReportCallbackEXT"));
+ if (UNLIKELY(!dispatch.CreateDebugReportCallbackEXT)) {
+ ALOGE("missing instance proc: %s", "vkCreateDebugReportCallbackEXT");
+ success = false;
+ }
+ dispatch.DestroyDebugReportCallbackEXT = reinterpret_cast<PFN_vkDestroyDebugReportCallbackEXT>(get_proc_addr(instance, "vkDestroyDebugReportCallbackEXT"));
+ if (UNLIKELY(!dispatch.DestroyDebugReportCallbackEXT)) {
+ ALOGE("missing instance proc: %s", "vkDestroyDebugReportCallbackEXT");
+ success = false;
+ }
+ dispatch.DebugReportMessageEXT = reinterpret_cast<PFN_vkDebugReportMessageEXT>(get_proc_addr(instance, "vkDebugReportMessageEXT"));
+ if (UNLIKELY(!dispatch.DebugReportMessageEXT)) {
+ ALOGE("missing instance proc: %s", "vkDebugReportMessageEXT");
+ success = false;
+ }
// clang-format on
return success;
}
@@ -1198,6 +1219,7 @@
bool LoadDriverDispatchTable(VkInstance instance,
PFN_vkGetInstanceProcAddr get_proc_addr,
+ const InstanceExtensionSet& extensions,
DriverDispatchTable& dispatch) {
bool success = true;
// clang-format off
@@ -1261,6 +1283,27 @@
ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceSparseImageFormatProperties");
success = false;
}
+ if (extensions[kEXT_debug_report]) {
+ dispatch.CreateDebugReportCallbackEXT = reinterpret_cast<PFN_vkCreateDebugReportCallbackEXT>(get_proc_addr(instance, "vkCreateDebugReportCallbackEXT"));
+ if (UNLIKELY(!dispatch.CreateDebugReportCallbackEXT)) {
+ ALOGE("missing driver proc: %s", "vkCreateDebugReportCallbackEXT");
+ success = false;
+ }
+ }
+ if (extensions[kEXT_debug_report]) {
+ dispatch.DestroyDebugReportCallbackEXT = reinterpret_cast<PFN_vkDestroyDebugReportCallbackEXT>(get_proc_addr(instance, "vkDestroyDebugReportCallbackEXT"));
+ if (UNLIKELY(!dispatch.DestroyDebugReportCallbackEXT)) {
+ ALOGE("missing driver proc: %s", "vkDestroyDebugReportCallbackEXT");
+ success = false;
+ }
+ }
+ if (extensions[kEXT_debug_report]) {
+ dispatch.DebugReportMessageEXT = reinterpret_cast<PFN_vkDebugReportMessageEXT>(get_proc_addr(instance, "vkDebugReportMessageEXT"));
+ if (UNLIKELY(!dispatch.DebugReportMessageEXT)) {
+ ALOGE("missing driver proc: %s", "vkDebugReportMessageEXT");
+ success = false;
+ }
+ }
dispatch.GetDeviceProcAddr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(get_proc_addr(instance, "vkGetDeviceProcAddr"));
if (UNLIKELY(!dispatch.GetDeviceProcAddr)) {
ALOGE("missing driver proc: %s", "vkGetDeviceProcAddr");
@@ -1276,6 +1319,11 @@
ALOGE("missing driver proc: %s", "vkDestroyImage");
success = false;
}
+ dispatch.GetSwapchainGrallocUsageANDROID = reinterpret_cast<PFN_vkGetSwapchainGrallocUsageANDROID>(get_proc_addr(instance, "vkGetSwapchainGrallocUsageANDROID"));
+ if (UNLIKELY(!dispatch.GetSwapchainGrallocUsageANDROID)) {
+ ALOGE("missing driver proc: %s", "vkGetSwapchainGrallocUsageANDROID");
+ success = false;
+ }
dispatch.AcquireImageANDROID = reinterpret_cast<PFN_vkAcquireImageANDROID>(get_proc_addr(instance, "vkAcquireImageANDROID"));
if (UNLIKELY(!dispatch.AcquireImageANDROID)) {
ALOGE("missing driver proc: %s", "vkAcquireImageANDROID");
diff --git a/vulkan/libvulkan/dispatch_gen.h b/vulkan/libvulkan/dispatch_gen.h
index 809f63e..14c5da8 100644
--- a/vulkan/libvulkan/dispatch_gen.h
+++ b/vulkan/libvulkan/dispatch_gen.h
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#define VK_PROTOTYPES
#define VK_USE_PLATFORM_ANDROID_KHR
#include <vulkan/vk_android_native_buffer.h>
+#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vulkan.h>
namespace vulkan {
@@ -41,6 +41,9 @@
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
+ PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
+ PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
+ PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
// clang-format on
};
@@ -188,6 +191,9 @@
PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
+ PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
+ PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
+ PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkCreateImage CreateImage;
PFN_vkDestroyImage DestroyImage;
diff --git a/vulkan/libvulkan/layers_extensions.cpp b/vulkan/libvulkan/layers_extensions.cpp
index e56cdea..287e69b 100644
--- a/vulkan/libvulkan/layers_extensions.cpp
+++ b/vulkan/libvulkan/layers_extensions.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_NDEBUG 0
+// #define LOG_NDEBUG 0
#include "loader.h"
#include <alloca.h>
@@ -30,6 +30,25 @@
using namespace vulkan;
+// TODO(jessehall): The whole way we deal with extensions is pretty hokey, and
+// not a good long-term solution. Having a hard-coded enum of extensions is
+// bad, of course. Representing sets of extensions (requested, supported, etc.)
+// as a bitset isn't necessarily bad, if the mapping from extension to bit were
+// dynamic. Need to rethink this completely when there's a little more time.
+
+// TODO(jessehall): This file currently builds up global data structures as it
+// loads, and never cleans them up. This means we're doing heap allocations
+// without going through an app-provided allocator, but worse, we'll leak those
+// allocations if the loader is unloaded.
+//
+// We should allocate "enough" BSS space, and suballocate from there. Will
+// probably want to intern strings, etc., and will need some custom/manual data
+// structures.
+
+// TODO(jessehall): Currently we have separate lists for instance and device
+// layers. Most layers are both; we should use one entry for each layer name,
+// with a mask saying what kind(s) it is.
+
namespace vulkan {
struct Layer {
VkLayerProperties properties;
@@ -47,7 +66,8 @@
size_t refcount;
};
std::vector<LayerLibrary> g_layer_libraries;
-std::vector<Layer> g_layers;
+std::vector<Layer> g_instance_layers;
+std::vector<Layer> g_device_layers;
void AddLayerLibrary(const std::string& path) {
ALOGV("examining layer library '%s'", path.c_str());
@@ -58,81 +78,163 @@
return;
}
- PFN_vkEnumerateInstanceLayerProperties enumerate_layer_properties =
+ PFN_vkEnumerateInstanceLayerProperties enumerate_instance_layers =
reinterpret_cast<PFN_vkEnumerateInstanceLayerProperties>(
dlsym(dlhandle, "vkEnumerateInstanceLayerProperties"));
- if (!enumerate_layer_properties) {
- ALOGW(
- "failed to find vkEnumerateInstanceLayerProperties in library "
- "'%s': %s",
- path.c_str(), dlerror());
- dlclose(dlhandle);
- return;
- }
- PFN_vkEnumerateInstanceExtensionProperties enumerate_extension_properties =
+ PFN_vkEnumerateInstanceExtensionProperties enumerate_instance_extensions =
reinterpret_cast<PFN_vkEnumerateInstanceExtensionProperties>(
dlsym(dlhandle, "vkEnumerateInstanceExtensionProperties"));
- if (!enumerate_extension_properties) {
- ALOGW(
- "failed to find vkEnumerateInstanceExtensionProperties in library "
- "'%s': %s",
- path.c_str(), dlerror());
+ PFN_vkEnumerateDeviceLayerProperties enumerate_device_layers =
+ reinterpret_cast<PFN_vkEnumerateDeviceLayerProperties>(
+ dlsym(dlhandle, "vkEnumerateDeviceLayerProperties"));
+ PFN_vkEnumerateDeviceExtensionProperties enumerate_device_extensions =
+ reinterpret_cast<PFN_vkEnumerateDeviceExtensionProperties>(
+ dlsym(dlhandle, "vkEnumerateDeviceExtensionProperties"));
+ if (!((enumerate_instance_layers && enumerate_instance_extensions) ||
+ (enumerate_device_layers && enumerate_device_extensions))) {
+ ALOGV(
+ "layer library '%s' has neither instance nor device enumeraion "
+ "functions",
+ path.c_str());
dlclose(dlhandle);
return;
}
- uint32_t layer_count;
- VkResult result = enumerate_layer_properties(&layer_count, nullptr);
- if (result != VK_SUCCESS) {
- ALOGW("vkEnumerateInstanceLayerProperties failed for library '%s': %d",
- path.c_str(), result);
- dlclose(dlhandle);
- return;
+ VkResult result;
+ uint32_t num_instance_layers = 0;
+ uint32_t num_device_layers = 0;
+ if (enumerate_instance_layers) {
+ result = enumerate_instance_layers(&num_instance_layers, nullptr);
+ if (result != VK_SUCCESS) {
+ ALOGW(
+ "vkEnumerateInstanceLayerProperties failed for library '%s': "
+ "%d",
+ path.c_str(), result);
+ dlclose(dlhandle);
+ return;
+ }
}
- VkLayerProperties* properties = static_cast<VkLayerProperties*>(
- alloca(layer_count * sizeof(VkLayerProperties)));
- result = enumerate_layer_properties(&layer_count, properties);
- if (result != VK_SUCCESS) {
- ALOGW("vkEnumerateInstanceLayerProperties failed for library '%s': %d",
- path.c_str(), result);
- dlclose(dlhandle);
- return;
+ if (enumerate_device_layers) {
+ result = enumerate_device_layers(VK_NULL_HANDLE, &num_device_layers,
+ nullptr);
+ if (result != VK_SUCCESS) {
+ ALOGW(
+ "vkEnumerateDeviceLayerProperties failed for library '%s': %d",
+ path.c_str(), result);
+ dlclose(dlhandle);
+ return;
+ }
+ }
+ VkLayerProperties* properties = static_cast<VkLayerProperties*>(alloca(
+ (num_instance_layers + num_device_layers) * sizeof(VkLayerProperties)));
+ if (num_instance_layers > 0) {
+ result = enumerate_instance_layers(&num_instance_layers, properties);
+ if (result != VK_SUCCESS) {
+ ALOGW(
+ "vkEnumerateInstanceLayerProperties failed for library '%s': "
+ "%d",
+ path.c_str(), result);
+ dlclose(dlhandle);
+ return;
+ }
+ }
+ if (num_device_layers > 0) {
+ result = enumerate_device_layers(VK_NULL_HANDLE, &num_device_layers,
+ properties + num_instance_layers);
+ if (result != VK_SUCCESS) {
+ ALOGW(
+ "vkEnumerateDeviceLayerProperties failed for library '%s': %d",
+ path.c_str(), result);
+ dlclose(dlhandle);
+ return;
+ }
}
size_t library_idx = g_layer_libraries.size();
- g_layers.reserve(g_layers.size() + layer_count);
- for (size_t i = 0; i < layer_count; i++) {
+ size_t prev_num_instance_layers = g_instance_layers.size();
+ size_t prev_num_device_layers = g_device_layers.size();
+ g_instance_layers.reserve(prev_num_instance_layers + num_instance_layers);
+ g_device_layers.reserve(prev_num_device_layers + num_device_layers);
+ for (size_t i = 0; i < num_instance_layers; i++) {
+ const VkLayerProperties& props = properties[i];
+
Layer layer;
- layer.properties = properties[i];
+ layer.properties = props;
layer.library_idx = library_idx;
- uint32_t count;
- result = enumerate_extension_properties(properties[i].layerName, &count,
- nullptr);
- if (result != VK_SUCCESS) {
- ALOGW(
- "vkEnumerateInstanceExtensionProperties(%s) failed for library "
- "'%s': %d",
- properties[i].layerName, path.c_str(), result);
- g_layers.resize(g_layers.size() - (i + 1));
- dlclose(dlhandle);
- return;
- }
- layer.extensions.resize(count);
- result = enumerate_extension_properties(properties[i].layerName, &count,
- layer.extensions.data());
- if (result != VK_SUCCESS) {
- ALOGW(
- "vkEnumerateInstanceExtensionProperties(%s) failed for library "
- "'%s': %d",
- properties[i].layerName, path.c_str(), result);
- g_layers.resize(g_layers.size() - (i + 1));
- dlclose(dlhandle);
- return;
+ if (enumerate_instance_extensions) {
+ uint32_t count = 0;
+ result =
+ enumerate_instance_extensions(props.layerName, &count, nullptr);
+ if (result != VK_SUCCESS) {
+ ALOGW(
+ "vkEnumerateInstanceExtensionProperties(%s) failed for "
+ "library "
+ "'%s': %d",
+ props.layerName, path.c_str(), result);
+ g_instance_layers.resize(prev_num_instance_layers);
+ dlclose(dlhandle);
+ return;
+ }
+ layer.extensions.resize(count);
+ result = enumerate_instance_extensions(props.layerName, &count,
+ layer.extensions.data());
+ if (result != VK_SUCCESS) {
+ ALOGW(
+ "vkEnumerateInstanceExtensionProperties(%s) failed for "
+ "library "
+ "'%s': %d",
+ props.layerName, path.c_str(), result);
+ g_instance_layers.resize(prev_num_instance_layers);
+ dlclose(dlhandle);
+ return;
+ }
}
- g_layers.push_back(layer);
- ALOGV("found layer '%s'", properties[i].layerName);
+ g_instance_layers.push_back(layer);
+ ALOGV(" added instance layer '%s'", props.layerName);
+ }
+ for (size_t i = 0; i < num_device_layers; i++) {
+ const VkLayerProperties& props = properties[num_instance_layers + i];
+
+ Layer layer;
+ layer.properties = props;
+ layer.library_idx = library_idx;
+
+ if (enumerate_device_extensions) {
+ uint32_t count;
+ result = enumerate_device_extensions(
+ VK_NULL_HANDLE, props.layerName, &count, nullptr);
+ if (result != VK_SUCCESS) {
+ ALOGW(
+ "vkEnumerateDeviceExtensionProperties(%s) failed for "
+ "library "
+ "'%s': %d",
+ props.layerName, path.c_str(), result);
+ g_instance_layers.resize(prev_num_instance_layers);
+ g_device_layers.resize(prev_num_device_layers);
+ dlclose(dlhandle);
+ return;
+ }
+ layer.extensions.resize(count);
+ result =
+ enumerate_device_extensions(VK_NULL_HANDLE, props.layerName,
+ &count, layer.extensions.data());
+ if (result != VK_SUCCESS) {
+ ALOGW(
+ "vkEnumerateDeviceExtensionProperties(%s) failed for "
+ "library "
+ "'%s': %d",
+ props.layerName, path.c_str(), result);
+ g_instance_layers.resize(prev_num_instance_layers);
+ g_device_layers.resize(prev_num_device_layers);
+ dlclose(dlhandle);
+ return;
+ }
+ }
+
+ g_device_layers.push_back(layer);
+ ALOGV(" added device layer '%s'", props.layerName);
}
dlclose(dlhandle);
@@ -159,7 +261,7 @@
struct dirent* entry;
while ((entry = readdir(directory))) {
size_t libname_len = strlen(entry->d_name);
- if (strncmp(entry->d_name, "libVKLayer", 10) != 0 ||
+ if (strncmp(entry->d_name, "libVkLayer", 10) != 0 ||
strncmp(entry->d_name + libname_len - 3, ".so", 3) != 0)
continue;
path.append(entry->d_name);
@@ -175,7 +277,7 @@
size_t gpa_name_len) {
const LayerLibrary& library = g_layer_libraries[layer.library_idx];
void* gpa;
- size_t layer_name_len = std::max(2u, strlen(layer.properties.layerName));
+ size_t layer_name_len = std::max(size_t{2}, strlen(layer.properties.layerName));
char* name = static_cast<char*>(alloca(layer_name_len + gpa_name_len + 1));
strcpy(name, layer.properties.layerName);
strcpy(name + layer_name_len, gpa_name);
@@ -187,6 +289,56 @@
return gpa;
}
+uint32_t EnumerateLayers(const std::vector<Layer>& layers,
+ uint32_t count,
+ VkLayerProperties* properties) {
+ uint32_t n = std::min(count, static_cast<uint32_t>(layers.size()));
+ for (uint32_t i = 0; i < n; i++) {
+ properties[i] = layers[i].properties;
+ }
+ return static_cast<uint32_t>(layers.size());
+}
+
+void GetLayerExtensions(const std::vector<Layer>& layers,
+ const char* name,
+ const VkExtensionProperties** properties,
+ uint32_t* count) {
+ auto layer =
+ std::find_if(layers.cbegin(), layers.cend(), [=](const Layer& entry) {
+ return strcmp(entry.properties.layerName, name) == 0;
+ });
+ if (layer == layers.cend()) {
+ *properties = nullptr;
+ *count = 0;
+ } else {
+ *properties = layer->extensions.data();
+ *count = static_cast<uint32_t>(layer->extensions.size());
+ }
+}
+
+LayerRef GetLayerRef(std::vector<Layer>& layers, const char* name) {
+ for (uint32_t id = 0; id < layers.size(); id++) {
+ if (strcmp(name, layers[id].properties.layerName) == 0) {
+ LayerLibrary& library = g_layer_libraries[layers[id].library_idx];
+ std::lock_guard<std::mutex> lock(g_library_mutex);
+ if (library.refcount++ == 0) {
+ library.dlhandle =
+ dlopen(library.path.c_str(), RTLD_NOW | RTLD_LOCAL);
+ ALOGV("Opening library %s", library.path.c_str());
+ if (!library.dlhandle) {
+ ALOGE("failed to load layer library '%s': %s",
+ library.path.c_str(), dlerror());
+ library.refcount = 0;
+ return LayerRef(nullptr);
+ }
+ }
+ ALOGV("Refcount on activate is %zu", library.refcount);
+ return LayerRef(&layers[id]);
+ }
+ }
+ return LayerRef(nullptr);
+}
+
} // anonymous namespace
namespace vulkan {
@@ -198,44 +350,33 @@
DiscoverLayersInDirectory(LoaderData::GetInstance().layer_path.c_str());
}
-uint32_t EnumerateLayers(uint32_t count, VkLayerProperties* properties) {
- uint32_t n = std::min(count, g_layers.size());
- for (uint32_t i = 0; i < n; i++) {
- properties[i] = g_layers[i].properties;
- }
- return g_layers.size();
+uint32_t EnumerateInstanceLayers(uint32_t count,
+ VkLayerProperties* properties) {
+ return EnumerateLayers(g_instance_layers, count, properties);
}
-void GetLayerExtensions(const char* name,
- const VkExtensionProperties** properties,
- uint32_t* count) {
- for (const auto& layer : g_layers) {
- if (strcmp(name, layer.properties.layerName) != 0)
- continue;
- *properties = layer.extensions.data();
- *count = layer.extensions.size();
- }
+uint32_t EnumerateDeviceLayers(uint32_t count, VkLayerProperties* properties) {
+ return EnumerateLayers(g_device_layers, count, properties);
}
-LayerRef GetLayerRef(const char* name) {
- for (uint32_t id = 0; id < g_layers.size(); id++) {
- if (strcmp(name, g_layers[id].properties.layerName) != 0) {
- LayerLibrary& library = g_layer_libraries[g_layers[id].library_idx];
- std::lock_guard<std::mutex> lock(g_library_mutex);
- if (library.refcount++ == 0) {
- library.dlhandle =
- dlopen(library.path.c_str(), RTLD_NOW | RTLD_LOCAL);
- if (!library.dlhandle) {
- ALOGE("failed to load layer library '%s': %s",
- library.path.c_str(), dlerror());
- library.refcount = 0;
- return LayerRef(nullptr);
- }
- }
- return LayerRef(&g_layers[id]);
- }
- }
- return LayerRef(nullptr);
+void GetInstanceLayerExtensions(const char* name,
+ const VkExtensionProperties** properties,
+ uint32_t* count) {
+ GetLayerExtensions(g_instance_layers, name, properties, count);
+}
+
+void GetDeviceLayerExtensions(const char* name,
+ const VkExtensionProperties** properties,
+ uint32_t* count) {
+ GetLayerExtensions(g_device_layers, name, properties, count);
+}
+
+LayerRef GetInstanceLayerRef(const char* name) {
+ return GetLayerRef(g_instance_layers, name);
+}
+
+LayerRef GetDeviceLayerRef(const char* name) {
+ return GetLayerRef(g_device_layers, name);
}
LayerRef::LayerRef(Layer* layer) : layer_(layer) {}
@@ -245,13 +386,17 @@
LayerLibrary& library = g_layer_libraries[layer_->library_idx];
std::lock_guard<std::mutex> lock(g_library_mutex);
if (--library.refcount == 0) {
+ ALOGV("Closing library %s", library.path.c_str());
dlclose(library.dlhandle);
library.dlhandle = nullptr;
}
+ ALOGV("Refcount on destruction is %zu", library.refcount);
}
}
-LayerRef::LayerRef(LayerRef&& other) : layer_(std::move(other.layer_)) {}
+LayerRef::LayerRef(LayerRef&& other) : layer_(std::move(other.layer_)) {
+ other.layer_ = nullptr;
+}
PFN_vkGetInstanceProcAddr LayerRef::GetGetInstanceProcAddr() const {
return layer_ ? reinterpret_cast<PFN_vkGetInstanceProcAddr>(
@@ -265,4 +410,29 @@
: nullptr;
}
+bool LayerRef::SupportsExtension(const char* name) const {
+ return std::find_if(layer_->extensions.cbegin(), layer_->extensions.cend(),
+ [=](const VkExtensionProperties& ext) {
+ return strcmp(ext.extensionName, name) == 0;
+ }) != layer_->extensions.cend();
+}
+
+InstanceExtension InstanceExtensionFromName(const char* name) {
+ if (strcmp(name, VK_KHR_SURFACE_EXTENSION_NAME) == 0)
+ return kKHR_surface;
+ if (strcmp(name, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0)
+ return kKHR_android_surface;
+ if (strcmp(name, VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0)
+ return kEXT_debug_report;
+ return kInstanceExtensionCount;
+}
+
+DeviceExtension DeviceExtensionFromName(const char* name) {
+ if (strcmp(name, VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0)
+ return kKHR_swapchain;
+ if (strcmp(name, VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME) == 0)
+ return kANDROID_native_buffer;
+ return kDeviceExtensionCount;
+}
+
} // namespace vulkan
diff --git a/vulkan/libvulkan/loader.cpp b/vulkan/libvulkan/loader.cpp
index 551804f..bc1c3b8 100644
--- a/vulkan/libvulkan/loader.cpp
+++ b/vulkan/libvulkan/loader.cpp
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-#define LOG_NDEBUG 0
-
// module header
#include "loader.h"
// standard C headers
@@ -37,9 +35,24 @@
#include <cutils/properties.h>
#include <hardware/hwvulkan.h>
#include <log/log.h>
-#include <vulkan/vk_debug_report_lunarg.h>
#include <vulkan/vulkan_loader_data.h>
+// #define ENABLE_ALLOC_CALLSTACKS 1
+#if ENABLE_ALLOC_CALLSTACKS
+#include <utils/CallStack.h>
+#define ALOGD_CALLSTACK(...) \
+ do { \
+ ALOGD(__VA_ARGS__); \
+ android::CallStack callstack; \
+ callstack.update(); \
+ callstack.log(LOG_TAG, ANDROID_LOG_DEBUG, " "); \
+ } while (false)
+#else
+#define ALOGD_CALLSTACK(...) \
+ do { \
+ } while (false)
+#endif
+
using namespace vulkan;
static const uint32_t kMaxPhysicalDevices = 4;
@@ -81,10 +94,12 @@
void* mem =
alloc->pfnAllocation(alloc->pUserData, n * sizeof(T), alignof(T),
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
+ if (!mem)
+ throw std::bad_alloc();
return static_cast<T*>(mem);
}
- void deallocate(T* array, std::size_t /*n*/) {
+ void deallocate(T* array, std::size_t /*n*/) noexcept {
alloc->pfnFree(alloc->pUserData, array);
}
@@ -102,17 +117,6 @@
return !(alloc1 == alloc2);
}
-template <class Key,
- class T,
- class Hash = std::hash<Key>,
- class Pred = std::equal_to<Key>>
-using UnorderedMap =
- std::unordered_map<Key,
- T,
- Hash,
- Pred,
- CallbackAllocator<std::pair<const Key, T>>>;
-
template <class T>
using Vector = std::vector<T, CallbackAllocator<T>>;
@@ -128,9 +132,10 @@
void* ptr = nullptr;
// Vulkan requires 'alignment' to be a power of two, but posix_memalign
// additionally requires that it be at least sizeof(void*).
- return posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size) == 0
- ? ptr
- : nullptr;
+ int ret = posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size);
+ ALOGD_CALLSTACK("Allocate: size=%zu align=%zu => (%d) %p", size, alignment,
+ ret, ptr);
+ return ret == 0 ? ptr : nullptr;
}
VKAPI_ATTR void* DefaultReallocate(void*,
@@ -163,8 +168,9 @@
return new_ptr;
}
-VKAPI_ATTR void DefaultFree(void*, void* pMem) {
- free(pMem);
+VKAPI_ATTR void DefaultFree(void*, void* ptr) {
+ ALOGD_CALLSTACK("Free: %p", ptr);
+ free(ptr);
}
const VkAllocationCallbacks kDefaultAllocCallbacks = {
@@ -178,6 +184,8 @@
// Global Data and Initialization
hwvulkan_device_t* g_hwdevice = nullptr;
+InstanceExtensionSet g_driver_instance_extensions;
+
void LoadVulkanHAL() {
static const hwvulkan_module_t* module;
int result =
@@ -195,6 +203,41 @@
module = nullptr;
return;
}
+
+ VkResult vkresult;
+ uint32_t count;
+ if ((vkresult = g_hwdevice->EnumerateInstanceExtensionProperties(
+ nullptr, &count, nullptr)) != VK_SUCCESS) {
+ ALOGE("driver EnumerateInstanceExtensionProperties failed: %d",
+ vkresult);
+ g_hwdevice->common.close(&g_hwdevice->common);
+ g_hwdevice = nullptr;
+ module = nullptr;
+ return;
+ }
+ VkExtensionProperties* extensions = static_cast<VkExtensionProperties*>(
+ alloca(count * sizeof(VkExtensionProperties)));
+ if ((vkresult = g_hwdevice->EnumerateInstanceExtensionProperties(
+ nullptr, &count, extensions)) != VK_SUCCESS) {
+ ALOGE("driver EnumerateInstanceExtensionProperties failed: %d",
+ vkresult);
+ g_hwdevice->common.close(&g_hwdevice->common);
+ g_hwdevice = nullptr;
+ module = nullptr;
+ return;
+ }
+ ALOGV_IF(count > 0, "Driver-supported instance extensions:");
+ for (uint32_t i = 0; i < count; i++) {
+ ALOGV(" %s (v%u)", extensions[i].extensionName,
+ extensions[i].specVersion);
+ InstanceExtension id =
+ InstanceExtensionFromName(extensions[i].extensionName);
+ if (id != kInstanceExtensionCount)
+ g_driver_instance_extensions.set(id);
+ }
+ // Ignore driver attempts to support loader extensions
+ g_driver_instance_extensions.reset(kKHR_surface);
+ g_driver_instance_extensions.reset(kKHR_android_surface);
}
bool EnsureInitialized() {
@@ -212,7 +255,6 @@
Instance(const VkAllocationCallbacks* alloc_callbacks)
: dispatch_ptr(&dispatch),
handle(reinterpret_cast<VkInstance>(&dispatch_ptr)),
- get_instance_proc_addr(nullptr),
alloc(alloc_callbacks),
num_physical_devices(0),
active_layers(CallbackAllocator<LayerRef>(alloc)),
@@ -230,17 +272,14 @@
const VkInstance handle;
InstanceDispatchTable dispatch;
- // TODO(jessehall): Only needed by GetInstanceProcAddr_Top for
- // vkDbg*MessageCallback. Points to the outermost layer's function. Remove
- // once the DEBUG_CALLBACK is integrated into the API file.
- PFN_vkGetInstanceProcAddr get_instance_proc_addr;
-
const VkAllocationCallbacks* alloc;
uint32_t num_physical_devices;
VkPhysicalDevice physical_devices[kMaxPhysicalDevices];
+ DeviceExtensionSet physical_device_driver_extensions[kMaxPhysicalDevices];
Vector<LayerRef> active_layers;
- VkDbgMsgCallback message;
+ VkDebugReportCallbackEXT message;
+ DebugReportCallbackList debug_report_callbacks;
struct {
VkInstance instance;
@@ -312,13 +351,33 @@
}
template <class TObject>
+LayerRef GetLayerRef(const char* name);
+template <>
+LayerRef GetLayerRef<Instance>(const char* name) {
+ return GetInstanceLayerRef(name);
+}
+template <>
+LayerRef GetLayerRef<Device>(const char* name) {
+ return GetDeviceLayerRef(name);
+}
+
+template <class TObject>
bool ActivateLayer(TObject* object, const char* name) {
- LayerRef layer(GetLayerRef(name));
+ LayerRef layer(GetLayerRef<TObject>(name));
if (!layer)
return false;
if (std::find(object->active_layers.begin(), object->active_layers.end(),
- layer) == object->active_layers.end())
- object->active_layers.push_back(std::move(layer));
+ layer) == object->active_layers.end()) {
+ try {
+ object->active_layers.push_back(std::move(layer));
+ } catch (std::bad_alloc&) {
+ // TODO(jessehall): We should fail with VK_ERROR_OUT_OF_MEMORY
+ // if we can't enable a requested layer. Callers currently ignore
+ // ActivateLayer's return value.
+ ALOGW("failed to activate layer '%s': out of memory", name);
+ return false;
+ }
+ }
ALOGV("activated layer '%s'", name);
return true;
}
@@ -331,26 +390,32 @@
void SetLayerNamesFromProperty(const char* name,
const char* value,
void* data) {
- const char prefix[] = "debug.vulkan.layer.";
- const size_t prefixlen = sizeof(prefix) - 1;
- if (value[0] == '\0' || strncmp(name, prefix, prefixlen) != 0)
- return;
- const char* number_str = name + prefixlen;
- long layer_number = strtol(number_str, nullptr, 10);
- if (layer_number <= 0 || layer_number == LONG_MAX) {
- ALOGW("Cannot use a layer at number %ld from string %s", layer_number,
- number_str);
+ try {
+ const char prefix[] = "debug.vulkan.layer.";
+ const size_t prefixlen = sizeof(prefix) - 1;
+ if (value[0] == '\0' || strncmp(name, prefix, prefixlen) != 0)
+ return;
+ const char* number_str = name + prefixlen;
+ long layer_number = strtol(number_str, nullptr, 10);
+ if (layer_number <= 0 || layer_number == LONG_MAX) {
+ ALOGW("Cannot use a layer at number %ld from string %s",
+ layer_number, number_str);
+ return;
+ }
+ auto instance_names_pair = static_cast<InstanceNamesPair*>(data);
+ Vector<String>* layer_names = instance_names_pair->layer_names;
+ Instance* instance = instance_names_pair->instance;
+ size_t layer_size = static_cast<size_t>(layer_number);
+ if (layer_size > layer_names->size()) {
+ layer_names->resize(
+ layer_size, String(CallbackAllocator<char>(instance->alloc)));
+ }
+ (*layer_names)[layer_size - 1] = value;
+ } catch (std::bad_alloc&) {
+ ALOGW("failed to handle property '%s'='%s': out of memory", name,
+ value);
return;
}
- auto instance_names_pair = static_cast<InstanceNamesPair*>(data);
- Vector<String>* layer_names = instance_names_pair->layer_names;
- Instance* instance = instance_names_pair->instance;
- size_t layer_size = static_cast<size_t>(layer_number);
- if (layer_size > layer_names->size()) {
- layer_names->resize(layer_size,
- String(CallbackAllocator<char>(instance->alloc)));
- }
- (*layer_names)[layer_size - 1] = value;
}
template <class TInfo, class TObject>
@@ -365,13 +430,11 @@
if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0)) {
char layer_prop[PROPERTY_VALUE_MAX];
property_get("debug.vulkan.layers", layer_prop, "");
- String layer_name(string_allocator);
- String layer_prop_str(layer_prop, string_allocator);
- size_t end, start = 0;
- while ((end = layer_prop_str.find(':', start)) != std::string::npos) {
- layer_name = layer_prop_str.substr(start, end - start);
- ActivateLayer(object, layer_name.c_str());
- start = end + 1;
+ char* strtok_state;
+ char* layer_name = nullptr;
+ while ((layer_name = strtok_r(layer_name ? nullptr : layer_prop, ":",
+ &strtok_state))) {
+ ActivateLayer(object, layer_name);
}
Vector<String> layer_names(CallbackAllocator<String>(instance->alloc));
InstanceNamesPair instance_names_pair = {.instance = instance,
@@ -438,17 +501,17 @@
}
VKAPI_ATTR
-VkBool32 LogDebugMessageCallback(VkFlags message_flags,
- VkDbgObjectType /*obj_type*/,
- uint64_t /*src_object*/,
+VkBool32 LogDebugMessageCallback(VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT /*objectType*/,
+ uint64_t /*object*/,
size_t /*location*/,
int32_t message_code,
const char* layer_prefix,
const char* message,
void* /*user_data*/) {
- if (message_flags & VK_DBG_REPORT_ERROR_BIT) {
+ if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
ALOGE("[%s] Code %d : %s", layer_prefix, message_code, message);
- } else if (message_flags & VK_DBG_REPORT_WARN_BIT) {
+ } else if (flags & VK_DEBUG_REPORT_WARN_BIT_EXT) {
ALOGW("[%s] Code %d : %s", layer_prefix, message_code, message);
}
return false;
@@ -472,7 +535,65 @@
Instance& instance = GetDispatchParent(*vkinstance);
VkResult result;
- result = g_hwdevice->CreateInstance(create_info, instance.alloc,
+ // Check that all enabled extensions are supported
+ InstanceExtensionSet enabled_extensions;
+ uint32_t num_driver_extensions = 0;
+ for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
+ const char* name = create_info->ppEnabledExtensionNames[i];
+ InstanceExtension id = InstanceExtensionFromName(name);
+ if (id != kInstanceExtensionCount) {
+ if (g_driver_instance_extensions[id]) {
+ num_driver_extensions++;
+ enabled_extensions.set(id);
+ continue;
+ }
+ if (id == kKHR_surface || id == kKHR_android_surface ||
+ id == kEXT_debug_report) {
+ enabled_extensions.set(id);
+ continue;
+ }
+ }
+ bool supported = false;
+ for (const auto& layer : instance.active_layers) {
+ if (layer.SupportsExtension(name))
+ supported = true;
+ }
+ if (!supported) {
+ ALOGE(
+ "requested instance extension '%s' not supported by "
+ "loader, driver, or any active layers",
+ name);
+ DestroyInstance_Bottom(instance.handle, allocator);
+ return VK_ERROR_EXTENSION_NOT_PRESENT;
+ }
+ }
+
+ VkInstanceCreateInfo driver_create_info = *create_info;
+ driver_create_info.enabledLayerCount = 0;
+ driver_create_info.ppEnabledLayerNames = nullptr;
+ driver_create_info.enabledExtensionCount = 0;
+ driver_create_info.ppEnabledExtensionNames = nullptr;
+ if (num_driver_extensions > 0) {
+ const char** names = static_cast<const char**>(
+ alloca(num_driver_extensions * sizeof(char*)));
+ for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
+ const char* name = create_info->ppEnabledExtensionNames[i];
+ InstanceExtension id = InstanceExtensionFromName(name);
+ if (id != kInstanceExtensionCount) {
+ if (g_driver_instance_extensions[id]) {
+ names[driver_create_info.enabledExtensionCount++] = name;
+ continue;
+ }
+ }
+ }
+ driver_create_info.ppEnabledExtensionNames = names;
+ ALOG_ASSERT(
+ driver_create_info.enabledExtensionCount == num_driver_extensions,
+ "counted enabled driver instance extensions twice and got "
+ "different answers!");
+ }
+
+ result = g_hwdevice->CreateInstance(&driver_create_info, instance.alloc,
&instance.drv.instance);
if (result != VK_SUCCESS) {
DestroyInstance_Bottom(instance.handle, allocator);
@@ -481,7 +602,7 @@
if (!LoadDriverDispatchTable(instance.drv.instance,
g_hwdevice->GetInstanceProcAddr,
- instance.drv.dispatch)) {
+ enabled_extensions, instance.drv.dispatch)) {
DestroyInstance_Bottom(instance.handle, allocator);
return VK_ERROR_INITIALIZATION_FAILED;
}
@@ -513,6 +634,9 @@
DestroyInstance_Bottom(instance.handle, allocator);
return VK_ERROR_INITIALIZATION_FAILED;
}
+
+ Vector<VkExtensionProperties> extensions(
+ Vector<VkExtensionProperties>::allocator_type(instance.alloc));
for (uint32_t i = 0; i < num_physical_devices; i++) {
hwvulkan_dispatch_t* pdev_dispatch =
reinterpret_cast<hwvulkan_dispatch_t*>(
@@ -524,10 +648,47 @@
return VK_ERROR_INITIALIZATION_FAILED;
}
pdev_dispatch->vtbl = instance.dispatch_ptr;
+
+ uint32_t count;
+ if ((result = instance.drv.dispatch.EnumerateDeviceExtensionProperties(
+ instance.physical_devices[i], nullptr, &count, nullptr)) !=
+ VK_SUCCESS) {
+ ALOGW("driver EnumerateDeviceExtensionProperties(%u) failed: %d", i,
+ result);
+ continue;
+ }
+ try {
+ extensions.resize(count);
+ } catch (std::bad_alloc&) {
+ ALOGE("instance creation failed: out of memory");
+ DestroyInstance_Bottom(instance.handle, allocator);
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+ if ((result = instance.drv.dispatch.EnumerateDeviceExtensionProperties(
+ instance.physical_devices[i], nullptr, &count,
+ extensions.data())) != VK_SUCCESS) {
+ ALOGW("driver EnumerateDeviceExtensionProperties(%u) failed: %d", i,
+ result);
+ continue;
+ }
+ ALOGV_IF(count > 0, "driver gpu[%u] supports extensions:", i);
+ for (const auto& extension : extensions) {
+ ALOGV(" %s (v%u)", extension.extensionName, extension.specVersion);
+ DeviceExtension id =
+ DeviceExtensionFromName(extension.extensionName);
+ if (id == kDeviceExtensionCount) {
+ ALOGW("driver gpu[%u] extension '%s' unknown to loader", i,
+ extension.extensionName);
+ } else {
+ instance.physical_device_driver_extensions[i].set(id);
+ }
+ }
+ // Ignore driver attempts to support loader extensions
+ instance.physical_device_driver_extensions[i].reset(kKHR_swapchain);
}
instance.drv.num_physical_devices = num_physical_devices;
-
instance.num_physical_devices = instance.drv.num_physical_devices;
+
return VK_SUCCESS;
}
@@ -535,12 +696,6 @@
PFN_vkVoidFunction pfn;
if ((pfn = GetLoaderBottomProcAddr(name)))
return pfn;
- // TODO: Possibly move this into the instance table
- // TODO: Possibly register the callbacks in the loader
- if (strcmp(name, "vkDbgCreateMsgCallback") == 0 ||
- strcmp(name, "vkDbgDestroyMsgCallback") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(Noop);
- }
return nullptr;
}
@@ -623,38 +778,68 @@
VKAPI_ATTR
VkResult EnumerateDeviceExtensionProperties_Bottom(
- VkPhysicalDevice /*pdev*/,
- const char* /*layer_name*/,
+ VkPhysicalDevice gpu,
+ const char* layer_name,
uint32_t* properties_count,
- VkExtensionProperties* /*properties*/) {
- // TODO(jessehall): Implement me...
- *properties_count = 0;
- return VK_SUCCESS;
+ VkExtensionProperties* properties) {
+ const VkExtensionProperties* extensions = nullptr;
+ uint32_t num_extensions = 0;
+ if (layer_name) {
+ GetDeviceLayerExtensions(layer_name, &extensions, &num_extensions);
+ } else {
+ Instance& instance = GetDispatchParent(gpu);
+ size_t gpu_idx = 0;
+ while (instance.physical_devices[gpu_idx] != gpu)
+ gpu_idx++;
+ const DeviceExtensionSet driver_extensions =
+ instance.physical_device_driver_extensions[gpu_idx];
+
+ // We only support VK_KHR_swapchain if the GPU supports
+ // VK_ANDROID_native_buffer
+ VkExtensionProperties* available = static_cast<VkExtensionProperties*>(
+ alloca(kDeviceExtensionCount * sizeof(VkExtensionProperties)));
+ if (driver_extensions[kANDROID_native_buffer]) {
+ available[num_extensions++] = VkExtensionProperties{
+ VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION};
+ }
+
+ // TODO(jessehall): We need to also enumerate extensions supported by
+ // implicitly-enabled layers. Currently we don't have that list of
+ // layers until instance creation.
+ extensions = available;
+ }
+
+ if (!properties || *properties_count > num_extensions)
+ *properties_count = num_extensions;
+ if (properties)
+ std::copy(extensions, extensions + *properties_count, properties);
+ return *properties_count < num_extensions ? VK_INCOMPLETE : VK_SUCCESS;
}
VKAPI_ATTR
VkResult EnumerateDeviceLayerProperties_Bottom(VkPhysicalDevice /*pdev*/,
uint32_t* properties_count,
- VkLayerProperties* /*properties*/) {
- // TODO(jessehall): Implement me...
- *properties_count = 0;
- return VK_SUCCESS;
+ VkLayerProperties* properties) {
+ uint32_t layer_count =
+ EnumerateDeviceLayers(properties ? *properties_count : 0, properties);
+ if (!properties || *properties_count > layer_count)
+ *properties_count = layer_count;
+ return *properties_count < layer_count ? VK_INCOMPLETE : VK_SUCCESS;
}
VKAPI_ATTR
-VkResult CreateDevice_Bottom(VkPhysicalDevice pdev,
+VkResult CreateDevice_Bottom(VkPhysicalDevice gpu,
const VkDeviceCreateInfo* create_info,
const VkAllocationCallbacks* allocator,
VkDevice* device_out) {
- Instance& instance = GetDispatchParent(pdev);
+ Instance& instance = GetDispatchParent(gpu);
VkResult result;
- if (!allocator) {
- if (instance.alloc)
- allocator = instance.alloc;
- else
- allocator = &kDefaultAllocCallbacks;
- }
+ // FIXME(jessehall): We don't have good conventions or infrastructure yet to
+ // do better than just using the instance allocator and scope for
+ // everything. See b/26732122.
+ if (true /*!allocator*/)
+ allocator = instance.alloc;
void* mem = allocator->pfnAllocation(allocator->pUserData, sizeof(Device),
alignof(Device),
@@ -669,9 +854,58 @@
return result;
}
+ size_t gpu_idx = 0;
+ while (instance.physical_devices[gpu_idx] != gpu)
+ gpu_idx++;
+
+ uint32_t num_driver_extensions = 0;
+ const char** driver_extensions = static_cast<const char**>(
+ alloca(create_info->enabledExtensionCount * sizeof(const char*)));
+ for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
+ const char* name = create_info->ppEnabledExtensionNames[i];
+ DeviceExtension id = DeviceExtensionFromName(name);
+ if (id != kDeviceExtensionCount) {
+ if (instance.physical_device_driver_extensions[gpu_idx][id]) {
+ driver_extensions[num_driver_extensions++] = name;
+ continue;
+ }
+ if (id == kKHR_swapchain &&
+ instance.physical_device_driver_extensions
+ [gpu_idx][kANDROID_native_buffer]) {
+ driver_extensions[num_driver_extensions++] =
+ VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME;
+ continue;
+ }
+ }
+ bool supported = false;
+ for (const auto& layer : device->active_layers) {
+ if (layer.SupportsExtension(name))
+ supported = true;
+ }
+ if (!supported) {
+ ALOGE(
+ "requested device extension '%s' not supported by loader, "
+ "driver, or any active layers",
+ name);
+ DestroyDevice(device);
+ return VK_ERROR_EXTENSION_NOT_PRESENT;
+ }
+ }
+
+ VkDeviceCreateInfo driver_create_info = *create_info;
+ driver_create_info.enabledLayerCount = 0;
+ driver_create_info.ppEnabledLayerNames = nullptr;
+ // TODO(jessehall): As soon as we enumerate device extensions supported by
+ // the driver, we need to filter the requested extension list to those
+ // supported by the driver here. Also, add the VK_ANDROID_native_buffer
+ // extension to the list iff the VK_KHR_swapchain extension was requested,
+ // instead of adding it unconditionally like we do now.
+ driver_create_info.enabledExtensionCount = num_driver_extensions;
+ driver_create_info.ppEnabledExtensionNames = driver_extensions;
+
VkDevice drv_device;
- result = instance.drv.dispatch.CreateDevice(pdev, create_info, allocator,
- &drv_device);
+ result = instance.drv.dispatch.CreateDevice(gpu, &driver_create_info,
+ allocator, &drv_device);
if (result != VK_SUCCESS) {
DestroyDevice(device);
return result;
@@ -700,8 +934,19 @@
VkLayerLinkedListElem* next_element;
PFN_vkGetDeviceProcAddr next_get_proc_addr = GetDeviceProcAddr_Bottom;
Vector<VkLayerLinkedListElem> elem_list(
- device->active_layers.size(),
CallbackAllocator<VkLayerLinkedListElem>(instance.alloc));
+ try {
+ elem_list.resize(device->active_layers.size());
+ } catch (std::bad_alloc&) {
+ ALOGE("device creation failed: out of memory");
+ PFN_vkDestroyDevice destroy_device =
+ reinterpret_cast<PFN_vkDestroyDevice>(
+ instance.drv.dispatch.GetDeviceProcAddr(drv_device,
+ "vkDestroyDevice"));
+ destroy_device(drv_device, allocator);
+ DestroyDevice(device);
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
for (size_t i = elem_list.size(); i > 0; i--) {
size_t idx = i - 1;
@@ -730,7 +975,7 @@
// therefore which functions to return procaddrs for.
PFN_vkCreateDevice create_device = reinterpret_cast<PFN_vkCreateDevice>(
next_get_proc_addr(drv_device, "vkCreateDevice"));
- create_device(pdev, create_info, allocator, &drv_device);
+ create_device(gpu, create_info, allocator, &drv_device);
if (!LoadDeviceDispatchTable(static_cast<VkDevice>(base_object),
next_get_proc_addr, device->dispatch)) {
@@ -754,11 +999,12 @@
instance.drv.dispatch.DestroyInstance(instance.drv.instance, allocator);
}
if (instance.message) {
- PFN_vkDbgDestroyMsgCallback DebugDestroyMessageCallback;
- DebugDestroyMessageCallback =
- reinterpret_cast<PFN_vkDbgDestroyMsgCallback>(
- vkGetInstanceProcAddr(vkinstance, "vkDbgDestroyMsgCallback"));
- DebugDestroyMessageCallback(vkinstance, instance.message);
+ PFN_vkDestroyDebugReportCallbackEXT destroy_debug_report_callback;
+ destroy_debug_report_callback =
+ reinterpret_cast<PFN_vkDestroyDebugReportCallbackEXT>(
+ vkGetInstanceProcAddr(vkinstance,
+ "vkDestroyDebugReportCallbackEXT"));
+ destroy_debug_report_callback(vkinstance, instance.message, allocator);
}
instance.active_layers.clear();
const VkAllocationCallbacks* alloc = instance.alloc;
@@ -809,17 +1055,24 @@
const VkExtensionProperties* extensions = nullptr;
uint32_t num_extensions = 0;
if (layer_name) {
- GetLayerExtensions(layer_name, &extensions, &num_extensions);
+ GetInstanceLayerExtensions(layer_name, &extensions, &num_extensions);
} else {
- static const VkExtensionProperties kInstanceExtensions[] = {
- {VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION},
- {VK_KHR_ANDROID_SURFACE_EXTENSION_NAME,
- VK_KHR_ANDROID_SURFACE_SPEC_VERSION}};
- extensions = kInstanceExtensions;
- num_extensions = sizeof(kInstanceExtensions) / sizeof(kInstanceExtensions[0]);
+ VkExtensionProperties* available = static_cast<VkExtensionProperties*>(
+ alloca(kInstanceExtensionCount * sizeof(VkExtensionProperties)));
+ available[num_extensions++] = VkExtensionProperties{
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION};
+ available[num_extensions++] =
+ VkExtensionProperties{VK_KHR_ANDROID_SURFACE_EXTENSION_NAME,
+ VK_KHR_ANDROID_SURFACE_SPEC_VERSION};
+ if (g_driver_instance_extensions[kEXT_debug_report]) {
+ available[num_extensions++] =
+ VkExtensionProperties{VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
+ VK_EXT_DEBUG_REPORT_SPEC_VERSION};
+ }
// TODO(jessehall): We need to also enumerate extensions supported by
// implicitly-enabled layers. Currently we don't have that list of
// layers until instance creation.
+ extensions = available;
}
if (!properties || *properties_count > num_extensions)
@@ -835,7 +1088,7 @@
return VK_ERROR_INITIALIZATION_FAILED;
uint32_t layer_count =
- EnumerateLayers(properties ? *properties_count : 0, properties);
+ EnumerateInstanceLayers(properties ? *properties_count : 0, properties);
if (!properties || *properties_count > layer_count)
*properties_count = layer_count;
return *properties_count < layer_count ? VK_INCOMPLETE : VK_SUCCESS;
@@ -873,8 +1126,14 @@
VkLayerLinkedListElem* next_element;
PFN_vkGetInstanceProcAddr next_get_proc_addr = GetInstanceProcAddr_Bottom;
Vector<VkLayerLinkedListElem> elem_list(
- instance->active_layers.size(),
CallbackAllocator<VkLayerLinkedListElem>(instance->alloc));
+ try {
+ elem_list.resize(instance->active_layers.size());
+ } catch (std::bad_alloc&) {
+ ALOGE("instance creation failed: out of memory");
+ DestroyInstance_Bottom(instance->handle, allocator);
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
for (size_t i = elem_list.size(); i > 0; i--) {
size_t idx = i - 1;
@@ -893,7 +1152,6 @@
next_element->get_proc_addr);
}
}
- instance->get_instance_proc_addr = next_get_proc_addr;
// This is the magic call that initializes all the layer instances and
// allows them to create their instance_handle -> instance_data mapping.
@@ -915,18 +1173,20 @@
enable_logging = enable_callback;
if (enable_callback) {
enable_callback = AddExtensionToCreateInfo(
- local_create_info, "DEBUG_REPORT", instance->alloc);
+ local_create_info, "VK_EXT_debug_report", instance->alloc);
}
}
- *instance_out = instance->handle;
+ VkInstance handle = instance->handle;
PFN_vkCreateInstance create_instance =
reinterpret_cast<PFN_vkCreateInstance>(
next_get_proc_addr(instance->handle, "vkCreateInstance"));
- result = create_instance(create_info, allocator, instance_out);
+ result = create_instance(create_info, allocator, &handle);
if (enable_callback)
FreeAllocatedCreateInfo(local_create_info, instance->alloc);
- if (result <= 0) {
+ if (result >= 0) {
+ *instance_out = instance->handle;
+ } else {
// For every layer, including the loader top and bottom layers:
// - If a call to the next CreateInstance fails, the layer must clean
// up anything it has successfully done so far, and propagate the
@@ -942,13 +1202,18 @@
}
if (enable_logging) {
- PFN_vkDbgCreateMsgCallback dbg_create_msg_callback;
- dbg_create_msg_callback = reinterpret_cast<PFN_vkDbgCreateMsgCallback>(
- GetInstanceProcAddr_Top(instance->handle,
- "vkDbgCreateMsgCallback"));
- dbg_create_msg_callback(
- instance->handle, VK_DBG_REPORT_ERROR_BIT | VK_DBG_REPORT_WARN_BIT,
- LogDebugMessageCallback, nullptr, &instance->message);
+ const VkDebugReportCallbackCreateInfoEXT callback_create_info = {
+ .sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT,
+ .flags =
+ VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARN_BIT_EXT,
+ .pfnCallback = LogDebugMessageCallback,
+ };
+ PFN_vkCreateDebugReportCallbackEXT create_debug_report_callback =
+ reinterpret_cast<PFN_vkCreateDebugReportCallbackEXT>(
+ GetInstanceProcAddr_Top(instance->handle,
+ "vkCreateDebugReportCallbackEXT"));
+ create_debug_report_callback(instance->handle, &callback_create_info,
+ allocator, &instance->message);
}
return result;
@@ -968,13 +1233,6 @@
// Otherwise, look up the handler in the instance dispatch table
if ((pfn = GetDispatchProcAddr(dispatch, name)))
return pfn;
- // TODO(jessehall): Generate these into the instance dispatch table, and
- // add loader-bottom procs for them.
- if (strcmp(name, "vkDbgCreateMsgCallback") == 0 ||
- strcmp(name, "vkDbgDestroyMsgCallback") == 0) {
- return GetDispatchParent(vkinstance)
- .get_instance_proc_addr(vkinstance, name);
- }
// Anything not handled already must be a device-dispatched function
// without a loader-top. We must return a function that will dispatch based
// on the dispatchable object parameter -- which is exactly what the
@@ -1052,6 +1310,14 @@
return GetDispatchParent(vkdevice).instance->alloc;
}
+VkInstance GetDriverInstance(VkInstance instance) {
+ return GetDispatchParent(instance).drv.instance;
+}
+
+const DriverDispatchTable& GetDriverDispatch(VkInstance instance) {
+ return GetDispatchParent(instance).drv.dispatch;
+}
+
const DriverDispatchTable& GetDriverDispatch(VkDevice device) {
return GetDispatchParent(device).instance->drv.dispatch;
}
@@ -1060,4 +1326,8 @@
return GetDispatchParent(queue).instance->drv.dispatch;
}
+DebugReportCallbackList& GetDebugReportCallbacks(VkInstance instance) {
+ return GetDispatchParent(instance).debug_report_callbacks;
+}
+
} // namespace vulkan
diff --git a/vulkan/libvulkan/loader.h b/vulkan/libvulkan/loader.h
index 6e32785..3e2d1c4 100644
--- a/vulkan/libvulkan/loader.h
+++ b/vulkan/libvulkan/loader.h
@@ -17,10 +17,27 @@
#ifndef LIBVULKAN_LOADER_H
#define LIBVULKAN_LOADER_H 1
+#include <bitset>
#include "dispatch_gen.h"
+#include "debug_report.h"
namespace vulkan {
+enum InstanceExtension {
+ kKHR_surface,
+ kKHR_android_surface,
+ kEXT_debug_report,
+ kInstanceExtensionCount
+};
+typedef std::bitset<kInstanceExtensionCount> InstanceExtensionSet;
+
+enum DeviceExtension {
+ kKHR_swapchain,
+ kANDROID_native_buffer,
+ kDeviceExtensionCount
+};
+typedef std::bitset<kDeviceExtensionCount> DeviceExtensionSet;
+
inline const InstanceDispatchTable& GetDispatchTable(VkInstance instance) {
return **reinterpret_cast<InstanceDispatchTable**>(instance);
}
@@ -62,6 +79,7 @@
DeviceDispatchTable& dispatch);
bool LoadDriverDispatchTable(VkInstance instance,
PFN_vkGetInstanceProcAddr get_proc_addr,
+ const InstanceExtensionSet& extensions,
DriverDispatchTable& dispatch);
// -----------------------------------------------------------------------------
@@ -97,8 +115,11 @@
const VkAllocationCallbacks* GetAllocator(VkInstance instance);
const VkAllocationCallbacks* GetAllocator(VkDevice device);
+VkInstance GetDriverInstance(VkInstance instance);
+const DriverDispatchTable& GetDriverDispatch(VkInstance instance);
const DriverDispatchTable& GetDriverDispatch(VkDevice device);
const DriverDispatchTable& GetDriverDispatch(VkQueue queue);
+DebugReportCallbackList& GetDebugReportCallbacks(VkInstance instance);
// -----------------------------------------------------------------------------
// swapchain.cpp
@@ -135,16 +156,26 @@
PFN_vkGetInstanceProcAddr GetGetInstanceProcAddr() const;
PFN_vkGetDeviceProcAddr GetGetDeviceProcAddr() const;
+ bool SupportsExtension(const char* name) const;
+
private:
Layer* layer_;
};
void DiscoverLayers();
-uint32_t EnumerateLayers(uint32_t count, VkLayerProperties* properties);
-void GetLayerExtensions(const char* name,
- const VkExtensionProperties** properties,
- uint32_t* count);
-LayerRef GetLayerRef(const char* name);
+uint32_t EnumerateInstanceLayers(uint32_t count, VkLayerProperties* properties);
+uint32_t EnumerateDeviceLayers(uint32_t count, VkLayerProperties* properties);
+void GetInstanceLayerExtensions(const char* name,
+ const VkExtensionProperties** properties,
+ uint32_t* count);
+void GetDeviceLayerExtensions(const char* name,
+ const VkExtensionProperties** properties,
+ uint32_t* count);
+LayerRef GetInstanceLayerRef(const char* name);
+LayerRef GetDeviceLayerRef(const char* name);
+
+InstanceExtension InstanceExtensionFromName(const char* name);
+DeviceExtension DeviceExtensionFromName(const char* name);
} // namespace vulkan
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index 2bad1bb..2392b5c 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-// #define LOG_NDEBUG 0
-
#include <algorithm>
#include <memory>
@@ -79,10 +77,13 @@
: allocator_(other.allocator_), scope_(other.scope_) {}
T* allocate(size_t n) const {
- return static_cast<T*>(allocator_.pfnAllocation(
+ T* p = static_cast<T*>(allocator_.pfnAllocation(
allocator_.pUserData, n * sizeof(T), alignof(T), scope_));
+ if (!p)
+ throw std::bad_alloc();
+ return p;
}
- void deallocate(T* p, size_t) const {
+ void deallocate(T* p, size_t) const noexcept {
return allocator_.pfnFree(allocator_.pUserData, p);
}
@@ -95,10 +96,15 @@
template <typename T, typename Host>
std::shared_ptr<T> InitSharedPtr(Host host, T* obj) {
- obj->common.incRef(&obj->common);
- return std::shared_ptr<T>(
- obj, NativeBaseDeleter<T>(),
- VulkanAllocator<T>(*GetAllocator(host), AllocScope<Host>::kScope));
+ try {
+ obj->common.incRef(&obj->common);
+ return std::shared_ptr<T>(
+ obj, NativeBaseDeleter<T>(),
+ VulkanAllocator<T>(*GetAllocator(host), AllocScope<Host>::kScope));
+ } catch (std::bad_alloc&) {
+ obj->common.decRef(&obj->common);
+ return nullptr;
+ }
}
// ----------------------------------------------------------------------------
@@ -163,6 +169,12 @@
Surface* surface = new (mem) Surface;
surface->window = InitSharedPtr(instance, pCreateInfo->window);
+ if (!surface->window) {
+ ALOGE("surface creation failed: out of memory");
+ surface->~Surface();
+ allocator->pfnFree(allocator->pUserData, surface);
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
// TODO(jessehall): Create and use NATIVE_WINDOW_API_VULKAN.
int err =
@@ -322,9 +334,9 @@
if (!allocator)
allocator = GetAllocator(device);
- ALOGV_IF(create_info->imageArraySize != 1,
- "Swapchain imageArraySize (%u) != 1 not supported",
- create_info->imageArraySize);
+ ALOGV_IF(create_info->imageArrayLayers != 1,
+ "Swapchain imageArrayLayers (%u) != 1 not supported",
+ create_info->imageArrayLayers);
ALOGE_IF(create_info->imageFormat != VK_FORMAT_R8G8B8A8_UNORM,
"swapchain formats other than R8G8B8A8_UNORM not yet implemented");
@@ -334,8 +346,10 @@
"swapchain re-creation not yet implemented");
ALOGE_IF(create_info->preTransform != VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
"swapchain preTransform not yet implemented");
- ALOGE_IF(create_info->presentMode != VK_PRESENT_MODE_FIFO_KHR,
- "present modes other than FIFO are not yet implemented");
+ ALOGW_IF((create_info->presentMode != VK_PRESENT_MODE_FIFO_KHR ||
+ create_info->presentMode != VK_PRESENT_MODE_MAILBOX_KHR),
+ "swapchain present mode %d not supported",
+ create_info->presentMode);
// -- Configure the native window --
@@ -406,6 +420,17 @@
return VK_ERROR_INITIALIZATION_FAILED;
}
+ err = surface.window->setSwapInterval(
+ surface.window.get(),
+ create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR ? 0 : 1);
+ if (err != 0) {
+ // TODO(jessehall): Improve error reporting. Can we enumerate possible
+ // errors and translate them to valid Vulkan result codes?
+ ALOGE("native_window->setSwapInterval failed: %s (%d)", strerror(-err),
+ err);
+ return VK_ERROR_INITIALIZATION_FAILED;
+ }
+
// -- Allocate our Swapchain object --
// After this point, we must deallocate the swapchain on error.
@@ -457,6 +482,13 @@
break;
}
img.buffer = InitSharedPtr(device, buffer);
+ if (!img.buffer) {
+ ALOGE("swapchain creation failed: out of memory");
+ surface.window->cancelBuffer(surface.window.get(), buffer,
+ img.dequeue_fence);
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
+ break;
+ }
img.dequeued = true;
image_create.extent =
@@ -643,8 +675,9 @@
int err;
int fence = -1;
- result =
- dispatch.QueueSignalReleaseImageANDROID(queue, img.image, &fence);
+ result = dispatch.QueueSignalReleaseImageANDROID(
+ queue, present_info->waitSemaphoreCount,
+ present_info->pWaitSemaphores, img.image, &fence);
if (result != VK_SUCCESS) {
ALOGE("QueueSignalReleaseImageANDROID failed: %d", result);
if (present_info->pResults)
diff --git a/vulkan/nulldrv/Android.mk b/vulkan/nulldrv/Android.mk
index 2db6138..77d4746 100644
--- a/vulkan/nulldrv/Android.mk
+++ b/vulkan/nulldrv/Android.mk
@@ -16,12 +16,13 @@
include $(CLEAR_VARS)
LOCAL_CLANG := true
-LOCAL_CFLAGS := -std=c99 -fvisibility=hidden -fstrict-aliasing
-LOCAL_CFLAGS += -DLOG_TAG=\"vknulldrv\"
-LOCAL_CFLAGS += -Weverything -Werror \
+LOCAL_CFLAGS := -std=c99 -fvisibility=hidden -fstrict-aliasing \
+ -DLOG_TAG=\"vknulldrv\" \
+ -Weverything -Werror \
-Wno-padded \
-Wno-undef \
-Wno-zero-length-array
+#LOCAL_CFLAGS += -DLOG_NDEBUG=0
LOCAL_CPPFLAGS := -std=c++1y \
-Wno-c++98-compat-pedantic \
-Wno-c99-extensions
diff --git a/vulkan/nulldrv/null_driver.cpp b/vulkan/nulldrv/null_driver.cpp
index 9a75697..b4e21db 100644
--- a/vulkan/nulldrv/null_driver.cpp
+++ b/vulkan/nulldrv/null_driver.cpp
@@ -15,13 +15,13 @@
*/
#include <hardware/hwvulkan.h>
+#include <vulkan/vk_ext_debug_report.h>
-#include <inttypes.h>
-#include <string.h>
#include <algorithm>
#include <array>
+#include <inttypes.h>
+#include <string.h>
-// #define LOG_NDEBUG 0
#include <log/log.h>
#include <utils/Errors.h>
@@ -37,6 +37,7 @@
hwvulkan_dispatch_t dispatch;
VkAllocationCallbacks allocator;
VkPhysicalDevice_T physical_device;
+ uint64_t next_callback_handle;
};
struct VkQueue_T {
@@ -67,6 +68,7 @@
namespace HandleType {
enum Enum {
kBufferView,
+ kDebugReportCallbackEXT,
kDescriptorPool,
kDescriptorSet,
kDescriptorSetLayout,
@@ -86,7 +88,6 @@
kNumTypes
};
} // namespace HandleType
-uint64_t AllocHandle(VkDevice device, HandleType::Enum type);
const VkDeviceSize kMaxDeviceMemory = VkDeviceSize(INTPTR_MAX) + 1;
@@ -164,14 +165,26 @@
offsetof(VkInstance_T, physical_device));
}
+uint64_t AllocHandle(uint64_t type, uint64_t* next_handle) {
+ const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
+ ALOGE_IF(*next_handle == kHandleMask,
+ "non-dispatchable handles of type=%" PRIu64
+ " are about to overflow",
+ type);
+ return (UINT64_C(1) << 63) | ((type & 0x7) << 56) |
+ ((*next_handle)++ & kHandleMask);
+}
+
+template <class Handle>
+Handle AllocHandle(VkInstance instance, HandleType::Enum type) {
+ return reinterpret_cast<Handle>(
+ AllocHandle(type, &instance->next_callback_handle));
+}
+
template <class Handle>
Handle AllocHandle(VkDevice device, HandleType::Enum type) {
- const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
- ALOGE_IF(device->next_handle[type] == kHandleMask,
- "non-dispatchable handles of type=%u are about to overflow", type);
return reinterpret_cast<Handle>(
- (UINT64_C(1) << 63) | ((uint64_t(type) & 0x7) << 56) |
- (device->next_handle[type]++ & kHandleMask));
+ AllocHandle(type, &device->next_handle[type]));
}
} // namespace
@@ -192,15 +205,39 @@
// Global
VKAPI_ATTR
-VkResult EnumerateInstanceExtensionProperties(const char*,
- uint32_t* count,
- VkExtensionProperties*) {
+VkResult EnumerateInstanceExtensionProperties(
+ const char* layer_name,
+ uint32_t* count,
+ VkExtensionProperties* properties) {
+ if (layer_name) {
+ ALOGW(
+ "Driver vkEnumerateInstanceExtensionProperties shouldn't be called "
+ "with a layer name ('%s')",
+ layer_name);
+ }
+
+// NOTE: Change this to zero to report and extension, which can be useful
+// for testing changes to the loader.
+#if 1
+ (void)properties; // unused
*count = 0;
return VK_SUCCESS;
+#else
+ const VkExtensionProperties kExtensions[] = {
+ {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}};
+ const uint32_t kExtensionsCount =
+ sizeof(kExtensions) / sizeof(kExtensions[0]);
+
+ if (!properties || *count > kExtensionsCount)
+ *count = kExtensionsCount;
+ if (properties)
+ std::copy(kExtensions, kExtensions + *count, properties);
+ return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
+#endif
}
VKAPI_ATTR
-VkResult CreateInstance(const VkInstanceCreateInfo* /*create_info*/,
+VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
const VkAllocationCallbacks* allocator,
VkInstance* out_instance) {
// Assume the loader provided alloc callbacks even if the app didn't.
@@ -218,6 +255,18 @@
instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
instance->allocator = *allocator;
instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
+ instance->next_callback_handle = 0;
+
+ for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
+ if (strcmp(create_info->ppEnabledExtensionNames[i],
+ VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
+ ALOGV("instance extension '%s' requested",
+ create_info->ppEnabledExtensionNames[i]);
+ } else {
+ ALOGW("unsupported extension '%s' requested",
+ create_info->ppEnabledExtensionNames[i]);
+ }
+ }
*out_instance = instance;
return VK_SUCCESS;
@@ -253,6 +302,40 @@
return VK_SUCCESS;
}
+VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/,
+ uint32_t* count,
+ VkLayerProperties* /*properties*/) {
+ ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called");
+ *count = 0;
+ return VK_SUCCESS;
+}
+
+VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/,
+ const char* layer_name,
+ uint32_t* count,
+ VkExtensionProperties* properties) {
+ if (layer_name) {
+ ALOGW(
+ "Driver vkEnumerateDeviceExtensionProperties shouldn't be called "
+ "with a layer name ('%s')",
+ layer_name);
+ *count = 0;
+ return VK_SUCCESS;
+ }
+
+ const VkExtensionProperties kExtensions[] = {
+ {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME,
+ VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}};
+ const uint32_t kExtensionsCount =
+ sizeof(kExtensions) / sizeof(kExtensions[0]);
+
+ if (!properties || *count > kExtensionsCount)
+ *count = kExtensionsCount;
+ if (properties)
+ std::copy(kExtensions, kExtensions + *count, properties);
+ return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
+}
+
void GetPhysicalDeviceProperties(VkPhysicalDevice,
VkPhysicalDeviceProperties* properties) {
properties->apiVersion = VK_API_VERSION;
@@ -269,13 +352,15 @@
VkPhysicalDevice,
uint32_t* count,
VkQueueFamilyProperties* properties) {
- if (properties) {
+ if (!properties || *count > 1)
+ *count = 1;
+ if (properties && *count == 1) {
properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
VK_QUEUE_TRANSFER_BIT;
properties->queueCount = 1;
properties->timestampValidBits = 64;
+ properties->minImageTransferGranularity = VkExtent3D{1, 1, 1};
}
- *count = 1;
}
void GetPhysicalDeviceMemoryProperties(
@@ -297,7 +382,7 @@
// Device
VkResult CreateDevice(VkPhysicalDevice physical_device,
- const VkDeviceCreateInfo*,
+ const VkDeviceCreateInfo* create_info,
const VkAllocationCallbacks* allocator,
VkDevice* out_device) {
VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
@@ -316,6 +401,13 @@
std::fill(device->next_handle.begin(), device->next_handle.end(),
UINT64_C(0));
+ for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
+ if (strcmp(create_info->ppEnabledExtensionNames[i],
+ VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME) == 0) {
+ ALOGV("Enabling " VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME);
+ }
+ }
+
*out_device = device;
return VK_SUCCESS;
}
@@ -559,6 +651,33 @@
allocator->pfnFree(allocator->pUserData, image);
}
+VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
+ VkFormat,
+ VkImageUsageFlags,
+ int* grallocUsage) {
+ // The null driver never reads or writes the gralloc buffer
+ *grallocUsage = 0;
+ return VK_SUCCESS;
+}
+
+VkResult AcquireImageANDROID(VkDevice,
+ VkImage,
+ int fence,
+ VkSemaphore,
+ VkFence) {
+ close(fence);
+ return VK_SUCCESS;
+}
+
+VkResult QueueSignalReleaseImageANDROID(VkQueue,
+ uint32_t,
+ const VkSemaphore*,
+ VkImage,
+ int* fence) {
+ *fence = -1;
+ return VK_SUCCESS;
+}
+
// -----------------------------------------------------------------------------
// No-op types
@@ -707,26 +826,12 @@
return VK_SUCCESS;
}
-VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
- VkFormat,
- VkImageUsageFlags,
- int* grallocUsage) {
- // The null driver never reads or writes the gralloc buffer
- *grallocUsage = 0;
- return VK_SUCCESS;
-}
-
-VkResult AcquireImageANDROID(VkDevice,
- VkImage,
- int fence,
- VkSemaphore,
- VkFence) {
- close(fence);
- return VK_SUCCESS;
-}
-
-VkResult QueueSignalReleaseImageANDROID(VkQueue, VkImage, int* fence) {
- *fence = -1;
+VkResult CreateDebugReportCallbackEXT(VkInstance instance,
+ const VkDebugReportCallbackCreateInfoEXT*,
+ const VkAllocationCallbacks*,
+ VkDebugReportCallbackEXT* callback) {
+ *callback = AllocHandle<VkDebugReportCallbackEXT>(
+ instance, HandleType::kDebugReportCallbackEXT);
return VK_SUCCESS;
}
@@ -755,16 +860,6 @@
return VK_SUCCESS;
}
-VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pCount, VkLayerProperties* pProperties) {
- ALOGV("TODO: vk%s", __FUNCTION__);
- return VK_SUCCESS;
-}
-
-VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pCount, VkExtensionProperties* pProperties) {
- ALOGV("TODO: vk%s", __FUNCTION__);
- return VK_SUCCESS;
-}
-
VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
return VK_SUCCESS;
}
@@ -1077,6 +1172,12 @@
void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
}
+void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) {
+}
+
+void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) {
+}
+
#pragma clang diagnostic pop
// clang-format on
diff --git a/vulkan/nulldrv/null_driver.tmpl b/vulkan/nulldrv/null_driver.tmpl
index 7762011..57e72d3 100644
--- a/vulkan/nulldrv/null_driver.tmpl
+++ b/vulkan/nulldrv/null_driver.tmpl
@@ -50,8 +50,8 @@
#ifndef NULLDRV_NULL_DRIVER_H
#define NULLDRV_NULL_DRIVER_H 1
¶
-#define VK_PROTOTYPES
#include <vulkan/vk_android_native_buffer.h>
+#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vulkan.h>
¶
namespace null_driver {«
@@ -67,7 +67,7 @@
{{end}}
VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
-VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, VkImage image, int* pNativeFenceFd);
+VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
// clang-format on
¶
»} // namespace null_driver
@@ -217,6 +217,7 @@
*/}}
{{define "IsDriverExtension"}}
{{$ext := index $.Arguments 0}}
- {{if eq $ext "VK_ANDROID_native_buffer"}}true
+ {{ if eq $ext "VK_ANDROID_native_buffer"}}true
+ {{else if eq $ext "VK_EXT_debug_report"}}true
{{end}}
{{end}}
diff --git a/vulkan/nulldrv/null_driver_gen.cpp b/vulkan/nulldrv/null_driver_gen.cpp
index a96c2c4..c5f42b0 100644
--- a/vulkan/nulldrv/null_driver_gen.cpp
+++ b/vulkan/nulldrv/null_driver_gen.cpp
@@ -110,6 +110,7 @@
{"vkCreateBufferView", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateBufferView>(CreateBufferView))},
{"vkCreateCommandPool", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateCommandPool>(CreateCommandPool))},
{"vkCreateComputePipelines", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateComputePipelines>(CreateComputePipelines))},
+ {"vkCreateDebugReportCallbackEXT", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDebugReportCallbackEXT>(CreateDebugReportCallbackEXT))},
{"vkCreateDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDescriptorPool>(CreateDescriptorPool))},
{"vkCreateDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDescriptorSetLayout>(CreateDescriptorSetLayout))},
{"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDevice>(CreateDevice))},
@@ -127,9 +128,11 @@
{"vkCreateSampler", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateSampler>(CreateSampler))},
{"vkCreateSemaphore", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateSemaphore>(CreateSemaphore))},
{"vkCreateShaderModule", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateShaderModule>(CreateShaderModule))},
+ {"vkDebugReportMessageEXT", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDebugReportMessageEXT>(DebugReportMessageEXT))},
{"vkDestroyBuffer", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyBuffer>(DestroyBuffer))},
{"vkDestroyBufferView", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyBufferView>(DestroyBufferView))},
{"vkDestroyCommandPool", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyCommandPool>(DestroyCommandPool))},
+ {"vkDestroyDebugReportCallbackEXT", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyDebugReportCallbackEXT>(DestroyDebugReportCallbackEXT))},
{"vkDestroyDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyDescriptorPool>(DestroyDescriptorPool))},
{"vkDestroyDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyDescriptorSetLayout>(DestroyDescriptorSetLayout))},
{"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyDevice>(DestroyDevice))},
diff --git a/vulkan/nulldrv/null_driver_gen.h b/vulkan/nulldrv/null_driver_gen.h
index 99c1017..ddf4afb 100644
--- a/vulkan/nulldrv/null_driver_gen.h
+++ b/vulkan/nulldrv/null_driver_gen.h
@@ -21,8 +21,8 @@
#ifndef NULLDRV_NULL_DRIVER_H
#define NULLDRV_NULL_DRIVER_H 1
-#define VK_PROTOTYPES
#include <vulkan/vk_android_native_buffer.h>
+#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vulkan.h>
namespace null_driver {
@@ -168,9 +168,12 @@
VKAPI_ATTR void CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents);
VKAPI_ATTR void CmdEndRenderPass(VkCommandBuffer commandBuffer);
VKAPI_ATTR void CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
+VKAPI_ATTR VkResult CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
+VKAPI_ATTR void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage);
VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
-VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, VkImage image, int* pNativeFenceFd);
+VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
// clang-format on
} // namespace null_driver
diff --git a/vulkan/tools/vkinfo.cpp b/vulkan/tools/vkinfo.cpp
index 221c7be..6a63667 100644
--- a/vulkan/tools/vkinfo.cpp
+++ b/vulkan/tools/vkinfo.cpp
@@ -14,13 +14,15 @@
* limitations under the License.
*/
+#include <algorithm>
+#include <array>
#include <inttypes.h>
#include <stdlib.h>
#include <sstream>
#include <vector>
-#define VK_PROTOTYPES
#include <vulkan/vulkan.h>
+#include <vulkan/vk_ext_debug_report.h>
#define LOG_TAG "vkinfo"
#include <log/log.h>
@@ -30,6 +32,7 @@
struct GpuInfo {
VkPhysicalDeviceProperties properties;
VkPhysicalDeviceMemoryProperties memory;
+ VkPhysicalDeviceFeatures features;
std::vector<VkQueueFamilyProperties> queue_families;
std::vector<VkExtensionProperties> extensions;
std::vector<VkLayerProperties> layers;
@@ -69,6 +72,14 @@
exit(1);
}
+bool HasExtension(const std::vector<VkExtensionProperties>& extensions,
+ const char* name) {
+ return std::find_if(extensions.cbegin(), extensions.cend(),
+ [=](const VkExtensionProperties& prop) {
+ return strcmp(prop.extensionName, name) == 0;
+ }) != extensions.end();
+}
+
void EnumerateInstanceExtensions(
const char* layer_name,
std::vector<VkExtensionProperties>* extensions) {
@@ -105,6 +116,70 @@
die("vkEnumerateDeviceExtensionProperties (data)", result);
}
+void GatherGpuInfo(VkPhysicalDevice gpu, GpuInfo& info) {
+ VkResult result;
+ uint32_t count;
+
+ vkGetPhysicalDeviceProperties(gpu, &info.properties);
+ vkGetPhysicalDeviceMemoryProperties(gpu, &info.memory);
+ vkGetPhysicalDeviceFeatures(gpu, &info.features);
+
+ vkGetPhysicalDeviceQueueFamilyProperties(gpu, &count, nullptr);
+ info.queue_families.resize(count);
+ vkGetPhysicalDeviceQueueFamilyProperties(gpu, &count,
+ info.queue_families.data());
+
+ result = vkEnumerateDeviceLayerProperties(gpu, &count, nullptr);
+ if (result != VK_SUCCESS)
+ die("vkEnumerateDeviceLayerProperties (count)", result);
+ do {
+ info.layers.resize(count);
+ result =
+ vkEnumerateDeviceLayerProperties(gpu, &count, info.layers.data());
+ } while (result == VK_INCOMPLETE);
+ if (result != VK_SUCCESS)
+ die("vkEnumerateDeviceLayerProperties (data)", result);
+ info.layer_extensions.resize(info.layers.size());
+
+ EnumerateDeviceExtensions(gpu, nullptr, &info.extensions);
+ for (size_t i = 0; i < info.layers.size(); i++) {
+ EnumerateDeviceExtensions(gpu, info.layers[i].layerName,
+ &info.layer_extensions[i]);
+ }
+
+ const std::array<const char*, 1> kDesiredExtensions = {
+ {VK_KHR_SWAPCHAIN_EXTENSION_NAME},
+ };
+ const char* extensions[kDesiredExtensions.size()];
+ uint32_t num_extensions = 0;
+ for (const auto& desired_ext : kDesiredExtensions) {
+ bool available = HasExtension(info.extensions, desired_ext);
+ for (size_t i = 0; !available && i < info.layer_extensions.size(); i++)
+ available = HasExtension(info.layer_extensions[i], desired_ext);
+ if (available)
+ extensions[num_extensions++] = desired_ext;
+ }
+
+ VkDevice device;
+ const VkDeviceQueueCreateInfo queue_create_info = {
+ .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
+ .queueFamilyIndex = 0,
+ .queueCount = 1,
+ };
+ const VkDeviceCreateInfo create_info = {
+ .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
+ .queueCreateInfoCount = 1,
+ .pQueueCreateInfos = &queue_create_info,
+ .enabledExtensionCount = num_extensions,
+ .ppEnabledExtensionNames = extensions,
+ .pEnabledFeatures = &info.features,
+ };
+ result = vkCreateDevice(gpu, &create_info, nullptr, &device);
+ if (result != VK_SUCCESS)
+ die("vkCreateDevice", result);
+ vkDestroyDevice(device, nullptr);
+}
+
void GatherInfo(VulkanInfo* info) {
VkResult result;
uint32_t count;
@@ -127,10 +202,26 @@
&info->layer_extensions[i]);
}
- VkInstance instance;
+ const char* kDesiredExtensions[] = {
+ VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
+ };
+ const char*
+ extensions[sizeof(kDesiredExtensions) / sizeof(kDesiredExtensions[0])];
+ uint32_t num_extensions = 0;
+ for (const auto& desired_ext : kDesiredExtensions) {
+ bool available = HasExtension(info->extensions, desired_ext);
+ for (size_t i = 0; !available && i < info->layer_extensions.size(); i++)
+ available = HasExtension(info->layer_extensions[i], desired_ext);
+ if (available)
+ extensions[num_extensions++] = desired_ext;
+ }
+
const VkInstanceCreateInfo create_info = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
+ .enabledExtensionCount = num_extensions,
+ .ppEnabledExtensionNames = extensions,
};
+ VkInstance instance;
result = vkCreateInstance(&create_info, nullptr, &instance);
if (result != VK_SUCCESS)
die("vkCreateInstance", result);
@@ -148,36 +239,8 @@
die("vkEnumeratePhysicalDevices (data)", result);
info->gpus.resize(num_gpus);
- for (size_t gpu_idx = 0; gpu_idx < gpus.size(); gpu_idx++) {
- VkPhysicalDevice gpu = gpus[gpu_idx];
- GpuInfo& gpu_info = info->gpus.at(gpu_idx);
-
- vkGetPhysicalDeviceProperties(gpu, &gpu_info.properties);
- vkGetPhysicalDeviceMemoryProperties(gpu, &gpu_info.memory);
-
- vkGetPhysicalDeviceQueueFamilyProperties(gpu, &count, nullptr);
- gpu_info.queue_families.resize(count);
- vkGetPhysicalDeviceQueueFamilyProperties(
- gpu, &count, gpu_info.queue_families.data());
-
- result = vkEnumerateDeviceLayerProperties(gpu, &count, nullptr);
- if (result != VK_SUCCESS)
- die("vkEnumerateDeviceLayerProperties (count)", result);
- do {
- gpu_info.layers.resize(count);
- result = vkEnumerateDeviceLayerProperties(gpu, &count,
- gpu_info.layers.data());
- } while (result == VK_INCOMPLETE);
- if (result != VK_SUCCESS)
- die("vkEnumerateDeviceLayerProperties (data)", result);
- gpu_info.layer_extensions.resize(gpu_info.layers.size());
-
- EnumerateDeviceExtensions(gpu, nullptr, &gpu_info.extensions);
- for (size_t i = 0; i < gpu_info.layers.size(); i++) {
- EnumerateDeviceExtensions(gpu, gpu_info.layers[i].layerName,
- &gpu_info.layer_extensions[i]);
- }
- }
+ for (size_t i = 0; i < gpus.size(); i++)
+ GatherGpuInfo(gpus[i], info->gpus.at(i));
vkDestroyInstance(instance, nullptr);
}
@@ -227,14 +290,35 @@
void PrintExtensions(const std::vector<VkExtensionProperties>& extensions,
const char* prefix) {
for (const auto& e : extensions)
- printf("%s- %s (v%u)\n", prefix, e.extensionName, e.specVersion);
+ printf("%s%s (v%u)\n", prefix, e.extensionName, e.specVersion);
+}
+
+void PrintLayers(
+ const std::vector<VkLayerProperties>& layers,
+ const std::vector<std::vector<VkExtensionProperties>> extensions,
+ const char* prefix) {
+ std::string ext_prefix(prefix);
+ ext_prefix.append(" ");
+ for (size_t i = 0; i < layers.size(); i++) {
+ printf(
+ "%s%s %u.%u.%u/%u\n"
+ "%s %s\n",
+ prefix, layers[i].layerName,
+ ExtractMajorVersion(layers[i].specVersion),
+ ExtractMinorVersion(layers[i].specVersion),
+ ExtractPatchVersion(layers[i].specVersion),
+ layers[i].implementationVersion, prefix, layers[i].description);
+ if (!extensions[i].empty())
+ printf("%s Extensions [%zu]:\n", prefix, extensions[i].size());
+ PrintExtensions(extensions[i], ext_prefix.c_str());
+ }
}
void PrintGpuInfo(const GpuInfo& info) {
VkResult result;
std::ostringstream strbuf;
- printf(" - \"%s\" (%s) %u.%u.%u/%#x [%04x:%04x]\n",
+ printf(" \"%s\" (%s) %u.%u.%u/%#x [%04x:%04x]\n",
info.properties.deviceName,
VkPhysicalDeviceTypeStr(info.properties.deviceType),
ExtractMajorVersion(info.properties.apiVersion),
@@ -247,7 +331,8 @@
if ((info.memory.memoryHeaps[heap].flags &
VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) != 0)
strbuf << "DEVICE_LOCAL";
- printf(" Heap %u: 0x%" PRIx64 " %s\n", heap,
+ printf(" Heap %u: %" PRIu64 " MiB (0x%" PRIx64 " B) %s\n", heap,
+ info.memory.memoryHeaps[heap].size / 0x1000000,
info.memory.memoryHeaps[heap].size, strbuf.str().c_str());
strbuf.str(std::string());
@@ -273,62 +358,41 @@
for (uint32_t family = 0; family < info.queue_families.size(); family++) {
const VkQueueFamilyProperties& qprops = info.queue_families[family];
- const char* sep = "";
- int bit, queue_flags = static_cast<int>(qprops.queueFlags);
- while ((bit = __builtin_ffs(queue_flags)) != 0) {
- VkQueueFlagBits flag = VkQueueFlagBits(1 << (bit - 1));
- strbuf << sep << VkQueueFlagBitStr(flag);
- queue_flags &= ~flag;
- sep = "+";
- }
- printf(" Queue Family %u: %2ux %s timestamps:%ub\n", family,
- qprops.queueCount, strbuf.str().c_str(),
- qprops.timestampValidBits);
- strbuf.str(std::string());
+ VkQueueFlags flags = qprops.queueFlags;
+ char flags_str[5];
+ flags_str[0] = (flags & VK_QUEUE_GRAPHICS_BIT) ? 'G' : '_';
+ flags_str[1] = (flags & VK_QUEUE_COMPUTE_BIT) ? 'C' : '_';
+ flags_str[2] = (flags & VK_QUEUE_TRANSFER_BIT) ? 'T' : '_';
+ flags_str[3] = (flags & VK_QUEUE_SPARSE_BINDING_BIT) ? 'S' : '_';
+ flags_str[4] = '\0';
+ printf(
+ " Queue Family %u: %ux %s\n"
+ " timestampValidBits: %ub\n"
+ " minImageTransferGranularity: (%u,%u,%u)\n",
+ family, qprops.queueCount, flags_str, qprops.timestampValidBits,
+ qprops.minImageTransferGranularity.width,
+ qprops.minImageTransferGranularity.height,
+ qprops.minImageTransferGranularity.depth);
+ }
- if (!info.extensions.empty()) {
- printf(" Extensions [%u]:\n", info.extensions.size());
- PrintExtensions(info.extensions, " ");
- }
- if (!info.layers.empty()) {
- printf(" Layers [%u]:\n", info.layers.size());
- for (size_t i = 0; i < info.layers.size(); i++) {
- const auto& layer = info.layers[i];
- printf(" - %s %u.%u.%u/%u \"%s\"\n", layer.layerName,
- ExtractMajorVersion(layer.specVersion),
- ExtractMinorVersion(layer.specVersion),
- ExtractPatchVersion(layer.specVersion),
- layer.implementationVersion, layer.description);
- if (!info.layer_extensions[i].empty()) {
- printf(" Extensions [%zu]:\n",
- info.layer_extensions.size());
- PrintExtensions(info.layer_extensions[i], " ");
- }
- }
- }
+ if (!info.extensions.empty()) {
+ printf(" Extensions [%zu]:\n", info.extensions.size());
+ PrintExtensions(info.extensions, " ");
+ }
+ if (!info.layers.empty()) {
+ printf(" Layers [%zu]:\n", info.layers.size());
+ PrintLayers(info.layers, info.layer_extensions, " ");
}
}
void PrintInfo(const VulkanInfo& info) {
std::ostringstream strbuf;
- printf("Instance Extensions [%u]:\n", info.extensions.size());
+ printf("Instance Extensions [%zu]:\n", info.extensions.size());
PrintExtensions(info.extensions, " ");
if (!info.layers.empty()) {
- printf("Instance Layers [%u]:\n", info.layers.size());
- for (size_t i = 0; i < info.layers.size(); i++) {
- const auto& layer = info.layers[i];
- printf(" - %s %u.%u.%u/%u \"%s\"\n", layer.layerName,
- ExtractMajorVersion(layer.specVersion),
- ExtractMinorVersion(layer.specVersion),
- ExtractPatchVersion(layer.specVersion),
- layer.implementationVersion, layer.description);
- if (!info.layer_extensions[i].empty()) {
- printf(" Extensions [%zu]:\n",
- info.layer_extensions.size());
- PrintExtensions(info.layer_extensions[i], " ");
- }
- }
+ printf("Instance Layers [%zu]:\n", info.layers.size());
+ PrintLayers(info.layers, info.layer_extensions, " ");
}
printf("PhysicalDevices [%zu]:\n", info.gpus.size());