[713/906] shader: make it possible to create the object in a non-GL thread

This commit is contained in:
Matthew Waters 2013-06-16 20:41:29 +10:00
parent 4801abb13a
commit 09496fc8a1

View file

@ -350,13 +350,6 @@ gst_gl_shader_new (GstGLDisplay * display)
shader = g_object_new (GST_GL_TYPE_SHADER, NULL);
shader->display = gst_object_ref (display);
if (!_fill_vtable (shader, display))
return NULL;
shader->priv->program_handle = shader->priv->vtable.CreateProgram ();
GST_TRACE ("shader initialized %u", shader->priv->program_handle);
return shader;
}
@ -386,6 +379,13 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
if (priv->compiled)
return priv->compiled;
if (!_fill_vtable (shader, shader->display))
return FALSE;
shader->priv->program_handle = shader->priv->vtable.CreateProgram ();
GST_TRACE ("shader created %u", shader->priv->program_handle);
g_return_val_if_fail (priv->program_handle, FALSE);
if (priv->vertex_src) {
@ -480,9 +480,7 @@ gst_gl_shader_release (GstGLShader * shader)
priv = shader->priv;
g_return_if_fail (priv->program_handle);
if (!priv->compiled)
if (!priv->compiled || !priv->program_handle)
return;
if (priv->vertex_handle) { /* not needed but nvidia doesn't care to respect the spec */