summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus Fernandez <jesus.fernandez@qt.io>2017-11-21 12:24:43 +0100
committerJesus Fernandez <Jesus.Fernandez@qt.io>2017-11-22 12:22:23 +0000
commit61ccb32fc06aa8dd2d3f40322345847fe00d43c0 (patch)
tree659394130ad5bfa37c9b77a9014a2206380564c7
parent7ac85fa5a5564aa4f2b66fe63c10f041479b8db5 (diff)
Move the WebGL GLFunction hash into the GLFunction class
This change prepares the way for new ways to find local and remote function information. Change-Id: Ie18952720d3570af3037e1bd4f8d16c8bfe8d6dc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
-rw-r--r--src/plugins/platforms/webgl/qwebglcontext.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/platforms/webgl/qwebglcontext.cpp b/src/plugins/platforms/webgl/qwebglcontext.cpp
index 5e92565..89a4283 100644
--- a/src/plugins/platforms/webgl/qwebglcontext.cpp
+++ b/src/plugins/platforms/webgl/qwebglcontext.cpp
@@ -287,8 +287,6 @@ static T queryValue(int id, const T &defaultValue = T())
}
struct GLFunction;
-static QHash<QString, const GLFunction *> glFunctions;
-
template<typename T>
struct ParameterTypeTraits {
static int typeId() { return qMetaTypeId<T>(); }
@@ -321,6 +319,7 @@ struct GLFunction
bool isArray;
};
+ static QHash<QString, const GLFunction *> byName;
using ParameterList = QVector<Parameter>;
GLFunction(const QString &remoteName,
@@ -330,8 +329,8 @@ struct GLFunction
: remoteName(remoteName), localName(localName),
functionPointer(functionPointer), parameters(parameters)
{
- Q_ASSERT(!glFunctions.contains(localName));
- glFunctions.insert(localName, this);
+ Q_ASSERT(!byName.contains(localName));
+ byName.insert(localName, this);
}
GLFunction(const QString &name) : GLFunction(name, name, nullptr)
@@ -343,6 +342,8 @@ struct GLFunction
const ParameterList parameters;
};
+QHash<QString, const GLFunction *> GLFunction::byName;
+
template<const GLFunction *Function>
static QWebGLFunctionCall *createEventImpl(bool wait)
{
@@ -1515,8 +1516,8 @@ bool QWebGLContext::isValid() const
QFunctionPointer QWebGLContext::getProcAddress(const char *procName)
{
- const auto it = glFunctions.find(procName);
- return it != glFunctions.end() ? (*it)->functionPointer : nullptr;
+ const auto it = GLFunction::byName.find(procName);
+ return it != GLFunction::byName.end() ? (*it)->functionPointer : nullptr;
}
int QWebGLContext::id() const