summaryrefslogtreecommitdiffstats
path: root/opengl/libs/EGL/getProcAddress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/libs/EGL/getProcAddress.cpp')
-rw-r--r--opengl/libs/EGL/getProcAddress.cpp50
1 files changed, 42 insertions, 8 deletions
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index fc61134..660af33 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -78,7 +78,7 @@ namespace android {
#elif defined(__i386__)
- #define API_ENTRY(_api) __attribute__((noinline)) _api
+ #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api
#define CALL_GL_EXTENSION_API(_api) \
register void** fn; \
@@ -100,7 +100,7 @@ namespace android {
#elif defined(__x86_64__)
- #define API_ENTRY(_api) __attribute__((noinline)) _api
+ #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api
#define CALL_GL_EXTENSION_API(_api) \
register void** fn; \
@@ -120,14 +120,46 @@ namespace android {
: "cc" \
);
+#elif defined(__mips64)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_EXTENSION_API(_api, ...) \
+ register unsigned int _t0 asm("$12"); \
+ register unsigned int _fn asm("$25"); \
+ register unsigned int _tls asm("$3"); \
+ asm volatile( \
+ ".set push\n\t" \
+ ".set noreorder\n\t" \
+ "rdhwr %[tls], $29\n\t" \
+ "ld %[t0], %[OPENGL_API](%[tls])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " move %[fn], $ra\n\t" \
+ "ld %[t0], %[API](%[t0])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " nop\n\t" \
+ "move %[fn], %[t0]\n\t" \
+ "1:\n\t" \
+ "jalr $0, %[fn]\n\t" \
+ " nop\n\t" \
+ ".set pop\n\t" \
+ : [fn] "=c"(_fn), \
+ [tls] "=&r"(_tls), \
+ [t0] "=&r"(_t0) \
+ : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*4), \
+ [API] "I"(__builtin_offsetof(gl_hooks_t, \
+ ext.extensions[_api])) \
+ : \
+ );
+
#elif defined(__mips__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
#define CALL_GL_EXTENSION_API(_api, ...) \
- register unsigned int _t0 asm("t0"); \
- register unsigned int _fn asm("t1"); \
- register unsigned int _tls asm("v1"); \
+ register unsigned int _t0 asm("$8"); \
+ register unsigned int _fn asm("$25"); \
+ register unsigned int _tls asm("$3"); \
asm volatile( \
".set push\n\t" \
".set noreorder\n\t" \
@@ -136,10 +168,12 @@ namespace android {
"lw %[t0], %[OPENGL_API](%[tls])\n\t" \
"beqz %[t0], 1f\n\t" \
" move %[fn], $ra\n\t" \
- "lw %[fn], %[API](%[t0])\n\t" \
- "movz %[fn], $ra, %[fn]\n\t" \
+ "lw %[t0], %[API](%[t0])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " nop\n\t" \
+ "move %[fn], %[t0]\n\t" \
"1:\n\t" \
- "j %[fn]\n\t" \
+ "jalr $0, %[fn]\n\t" \
" nop\n\t" \
".set pop\n\t" \
: [fn] "=c"(_fn), \