gl/tests: fix shader creation tests

We check the availability of the high precision floats in GLSL shaders
which involves an OpenGL call and thus is required to be executed on the
OpenGL thread.

The tests were not respecting that and could fail on more strict
drivers.

Tests update for 675415bf2e
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/590
This commit is contained in:
Matthew Waters 2019-06-07 20:51:39 +10:00
parent 944396af33
commit 4fd7a2c783
2 changed files with 14 additions and 6 deletions

View file

@ -104,7 +104,6 @@ teardown (void)
GST_START_TEST (test_constructors)
{
GstBufferPool *pool = NULL;
GstGLShader *shader = NULL;
GstGLSLStage *stage = NULL;
GstGLColorConvert *convert = NULL;
GstGLOverlayCompositor *compositor = NULL;
@ -114,10 +113,6 @@ GST_START_TEST (test_constructors)
fail_if (pool == NULL);
gst_object_unref (pool);
shader = gst_gl_shader_new (context);
fail_if (shader == NULL);
gst_object_unref (shader);
stage = gst_glsl_stage_new_default_fragment (context);
fail_if (stage == NULL);
gst_object_unref (stage);
@ -141,10 +136,15 @@ static void
_construct_with_activated_context (GstGLContext * context, gpointer unused)
{
GstGLFramebuffer *framebuffer = NULL;
GstGLShader *shader = NULL;
framebuffer = gst_gl_framebuffer_new (context);
fail_if (framebuffer == NULL);
gst_object_unref (framebuffer);
shader = gst_gl_shader_new (context);
fail_if (shader == NULL);
gst_object_unref (shader);
}
GST_START_TEST (test_constructors_require_activated_context)

View file

@ -68,12 +68,20 @@ GST_START_TEST (test_default_vertex)
GST_END_TEST;
static void
create_frag_shader (GstGLContext * context, GstGLSLStage ** stage)
{
*stage = gst_glsl_stage_new_default_fragment (context);
}
GST_START_TEST (test_default_fragment)
{
GstGLSLStage *stage;
GError *error = NULL;
stage = gst_glsl_stage_new_default_fragment (context);
gst_gl_context_thread_add (context,
(GstGLContextThreadFunc) create_frag_shader, &stage);
fail_unless (stage != NULL);
fail_unless (GL_FRAGMENT_SHADER == gst_glsl_stage_get_shader_type (stage));