| 82 | } |
| 83 | |
| 84 | void DisplayGenericSplash() |
| 85 | { |
| 86 | ANDROID_LOG("Trying to splash"); |
| 87 | // if something else is drawing and holding the lock, then bail |
| 88 | if(!m_DrawLock.trylock()) |
| 89 | return; |
| 90 | ANDROID_LOG("Doing a splash"); |
| 91 | |
| 92 | // since we're not pumping this continually and we only draw when we need to, we can just do the |
| 93 | // full initialisation and teardown every time. This means we don't have to pay attention to |
| 94 | // whether something else needs to create a context on the window - we just do it |
| 95 | // opportunistically when we can hold the draw lock. |
| 96 | // This only takes about 30ms anyway, so it's still technically realtime, right!? |
| 97 | |
| 98 | // fetch everything dynamically. We can't link against libEGL otherwise it messes with the hooking |
| 99 | // in the main library. Just declare local function pointers with the real names |
| 100 | void *libEGL = dlopen("libEGL.so", RTLD_NOW); |
| 101 | |
| 102 | #define DLSYM_GET(name) decltype(&::name) name = (decltype(&::name))dlsym(libEGL, #name); |
| 103 | #define GPA_GET(name) decltype(&::name) name = (decltype(&::name))eglGetProcAddress(#name); |
| 104 | |
| 105 | DLSYM_GET(eglBindAPI); |
| 106 | DLSYM_GET(eglGetDisplay); |
| 107 | DLSYM_GET(eglInitialize); |
| 108 | DLSYM_GET(eglGetError); |
| 109 | DLSYM_GET(eglChooseConfig); |
| 110 | DLSYM_GET(eglCreateContext); |
| 111 | DLSYM_GET(eglCreateWindowSurface); |
| 112 | DLSYM_GET(eglMakeCurrent); |
| 113 | DLSYM_GET(eglDestroySurface); |
| 114 | DLSYM_GET(eglDestroyContext); |
| 115 | DLSYM_GET(eglGetProcAddress); |
| 116 | DLSYM_GET(eglSwapBuffers); |
| 117 | DLSYM_GET(eglTerminate); |
| 118 | |
| 119 | GPA_GET(glCreateShader); |
| 120 | GPA_GET(glShaderSource); |
| 121 | GPA_GET(glCompileShader); |
| 122 | GPA_GET(glCreateProgram); |
| 123 | GPA_GET(glAttachShader); |
| 124 | GPA_GET(glLinkProgram); |
| 125 | GPA_GET(glGetUniformLocation); |
| 126 | GPA_GET(glUniform2f); |
| 127 | GPA_GET(glUniform1f); |
| 128 | GPA_GET(glUseProgram); |
| 129 | GPA_GET(glVertexAttribPointer); |
| 130 | GPA_GET(glEnableVertexAttribArray); |
| 131 | GPA_GET(glDrawArrays); |
| 132 | GPA_GET(glGetShaderiv); |
| 133 | GPA_GET(glGetShaderInfoLog); |
| 134 | GPA_GET(glGetProgramiv); |
| 135 | GPA_GET(glGetProgramInfoLog); |
| 136 | |
| 137 | eglBindAPI(EGL_OPENGL_ES_API); |
| 138 | |
| 139 | EGLDisplay eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
| 140 | |
| 141 | if(eglDisplay && android_state && android_state->window) |
no test coverage detected