opengl: reorder initialization

This prepares further commits.
This commit is contained in:
Romain Vimont 2022-04-01 14:08:57 +02:00 committed by Hugo Beauzée-Luyssen
parent a22a08af90
commit b813327e1e
1 changed files with 10 additions and 8 deletions

View File

@ -354,12 +354,21 @@ opengl_interop_generic_init(struct vlc_gl_interop *interop, bool allow_dr)
if (unlikely(priv == NULL))
return VLC_ENOMEM;
interop->priv = priv;
#define LOAD_SYMBOL(type, name) \
priv->gl.name = vlc_gl_GetProcAddress(interop->gl, "gl" # name); \
assert(priv->gl.name != NULL);
OPENGL_VTABLE_F(LOAD_SYMBOL);
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(interop->gl, &extension_vt);
/* OpenGL or OpenGL ES2 with GL_EXT_unpack_subimage ext */
priv->has_unpack_subimage = interop->gl->api_type == VLC_OPENGL
|| vlc_gl_HasExtension(&extension_vt, "GL_EXT_unpack_subimage");
video_color_space_t space;
const vlc_fourcc_t *list;
@ -432,17 +441,9 @@ interop_init:
.update_textures = tc_common_update,
.close = opengl_interop_generic_deinit,
};
interop->priv = priv;
interop->ops = &ops;
interop->fmt_in.i_chroma = i_chroma;
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(interop->gl, &extension_vt);
/* OpenGL or OpenGL ES2 with GL_EXT_unpack_subimage ext */
priv->has_unpack_subimage = interop->gl->api_type == VLC_OPENGL
|| vlc_gl_HasExtension(&extension_vt, "GL_EXT_unpack_subimage");
if (allow_dr && priv->has_unpack_subimage)
{
/* Ensure we do direct rendering / PBO with OpenGL 3.0 or higher. */
@ -471,5 +472,6 @@ interop_init:
error:
free(priv);
interop->priv = NULL;
return VLC_EGENERIC;
}