[495/906] glES2.0: properly use glDeleteShader

This commit is contained in:
Julien Isorce 2012-04-18 15:44:05 +02:00 committed by Tim-Philipp Müller
parent 46eea6f943
commit 83b2f12c12
4 changed files with 40 additions and 9 deletions

View file

@ -1918,7 +1918,11 @@ gst_gl_display_on_draw (GstGLDisplay * display)
//make sure that the environnement is clean //make sure that the environnement is clean
if (display->upload_colorspace_conversion == GST_GL_DISPLAY_CONVERSION_GLSL) if (display->upload_colorspace_conversion == GST_GL_DISPLAY_CONVERSION_GLSL)
glUseProgramObjectARB (0); glUseProgramObjectARB (0);
#ifndef OPENGL_ES2
glDisable (GL_TEXTURE_RECTANGLE_ARB); glDisable (GL_TEXTURE_RECTANGLE_ARB);
#endif
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
//check if a client draw callback is registered //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); glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, display->upload_fbo);
//setup a texture to render to //setup a texture to render to
#ifndef OPENGL_ES2
glEnable (GL_TEXTURE_RECTANGLE_ARB); glEnable (GL_TEXTURE_RECTANGLE_ARB);
#endif
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_outtex); glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_outtex);
//attach the texture to the FBO to renderer to //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_position_loc);
glEnableVertexAttribArray (display->shader_upload_attr_texture_loc); glEnableVertexAttribArray (display->shader_upload_attr_texture_loc);
#endif #endif
#ifndef OPENGL_ES2
glEnable (GL_TEXTURE_RECTANGLE_ARB); glEnable (GL_TEXTURE_RECTANGLE_ARB);
#endif
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_intex); glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_intex);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
GL_LINEAR); GL_LINEAR);
@ -3124,9 +3133,8 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
glMatrixMode (GL_PROJECTION); glMatrixMode (GL_PROJECTION);
glLoadIdentity (); glLoadIdentity ();
#endif
glEnable (GL_TEXTURE_RECTANGLE_ARB); glEnable (GL_TEXTURE_RECTANGLE_ARB);
#endif
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_intex); glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_intex);
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
GL_LINEAR); GL_LINEAR);
@ -3334,7 +3342,6 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
glDrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices); glDrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
glUseProgramObjectARB (0); glUseProgramObjectARB (0);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
#endif #endif
switch (video_format) { switch (video_format) {
@ -3379,9 +3386,8 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
glReadBuffer (GL_NONE); glReadBuffer (GL_NONE);
#endif
glDisable (GL_TEXTURE_RECTANGLE_ARB); 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) //without GLSL (whereas rgb is)
glUseProgramObjectARB (0); glUseProgramObjectARB (0);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
#ifndef OPENGL_ES2 #ifndef OPENGL_ES2
glDisable (GL_TEXTURE_RECTANGLE_ARB);
glMatrixMode (GL_PROJECTION); glMatrixMode (GL_PROJECTION);
glPopMatrix (); glPopMatrix ();
glMatrixMode (GL_MODELVIEW); glMatrixMode (GL_MODELVIEW);

View file

@ -308,8 +308,13 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
glGetObjectParameterivARB (priv->vertex_handle, glGetObjectParameterivARB (priv->vertex_handle,
GL_OBJECT_COMPILE_STATUS_ARB, &status); GL_OBJECT_COMPILE_STATUS_ARB, &status);
#ifndef OPENGL_ES2
glGetInfoLogARB (priv->vertex_handle, glGetInfoLogARB (priv->vertex_handle,
sizeof (info_buffer) - 1, &len, info_buffer); sizeof (info_buffer) - 1, &len, info_buffer);
#else
glGetShaderInfoLog (priv->vertex_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#endif
info_buffer[len] = '\0'; info_buffer[len] = '\0';
if (status != GL_TRUE) { if (status != GL_TRUE) {
@ -324,6 +329,8 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
g_debug ("\n%s\n", info_buffer); g_debug ("\n%s\n", info_buffer);
} }
glAttachObjectARB (priv->program_handle, priv->vertex_handle); glAttachObjectARB (priv->program_handle, priv->vertex_handle);
g_debug ("vertex shader attached %ud", priv->vertex_handle);
} }
if (priv->fragment_src) { if (priv->fragment_src) {
@ -337,8 +344,13 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
glGetObjectParameterivARB (priv->fragment_handle, glGetObjectParameterivARB (priv->fragment_handle,
GL_OBJECT_COMPILE_STATUS_ARB, &status); GL_OBJECT_COMPILE_STATUS_ARB, &status);
#ifndef OPENGL_ES2
glGetInfoLogARB (priv->fragment_handle, glGetInfoLogARB (priv->fragment_handle,
sizeof (info_buffer) - 1, &len, info_buffer); sizeof (info_buffer) - 1, &len, info_buffer);
#else
glGetShaderInfoLog (priv->fragment_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#endif
info_buffer[len] = '\0'; info_buffer[len] = '\0';
if (status != GL_TRUE) { if (status != GL_TRUE) {
g_set_error (error, GST_GL_SHADER_ERROR, 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); g_debug ("\n%s\n", info_buffer);
} }
glAttachObjectARB (priv->program_handle, priv->fragment_handle); glAttachObjectARB (priv->program_handle, priv->fragment_handle);
g_debug ("fragment shader attached %ud", priv->fragment_handle);
} }
/* if nothing failed link shaders */ /* if nothing failed link shaders */
glLinkProgramARB (priv->program_handle); glLinkProgramARB (priv->program_handle);
#ifndef OPENGL_ES2
glGetObjectParameterivARB (priv->program_handle, GL_LINK_STATUS, &status); glGetObjectParameterivARB (priv->program_handle, GL_LINK_STATUS, &status);
#else
glGetProgramiv (priv->program_handle, GL_LINK_STATUS, &status);
#endif
glGetInfoLogARB (priv->program_handle, glGetInfoLogARB (priv->program_handle,
sizeof (info_buffer) - 1, &len, info_buffer); 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 if (priv->vertex_handle) { // not needed but nvidia doesn't care to respect the spec
g_debug ("finalizing vertex shader %ud", priv->vertex_handle); g_debug ("finalizing vertex shader %ud", priv->vertex_handle);
#ifndef OPENGL_ES2
glDeleteObjectARB (priv->vertex_handle); glDeleteObjectARB (priv->vertex_handle);
#else
glDeleteShader (priv->vertex_handle);
#endif
/* err = glGetError (); */ /* err = glGetError (); */
/* g_debug ("error: 0x%x", err); */ /* g_debug ("error: 0x%x", err); */
@ -408,7 +430,11 @@ gst_gl_shader_release (GstGLShader * shader)
if (priv->fragment_handle) { if (priv->fragment_handle) {
g_debug ("finalizing fragment shader %ud", priv->fragment_handle); g_debug ("finalizing fragment shader %ud", priv->fragment_handle);
#ifndef OPENGL_ES2
glDeleteObjectARB (priv->fragment_handle); glDeleteObjectARB (priv->fragment_handle);
#else
glDeleteShader (priv->fragment_handle);
#endif
/* err = glGetError (); */ /* err = glGetError (); */
/* g_debug ("error: 0x%x", err); */ /* g_debug ("error: 0x%x", err); */

View file

@ -824,7 +824,7 @@ gst_gl_window_run_loop (GstGLWindow * window)
} }
default: default:
g_debug ("unknow\n"); g_debug ("unknown XEvent type: %ud\n", event.type);
break; break;
} // switch } // switch

View file

@ -878,7 +878,7 @@ gst_gl_window_run_loop (GstGLWindow * window)
} }
default: default:
g_debug ("unknow\n"); g_debug ("unknown XEvent type: %ud\n", event.type);
break; break;
} // switch } // switch