aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2020-05-08 12:07:48 +0200
committerMarge Bot <[email protected]>2020-05-11 09:09:34 +0000
commit5c7dea394fc21d455cd00dff3d3881276427fc47 (patch)
tree4751209a304a3325b0522956ec8615c0fac5a1a4 /src
parentb8fd70eef2cb5936e8ccb4d237e50084d6ff2a7c (diff)
zink: add a GET_PROC_ADDR macro to simplify load_device_extensions
This doesn't do much for now, but it will keep thing cleaner in the next commit. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4835>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/zink/zink_screen.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index fae39c6ec1b..53db925192d 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -707,11 +707,16 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen,
static bool
load_device_extensions(struct zink_screen *screen)
{
- if (screen->have_KHR_external_memory_fd) {
- screen->vk_GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR)vkGetDeviceProcAddr(screen->dev, "vkGetMemoryFdKHR");
- if (!screen->vk_GetMemoryFdKHR)
- return false;
- }
+#define GET_PROC_ADDR(x) do { \
+ screen->vk_##x = (PFN_vk##x)vkGetDeviceProcAddr(screen->dev, "vk"#x); \
+ if (!screen->vk_##x) \
+ return false; \
+ } while (0)
+
+ if (screen->have_KHR_external_memory_fd)
+ GET_PROC_ADDR(GetMemoryFdKHR);
+
+#undef GET_PROC_ADDR
return true;
}