Merge "Load ES3 functions with eglGetProcAddress, not dlsym" into jb-mr2-dev
diff --git a/ndk/platforms/android-18/samples/gles3jni/README b/ndk/platforms/android-18/samples/gles3jni/README
index 517eec3..2250e21 100644
--- a/ndk/platforms/android-18/samples/gles3jni/README
+++ b/ndk/platforms/android-18/samples/gles3jni/README
@@ -30,4 +30,4 @@
[*1] The only dependency on API level 11 is the call to
setEGLContextClientVersion in GLES3JNIView. With a custom
EGLConfigChooser and EGLContextFactory the sample would be compatible
- with older API levels.
\ No newline at end of file
+ with older API levels.
diff --git a/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.c b/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.c
index b579f23..19b78e7 100644
--- a/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.c
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.c
@@ -15,120 +15,114 @@
*/
#include "gl3stub.h"
-#include <dlfcn.h>
-
GLboolean gl3stubInit() {
- void* so = dlopen("libGLESv3.so", RTLD_NOW | RTLD_GLOBAL);
- if (!so)
- return GL_FALSE;
-
- #define DLSYM(s) s = dlsym(so, #s)
- DLSYM(glReadBuffer);
- DLSYM(glDrawRangeElements);
- DLSYM(glTexImage3D);
- DLSYM(glTexSubImage3D);
- DLSYM(glCopyTexSubImage3D);
- DLSYM(glCompressedTexImage3D);
- DLSYM(glCompressedTexSubImage3D);
- DLSYM(glGenQueries);
- DLSYM(glDeleteQueries);
- DLSYM(glIsQuery);
- DLSYM(glBeginQuery);
- DLSYM(glEndQuery);
- DLSYM(glGetQueryiv);
- DLSYM(glGetQueryObjectuiv);
- DLSYM(glUnmapBuffer);
- DLSYM(glGetBufferPointerv);
- DLSYM(glDrawBuffers);
- DLSYM(glUniformMatrix2x3fv);
- DLSYM(glUniformMatrix3x2fv);
- DLSYM(glUniformMatrix2x4fv);
- DLSYM(glUniformMatrix4x2fv);
- DLSYM(glUniformMatrix3x4fv);
- DLSYM(glUniformMatrix4x3fv);
- DLSYM(glBlitFramebuffer);
- DLSYM(glRenderbufferStorageMultisample);
- DLSYM(glFramebufferTextureLayer);
- DLSYM(glMapBufferRange);
- DLSYM(glFlushMappedBufferRange);
- DLSYM(glBindVertexArray);
- DLSYM(glDeleteVertexArrays);
- DLSYM(glGenVertexArrays);
- DLSYM(glIsVertexArray);
- DLSYM(glGetIntegeri_v);
- DLSYM(glBeginTransformFeedback);
- DLSYM(glEndTransformFeedback);
- DLSYM(glBindBufferRange);
- DLSYM(glBindBufferBase);
- DLSYM(glTransformFeedbackVaryings);
- DLSYM(glGetTransformFeedbackVarying);
- DLSYM(glVertexAttribIPointer);
- DLSYM(glGetVertexAttribIiv);
- DLSYM(glGetVertexAttribIuiv);
- DLSYM(glVertexAttribI4i);
- DLSYM(glVertexAttribI4ui);
- DLSYM(glVertexAttribI4iv);
- DLSYM(glVertexAttribI4uiv);
- DLSYM(glGetUniformuiv);
- DLSYM(glGetFragDataLocation);
- DLSYM(glUniform1ui);
- DLSYM(glUniform2ui);
- DLSYM(glUniform3ui);
- DLSYM(glUniform4ui);
- DLSYM(glUniform1uiv);
- DLSYM(glUniform2uiv);
- DLSYM(glUniform3uiv);
- DLSYM(glUniform4uiv);
- DLSYM(glClearBufferiv);
- DLSYM(glClearBufferuiv);
- DLSYM(glClearBufferfv);
- DLSYM(glClearBufferfi);
- DLSYM(glGetStringi);
- DLSYM(glCopyBufferSubData);
- DLSYM(glGetUniformIndices);
- DLSYM(glGetActiveUniformsiv);
- DLSYM(glGetUniformBlockIndex);
- DLSYM(glGetActiveUniformBlockiv);
- DLSYM(glGetActiveUniformBlockName);
- DLSYM(glUniformBlockBinding);
- DLSYM(glDrawArraysInstanced);
- DLSYM(glDrawElementsInstanced);
- DLSYM(glFenceSync);
- DLSYM(glIsSync);
- DLSYM(glDeleteSync);
- DLSYM(glClientWaitSync);
- DLSYM(glWaitSync);
- DLSYM(glGetInteger64v);
- DLSYM(glGetSynciv);
- DLSYM(glGetInteger64i_v);
- DLSYM(glGetBufferParameteri64v);
- DLSYM(glGenSamplers);
- DLSYM(glDeleteSamplers);
- DLSYM(glIsSampler);
- DLSYM(glBindSampler);
- DLSYM(glSamplerParameteri);
- DLSYM(glSamplerParameteriv);
- DLSYM(glSamplerParameterf);
- DLSYM(glSamplerParameterfv);
- DLSYM(glGetSamplerParameteriv);
- DLSYM(glGetSamplerParameterfv);
- DLSYM(glVertexAttribDivisor);
- DLSYM(glBindTransformFeedback);
- DLSYM(glDeleteTransformFeedbacks);
- DLSYM(glGenTransformFeedbacks);
- DLSYM(glIsTransformFeedback);
- DLSYM(glPauseTransformFeedback);
- DLSYM(glResumeTransformFeedback);
- DLSYM(glGetProgramBinary);
- DLSYM(glProgramBinary);
- DLSYM(glProgramParameteri);
- DLSYM(glInvalidateFramebuffer);
- DLSYM(glInvalidateSubFramebuffer);
- DLSYM(glTexStorage2D);
- DLSYM(glTexStorage3D);
- DLSYM(glGetInternalformativ);
- #undef DLSYM
+ #define FIND_PROC(s) s = (void*)eglGetProcAddress(#s)
+ FIND_PROC(glReadBuffer);
+ FIND_PROC(glDrawRangeElements);
+ FIND_PROC(glTexImage3D);
+ FIND_PROC(glTexSubImage3D);
+ FIND_PROC(glCopyTexSubImage3D);
+ FIND_PROC(glCompressedTexImage3D);
+ FIND_PROC(glCompressedTexSubImage3D);
+ FIND_PROC(glGenQueries);
+ FIND_PROC(glDeleteQueries);
+ FIND_PROC(glIsQuery);
+ FIND_PROC(glBeginQuery);
+ FIND_PROC(glEndQuery);
+ FIND_PROC(glGetQueryiv);
+ FIND_PROC(glGetQueryObjectuiv);
+ FIND_PROC(glUnmapBuffer);
+ FIND_PROC(glGetBufferPointerv);
+ FIND_PROC(glDrawBuffers);
+ FIND_PROC(glUniformMatrix2x3fv);
+ FIND_PROC(glUniformMatrix3x2fv);
+ FIND_PROC(glUniformMatrix2x4fv);
+ FIND_PROC(glUniformMatrix4x2fv);
+ FIND_PROC(glUniformMatrix3x4fv);
+ FIND_PROC(glUniformMatrix4x3fv);
+ FIND_PROC(glBlitFramebuffer);
+ FIND_PROC(glRenderbufferStorageMultisample);
+ FIND_PROC(glFramebufferTextureLayer);
+ FIND_PROC(glMapBufferRange);
+ FIND_PROC(glFlushMappedBufferRange);
+ FIND_PROC(glBindVertexArray);
+ FIND_PROC(glDeleteVertexArrays);
+ FIND_PROC(glGenVertexArrays);
+ FIND_PROC(glIsVertexArray);
+ FIND_PROC(glGetIntegeri_v);
+ FIND_PROC(glBeginTransformFeedback);
+ FIND_PROC(glEndTransformFeedback);
+ FIND_PROC(glBindBufferRange);
+ FIND_PROC(glBindBufferBase);
+ FIND_PROC(glTransformFeedbackVaryings);
+ FIND_PROC(glGetTransformFeedbackVarying);
+ FIND_PROC(glVertexAttribIPointer);
+ FIND_PROC(glGetVertexAttribIiv);
+ FIND_PROC(glGetVertexAttribIuiv);
+ FIND_PROC(glVertexAttribI4i);
+ FIND_PROC(glVertexAttribI4ui);
+ FIND_PROC(glVertexAttribI4iv);
+ FIND_PROC(glVertexAttribI4uiv);
+ FIND_PROC(glGetUniformuiv);
+ FIND_PROC(glGetFragDataLocation);
+ FIND_PROC(glUniform1ui);
+ FIND_PROC(glUniform2ui);
+ FIND_PROC(glUniform3ui);
+ FIND_PROC(glUniform4ui);
+ FIND_PROC(glUniform1uiv);
+ FIND_PROC(glUniform2uiv);
+ FIND_PROC(glUniform3uiv);
+ FIND_PROC(glUniform4uiv);
+ FIND_PROC(glClearBufferiv);
+ FIND_PROC(glClearBufferuiv);
+ FIND_PROC(glClearBufferfv);
+ FIND_PROC(glClearBufferfi);
+ FIND_PROC(glGetStringi);
+ FIND_PROC(glCopyBufferSubData);
+ FIND_PROC(glGetUniformIndices);
+ FIND_PROC(glGetActiveUniformsiv);
+ FIND_PROC(glGetUniformBlockIndex);
+ FIND_PROC(glGetActiveUniformBlockiv);
+ FIND_PROC(glGetActiveUniformBlockName);
+ FIND_PROC(glUniformBlockBinding);
+ FIND_PROC(glDrawArraysInstanced);
+ FIND_PROC(glDrawElementsInstanced);
+ FIND_PROC(glFenceSync);
+ FIND_PROC(glIsSync);
+ FIND_PROC(glDeleteSync);
+ FIND_PROC(glClientWaitSync);
+ FIND_PROC(glWaitSync);
+ FIND_PROC(glGetInteger64v);
+ FIND_PROC(glGetSynciv);
+ FIND_PROC(glGetInteger64i_v);
+ FIND_PROC(glGetBufferParameteri64v);
+ FIND_PROC(glGenSamplers);
+ FIND_PROC(glDeleteSamplers);
+ FIND_PROC(glIsSampler);
+ FIND_PROC(glBindSampler);
+ FIND_PROC(glSamplerParameteri);
+ FIND_PROC(glSamplerParameteriv);
+ FIND_PROC(glSamplerParameterf);
+ FIND_PROC(glSamplerParameterfv);
+ FIND_PROC(glGetSamplerParameteriv);
+ FIND_PROC(glGetSamplerParameterfv);
+ FIND_PROC(glVertexAttribDivisor);
+ FIND_PROC(glBindTransformFeedback);
+ FIND_PROC(glDeleteTransformFeedbacks);
+ FIND_PROC(glGenTransformFeedbacks);
+ FIND_PROC(glIsTransformFeedback);
+ FIND_PROC(glPauseTransformFeedback);
+ FIND_PROC(glResumeTransformFeedback);
+ FIND_PROC(glGetProgramBinary);
+ FIND_PROC(glProgramBinary);
+ FIND_PROC(glProgramParameteri);
+ FIND_PROC(glInvalidateFramebuffer);
+ FIND_PROC(glInvalidateSubFramebuffer);
+ FIND_PROC(glTexStorage2D);
+ FIND_PROC(glTexStorage3D);
+ FIND_PROC(glGetInternalformativ);
+ #undef FIND_PROC
if (!glReadBuffer ||
!glDrawRangeElements ||
@@ -235,7 +229,6 @@
!glTexStorage3D ||
!glGetInternalformativ)
{
- dlclose(so);
return GL_FALSE;
}