summaryrefslogtreecommitdiffstats
path: root/src/vulkan/util/vk_util.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-09 19:17:17 -0800
committerJason Ekstrand <[email protected]>2018-03-07 12:13:47 -0800
commita1ee51309ef7a36aef177ef523260e7b574ce4ab (patch)
tree267de53ebfa686d706644f39394522160971595e /src/vulkan/util/vk_util.c
parentd6b65222df53677e5d3b2f6f42163387725d57b8 (diff)
vulkan/util: Add a helper to get a version override
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/vulkan/util/vk_util.c')
-rw-r--r--src/vulkan/util/vk_util.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vulkan/util/vk_util.c b/src/vulkan/util/vk_util.c
index 769e69062ad..ec95a89078a 100644
--- a/src/vulkan/util/vk_util.c
+++ b/src/vulkan/util/vk_util.c
@@ -47,3 +47,23 @@ uint32_t vk_get_driver_version(void)
}
return VK_MAKE_VERSION(major, minor, patch);
}
+
+uint32_t vk_get_version_override(void)
+{
+ const char *str = getenv("MESA_VK_VERSION_OVERRIDE");
+ if (str == NULL)
+ return 0;
+
+ const char *minor_str = strchr(str, '.');
+ const char *patch_str = minor_str ? strchr(minor_str + 1, '.') : NULL;
+
+ int major = atoi(str);
+ int minor = minor_str ? atoi(minor_str + 1) : 0;
+ int patch = patch_str ? atoi(patch_str + 1) : 0;
+
+ /* Do some basic version sanity checking */
+ if (major < 1 || minor < 0 || patch < 0 || minor > 1023 || patch > 4095)
+ return 0;
+
+ return VK_MAKE_VERSION(major, minor, patch);
+}