summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/wsi/wsi_common.h20
-rw-r--r--src/vulkan/wsi/wsi_common_wayland.c2
-rw-r--r--src/vulkan/wsi/wsi_common_x11.c4
3 files changed, 22 insertions, 4 deletions
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index a1f5a40186c..394b8fa1914 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -116,9 +116,27 @@ struct wsi_callbacks {
return (__VkType)(uintptr_t) _obj; \
}
-WSI_DEFINE_NONDISP_HANDLE_CASTS(_VkIcdSurfaceBase, VkSurfaceKHR)
WSI_DEFINE_NONDISP_HANDLE_CASTS(wsi_swapchain, VkSwapchainKHR)
+#define ICD_DEFINE_NONDISP_HANDLE_CASTS(__VkIcdType, __VkType) \
+ \
+ static inline __VkIcdType * \
+ __VkIcdType ## _from_handle(__VkType _handle) \
+ { \
+ return (__VkIcdType *)(uintptr_t) _handle; \
+ } \
+ \
+ static inline __VkType \
+ __VkIcdType ## _to_handle(__VkIcdType *_obj) \
+ { \
+ return (__VkType)(uintptr_t) _obj; \
+ }
+
+#define ICD_FROM_HANDLE(__VkIcdType, __name, __handle) \
+ __VkIcdType *__name = __VkIcdType ## _from_handle(__handle)
+
+ICD_DEFINE_NONDISP_HANDLE_CASTS(VkIcdSurfaceBase, VkSurfaceKHR)
+
VkResult wsi_x11_init_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 2fe889ecc2a..687ac9c731b 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -463,7 +463,7 @@ VkResult wsi_create_wl_surface(const VkAllocationCallbacks *pAllocator,
surface->display = pCreateInfo->display;
surface->surface = pCreateInfo->surface;
- *pSurface = _VkIcdSurfaceBase_to_handle(&surface->base);
+ *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
return VK_SUCCESS;
}
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 71268388484..158446c2ca7 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -453,7 +453,7 @@ VkResult wsi_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
surface->connection = pCreateInfo->connection;
surface->window = pCreateInfo->window;
- *pSurface = _VkIcdSurfaceBase_to_handle(&surface->base);
+ *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
return VK_SUCCESS;
}
@@ -472,7 +472,7 @@ VkResult wsi_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
surface->dpy = pCreateInfo->dpy;
surface->window = pCreateInfo->window;
- *pSurface = _VkIcdSurfaceBase_to_handle(&surface->base);
+ *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
return VK_SUCCESS;
}