diff options
Diffstat (limited to 'src/quick/scenegraph/qsgrhisupport.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index 6a66906ca1..8a7274f947 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -741,7 +741,14 @@ QImage QSGRhiSupport::grabOffscreen(QQuickWindow *window) qWarning("Failed to build texture for offscreen readback"); return QImage(); } - QScopedPointer<QRhiTextureRenderTarget> rt(rhi->newTextureRenderTarget({ texture.data() })); + QScopedPointer<QRhiRenderBuffer> depthStencil(rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil, pixelSize, 1)); + if (!depthStencil->create()) { + qWarning("Failed to create depth/stencil buffer for offscreen readback"); + return QImage(); + } + QRhiTextureRenderTargetDescription rtDesc(texture.data()); + rtDesc.setDepthStencilBuffer(depthStencil.data()); + QScopedPointer<QRhiTextureRenderTarget> rt(rhi->newTextureRenderTarget(rtDesc)); QScopedPointer<QRhiRenderPassDescriptor> rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); if (!rt->create()) { |