mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
venus: avoid strcmp for spec version override
Add VN_EXTENSION_TABLE_INDEX for use with VK_ANDROID_native_buffer spec version override. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>
This commit is contained in:
parent
14ce47e04a
commit
c44225c20b
1 changed files with 13 additions and 7 deletions
|
|
@ -37,6 +37,11 @@
|
|||
#define VN_MAX_API_VERSION VK_MAKE_VERSION(1, 2, VK_HEADER_VERSION)
|
||||
#endif
|
||||
|
||||
#define VN_EXTENSION_TABLE_INDEX(tbl, ext) \
|
||||
((const bool *)((const void *)(&(tbl)) + \
|
||||
offsetof(__typeof__(tbl), ext)) - \
|
||||
(tbl).extensions)
|
||||
|
||||
/*
|
||||
* Instance extensions add instance-level or physical-device-level
|
||||
* functionalities. It seems renderer support is either unnecessary or
|
||||
|
|
@ -1523,13 +1528,6 @@ vn_physical_device_init_supported_extensions(
|
|||
if (supported.extensions[i]) {
|
||||
physical_dev->base.base.supported_extensions.extensions[i] = true;
|
||||
physical_dev->extension_spec_versions[i] = props->specVersion;
|
||||
#ifdef ANDROID
|
||||
/* override VK_ANDROID_native_buffer spec version */
|
||||
if (!strcmp(props->extensionName,
|
||||
VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME))
|
||||
physical_dev->extension_spec_versions[i] =
|
||||
VN_ANDROID_NATIVE_BUFFER_SPEC_VERSION;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1545,6 +1543,14 @@ vn_physical_device_init_supported_extensions(
|
|||
physical_dev->extension_spec_versions[i] =
|
||||
MIN2(physical_dev->extension_spec_versions[i], props->specVersion);
|
||||
}
|
||||
|
||||
/* override VK_ANDROID_native_buffer spec version */
|
||||
if (supported.ANDROID_native_buffer) {
|
||||
const uint32_t index =
|
||||
VN_EXTENSION_TABLE_INDEX(supported, ANDROID_native_buffer);
|
||||
physical_dev->extension_spec_versions[index] =
|
||||
VN_ANDROID_NATIVE_BUFFER_SPEC_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue