diff options
Diffstat (limited to 'src/widgets/kernel/qopenglwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index c96b6812c4..ed0fe0ed91 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -906,9 +906,19 @@ void QOpenGLWidgetPrivate::invalidateFbo() const int gl_color_attachment0 = 0x8CE0; // GL_COLOR_ATTACHMENT0 const int gl_depth_attachment = 0x8D00; // GL_DEPTH_ATTACHMENT const int gl_stencil_attachment = 0x8D20; // GL_STENCIL_ATTACHMENT +#ifdef Q_OS_WASM + // webgl does not allow separate depth and stencil attachments + // QTBUG-69913 + const int gl_depth_stencil_attachment = 0x821A; // GL_DEPTH_STENCIL_ATTACHMENT + + const GLenum attachments[] = { + gl_color_attachment0, gl_depth_attachment, gl_stencil_attachment, gl_depth_stencil_attachment + }; +#else const GLenum attachments[] = { gl_color_attachment0, gl_depth_attachment, gl_stencil_attachment }; +#endif f->glDiscardFramebufferEXT(GL_FRAMEBUFFER, sizeof attachments / sizeof *attachments, attachments); } else { f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); @@ -938,7 +948,8 @@ QImage QOpenGLWidgetPrivate::grabFramebuffer() q->makeCurrent(); } - QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatioF(), false, false); + const bool hasAlpha = q->format().hasAlpha(); + QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatioF(), hasAlpha, hasAlpha); res.setDevicePixelRatio(q->devicePixelRatioF()); // While we give no guarantees of what is going to be left bound, prefer the |