[vlc-commits] [Git][videolan/vlc][master] 2 commits: opengl: display: move GetProcAddress under MakeCurrent
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Jun 3 11:11:21 UTC 2022
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
44138d04 by Alexandre Janniaux at 2022-06-03T10:58:55+00:00
opengl: display: move GetProcAddress under MakeCurrent
With OpenGL callback and glfw as a provider, it leads to a failure.
- - - - -
c0b2f318 by Alexandre Janniaux at 2022-06-03T10:58:55+00:00
vlc_opengl: document vlc_gl_GetProcAddress
Document that the function must be called with a context enabled. Even
if most low-level implementation will allow getting an address without
a context, so as to keep the same symbol across contexts, some other
common implementations like glfw[^1] will require an active context.
[^1]: https://www.glfw.org/docs/3.3/group__context.html#ga35f1837e6f666781842483937612f163
- - - - -
2 changed files:
- include/vlc_opengl.h
- modules/video_output/opengl/display.c
Changes:
=====================================
include/vlc_opengl.h
=====================================
@@ -134,6 +134,24 @@ static inline picture_t *vlc_gl_SwapOffscreen(vlc_gl_t *gl)
return gl->ops->swap_offscreen(gl);
}
+/**
+ * Fetch a symbol or pointer function from the OpenGL implementation.
+ *
+ * Return a pointer from the OpenGL implementation, which can be part of
+ * either the underlying OpenGL provider or an OpenGL function matching
+ * the version requested.
+ *
+ * If the symbol name is not matching the underlying implementation of
+ * OpenGL, an invalid pointer or NULL can be returned.
+ *
+ * @note This function must be called between MakeCurrent and ReleaseCurrent.
+ *
+ * @param gl the OpenGL provider to fetch the function from
+ * @param name the symbol name to fetch from the implementation
+ *
+ * @return A pointer corresponding to the symbol, or a potentially invalid
+ * value or NULL in case of error.
+ */
static inline void *vlc_gl_GetProcAddress(vlc_gl_t *gl, const char *name)
{
return gl->ops->get_proc_address(gl, name);
=====================================
modules/video_output/opengl/display.c
=====================================
@@ -158,10 +158,6 @@ static int Open(vout_display_t *vd,
if (sys->gl == NULL)
goto error;
- sys->vt.Flush = vlc_gl_GetProcAddress(sys->gl, "glFlush");
- if (sys->vt.Flush == NULL)
- goto error;
-
struct vout_display_placement flipped_dp = vd->cfg->display;
FlipVerticalAlign(&flipped_dp);
vout_display_PlacePicture(&sys->place, vd->source, &flipped_dp);
@@ -174,6 +170,13 @@ static int Open(vout_display_t *vd,
if (vlc_gl_MakeCurrent (sys->gl))
goto error;
+ sys->vt.Flush = vlc_gl_GetProcAddress(sys->gl, "glFlush");
+ if (sys->vt.Flush == NULL)
+ {
+ vlc_gl_ReleaseCurrent (sys->gl);
+ goto error;
+ }
+
sys->vgl = vout_display_opengl_New (fmt, &spu_chromas, sys->gl,
&vd->cfg->viewpoint, context);
vlc_gl_ReleaseCurrent (sys->gl);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2999e6a02ddbc56d42d473555342c99bd37ec7dc...c0b2f318ceb7e235883550008eee148e6f98dc93
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2999e6a02ddbc56d42d473555342c99bd37ec7dc...c0b2f318ceb7e235883550008eee148e6f98dc93
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