gl: initialize output params to 0 before calling gl functions
authorJulien Isorce <j.isorce@samsung.com>
Thu, 2 Jul 2015 09:26:18 +0000 (10:26 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:05 +0000 (19:32 +0000)
The client side API of the Chromium's GPU Process has asserts
in debug mode that check that output params are initialized to 0.

gst-libs/gst/gl/gstglcolorconvert.c
gst-libs/gst/gl/gstglcontext.c
gst-libs/gst/gl/gstglframebuffer.c
gst-libs/gst/gl/gstglshader.c
gst-libs/gst/gl/gstglviewconvert.c

index da903f4..549db48 100644 (file)
@@ -1714,7 +1714,7 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert)
   guint out_width, out_height;
   gint i;
 
-  GLint viewport_dim[4];
+  GLint viewport_dim[4] = { 0 };
 
   GLenum multipleRT[] = {
     GL_COLOR_ATTACHMENT0,
index 637ecdf..b25738c 100644 (file)
@@ -1179,7 +1179,8 @@ _build_extension_string (GstGLContext * context)
   const GstGLFuncs *gl = context->gl_vtable;
   GString *ext_g_str = g_string_sized_new (1024);
   const gchar *ext_const_c_str = NULL;
-  int i, n;
+  GLint i = 0;
+  GLint n = 0;
 
   gl->GetIntegerv (GL_NUM_EXTENSIONS, &n);
 
index 7e958ca..fb706f5 100644 (file)
@@ -173,7 +173,7 @@ gst_gl_framebuffer_use_v2 (GstGLFramebuffer * frame, gint texture_fbo_width,
     GLuint texture_fbo, GLCB_V2 cb, gpointer stuff)
 {
   const GstGLFuncs *gl;
-  GLint viewport_dim[4];
+  GLint viewport_dim[4] = { 0 };
 
   g_return_val_if_fail (GST_IS_GL_FRAMEBUFFER (frame), FALSE);
   g_return_val_if_fail (texture_fbo_width > 0 && texture_fbo_height > 0, FALSE);
index 016e475..a41bf38 100644 (file)
@@ -522,6 +522,7 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
     /* compile */
     gl->CompileShader (priv->vertex_handle);
     /* check everything is ok */
+    status = GL_FALSE;
     gl->GetShaderiv (priv->vertex_handle, GL_COMPILE_STATUS, &status);
 
     priv->vtable.GetShaderInfoLog (priv->vertex_handle,
@@ -561,6 +562,7 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
     /* compile */
     gl->CompileShader (priv->fragment_handle);
     /* check everything is ok */
+    status = GL_FALSE;
     priv->vtable.GetShaderiv (priv->fragment_handle,
         GL_COMPILE_STATUS, &status);
 
@@ -587,6 +589,7 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
 
   /* if nothing failed link shaders */
   gl->LinkProgram (priv->program_handle);
+  status = GL_FALSE;
   priv->vtable.GetProgramiv (priv->program_handle, GL_LINK_STATUS, &status);
 
   priv->vtable.GetProgramInfoLog (priv->program_handle,
index f48e3a5..ebe4ed3 100644 (file)
@@ -1586,7 +1586,7 @@ _do_view_convert_draw (GstGLContext * context, GstGLViewConvert * viewconvert)
   GstGLFuncs *gl;
   guint out_width, out_height;
   gint out_views, i;
-  GLint viewport_dim[4];
+  GLint viewport_dim[4] = { 0 };
   GLenum multipleRT[] = {
     GL_COLOR_ATTACHMENT0,
     GL_COLOR_ATTACHMENT1,