mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
[495/906] glES2.0: properly use glDeleteShader
This commit is contained in:
parent
7e45f26a21
commit
a1649a497a
4 changed files with 40 additions and 9 deletions
|
@ -1918,7 +1918,11 @@ gst_gl_display_on_draw (GstGLDisplay * display)
|
|||
//make sure that the environnement is clean
|
||||
if (display->upload_colorspace_conversion == GST_GL_DISPLAY_CONVERSION_GLSL)
|
||||
glUseProgramObjectARB (0);
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
glDisable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
#endif
|
||||
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
//check if a client draw callback is registered
|
||||
|
@ -2982,7 +2986,9 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
|
|||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, display->upload_fbo);
|
||||
|
||||
//setup a texture to render to
|
||||
#ifndef OPENGL_ES2
|
||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
#endif
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_outtex);
|
||||
|
||||
//attach the texture to the FBO to renderer to
|
||||
|
@ -3040,7 +3046,10 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
|
|||
glEnableVertexAttribArray (display->shader_upload_attr_position_loc);
|
||||
glEnableVertexAttribArray (display->shader_upload_attr_texture_loc);
|
||||
#endif
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
#endif
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_intex);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
|
||||
GL_LINEAR);
|
||||
|
@ -3124,9 +3133,8 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
|
|||
#ifndef OPENGL_ES2
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glLoadIdentity ();
|
||||
#endif
|
||||
|
||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
#endif
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_intex);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
|
||||
GL_LINEAR);
|
||||
|
@ -3334,7 +3342,6 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
|
|||
glDrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
|
||||
|
||||
glUseProgramObjectARB (0);
|
||||
glDisable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
#endif
|
||||
|
||||
switch (video_format) {
|
||||
|
@ -3379,9 +3386,8 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
|
|||
|
||||
#ifndef OPENGL_ES2
|
||||
glReadBuffer (GL_NONE);
|
||||
#endif
|
||||
|
||||
glDisable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -3560,9 +3566,8 @@ gst_gl_display_thread_do_download_draw_yuv (GstGLDisplay * display)
|
|||
//without GLSL (whereas rgb is)
|
||||
glUseProgramObjectARB (0);
|
||||
|
||||
glDisable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
glDisable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPopMatrix ();
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
|
|
|
@ -308,8 +308,13 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
|
|||
glGetObjectParameterivARB (priv->vertex_handle,
|
||||
GL_OBJECT_COMPILE_STATUS_ARB, &status);
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
glGetInfoLogARB (priv->vertex_handle,
|
||||
sizeof (info_buffer) - 1, &len, info_buffer);
|
||||
#else
|
||||
glGetShaderInfoLog (priv->vertex_handle,
|
||||
sizeof (info_buffer) - 1, &len, info_buffer);
|
||||
#endif
|
||||
info_buffer[len] = '\0';
|
||||
|
||||
if (status != GL_TRUE) {
|
||||
|
@ -324,6 +329,8 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
|
|||
g_debug ("\n%s\n", info_buffer);
|
||||
}
|
||||
glAttachObjectARB (priv->program_handle, priv->vertex_handle);
|
||||
|
||||
g_debug ("vertex shader attached %ud", priv->vertex_handle);
|
||||
}
|
||||
|
||||
if (priv->fragment_src) {
|
||||
|
@ -337,8 +344,13 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
|
|||
glGetObjectParameterivARB (priv->fragment_handle,
|
||||
GL_OBJECT_COMPILE_STATUS_ARB, &status);
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
glGetInfoLogARB (priv->fragment_handle,
|
||||
sizeof (info_buffer) - 1, &len, info_buffer);
|
||||
#else
|
||||
glGetShaderInfoLog (priv->fragment_handle,
|
||||
sizeof (info_buffer) - 1, &len, info_buffer);
|
||||
#endif
|
||||
info_buffer[len] = '\0';
|
||||
if (status != GL_TRUE) {
|
||||
g_set_error (error, GST_GL_SHADER_ERROR,
|
||||
|
@ -352,12 +364,18 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
|
|||
g_debug ("\n%s\n", info_buffer);
|
||||
}
|
||||
glAttachObjectARB (priv->program_handle, priv->fragment_handle);
|
||||
|
||||
g_debug ("fragment shader attached %ud", priv->fragment_handle);
|
||||
}
|
||||
|
||||
/* if nothing failed link shaders */
|
||||
glLinkProgramARB (priv->program_handle);
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
glGetObjectParameterivARB (priv->program_handle, GL_LINK_STATUS, &status);
|
||||
#else
|
||||
glGetProgramiv (priv->program_handle, GL_LINK_STATUS, &status);
|
||||
#endif
|
||||
|
||||
glGetInfoLogARB (priv->program_handle,
|
||||
sizeof (info_buffer) - 1, &len, info_buffer);
|
||||
|
@ -397,7 +415,11 @@ gst_gl_shader_release (GstGLShader * shader)
|
|||
if (priv->vertex_handle) { // not needed but nvidia doesn't care to respect the spec
|
||||
g_debug ("finalizing vertex shader %ud", priv->vertex_handle);
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
glDeleteObjectARB (priv->vertex_handle);
|
||||
#else
|
||||
glDeleteShader (priv->vertex_handle);
|
||||
#endif
|
||||
|
||||
/* err = glGetError (); */
|
||||
/* g_debug ("error: 0x%x", err); */
|
||||
|
@ -408,7 +430,11 @@ gst_gl_shader_release (GstGLShader * shader)
|
|||
if (priv->fragment_handle) {
|
||||
g_debug ("finalizing fragment shader %ud", priv->fragment_handle);
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
glDeleteObjectARB (priv->fragment_handle);
|
||||
#else
|
||||
glDeleteShader (priv->fragment_handle);
|
||||
#endif
|
||||
|
||||
/* err = glGetError (); */
|
||||
/* g_debug ("error: 0x%x", err); */
|
||||
|
|
|
@ -824,7 +824,7 @@ gst_gl_window_run_loop (GstGLWindow * window)
|
|||
}
|
||||
|
||||
default:
|
||||
g_debug ("unknow\n");
|
||||
g_debug ("unknown XEvent type: %ud\n", event.type);
|
||||
break;
|
||||
|
||||
} // switch
|
||||
|
|
|
@ -878,7 +878,7 @@ gst_gl_window_run_loop (GstGLWindow * window)
|
|||
}
|
||||
|
||||
default:
|
||||
g_debug ("unknow\n");
|
||||
g_debug ("unknown XEvent type: %ud\n", event.type);
|
||||
break;
|
||||
|
||||
} // switch
|
||||
|
|
Loading…
Reference in a new issue