diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-12-28 01:04:52 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-12-28 01:08:52 -0600 |
| commit | d8b7f4d73f9b2b8ce4a5b74a014bf597296b2bfc (patch) | |
| tree | da1e27eafa898796ffe0461bfcd328366f18a812 /Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp | |
| parent | e04edd89cca5133ffb542847f2c398b3a9cc16c2 (diff) | |
[Android] Support grabbing OpenGL extensions and a function for checking for support.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp b/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp index c91908ea11..505326b1ea 100644 --- a/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp +++ b/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp @@ -5,7 +5,9 @@ #include "DriverDetails.h" #include "GLFunctions.h" #include "Log.h" + #include <dlfcn.h> +#include <unordered_map> #ifdef USE_GLES3 PFNGLMAPBUFFERRANGEPROC glMapBufferRange; @@ -13,6 +15,7 @@ PFNGLUNMAPBUFFERPROC glUnmapBuffer; PFNGLBINDBUFFERRANGEPROC glBindBufferRange; PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer; +PFNGLGETSTRINGIPROC glGetStringi; PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; @@ -49,6 +52,8 @@ PFNGLGENQUERIESPROC glGenQueries; namespace GLFunc { void *self; + std::unordered_map<std::string, bool> _extensions; + void LoadFunction(const char *name, void **func) { #ifdef USE_GLES3 @@ -67,10 +72,27 @@ namespace GLFunc #endif } + bool SupportsExt(std::string ext) + { + return _extensions.find(ext) != _extensions.end(); + } + + void InitExtensions() + { + GLint NumExtension = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &NumExtension); + for (GLint i = 0; i < NumExtension; ++i) + _extensions[std::string((const char*)glGetStringi(GL_EXTENSIONS, i))] = true; + } + void Init() { self = dlopen(NULL, RTLD_LAZY); + LoadFunction("glGetStringi", (void**)&glGetStringi); + + InitExtensions(); + LoadFunction("glUnmapBuffer", (void**)&glUnmapBuffer); LoadFunction("glBeginQuery", (void**)&glBeginQuery); LoadFunction("glEndQuery", (void**)&glEndQuery); |
