vulkan,docs: Document vk_device
authorJason Ekstrand <jason.ekstrand@collabora.com>
Tue, 22 Mar 2022 22:20:06 +0000 (17:20 -0500)
committerMarge Bot <emma+marge@anholt.net>
Thu, 7 Apr 2022 16:32:21 +0000 (16:32 +0000)
Acked-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15472>

docs/vulkan/base-objs.rst
src/vulkan/runtime/vk_device.h

index b16a2f7..b3ba9bd 100644 (file)
@@ -173,3 +173,12 @@ vk_physical_device
 
 .. doxygenfunction:: vk_physical_device_init
 .. doxygenfunction:: vk_physical_device_finish
+
+vk_device
+------------------
+
+.. doxygenstruct:: vk_device
+   :members:
+
+.. doxygenfunction:: vk_device_init
+.. doxygenfunction:: vk_device_finish
index d1dc154..b45501c 100644 (file)
@@ -254,8 +254,27 @@ struct vk_device {
 };
 
 VK_DEFINE_HANDLE_CASTS(vk_device, base, VkDevice,
-                       VK_OBJECT_TYPE_DEVICE)
+                       VK_OBJECT_TYPE_DEVICE);
 
+/** Initialize a vk_device
+ *
+ * Along with initializing the data structures in `vk_device`, this function
+ * checks that every extension specified by
+ * `VkInstanceCreateInfo::ppEnabledExtensionNames` is actually supported by
+ * the physical device and returns `VK_ERROR_EXTENSION_NOT_PRESENT` if an
+ * unsupported extension is requested.  It also checks all the feature struct
+ * chained into the `pCreateInfo->pNext` chain against the features returned
+ * by `vkGetPhysicalDeviceFeatures2` and returns
+ * `VK_ERROR_FEATURE_NOT_PRESENT` if an unsupported feature is requested.
+ *
+ * @param[out] device               The device to initialize
+ * @param[in]  physical_device      The physical device
+ * @param[in]  dispatch_table       Device-level dispatch table
+ * @param[in]  pCreateInfo          VkDeviceCreateInfo pointer passed to
+ *                                  `vkCreateDevice()`
+ * @param[in]  alloc                Allocation callbacks passed to
+ *                                  `vkCreateDevice()`
+ */
 VkResult MUST_CHECK
 vk_device_init(struct vk_device *device,
                struct vk_physical_device *physical_device,
@@ -269,6 +288,10 @@ vk_device_set_drm_fd(struct vk_device *device, int drm_fd)
    device->drm_fd = drm_fd;
 }
 
+/** Tears down a vk_device
+ *
+ * @param[out] device               The device to tear down
+ */
 void
 vk_device_finish(struct vk_device *device);