opengl: move pack invert detection to OpenGlContext
This commit is contained in:
parent
a8b9e8d262
commit
568da29fbf
5 changed files with 11 additions and 12 deletions
|
@ -719,7 +719,6 @@ GLPlatform::GLPlatform()
|
||||||
, m_chipClass(UnknownChipClass)
|
, m_chipClass(UnknownChipClass)
|
||||||
, m_recommendedCompositor(QPainterCompositing)
|
, m_recommendedCompositor(QPainterCompositing)
|
||||||
, m_looseBinding(false)
|
, m_looseBinding(false)
|
||||||
, m_packInvert(false)
|
|
||||||
, m_virtualMachine(false)
|
, m_virtualMachine(false)
|
||||||
, m_preferBufferSubData(false)
|
, m_preferBufferSubData(false)
|
||||||
, m_platformInterface(NoOpenGLPlatformInterface)
|
, m_platformInterface(NoOpenGLPlatformInterface)
|
||||||
|
@ -748,7 +747,6 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
|
||||||
|
|
||||||
m_chipset = QByteArrayLiteral("Unknown");
|
m_chipset = QByteArrayLiteral("Unknown");
|
||||||
m_preferBufferSubData = false;
|
m_preferBufferSubData = false;
|
||||||
m_packInvert = m_context->hasOpenglExtension("GL_MESA_pack_invert");
|
|
||||||
|
|
||||||
// Mesa classic drivers
|
// Mesa classic drivers
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
@ -1061,8 +1059,6 @@ bool GLPlatform::supports(GLFeature feature) const
|
||||||
switch (feature) {
|
switch (feature) {
|
||||||
case GLFeature::LooseBinding:
|
case GLFeature::LooseBinding:
|
||||||
return m_looseBinding;
|
return m_looseBinding;
|
||||||
case GLFeature::PackInvert:
|
|
||||||
return m_packInvert;
|
|
||||||
case GLFeature::TimerQuery:
|
case GLFeature::TimerQuery:
|
||||||
return m_context && m_context->supportsTimerQueries();
|
return m_context && m_context->supportsTimerQueries();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,6 @@ enum class GLFeature {
|
||||||
*/
|
*/
|
||||||
LooseBinding,
|
LooseBinding,
|
||||||
|
|
||||||
/**
|
|
||||||
* Set if the extension GL_MESA_pack_invert is present
|
|
||||||
*/
|
|
||||||
PackInvert,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set if the driver supports GL_ARB_timer_query extension or OpenGL 3.3.
|
* Set if the driver supports GL_ARB_timer_query extension or OpenGL 3.3.
|
||||||
*/
|
*/
|
||||||
|
@ -383,7 +378,6 @@ private:
|
||||||
Version m_mesaVersion;
|
Version m_mesaVersion;
|
||||||
Version m_driverVersion;
|
Version m_driverVersion;
|
||||||
bool m_looseBinding : 1;
|
bool m_looseBinding : 1;
|
||||||
bool m_packInvert : 1;
|
|
||||||
bool m_virtualMachine : 1;
|
bool m_virtualMachine : 1;
|
||||||
bool m_preferBufferSubData : 1;
|
bool m_preferBufferSubData : 1;
|
||||||
OpenGLPlatformInterface m_platformInterface;
|
OpenGLPlatformInterface m_platformInterface;
|
||||||
|
|
|
@ -90,6 +90,7 @@ OpenGlContext::OpenGlContext()
|
||||||
, m_haveBufferStorage((!m_isOpenglES || hasVersion(Version(4, 4))) || hasOpenglExtension(QByteArrayLiteral("GL_ARB_buffer_storage")) || hasOpenglExtension(QByteArrayLiteral("GL_EXT_buffer_storage")))
|
, m_haveBufferStorage((!m_isOpenglES || hasVersion(Version(4, 4))) || hasOpenglExtension(QByteArrayLiteral("GL_ARB_buffer_storage")) || hasOpenglExtension(QByteArrayLiteral("GL_EXT_buffer_storage")))
|
||||||
, m_haveSyncFences((m_isOpenglES && hasVersion(Version(3, 0))) || (!m_isOpenglES && hasVersion(Version(3, 2))) || hasOpenglExtension(QByteArrayLiteral("GL_ARB_sync")))
|
, m_haveSyncFences((m_isOpenglES && hasVersion(Version(3, 0))) || (!m_isOpenglES && hasVersion(Version(3, 2))) || hasOpenglExtension(QByteArrayLiteral("GL_ARB_sync")))
|
||||||
, m_supportsIndexedQuads(checkIndexedQuads(this))
|
, m_supportsIndexedQuads(checkIndexedQuads(this))
|
||||||
|
, m_supportsPackInvert(hasOpenglExtension(QByteArrayLiteral("GL_MESA_pack_invert")))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,6 +210,11 @@ bool OpenGlContext::haveSyncFences() const
|
||||||
return m_haveSyncFences;
|
return m_haveSyncFences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OpenGlContext::supportsPackInvert() const
|
||||||
|
{
|
||||||
|
return m_supportsPackInvert;
|
||||||
|
}
|
||||||
|
|
||||||
ShaderManager *OpenGlContext::shaderManager() const
|
ShaderManager *OpenGlContext::shaderManager() const
|
||||||
{
|
{
|
||||||
return m_shaderManager;
|
return m_shaderManager;
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
bool hasMapBufferRange() const;
|
bool hasMapBufferRange() const;
|
||||||
bool haveBufferStorage() const;
|
bool haveBufferStorage() const;
|
||||||
bool haveSyncFences() const;
|
bool haveSyncFences() const;
|
||||||
|
bool supportsPackInvert() const;
|
||||||
ShaderManager *shaderManager() const;
|
ShaderManager *shaderManager() const;
|
||||||
GLVertexBuffer *streamingVbo() const;
|
GLVertexBuffer *streamingVbo() const;
|
||||||
IndexBuffer *indexBuffer() const;
|
IndexBuffer *indexBuffer() const;
|
||||||
|
@ -91,6 +92,7 @@ protected:
|
||||||
const bool m_haveBufferStorage;
|
const bool m_haveBufferStorage;
|
||||||
const bool m_haveSyncFences;
|
const bool m_haveSyncFences;
|
||||||
const bool m_supportsIndexedQuads;
|
const bool m_supportsIndexedQuads;
|
||||||
|
const bool m_supportsPackInvert;
|
||||||
ShaderManager *m_shaderManager = nullptr;
|
ShaderManager *m_shaderManager = nullptr;
|
||||||
GLVertexBuffer *m_streamingBuffer = nullptr;
|
GLVertexBuffer *m_streamingBuffer = nullptr;
|
||||||
IndexBuffer *m_indexBuffer = nullptr;
|
IndexBuffer *m_indexBuffer = nullptr;
|
||||||
|
|
|
@ -49,9 +49,10 @@ static GLenum closestGLType(spa_video_format format)
|
||||||
|
|
||||||
static void doGrabTexture(GLTexture *texture, spa_data *spa, spa_video_format format)
|
static void doGrabTexture(GLTexture *texture, spa_data *spa, spa_video_format format)
|
||||||
{
|
{
|
||||||
|
const auto context = OpenGlContext::currentContext();
|
||||||
const QSize size = texture->size();
|
const QSize size = texture->size();
|
||||||
const bool invertNeeded = GLPlatform::instance()->isGLES() ^ (texture->contentTransform() != OutputTransform::FlipY);
|
const bool invertNeeded = context->isOpenglES() ^ (texture->contentTransform() != OutputTransform::FlipY);
|
||||||
const bool invertNeededAndSupported = invertNeeded && GLPlatform::instance()->supports(GLFeature::PackInvert);
|
const bool invertNeededAndSupported = invertNeeded && context->supportsPackInvert();
|
||||||
GLboolean prev;
|
GLboolean prev;
|
||||||
if (invertNeededAndSupported) {
|
if (invertNeededAndSupported) {
|
||||||
glGetBooleanv(GL_PACK_INVERT_MESA, &prev);
|
glGetBooleanv(GL_PACK_INVERT_MESA, &prev);
|
||||||
|
|
Loading…
Reference in a new issue