Mesa (master): zink/codegen: enable instance extension unconditionally if promoted
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Jan 17 15:31:08 UTC 2021
Module: Mesa
Branch: master
Commit: c0259e5c6eea1252eec63e8116ea7d17c743e77e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c0259e5c6eea1252eec63e8116ea7d17c743e77e
Author: Hoe Hao Cheng <haochengho12907 at gmail.com>
Date: Fri Jan 15 17:13:51 2021 +0800
zink/codegen: enable instance extension unconditionally if promoted
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8521>
---
src/gallium/drivers/zink/zink_instance.py | 33 +++++++++++++++++++++++--------
src/gallium/drivers/zink/zink_screen.c | 6 ++++--
2 files changed, 29 insertions(+), 10 deletions(-)
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;
More information about the mesa-commit
mailing list