diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-05-28 19:23:49 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-06-03 17:05:44 +0200 |
commit | 64089b900fe245cc64c10ff47033dda60d4a5f86 (patch) | |
tree | 07f3f38f6ff40738969f8886b6ce707e39be8bf2 /src/gui/rhi/qrhimetal.mm | |
parent | 4652da536a5db3608e6026b27dfe808227b721f2 (diff) |
rhi: Enable reading back slices of 3D textures
Change-Id: I0c687677b7e86b7284130c775718b29aca2cca40
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhimetal.mm')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index b31d7cccaa..cf11f12ead 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -1854,15 +1854,13 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate QMetalSwapChain *swapChainD = nullptr; id<MTLTexture> src; QSize srcSize; + bool is3D = false; if (texD) { if (texD->samples > 1) { qWarning("Multisample texture cannot be read back"); continue; } - if (texD->m_flags.testFlag(QRhiTexture::ThreeDimensional)) { - qWarning("3D texture readback is not implemented"); - continue; - } + is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional); readback.pixelSize = q->sizeForMipLevel(u.rb.level(), texD->m_pixelSize); readback.format = texD->m_format; src = texD->d->tex; @@ -1890,9 +1888,9 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate ensureBlit(); [blitEnc copyFromTexture: src - sourceSlice: NSUInteger(u.rb.layer()) + sourceSlice: NSUInteger(is3D ? 0 : u.rb.layer()) sourceLevel: NSUInteger(u.rb.level()) - sourceOrigin: MTLOriginMake(0, 0, 0) + sourceOrigin: MTLOriginMake(0, 0, is3D ? u.rb.layer() : 0) sourceSize: MTLSizeMake(NSUInteger(srcSize.width()), NSUInteger(srcSize.height()), 1) toBuffer: readback.buf destinationOffset: 0 |