diff --git a/src/gallium/drivers/zink/zink_instance.py b/src/gallium/drivers/zink/zink_instance.py index d0745d810cf..ddabd335023 100644 --- a/src/gallium/drivers/zink/zink_instance.py +++ b/src/gallium/drivers/zink/zink_instance.py @@ -1,14 +1,20 @@ from mako.template import Template from os import path -from zink_extensions import Extension,Layer +from zink_extensions import Extension,Layer,Version import sys EXTENSIONS = [ Extension("VK_EXT_debug_utils"), - Extension("VK_KHR_maintenance2"), - Extension("VK_KHR_get_physical_device_properties2"), - Extension("VK_KHR_draw_indirect_count"), - Extension("VK_KHR_external_memory_capabilities"), + Extension("VK_KHR_maintenance2", + core_since=Version((1, 1, 0))), + Extension("VK_KHR_get_physical_device_properties2", + core_since=Version((1, 1, 0)), + functions=["GetPhysicalDeviceFeatures2", "GetPhysicalDeviceProperties2"]), + Extension("VK_KHR_draw_indirect_count", + core_since=Version((1, 2, 0)), + functions=["CmdDrawIndexedIndirectCount", "CmdDrawIndirectCount"]), + Extension("VK_KHR_external_memory_capabilities", + core_since=Version((1, 1, 0))), Extension("VK_MVK_moltenvk"), ] @@ -89,12 +95,23 @@ zink_create_instance(struct zink_screen *screen) if (extension_props) { if (vkEnumerateInstanceExtensionProperties(NULL, &extension_count, extension_props) == VK_SUCCESS) { for (uint32_t i = 0; i < extension_count; i++) { -%for ext in extensions: - if (!strcmp(extension_props[i].extensionName, ${ext.extension_name_literal()})) { + %for ext in extensions: + %if not ext.core_since: + if (!strcmp(extension_props[i].extensionName, ${ext.extension_name_literal()})) { have_${ext.name_with_vendor()} = true; extensions[num_extensions++] = ${ext.extension_name_literal()}; + } + %else: + if (screen->loader_version < ${ext.core_since.version()}) { + if (!strcmp(extension_props[i].extensionName, ${ext.extension_name_literal()})) { + have_${ext.name_with_vendor()} = true; + extensions[num_extensions++] = ${ext.extension_name_literal()}; + } + } else { + have_${ext.name_with_vendor()} = true; } -%endfor + %endif + %endfor } } free(extension_props); diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 25eaafe1017..2f3967be8e8 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -834,7 +834,8 @@ load_instance_extensions(struct zink_screen *screen) printf("zink: Loader %d.%d.%d \n", VK_VERSION_MAJOR(screen->loader_version), VK_VERSION_MINOR(screen->loader_version), VK_VERSION_PATCH(screen->loader_version)); } - if (screen->instance_info.have_KHR_get_physical_device_properties2) { + if (screen->instance_info.have_KHR_get_physical_device_properties2 && + !(VK_MAKE_VERSION(1,1,0) <= screen->loader_version)) { // Not Vk 1.1+ so if VK_KHR_get_physical_device_properties2 the use it GET_PROC_ADDR_INSTANCE_LOCAL(screen->instance, GetPhysicalDeviceFeatures2KHR); GET_PROC_ADDR_INSTANCE_LOCAL(screen->instance, GetPhysicalDeviceProperties2KHR); @@ -846,7 +847,8 @@ load_instance_extensions(struct zink_screen *screen) GET_PROC_ADDR_INSTANCE(GetPhysicalDeviceProperties2); } - if (screen->instance_info.have_KHR_draw_indirect_count) { + if (screen->instance_info.have_KHR_draw_indirect_count && + !(VK_MAKE_VERSION(1,1,0) <= screen->loader_version)) { GET_PROC_ADDR_INSTANCE_LOCAL(screen->instance, CmdDrawIndirectCountKHR); GET_PROC_ADDR_INSTANCE_LOCAL(screen->instance, CmdDrawIndexedIndirectCountKHR); screen->vk_CmdDrawIndirectCount = vk_CmdDrawIndirectCountKHR;