[vlc-commits] [Git][videolan/vlc][master] 2 commits: opengl: sampler: initialize pl_opengl instance params

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Nov 17 04:45:37 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
69a4d42a by Alexandre Janniaux at 2022-11-17T04:09:28+00:00
opengl: sampler: initialize pl_opengl instance params

The pl_opengl_create must use the vlc_gl_GetProcAddress call to
initialize the different extensions and client APIs. Provide the
function to the context, fixing a failure when creating the sampler on
tvOS and iOS, where libplacebo internal (through glad) could not load
OpenGL functions.

- - - - -
b00b46f3 by Alexandre Janniaux at 2022-11-17T04:09:28+00:00
opengl: sampler: initialize placebo shader at runtime

The initialization of the placebo shader, and value used to select
whether the GL ES variant was used and the language version of the
generated shaders, were dependant on defines that are only providing
whether the headers are GLES 2 or OpenGL. The API used at the end will
be provided during runtime and a file compiled against OpenGL can be run
against a GLES 2 or more pipeline.

- - - - -


1 changed file:

- modules/video_output/opengl/sampler.c


Changes:

=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -918,6 +918,14 @@ opengl_fragment_shader_init(struct vlc_gl_sampler *sampler, bool expose_planes)
     return VLC_SUCCESS;
 }
 
+#if defined(HAVE_LIBPLACEBO_GL) && PL_API_VER >= 215
+static pl_voidfunc_t PlaceboGetProcAddr(void *opaque, const char *name)
+{
+    vlc_gl_t *gl = opaque;
+    return (pl_voidfunc_t)vlc_gl_GetProcAddress(gl, name);
+}
+#endif
+
 struct vlc_gl_sampler *
 vlc_gl_sampler_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
                    const struct vlc_gl_format *glfmt, bool expose_planes)
@@ -953,7 +961,21 @@ vlc_gl_sampler_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
     priv->uloc.pl_descs = NULL;
     priv->pl_sh_res = NULL;
     priv->pl_log = vlc_placebo_CreateLog(VLC_OBJECT(gl));
-    priv->pl_opengl = pl_opengl_create(priv->pl_log, NULL);
+
+    const struct pl_opengl_params gl_params =
+    {
+        /* Libplacebo won't control whether the context is current or not.
+         * This is the default but we also want to ensure that the struct is
+         * properly initialized even if PL_API_VER < 215. */
+        .make_current = NULL,
+        .release_current = NULL,
+
+#if PL_API_VER >= 215
+        .get_proc_addr_ex = PlaceboGetProcAddr,
+        .proc_ctx = gl,
+#endif
+    };
+    priv->pl_opengl = pl_opengl_create(priv->pl_log, &gl_params);
     if (!priv->pl_opengl)
     {
         vlc_gl_sampler_Delete(sampler);
@@ -963,12 +985,8 @@ vlc_gl_sampler_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
     priv->pl_sh = pl_shader_alloc(priv->pl_log, &(struct pl_shader_params) {
         .gpu = priv->pl_opengl->gpu,
         .glsl = {
-#   ifdef USE_OPENGL_ES2
-            .version = 100,
-            .gles = true,
-#   else
-            .version = 120,
-#   endif
+            .version = gl->api_type == VLC_OPENGL_ES2 ? 100 : 120,
+            .gles = gl->api_type == VLC_OPENGL_ES2,
         },
     });
 #endif



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b0db51a268ac26de7de8f6e4d4108bf62a73f7ef...b00b46f3b598dcd55e95d95a3e851ae5c54bd60a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b0db51a268ac26de7de8f6e4d4108bf62a73f7ef...b00b46f3b598dcd55e95d95a3e851ae5c54bd60a
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