libkwineffects: move render time query check to OpenGlContext
This commit is contained in:
parent
e401f3ff11
commit
c0e44378ca
4 changed files with 27 additions and 13 deletions
|
@ -740,16 +740,6 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
|
|||
m_mesaVersion = Version::parseString(versionTokens.at(mesaIndex + 1));
|
||||
}
|
||||
|
||||
if (!qEnvironmentVariableIsSet("KWIN_NO_TIMER_QUERY")) {
|
||||
if (isGLES()) {
|
||||
// 3.0 is required so query functions can be used without "EXT" suffix.
|
||||
// Timer queries are still not part of the core OpenGL ES specification.
|
||||
m_supportsTimerQuery = glVersion() >= Version(3, 0) && m_context->hasOpenglExtension("GL_EXT_disjoint_timer_query");
|
||||
} else {
|
||||
m_supportsTimerQuery = glVersion() >= Version(3, 3) || m_context->hasOpenglExtension("GL_ARB_timer_query");
|
||||
}
|
||||
}
|
||||
|
||||
m_glsl_version = (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||
m_glslVersion = Version::parseString(m_glsl_version);
|
||||
|
||||
|
@ -1060,7 +1050,7 @@ void GLPlatform::printResults() const
|
|||
}
|
||||
print(QByteArrayLiteral("Requires strict binding:"), !m_looseBinding ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
|
||||
print(QByteArrayLiteral("Virtual Machine:"), m_virtualMachine ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
|
||||
print(QByteArrayLiteral("Timer query support:"), m_supportsTimerQuery ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
|
||||
print(QByteArrayLiteral("Timer query support:"), supports(GLFeature::TimerQuery) ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
|
||||
}
|
||||
|
||||
bool GLPlatform::supports(GLFeature feature) const
|
||||
|
@ -1071,7 +1061,7 @@ bool GLPlatform::supports(GLFeature feature) const
|
|||
case GLFeature::PackInvert:
|
||||
return m_packInvert;
|
||||
case GLFeature::TimerQuery:
|
||||
return m_supportsTimerQuery;
|
||||
return m_context && m_context->supportsTimerQueries();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -385,7 +385,6 @@ private:
|
|||
Version m_driverVersion;
|
||||
bool m_looseBinding : 1;
|
||||
bool m_packInvert : 1;
|
||||
bool m_supportsTimerQuery : 1;
|
||||
bool m_virtualMachine : 1;
|
||||
bool m_preferBufferSubData : 1;
|
||||
OpenGLPlatformInterface m_platformInterface;
|
||||
|
|
|
@ -42,9 +42,24 @@ OpenGlContext::OpenGlContext()
|
|||
, m_renderer((const char *)glGetString(GL_RENDERER))
|
||||
, m_isOpenglES(m_versionString.startsWith("OpenGL ES"))
|
||||
, m_extensions(getExtensions(this))
|
||||
, m_supportsTimerQueries(checkTimerQuerySupport())
|
||||
{
|
||||
}
|
||||
|
||||
bool OpenGlContext::checkTimerQuerySupport() const
|
||||
{
|
||||
if (qEnvironmentVariableIsSet("KWIN_NO_TIMER_QUERY")) {
|
||||
return false;
|
||||
}
|
||||
if (m_isOpenglES) {
|
||||
// 3.0 is required so query functions can be used without "EXT" suffix.
|
||||
// Timer queries are still not part of the core OpenGL ES specification.
|
||||
return openglVersion() >= Version(3, 0) && hasOpenglExtension("GL_EXT_disjoint_timer_query");
|
||||
} else {
|
||||
return openglVersion() >= Version(3, 3) || hasOpenglExtension("GL_ARB_timer_query");
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenGlContext::hasVersion(const Version &version) const
|
||||
{
|
||||
return m_version >= version;
|
||||
|
@ -87,6 +102,11 @@ bool OpenGlContext::isSoftwareRenderer() const
|
|||
return m_renderer.contains("softpipe") || m_renderer.contains("Software Rasterizer") || m_renderer.contains("llvmpipe");
|
||||
}
|
||||
|
||||
bool OpenGlContext::supportsTimerQueries() const
|
||||
{
|
||||
return m_supportsTimerQueries;
|
||||
}
|
||||
|
||||
bool OpenGlContext::checkSupported() const
|
||||
{
|
||||
const bool supportsGLSL = m_isOpenglES || (hasOpenglExtension("GL_ARB_shader_objects") && hasOpenglExtension("GL_ARB_fragment_shader") && hasOpenglExtension("GL_ARB_vertex_shader"));
|
||||
|
|
|
@ -34,18 +34,23 @@ public:
|
|||
bool isOpenglES() const;
|
||||
bool hasOpenglExtension(QByteArrayView name) const;
|
||||
bool isSoftwareRenderer() const;
|
||||
bool supportsTimerQueries() const;
|
||||
|
||||
/**
|
||||
* checks whether or not this context supports all the features that KWin requires
|
||||
*/
|
||||
bool checkSupported() const;
|
||||
|
||||
protected:
|
||||
bool checkTimerQuerySupport() const;
|
||||
|
||||
const QByteArrayView m_versionString;
|
||||
const Version m_version;
|
||||
const QByteArrayView m_vendor;
|
||||
const QByteArrayView m_renderer;
|
||||
const bool m_isOpenglES;
|
||||
const QSet<QByteArray> m_extensions;
|
||||
const bool m_supportsTimerQueries;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue