Don't forget to tell our users that the epoxy GL functions are __dllimport.

This lets the compiler generate faster function calls (call through
function pointer, instead of call into a linker-generated stub func
containing jump to function pointer).
macos/v1.5.9
Eric Anholt 11 years ago
parent 920543faa4
commit 8022cda75d
  1. 5
      include/epoxy/gl.h
  2. 1
      src/dispatch_common.h
  3. 8
      src/gen_dispatch.py

@ -47,6 +47,7 @@ extern "C" {
/* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */ /* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */
#define APIENTRY #define APIENTRY
#define GLAPIENTRY #define GLAPIENTRY
#define EPOXYAPIENTRY
#define GLAPI #define GLAPI
#else #else
#ifndef APIENTRY #ifndef APIENTRY
@ -57,6 +58,10 @@ extern "C" {
#define GLAPIENTRY APIENTRY #define GLAPIENTRY APIENTRY
#endif #endif
#ifndef EPOXYAPIENTRY
#define EPOXYAPIENTRY __declspec(dllimport)
#endif
#ifndef GLAPI #ifndef GLAPI
#define GLAPI extern #define GLAPI extern
#endif #endif

@ -27,6 +27,7 @@
#define PLATFORM_HAS_EGL 0 #define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_GLX 0 #define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 1 #define PLATFORM_HAS_WGL 1
#define EPOXYAPIENTRY __declspec(dllexport)
#elif defined(__APPLE__) #elif defined(__APPLE__)
#define PLATFORM_HAS_EGL 0 #define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_GLX 1 #define PLATFORM_HAS_GLX 1

@ -506,16 +506,14 @@ class Generator(object):
self.outln(' */') self.outln(' */')
self.outln('#ifdef _WIN32') self.outln('#ifdef _WIN32')
self.outln('#define EPOXY_FPTR(x) x') self.outln('#define EPOXY_FPTR(x) x')
self.outln('#define EPOXY_FPTR_EXTERN')
self.outln('#else') self.outln('#else')
self.outln('#define EPOXY_FPTR(x) (*x)') self.outln('#define EPOXY_FPTR(x) (*x)')
self.outln('#define EPOXY_FPTR_EXTERN extern')
self.outln('#endif') self.outln('#endif')
for func in self.sorted_functions: for func in self.sorted_functions:
self.outln('EPOXY_FPTR_EXTERN {0} EPOXY_FPTR(epoxy_{1})({2});'.format(func.ret_type, self.outln('extern EPOXYAPIENTRY {0} EPOXY_FPTR(epoxy_{1})({2});'.format(func.ret_type,
func.name, func.name,
func.args_decl)) func.args_decl))
self.outln('') self.outln('')
for func in self.sorted_functions: for func in self.sorted_functions:

Loading…
Cancel
Save