From: Dave Airlie Date: Wed, 15 Nov 2017 22:46:41 +0000 (+1000) Subject: vulkan/wsi: use function ptr definitions from the spec. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2cbeb32555421ae302222e6e730b412c82742d74;p=mesa.git vulkan/wsi: use function ptr definitions from the spec. This just seems cleaner, and we may expand this in future. Signed-off-by: Dave Airlie Reviewed-by: Jason Ekstrand --- diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c index 64f5b0d0d30..98346cae062 100644 --- a/src/amd/vulkan/radv_wsi.c +++ b/src/amd/vulkan/radv_wsi.c @@ -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 diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c index 08d83cd7f7d..945b01147ea 100644 --- a/src/intel/vulkan/anv_wsi.c +++ b/src/intel/vulkan/anv_wsi.c @@ -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 diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h index 8166b7dd344..7be0182adfa 100644 --- a/src/vulkan/wsi/wsi_common.h +++ b/src/vulkan/wsi/wsi_common.h @@ -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) \ \ diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index 4c94cd60a54..b93c3d7e0d7 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -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;