vulkan/instance: allow the requested api version to be larger than the supported

Since Vulkan 1.1, the requested API version is the maximum API version that the
application is expecting to use. It is also possible for individual devices
(backed by potentially different drivers) may support a higher or lower API
version than the instance.  Both cases (higher and lower) should be supported
and as such, it is not an error to request an API version that is larger than
the instance supported API version.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
This commit is contained in:
Matthew Waters 2025-02-25 21:04:35 +11:00 committed by GStreamer Marge Bot
parent 156b05d52b
commit 7452589ff8

View file

@ -882,7 +882,12 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
requested_instance_api = priv->supported_instance_api; requested_instance_api = priv->supported_instance_api;
} }
if (requested_instance_api > priv->supported_instance_api) { /* Since Vulkan 1.1, it is possible to have an instance API version that is
* less than a device supported API. As such, requesting a higher API version
* is no longer an error.
*/
if (priv->supported_instance_api < VK_MAKE_VERSION (1, 1, 0)
&& requested_instance_api > priv->supported_instance_api) {
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED, g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
"Requested API version (%u.%u) is larger than the maximum supported " "Requested API version (%u.%u) is larger than the maximum supported "
"version (%u.%u)", VK_VERSION_MAJOR (requested_instance_api), "version (%u.%u)", VK_VERSION_MAJOR (requested_instance_api),