aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp4
-rw-r--r--src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp21
2 files changed, 24 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 2f1a4ae457..6616173253 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -128,10 +128,12 @@ void QSGTextMaskMaterialData::activate()
QSGMaterialShader::activate();
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR);
+#if !defined(QT_OPENGL_ES_2)
// 0.25 was found to be acceptable error margin by experimentation. On Mac, the gamma is 2.0,
// but using sRGB looks okay.
if (qAbs(fontSmoothingGamma() - 2.2) < 0.25)
glEnable(GL_FRAMEBUFFER_SRGB);
+#endif
}
void QSGTextMaskMaterialData::deactivate()
@@ -139,8 +141,10 @@ void QSGTextMaskMaterialData::deactivate()
QSGMaterialShader::deactivate();
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+#if !defined(QT_OPENGL_ES_2)
if (qAbs(fontSmoothingGamma() - 2.2) < 0.25)
glDisable(GL_FRAMEBUFFER_SRGB);
+#endif
}
void QSGTextMaskMaterialData::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
index bca57a3b6b..932da70471 100644
--- a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
+++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
@@ -75,6 +75,16 @@ void QSGDepthStencilBuffer::detach()
GL_RENDERBUFFER, 0);
}
+// ###TODO Remove once using Khronos OpenGL headers
+#if defined(QT_OPENGL_ES_2)
+#ifndef GL_DEPTH24_STENCIL8_OES
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif
+
+#ifndef GL_DEPTH_COMPONENT24_OES
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif
+#endif
QSGDefaultDepthStencilBuffer::QSGDefaultDepthStencilBuffer(QOpenGLContext *context, const Format &format)
: QSGDepthStencilBuffer(context, format)
@@ -88,10 +98,19 @@ QSGDefaultDepthStencilBuffer::QSGDefaultDepthStencilBuffer(QOpenGLContext *conte
m_functions.glGenRenderbuffers(1, &m_depthBuffer);
m_functions.glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
if (format.samples && m_functions.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) {
+#if defined(QT_OPENGL_ES_2)
+ m_functions.glRenderbufferStorageMultisample(GL_RENDERBUFFER, format.samples,
+ GL_DEPTH24_STENCIL8_OES, width, height);
+#else
m_functions.glRenderbufferStorageMultisample(GL_RENDERBUFFER, format.samples,
GL_DEPTH24_STENCIL8, width, height);
+#endif
} else {
+#if defined(QT_OPENGL_ES_2)
+ m_functions.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, width, height);
+#else
m_functions.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
+#endif
}
m_stencilBuffer = m_depthBuffer;
}
@@ -100,7 +119,7 @@ QSGDefaultDepthStencilBuffer::QSGDefaultDepthStencilBuffer(QOpenGLContext *conte
m_functions.glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
#ifdef QT_OPENGL_ES
const GLenum internalFormat = m_functions.hasOpenGLExtension(QOpenGLExtensions::Depth24)
- ? GL_DEPTH_COMPONENT24 : GL_DEPTH_COMPONENT16;
+ ? GL_DEPTH_COMPONENT24_OES : GL_DEPTH_COMPONENT16;
#else
const GLenum internalFormat = GL_DEPTH_COMPONENT;
#endif