Skip to content

Commit 61ccb32

Browse files
committed
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 <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Jesus Fernandez <[email protected]>
1 parent 7ac85fa commit 61ccb32

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/plugins/platforms/webgl/qwebglcontext.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,6 @@ static T queryValue(int id, const T &defaultValue = T())
287287
}
288288

289289
struct GLFunction;
290-
static QHash<QString, const GLFunction *> glFunctions;
291-
292290
template<typename T>
293291
struct ParameterTypeTraits {
294292
static int typeId() { return qMetaTypeId<T>(); }
@@ -321,6 +319,7 @@ struct GLFunction
321319
bool isArray;
322320
};
323321

322+
static QHash<QString, const GLFunction *> byName;
324323
using ParameterList = QVector<Parameter>;
325324

326325
GLFunction(const QString &remoteName,
@@ -330,8 +329,8 @@ struct GLFunction
330329
: remoteName(remoteName), localName(localName),
331330
functionPointer(functionPointer), parameters(parameters)
332331
{
333-
Q_ASSERT(!glFunctions.contains(localName));
334-
glFunctions.insert(localName, this);
332+
Q_ASSERT(!byName.contains(localName));
333+
byName.insert(localName, this);
335334
}
336335

337336
GLFunction(const QString &name) : GLFunction(name, name, nullptr)
@@ -343,6 +342,8 @@ struct GLFunction
343342
const ParameterList parameters;
344343
};
345344

345+
QHash<QString, const GLFunction *> GLFunction::byName;
346+
346347
template<const GLFunction *Function>
347348
static QWebGLFunctionCall *createEventImpl(bool wait)
348349
{
@@ -1515,8 +1516,8 @@ bool QWebGLContext::isValid() const
15151516

15161517
QFunctionPointer QWebGLContext::getProcAddress(const char *procName)
15171518
{
1518-
const auto it = glFunctions.find(procName);
1519-
return it != glFunctions.end() ? (*it)->functionPointer : nullptr;
1519+
const auto it = GLFunction::byName.find(procName);
1520+
return it != GLFunction::byName.end() ? (*it)->functionPointer : nullptr;
15201521
}
15211522

15221523
int QWebGLContext::id() const

0 commit comments

Comments
 (0)