diff options
author | Jesse Hall <jessehall@google.com> | 2014-05-27 23:26:15 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-05-27 23:26:15 +0000 |
commit | dc2736219fa897840d1ff12b11cd7defb636f845 (patch) | |
tree | 0e6b8ce2495289450782e02f31e0663ac9f9859e | |
parent | c9fcaf3751af078ad730913304431197e4d1ae80 (diff) | |
parent | c80aafa61d619087a879dc1095ddf1ca2a5e69fb (diff) | |
download | native-dc2736219fa897840d1ff12b11cd7defb636f845.tar.gz |
Merge "EGL: add x86/64 assembly code for EGL/GLES wrappers"
-rw-r--r-- | opengl/libs/EGL/getProcAddress.cpp | 45 | ||||
-rw-r--r-- | opengl/libs/GLES2/gl2.cpp | 38 | ||||
-rw-r--r-- | opengl/libs/GLES_CM/gl.cpp | 38 |
3 files changed, 121 insertions, 0 deletions
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp index add2a799f4..5470d81c57 100644 --- a/opengl/libs/EGL/getProcAddress.cpp +++ b/opengl/libs/EGL/getProcAddress.cpp @@ -56,6 +56,50 @@ namespace android { : \ ); +#elif defined(__i386__) + + #define API_ENTRY(_api) __attribute__((noinline)) _api + + #define CALL_GL_EXTENSION_API(_api) \ + register void** fn; \ + __asm__ volatile( \ + "mov %%gs:0, %[fn]\n" \ + "mov %P[tls](%[fn]), %[fn]\n" \ + "test %[fn], %[fn]\n" \ + "cmovne %P[api](%[fn]), %[fn]\n" \ + "test %[fn], %[fn]\n" \ + "je 1f\n" \ + "jmp *%[fn]\n" \ + "1:\n" \ + : [fn] "=r" (fn) \ + : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ + [api] "i" (__builtin_offsetof(gl_hooks_t, \ + ext.extensions[_api])) \ + : "cc" \ + ); + +#elif defined(__x86_64__) + + #define API_ENTRY(_api) __attribute__((noinline)) _api + + #define CALL_GL_EXTENSION_API(_api) \ + register void** fn; \ + __asm__ volatile( \ + "mov %%fs:0, %[fn]\n" \ + "mov %P[tls](%[fn]), %[fn]\n" \ + "test %[fn], %[fn]\n" \ + "cmovne %P[api](%[fn]), %[fn]\n" \ + "test %[fn], %[fn]\n" \ + "je 1f\n" \ + "jmp *%[fn]\n" \ + "1:\n" \ + : [fn] "=r" (fn) \ + : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ + [api] "i" (__builtin_offsetof(gl_hooks_t, \ + ext.extensions[_api])) \ + : "cc" \ + ); + #elif defined(__mips__) #define API_ENTRY(_api) __attribute__((noinline)) _api @@ -86,6 +130,7 @@ namespace android { ext.extensions[_api])) \ : \ ); + #endif #if defined(CALL_GL_EXTENSION_API) diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp index 3134e568fe..ab6fb51c97 100644 --- a/opengl/libs/GLES2/gl2.cpp +++ b/opengl/libs/GLES2/gl2.cpp @@ -58,6 +58,44 @@ using namespace android; : \ ); +#elif defined(__i386__) && !USE_SLOW_BINDING + + #define API_ENTRY(_api) __attribute__((noinline)) _api + + #define CALL_GL_API(_api, ...) \ + register void** fn; \ + __asm__ volatile( \ + "mov %%gs:0, %[fn]\n" \ + "mov %P[tls](%[fn]), %[fn]\n" \ + "test %[fn], %[fn]\n" \ + "je 1f\n" \ + "jmp *%P[api](%[fn])\n" \ + "1:\n" \ + : [fn] "=r" (fn) \ + : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ + [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ + : "cc" \ + ); + +#elif defined(__x86_64__) && !USE_SLOW_BINDING + + #define API_ENTRY(_api) __attribute__((noinline)) _api + + #define CALL_GL_API(_api, ...) \ + register void** fn; \ + __asm__ volatile( \ + "mov %%fs:0, %[fn]\n" \ + "mov %P[tls](%[fn]), %[fn]\n" \ + "test %[fn], %[fn]\n" \ + "je 1f\n" \ + "jmp *%P[api](%[fn])\n" \ + "1:\n" \ + : [fn] "=r" (fn) \ + : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ + [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ + : "cc" \ + ); + #elif defined(__mips__) && !USE_SLOW_BINDING #define API_ENTRY(_api) __attribute__((noinline)) _api diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp index 893577b725..587339150d 100644 --- a/opengl/libs/GLES_CM/gl.cpp +++ b/opengl/libs/GLES_CM/gl.cpp @@ -110,6 +110,44 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, : \ ); +#elif defined(__i386__) && !USE_SLOW_BINDING + + #define API_ENTRY(_api) __attribute__((noinline)) _api + + #define CALL_GL_API(_api, ...) \ + register void* fn; \ + __asm__ volatile( \ + "mov %%gs:0, %[fn]\n" \ + "mov %P[tls](%[fn]), %[fn]\n" \ + "test %[fn], %[fn]\n" \ + "je 1f\n" \ + "jmp *%P[api](%[fn])\n" \ + "1:\n" \ + : [fn] "=r" (fn) \ + : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ + [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ + : "cc" \ + ); + +#elif defined(__x86_64__) && !USE_SLOW_BINDING + + #define API_ENTRY(_api) __attribute__((noinline)) _api + + #define CALL_GL_API(_api, ...) \ + register void** fn; \ + __asm__ volatile( \ + "mov %%fs:0, %[fn]\n" \ + "mov %P[tls](%[fn]), %[fn]\n" \ + "test %[fn], %[fn]\n" \ + "je 1f\n" \ + "jmp *%P[api](%[fn])\n" \ + "1:\n" \ + : [fn] "=r" (fn) \ + : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ + [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ + : "cc" \ + ); + #elif defined(__mips__) && !USE_SLOW_BINDING #define API_ENTRY(_api) __attribute__((noinline)) _api |