[vlc-commits] [Git][videolan/vlc][master] 6 commits: opengl: filter_draw: add assertion for GL errors

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Apr 3 14:22:31 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
55e0a35a by Alexandre Janniaux at 2023-04-03T14:02:28+00:00
opengl: filter_draw: add assertion for GL errors

Ensure that draw commands are not leading to any error later in the
pipeline.

- - - - -
8f9ec06e by Alexandre Janniaux at 2023-04-03T14:02:28+00:00
opengl: filter_mock: add assertions for GL errors

Ensure that draw commands are not leading to any error later in the
pipeline.

- - - - -
8bc819a2 by Alexandre Janniaux at 2023-04-03T14:02:28+00:00
opengl: interop: add assertions for GL errors

Ensure that draw commands are not leading to any error later in the
pipeline.

- - - - -
9f1683bd by Alexandre Janniaux at 2023-04-03T14:02:28+00:00
opengl: renderer: add assertions for GL errors

Ensure that draw commands are not leading to any error later in the
pipeline.

- - - - -
e0f4d15e by Alexandre Janniaux at 2023-04-03T14:02:28+00:00
opengl: interop: handle GLES2 case during runtime

Fix a future issue when using the code against a GLES2 provider, where
the detection was done at build time instead of runtime. The build time
check is needed to prevent using non-existant function and defines, but
the runtime check will be needed whenever OpenGL headers are available.

With the work allowing to use the opengl filter with a gles2 provider on
Linux with OpenGL available (not merged), it leads to:

    $ MESA_DEBUG=1 ./vlc -vv ~/Video/dog_meme.mp4 --video-filter='opengl{filter=mock{mask},gles=any}'
    Mesa: User error: GL_INVALID_ENUM in glTexParameter(pname=GL_TEXTURE_PRIORITY)
    Mesa: User error: GL_INVALID_OPERATION in unsupported function called (unsupported extension or deprecated function?)
    -> GL_ASSERT_NOERROR triggers

Oddly, it was not reproduced with `-V gles2`, but only because the
interop code is built into the convenience libvlc_opengles.la with the
USE_OPENGL_ES2 define, which is what is currently disabling this code.

- - - - -
66a8ad52 by Alexandre Janniaux at 2023-04-03T14:02:28+00:00
video_filter: opengl: remove stray line feed

- - - - -


5 changed files:

- modules/video_filter/opengl.c
- modules/video_output/opengl/filter_draw.c
- modules/video_output/opengl/filter_mock.c
- modules/video_output/opengl/interop.c
- modules/video_output/opengl/renderer.c


Changes:

=====================================
modules/video_filter/opengl.c
=====================================
@@ -191,7 +191,7 @@ static int Open( vlc_object_t *obj )
 
     if (sys->gl == NULL)
     {
-        msg_Err(obj, "Failed to create opengl context\n");
+        msg_Err(obj, "Failed to create opengl context");
         goto gl_create_failure;
     }
 


=====================================
modules/video_output/opengl/filter_draw.c
=====================================
@@ -109,6 +109,7 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
 
     vt->Clear(GL_COLOR_BUFFER_BIT);
     vt->DrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+    GL_ASSERT_NOERROR(vt);
 
     return VLC_SUCCESS;
 }


=====================================
modules/video_output/opengl/filter_mock.c
=====================================
@@ -168,6 +168,7 @@ DrawBlend(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
     vt->DrawArrays(GL_TRIANGLES, 0, 3);
 
     vt->Disable(GL_BLEND);
+    GL_ASSERT_NOERROR(vt);
 
     return VLC_SUCCESS;
 }
@@ -206,6 +207,7 @@ DrawMask(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
 
     vt->Clear(GL_COLOR_BUFFER_BIT);
     vt->DrawArrays(GL_TRIANGLES, 0, 3);
+    GL_ASSERT_NOERROR(vt);
 
     return VLC_SUCCESS;
 }
@@ -265,6 +267,7 @@ DrawPlane(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
 
     vt->Clear(GL_COLOR_BUFFER_BIT);
     vt->DrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+    GL_ASSERT_NOERROR(vt);
 
     return VLC_SUCCESS;
 }


=====================================
modules/video_output/opengl/interop.c
=====================================
@@ -64,9 +64,12 @@ vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop,
         priv->gl.BindTexture(interop->tex_target, textures[i]);
 
 #if !defined(USE_OPENGL_ES2)
-        /* Set the texture parameters */
-        priv->gl.TexParameterf(interop->tex_target, GL_TEXTURE_PRIORITY, 1.0);
-        priv->gl.TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+        if (interop->gl->api_type == VLC_OPENGL)
+        {
+            /* Set the texture parameters */
+            priv->gl.TexParameterf(interop->tex_target, GL_TEXTURE_PRIORITY, 1.0);
+            priv->gl.TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+        }
 #endif
 
         priv->gl.TexParameteri(interop->tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -74,6 +77,7 @@ vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop,
         priv->gl.TexParameteri(interop->tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
         priv->gl.TexParameteri(interop->tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     }
+    GL_ASSERT_NOERROR(&priv->gl);
 
     if (interop->ops->allocate_textures != NULL)
     {


=====================================
modules/video_output/opengl/renderer.c
=====================================
@@ -712,6 +712,7 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
     const opengl_vtable_t *vt = renderer->vt;
 
     vt->Clear(GL_COLOR_BUFFER_BIT);
+    GL_ASSERT_NOERROR(vt);
 
     vt->UseProgram(renderer->program_id);
 
@@ -751,6 +752,7 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
                          renderer->var.ZoomMatrix);
 
     vt->DrawElements(GL_TRIANGLES, renderer->nb_indices, GL_UNSIGNED_SHORT, 0);
+    GL_ASSERT_NOERROR(vt);
 
     return VLC_SUCCESS;
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e8b6a9324d0048cdede41cbb99db8a483eff016e...66a8ad52e8aacfdaf6583be72e1361b7f9b07231

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e8b6a9324d0048cdede41cbb99db8a483eff016e...66a8ad52e8aacfdaf6583be72e1361b7f9b07231
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list