diff options
author | Matthew Waters <matthew@centricular.com> | 2016-01-07 14:02:52 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2016-01-07 14:11:13 +1100 |
commit | 2aadd7eaf9e417afdd7040781c64fe6cd92d4d01 (patch) | |
tree | 64b1db0aa494cc944c9b00929859242aa2fd8c87 /tests | |
parent | 17f0faa368fa8cfb542819fd8af5f5f418ecb7d4 (diff) | |
download | gstreamer-plugins-bad-2aadd7eaf9e417afdd7040781c64fe6cd92d4d01.tar.gz |
glcontext: implement checking whether a context has been shared
Some operations are unnecessary when running with only a single GL
context.
e.g. glFlush when setting a fence object as the flush happens on wait.
API: gst_gl_context_is_shared
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/libs/gstglcontext.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/check/libs/gstglcontext.c b/tests/check/libs/gstglcontext.c index edbf9f90f..e626f2a7d 100644 --- a/tests/check/libs/gstglcontext.c +++ b/tests/check/libs/gstglcontext.c @@ -489,6 +489,34 @@ GST_START_TEST (test_context_can_share) GST_END_TEST; +GST_START_TEST (test_is_shared) +{ + GstGLContext *c1, *c2; + GError *error = NULL; + + c1 = gst_gl_context_new (display); + gst_gl_context_create (c1, NULL, &error); + fail_if (error != NULL, "Error creating context %s\n", + error ? error->message : "Unknown Error"); + + c2 = gst_gl_context_new (display); + gst_gl_context_create (c2, c1, &error); + fail_if (error != NULL, "Error creating context %s\n", + error ? error->message : "Unknown Error"); + + fail_unless (gst_gl_context_is_shared (c1)); + fail_unless (gst_gl_context_is_shared (c2)); + + gst_object_unref (c2); + c2 = NULL; + + fail_unless (!gst_gl_context_is_shared (c1)); + + gst_object_unref (c1); +} + +GST_END_TEST; + static Suite * gst_gl_context_suite (void) { @@ -501,6 +529,7 @@ gst_gl_context_suite (void) tcase_add_test (tc_chain, test_wrapped_context); tcase_add_test (tc_chain, test_current_context); tcase_add_test (tc_chain, test_context_can_share); + tcase_add_test (tc_chain, test_is_shared); return s; } |