Remove some now unused code

The old Resolver class to resolve GL symbols is not
being used any longer, get rid of it.

Change-Id: I835860eb1c42aea05458ca32cf652659500312da
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
bb10
Lars Knoll 2016-02-02 15:35:26 +01:00 committed by Laszlo Agocs
parent 8115a3b444
commit a900645c2a
1 changed files with 2 additions and 346 deletions

View File

@ -2089,110 +2089,6 @@ enum ResolvePolicy
ResolveNV = 0x8
};
template <typename Base, typename FuncType, int Policy, typename ReturnType>
class Resolver
{
public:
Resolver(FuncType Base::*func, FuncType fallback, const char *name)
: funcPointerName(func)
, fallbackFuncPointer(fallback)
, funcName(name)
{
}
ReturnType operator()();
template <typename P1>
ReturnType operator()(P1 p1);
template <typename P1, typename P2>
ReturnType operator()(P1 p1, P2 p2);
template <typename P1, typename P2, typename P3>
ReturnType operator()(P1 p1, P2 p2, P3 p3);
template <typename P1, typename P2, typename P3, typename P4>
ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4);
template <typename P1, typename P2, typename P3, typename P4, typename P5>
ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11>
ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11);
private:
FuncType Base::*funcPointerName;
FuncType fallbackFuncPointer;
const char *funcName;
};
template <typename Base, typename FuncType, int Policy>
class Resolver<Base, FuncType, Policy, void>
{
public:
Resolver(FuncType Base::*func, FuncType fallback, const char *name)
: funcPointerName(func)
, fallbackFuncPointer(fallback)
, funcName(name)
{
}
void operator()();
template <typename P1>
void operator()(P1 p1);
template <typename P1, typename P2>
void operator()(P1 p1, P2 p2);
template <typename P1, typename P2, typename P3>
void operator()(P1 p1, P2 p2, P3 p3);
template <typename P1, typename P2, typename P3, typename P4>
void operator()(P1 p1, P2 p2, P3 p3, P4 p4);
template <typename P1, typename P2, typename P3, typename P4, typename P5>
void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10);
template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11>
void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11);
private:
FuncType Base::*funcPointerName;
FuncType fallbackFuncPointer;
const char *funcName;
};
static QFunctionPointer getProcAddress(QOpenGLContext *context, const char *funcName, int policy)
{
QFunctionPointer function = context->getProcAddress(funcName);
@ -2233,248 +2129,6 @@ static QFunctionPointer getProcAddress(QOpenGLContext *context, const char *func
return function;
}
#define RESOLVER_COMMON \
QOpenGLContext *context = QOpenGLContext::currentContext(); \
Base *funcs = qt_gl_functions(context); \
\
FuncType old = funcs->*funcPointerName; \
funcs->*funcPointerName = (FuncType)getProcAddress(context, funcName, Policy);
#define RESOLVER_COMMON_NON_VOID \
RESOLVER_COMMON \
\
if (!(funcs->*funcPointerName)) { \
if (fallbackFuncPointer) { \
funcs->*funcPointerName = fallbackFuncPointer; \
} else { \
funcs->*funcPointerName = old; \
return ReturnType(); \
} \
}
#define RESOLVER_COMMON_VOID \
RESOLVER_COMMON \
\
if (!(funcs->*funcPointerName)) { \
if (fallbackFuncPointer) { \
funcs->*funcPointerName = fallbackFuncPointer; \
} else { \
funcs->*funcPointerName = old; \
return; \
} \
}
template <typename Base, typename FuncType, int Policy, typename ReturnType>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()()
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)();
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2, typename P3>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2, P3 p3)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2, p3);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2, typename P3, typename P4>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2, P3 p3, P4 p4)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2, p3, p4);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2, typename P3, typename P4, typename P5>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2, p3, p4, p5);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
template <typename Base, typename FuncType, int Policy, typename ReturnType> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
ReturnType Resolver<Base, FuncType, Policy, ReturnType>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10)
{
RESOLVER_COMMON_NON_VOID
return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
}
template <typename Base, typename FuncType, int Policy>
void Resolver<Base, FuncType, Policy, void>::operator()()
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)();
}
template <typename Base, typename FuncType, int Policy> template <typename P1>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3, typename P4>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3, P4 p4)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3, p4);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3, typename P4, typename P5>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3, p4, p5);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
}
template <typename Base, typename FuncType, int Policy> template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11>
void Resolver<Base, FuncType, Policy, void>::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11)
{
RESOLVER_COMMON_VOID
(funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
}
template <typename ReturnType, int Policy, typename Base, typename FuncType>
Resolver<Base, FuncType, Policy, ReturnType> functionResolverWithFallback(FuncType Base::*func, FuncType fallback, const char *name)
{
return Resolver<Base, FuncType, Policy, ReturnType>(func, fallback, name);
}
template <typename ReturnType, int Policy, typename Base, typename FuncType>
Resolver<Base, FuncType, Policy, ReturnType> functionResolver(FuncType Base::*func, const char *name)
{
return Resolver<Base, FuncType, Policy, ReturnType>(func, 0, name);
}
} // namespace
#define RESOLVE_FUNC(RETURN_TYPE, POLICY, NAME) \
return functionResolver<RETURN_TYPE, POLICY>(&QOpenGLExtensionsPrivate::NAME, "gl" #NAME)
#define RESOLVE_FUNC_VOID(POLICY, NAME) \
functionResolver<void, POLICY>(&QOpenGLExtensionsPrivate::NAME, "gl" #NAME)
#define RESOLVE_FUNC_SPECIAL(RETURN_TYPE, POLICY, NAME) \
return functionResolverWithFallback<RETURN_TYPE, POLICY>(&QOpenGLExtensionsPrivate::NAME, qopenglfSpecial##NAME, "gl" #NAME)
#define RESOLVE_FUNC_SPECIAL_VOID(POLICY, NAME) \
functionResolverWithFallback<void, POLICY>(&QOpenGLExtensionsPrivate::NAME, qopenglfSpecial##NAME, "gl" #NAME)
template <typename Func>
Func resolve(QOpenGLContext *context, const char *name, int policy, Func)
{
@ -2490,6 +2144,8 @@ Func resolveWithFallback(QOpenGLContext *context, const char *name, int policy,
return f;
}
}
#define RESOLVE(name, policy) \
resolve(context, "gl"#name, policy, name)