diff options
author | Matthew Waters <matthew@centricular.com> | 2020-06-14 21:00:06 +1000 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-06-21 09:30:29 +0000 |
commit | 0e72318515572a8bf1027decd4066b91963d786e (patch) | |
tree | 79e46038be629600a5db02cf6277f5d3f61de2ac /tests/check/libs | |
parent | 91b8ec1f0adaaa644b03c5064470cb142fc0a3ae (diff) | |
download | gstreamer-plugins-bad-0e72318515572a8bf1027decd4066b91963d786e.tar.gz |
vulkan/instance: expose extension/layer choices
Extensions and layers can be enabled before calling
gst_vulkan_instance_open() but after calling
gst_vulkan_instance_fill_info().
Use the list of available extensions to better choose a default display
implementation to use based on the available Vulkan extensions for surface
output.
Defaults are still the same.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
Diffstat (limited to 'tests/check/libs')
-rw-r--r-- | tests/check/libs/vkinstance.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/check/libs/vkinstance.c b/tests/check/libs/vkinstance.c index 2d989dc65..b07efc5dc 100644 --- a/tests/check/libs/vkinstance.c +++ b/tests/check/libs/vkinstance.c @@ -107,6 +107,43 @@ GST_START_TEST (test_instance_request_version) GST_END_TEST; +GST_START_TEST (test_instance_enable_extension) +{ + GstVulkanInstance *instance; + /* test with a very common extension */ + const gchar *test_ext_name = VK_KHR_SURFACE_EXTENSION_NAME; + + instance = gst_vulkan_instance_new (); + fail_unless (instance != NULL); + fail_unless (gst_vulkan_instance_fill_info (instance, NULL)); + + /* only run the test if the extension is available. otherwise, skip. */ + if (gst_vulkan_instance_get_extension_info (instance, test_ext_name, NULL)) { + /* ensure it has been disabled */ + if (gst_vulkan_instance_is_extension_enabled (instance, test_ext_name)) + gst_vulkan_instance_disable_extension (instance, test_ext_name); + + fail_unless (gst_vulkan_instance_enable_extension (instance, + test_ext_name)); + fail_unless (gst_vulkan_instance_is_extension_enabled (instance, + test_ext_name)); + fail_unless (gst_vulkan_instance_disable_extension (instance, + test_ext_name)); + fail_unless (!gst_vulkan_instance_is_extension_enabled (instance, + test_ext_name)); + + fail_unless (gst_vulkan_instance_enable_extension (instance, + test_ext_name)); + fail_unless (gst_vulkan_instance_open (instance, NULL)); + fail_unless (gst_vulkan_instance_is_extension_enabled (instance, + test_ext_name)); + } + + gst_object_unref (instance); +} + +GST_END_TEST; + static Suite * vkinstance_suite (void) { @@ -128,10 +165,10 @@ vkinstance_suite (void) tcase_add_test (tc_basic, test_instance_open); tcase_add_test (tc_basic, test_instance_default_max_version); tcase_add_test (tc_basic, test_instance_request_version); + tcase_add_test (tc_basic, test_instance_enable_extension); } return s; } - GST_CHECK_MAIN (vkinstance); |