zink: rewrite macro for getting KHR device functions
we have the technology. we can improve our our lives with better macros. Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9398>
This commit is contained in:
@@ -1028,10 +1028,8 @@ load_device_extensions(struct zink_screen *screen)
|
||||
}
|
||||
|
||||
if (screen->info.have_KHR_draw_indirect_count) {
|
||||
GET_PROC_ADDR_DEVICE_LOCAL(CmdDrawIndexedIndirectCountKHR);
|
||||
screen->vk_CmdDrawIndexedIndirectCount = vk_CmdDrawIndexedIndirectCountKHR;
|
||||
GET_PROC_ADDR_DEVICE_LOCAL(CmdDrawIndirectCountKHR);
|
||||
screen->vk_CmdDrawIndirectCount = vk_CmdDrawIndirectCountKHR;
|
||||
GET_PROC_ADDR_KHR(CmdDrawIndexedIndirectCount);
|
||||
GET_PROC_ADDR_KHR(CmdDrawIndirectCount);
|
||||
}
|
||||
|
||||
if (screen->info.have_EXT_calibrated_timestamps) {
|
||||
|
@@ -147,6 +147,14 @@ zink_is_depth_format_supported(struct zink_screen *screen, VkFormat format);
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define GET_PROC_ADDR_KHR(x) do { \
|
||||
screen->vk_##x = (PFN_vk##x)vkGetDeviceProcAddr(screen->dev, "vk"#x"KHR"); \
|
||||
if (!screen->vk_##x) { \
|
||||
mesa_loge("ZINK: vkGetDeviceProcAddr failed: vk"#x"KHR\n"); \
|
||||
return false; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define GET_PROC_ADDR_INSTANCE(x) do { \
|
||||
screen->vk_##x = (PFN_vk##x)vkGetInstanceProcAddr(screen->instance, "vk"#x); \
|
||||
if (!screen->vk_##x) { \
|
||||
@@ -155,7 +163,6 @@ zink_is_depth_format_supported(struct zink_screen *screen, VkFormat format);
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define GET_PROC_ADDR_DEVICE_LOCAL(x) PFN_vk##x vk_##x = (PFN_vk##x)vkGetDeviceProcAddr(screen->dev, "vk"#x)
|
||||
#define GET_PROC_ADDR_INSTANCE_LOCAL(instance, x) PFN_vk##x vk_##x = (PFN_vk##x)vkGetInstanceProcAddr(instance, "vk"#x)
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user