From 37aea112c15958052bcc6d0582593edf3bfead8f Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Fri, 19 Aug 2022 13:51:50 +0200 Subject: vo_gpu_next: pass GL get_proc_addr pointer to libplacebo Facing down the multitude of ways to somehow wrangle the get_fn pointer out of the GL environment and into libplacebo, I decided the easiest is to just store it inside the GL struct itself. The lifetime of this get_fn function is a bit murky, since it's not clear on whether or not it survives the VO init call (especially in the case of the GL render API, which explicitly states that parameters do not need to survive the call they're passed to), so just add a disclaimer. (It's fine for us to use like this because `gpu_ctx_create` is still part of VO init) Closes https://code.videolan.org/videolan/libplacebo/-/issues/216 --- video/out/opengl/common.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'video/out/opengl/common.h') diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h index 1292be45b2..a9e67d9756 100644 --- a/video/out/opengl/common.h +++ b/video/out/opengl/common.h @@ -87,6 +87,11 @@ struct GL { int mpgl_caps; // Bitfield of MPGL_CAP_* constants bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB + // Copy of function pointer used to load GL. + // Caution: Not necessarily valid to use after VO init has completed! + void *(*get_fn)(void *ctx, const char *n); + void *fn_ctx; + void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei); void (GLAPIENTRY *Clear)(GLbitfield); void (GLAPIENTRY *GenTextures)(GLsizei, GLuint *); -- cgit v1.2.3