Skip to content

Commit

Permalink
Add epoxy_set_resolver_failure_handler()
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Jackson <ajax@redhat.com>
  • Loading branch information
nwnk committed Jul 5, 2017
1 parent b157a4d commit 013b8cb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/epoxy/gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ EPOXY_PUBLIC bool epoxy_has_gl_extension(const char *extension);
EPOXY_PUBLIC bool epoxy_is_desktop_gl(void);
EPOXY_PUBLIC int epoxy_gl_version(void);

typedef void * (*epoxy_resolver_failure_handler_t)(const char *name);

EPOXY_PUBLIC epoxy_resolver_failure_handler_t
epoxy_set_resolver_failure_handler(epoxy_resolver_failure_handler_t handler);

EPOXY_END_DECLS

#endif /* EPOXY_GL_H */
10 changes: 10 additions & 0 deletions src/dispatch_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,3 +834,13 @@ WRAPPER(epoxy_glEnd)(void)

PFNGLBEGINPROC epoxy_glBegin = epoxy_glBegin_wrapped;
PFNGLENDPROC epoxy_glEnd = epoxy_glEnd_wrapped;

epoxy_resolver_failure_handler_t epoxy_resolver_failure_handler;

epoxy_resolver_failure_handler_t
epoxy_set_resolver_failure_handler(epoxy_resolver_failure_handler_t handler)
{
epoxy_resolver_failure_handler_t old = epoxy_resolver_failure_handler;
epoxy_resolver_failure_handler = handler;
return old;
}
2 changes: 2 additions & 0 deletions src/dispatch_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ bool epoxy_extension_in_string(const char *extension_list, const char *ext);
extern void UNWRAPPED_PROTO(glBegin_unwrapped)(GLenum primtype);
extern void UNWRAPPED_PROTO(glEnd_unwrapped)(void);

extern epoxy_resolver_failure_handler_t epoxy_resolver_failure_handler;

#if USING_DISPATCH_TABLE
void gl_init_dispatch_table(void);
void gl_switch_to_dispatch_table(void);
Expand Down
5 changes: 5 additions & 0 deletions src/gen_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,11 @@ def write_provider_resolver(self):
self.outln(' }')
self.outln('')

self.outln('')
self.outln(' if (epoxy_resolver_failure_handler)')
self.outln(' return epoxy_resolver_failure_handler(name);')
self.outln('')

# If the function isn't provided by any known extension, print
# something useful for the poor application developer before
# aborting. (In non-epoxy GL usage, the app developer would
Expand Down

0 comments on commit 013b8cb

Please sign in to comment.