Skip to content
Snippets Groups Projects
Commit 6ed1b009 authored by Niklas Haas's avatar Niklas Haas
Browse files

opengl/context: add get_proc_addr_ex to take an extra void*

This is needed for both mpv and VLC. Preserve the old API for
back-compat with simpler libraries like GLFW or SDL2.

Closes videolan/libplacebo#216
parent f0ff6812
No related branches found
No related tags found
No related merge requests found
Pipeline #253605 passed with stages
in 11 minutes and 22 seconds
......@@ -12,6 +12,7 @@ project('libplacebo', ['c', 'cpp'],
5,
# API version
{
'215': 'add pl_opengl_params.get_proc_addr_ex',
'214': 'drop deprecated legacy C struct names',
'213': 'add pl_opengl_params.get_proc_addr',
'212': 'add pl_opengl.major/minor version numbers',
......
......@@ -55,6 +55,11 @@ struct pl_opengl_params {
// Main gl*GetProcAddr function. This will be used to load all GL/EGL
// functions. Optional - if unspecified, libplacebo will default to an
// internal loading logic which should work on most platforms.
pl_voidfunc_t (*get_proc_addr_ex)(void *proc_ctx, const char *procname);
void *proc_ctx;
// Simpler API for backwards compatibility / convenience. (This one
// directly matches the signature of most gl*GetProcAddr library functions)
pl_voidfunc_t (*get_proc_addr)(const char *procname);
// Enable OpenGL debug report callbacks. May have little effect depending
......
......@@ -120,7 +120,10 @@ pl_opengl pl_opengl_create(pl_log log, const struct pl_opengl_params *params)
}
bool ok = false;
if (params->get_proc_addr) {
if (params->get_proc_addr_ex) {
ok |= gladLoadGLContextUserPtr(gl, params->get_proc_addr_ex, params->proc_ctx);
ok |= gladLoadGLES2ContextUserPtr(gl, params->get_proc_addr_ex, params->proc_ctx);
} else if (params->get_proc_addr) {
ok |= gladLoadGLContext(gl, params->get_proc_addr);
ok |= gladLoadGLES2Context(gl, params->get_proc_addr);
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment