summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp22
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);