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 <airlied@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Dave Airlie 2017-11-16 08:46:41 +10:00 committed by Jason Ekstrand
parent 55a97db523
commit 2cbeb32555
4 changed files with 8 additions and 6 deletions

View 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

View 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

View 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) \
\

View 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;