vulkan/wsi: use function ptr definitions from the spec.
authorDave Airlie <airlied@redhat.com>
Wed, 15 Nov 2017 22:46:41 +0000 (08:46 +1000)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 4 Dec 2017 18:04:19 +0000 (10:04 -0800)
This just seems cleaner, and we may expand this in future.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/amd/vulkan/radv_wsi.c
src/intel/vulkan/anv_wsi.c
src/vulkan/wsi/wsi_common.h
src/vulkan/wsi/wsi_common_wayland.c

index 64f5b0d0d30499f4690e1b68054d85feba1e984e..98346cae0625377b9ac22499b68969088b9b301b 100644 (file)
@@ -29,8 +29,9 @@
 #include "vk_util.h"
 #include "util/macros.h"
 
+#define WSI_CB(x) .x = radv_##x
 MAYBE_UNUSED static const struct wsi_callbacks wsi_cbs = {
-   .get_phys_device_format_properties = radv_GetPhysicalDeviceFormatProperties,
+       WSI_CB(GetPhysicalDeviceFormatProperties),
 };
 
 VkResult
index 08d83cd7f7d38e1efa24ac30c0d46cd5c1137fea..945b01147eaffffe6acfffd7dc31f08b4f292057 100644 (file)
@@ -27,8 +27,9 @@
 #include "vk_util.h"
 
 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
+#define WSI_CB(x) .x = anv_##x
 static const struct wsi_callbacks wsi_cbs = {
-   .get_phys_device_format_properties = anv_GetPhysicalDeviceFormatProperties,
+   WSI_CB(GetPhysicalDeviceFormatProperties),
 };
 #endif
 
index 8166b7dd3441eaae89720805741b9bbd1cfc5c54..7be0182adfa23d814848f9a72d15be33897aa391 100644 (file)
@@ -118,11 +118,11 @@ struct wsi_device {
     struct wsi_interface *                  wsi[VK_ICD_WSI_PLATFORM_MAX];
 };
 
+#define WSI_CB(cb) PFN_vk##cb cb
 struct wsi_callbacks {
-   void (*get_phys_device_format_properties)(VkPhysicalDevice physicalDevice,
-                                             VkFormat format,
-                                             VkFormatProperties *pFormatProperties);
+   WSI_CB(GetPhysicalDeviceFormatProperties);
 };
+#undef WSI_CB
 
 #define WSI_DEFINE_NONDISP_HANDLE_CASTS(__wsi_type, __VkType)              \
                                                                            \
index 4c94cd60a5412f300b4e5a057fe3c4a0b9e5b6aa..b93c3d7e0d711716efa9a5aaaccd828cc98d794b 100644 (file)
@@ -84,7 +84,7 @@ wsi_wl_display_add_vk_format(struct wsi_wl_display *display, VkFormat format)
    /* Don't add formats that aren't renderable. */
    VkFormatProperties props;
 
-   display->wsi_wl->cbs->get_phys_device_format_properties(display->wsi_wl->physical_device,
+   display->wsi_wl->cbs->GetPhysicalDeviceFormatProperties(display->wsi_wl->physical_device,
                                                            format, &props);
    if (!(props.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT))
       return;