summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-09-22 18:16:20 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-09-23 16:27:59 +0200
commite5d65996a93bbf4cbc8a155887def6efa3ad73de (patch)
tree0b498361f96b22040119710e04ef301451bfd938
parente9cef8e7fa1c1cf4956cd25ccc5504f2e7790e4e (diff)
Add some debug warnings to the GL paint engine regarding stencil
There is absolutely nothing we can do if the render target has no stencil buffer, but print at least a warning in debug builds to give a hint to the developer. Pick-to: 6.2 Task-number: QTBUG-96786 Change-Id: If7f84f28f9bc9b3dadd01d0816c8db4015a1db0b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/opengl/qopenglpaintengine.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/opengl/qopenglpaintengine.cpp b/src/opengl/qopenglpaintengine.cpp
index 8606a2e7ef..c385b4c62b 100644
--- a/src/opengl/qopenglpaintengine.cpp
+++ b/src/opengl/qopenglpaintengine.cpp
@@ -1124,6 +1124,10 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
funcs.glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes
useSimpleShader();
+#ifndef QT_NO_DEBUG
+ if (ctx->format().stencilBufferSize() <= 0)
+ qWarning("OpenGL paint engine: attempted to use stencil test without requesting a stencil buffer.");
+#endif
funcs.glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d
if (mode == WindingFillMode) {
@@ -2346,6 +2350,10 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest()
{
Q_Q(QOpenGL2PaintEngineEx);
if (q->state()->clipTestEnabled) {
+#ifndef QT_NO_DEBUG
+ if (ctx->format().stencilBufferSize() <= 0)
+ qWarning("OpenGL paint engine: attempted to use stencil test for clipping without requesting a stencil buffer.");
+#endif
funcs.glEnable(GL_STENCIL_TEST);
funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
} else {