vulkan/wsi: Make wsi_swapchain inherit from vk_object_base
[mesa.git] / src / vulkan / wsi / wsi_common_private.h
index 88c360a2409066e1b98c0c852dba016d214703a0..4b569d54704805699c7f491fa83bc4d8dd56cca2 100644 (file)
@@ -24,6 +24,7 @@
 #define WSI_COMMON_PRIVATE_H
 
 #include "wsi_common.h"
+#include "vulkan/util/vk_object.h"
 
 struct wsi_image {
    VkImage image;
@@ -44,6 +45,8 @@ struct wsi_image {
 };
 
 struct wsi_swapchain {
+   struct vk_object_base base;
+
    const struct wsi_device *wsi;
 
    VkDevice device;
@@ -158,23 +161,7 @@ void
 wsi_display_finish_wsi(struct wsi_device *wsi_device,
                        const VkAllocationCallbacks *alloc);
 
-#define WSI_DEFINE_NONDISP_HANDLE_CASTS(__wsi_type, __VkType)              \
-                                                                           \
-   static inline struct __wsi_type *                                       \
-   __wsi_type ## _from_handle(__VkType _handle)                            \
-   {                                                                       \
-      return (struct __wsi_type *)(uintptr_t) _handle;                     \
-   }                                                                       \
-                                                                           \
-   static inline __VkType                                                  \
-   __wsi_type ## _to_handle(struct __wsi_type *_obj)                       \
-   {                                                                       \
-      return (__VkType)(uintptr_t) _obj;                                   \
-   }
-
-#define WSI_FROM_HANDLE(__wsi_type, __name, __handle) \
-   struct __wsi_type *__name = __wsi_type ## _from_handle(__handle)
-
-WSI_DEFINE_NONDISP_HANDLE_CASTS(wsi_swapchain, VkSwapchainKHR)
+VK_DEFINE_NONDISP_HANDLE_CASTS(wsi_swapchain, base, VkSwapchainKHR,
+                               VK_OBJECT_TYPE_SWAPCHAIN_KHR)
 
 #endif /* WSI_COMMON_PRIVATE_H */