: \
);
+#elif defined(__i386__) && !USE_SLOW_BINDING
+
+ /* Tell gcc 4.4+ to always omit the frame pointer to have working code
+ * independ of compiler flag
+ */
+ #define API_ENTRY(_api) __attribute__((noinline)) \
+ __attribute__((optimize("omit-frame-pointer"))) \
+ _api
+
+ /* pop %%ebp only because x86 doesn't support naked functions */
+ /* 4.4+ supports __attribute__((optimize)) that disable function
+ * prologues
+ */
+ #if __GNUC__ < 4 || \
+ (__GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #define PROLOGUE "pop %%ebp \n"
+ #else
+ #define PROLOGUE ""
+ #endif
+
+ #define CALL_GL_API(_api, ...) \
+ asm volatile( \
+ PROLOGUE \
+ "movl %%gs:0, %%ecx \n" \
+ "movl %c[tls](%%ecx), %%eax \n" \
+ "test %%eax, %%eax \n" \
+ "je out" #_api " \n" \
+ "movl %c[api](%%eax), %%ecx \n" \
+ "jmp *%%ecx \n" \
+ "out" #_api ": ret \n" \
+ : \
+ : [tls] "i"(TLS_SLOT_OPENGL_API*4), \
+ [api] "i"(__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : \
+ );
+
#elif defined(__mips__) && !USE_SLOW_BINDING
#define API_ENTRY(_api) __attribute__((noinline)) _api
const GLubyte * ret = egl_get_string_for_current_context(name);
if (ret == NULL) {
gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl;
- ret = _c->glGetString(name);
+ if(_c) ret = _c->glGetString(name);
}
return ret;
}