Skip to content

Commit 931962a

Browse files
committed
drivers/glrend: switch to the userptr variant of GetProcAddress
1 parent cec844e commit 931962a

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

drivers/glrend/devpmglf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ br_device_pixelmap *DevicePixelmapGLAllocateFront(br_device *dev, br_output_faci
230230
if(DevicePixelmapGLExtMakeCurrent(self, self->asFront.gl_context) != BRE_OK)
231231
goto cleanup_context;
232232

233-
if((glad_version = gladLoadGLContext(&self->asFront.glad_gl_context, DevicePixelmapGLExtGetGetProcAddress(self))) == 0) {
233+
if((glad_version = gladLoadGLContextUserPtr(&self->asFront.glad_gl_context, DevicePixelmapGLExtGetGetProcAddress(self), self)) == 0) {
234234
BrLogError("GLREND", "Unable to load OpenGL functions.");
235235
goto cleanup_context;
236236
}

drivers/glrend/drv_ip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ br_error DevicePixelmapGLExtMakeCurrent(br_device_pixelmap *self, void *ctx);
205205

206206
void DevicePixelmapGLExtSwapBuffers(br_device_pixelmap *self);
207207

208-
br_device_pixelmap_gl_getprocaddress_cbfn *DevicePixelmapGLExtGetGetProcAddress(br_device_pixelmap *self);
208+
GLADuserptrloadfunc DevicePixelmapGLExtGetGetProcAddress(br_device_pixelmap *self);
209209

210210
br_error DevicePixelmapGLExtResize(br_device_pixelmap *self, br_int_32 w, br_int_32 h);
211211

drivers/glrend/ext_procs.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,17 @@ br_error DevicePixelmapGLExtResize(br_device_pixelmap *self, br_int_32 w, br_int
3434
return self->asFront.ext_procs.resize((br_pixelmap *)self, w, h, self->asFront.ext_procs.user);
3535
}
3636

37-
br_device_pixelmap_gl_getprocaddress_cbfn *DevicePixelmapGLExtGetGetProcAddress(br_device_pixelmap *self)
37+
static GLADapiproc GetProcAddressInternal(void *userptr, const char *name)
3838
{
39+
br_device_pixelmap *self = userptr;
3940
UASSERT(self->use_type == BRT_NONE);
40-
return self->asFront.ext_procs.get_proc_address;
41+
return self->asFront.ext_procs.get_proc_address(name, self->asFront.ext_procs.user);
42+
}
43+
44+
GLADuserptrloadfunc DevicePixelmapGLExtGetGetProcAddress(br_device_pixelmap *self)
45+
{
46+
(void)self;
47+
return GetProcAddressInternal;
4148
}
4249

4350
void DevicePixelmapGLExtPreSwap(br_device_pixelmap *self, GLuint fbo)

drivers/glrend/include/brglrend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ typedef void BR_CALLBACK br_device_pixelmap_gl_swapbuffers_cbfn(br_pixelmap *pm,
3636

3737
typedef br_error BR_CALLBACK br_device_pixelmap_gl_resize_cbfn(br_pixelmap *pm, br_int_32 w, br_int_32 h, void *user);
3838

39-
typedef void (*BR_CALLBACK br_device_pixelmap_gl_getprocaddress_cbfn(const char *name))(void);
39+
typedef void (*BR_CALLBACK br_device_pixelmap_gl_getprocaddress_cbfn(const char *name, void *user))(void);
4040

4141
typedef void BR_CALLBACK br_device_pixelmap_gl_preswap_hook_cbfn(br_pixelmap *pm, unsigned int fbo, void *user);
4242

drivers/sdl2dev/glrend.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ static br_error sdl_gl_make_current(br_pixelmap *dev, void *ctx, void *user)
6767
return BRE_OK;
6868
}
6969

70-
static void (*sdl_gl_get_proc_address(const char *name))(void)
70+
static void (*sdl_gl_get_proc_address(const char *name, void *user))(void)
7171
{
72+
(void)user;
7273
return SDL_GL_GetProcAddress(name);
7374
}
7475

drivers/sdl3dev/glrend.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ static br_error sdl_gl_make_current(br_pixelmap *dev, void *ctx, void *user)
6868
return BRE_OK;
6969
}
7070

71-
static void (*sdl_gl_get_proc_address(const char *name))(void)
71+
static void (*sdl_gl_get_proc_address(const char *name, void *user))(void)
7272
{
73+
(void)user;
7374
return SDL_GL_GetProcAddress(name);
7475
}
7576

0 commit comments

Comments
 (0)