diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-04-30 12:50:02 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-05-02 12:46:18 +0200 |
commit | 124e7d896b455570c74d91b4f70087b9806933da (patch) | |
tree | aff3d952be1370a3dc12577f398f47f97a597ecd /src/gui/rhi | |
parent | c09270753d3ec35c89c6f73a5fd4f197321e74fb (diff) |
rhi: metal: Handle multiview with depth attachment only
Copy the approach added for Vulkan. (no color attachments,
but depth texture array is present -> assume this means
multiview rendering and use the array size as view
count)
Change-Id: Ie523b54e8eec6fdd4fe5f203d1ea97b366f8ac00
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index b99afc596c..212f9c8240 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -2981,9 +2981,11 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb, cbD->d->currentPassRpDesc.depthAttachment.loadAction = MTLLoadActionLoad; cbD->d->currentPassRpDesc.stencilAttachment.loadAction = MTLLoadActionLoad; } + int colorAttCount = 0; for (auto it = rtTex->m_desc.cbeginColorAttachments(), itEnd = rtTex->m_desc.cendColorAttachments(); it != itEnd; ++it) { + colorAttCount += 1; if (it->texture()) { QRHI_RES(QMetalTexture, it->texture())->lastActiveFrameSlot = currentFrameSlot; if (it->multiViewCount() >= 2) @@ -2996,8 +2998,12 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb, } if (rtTex->m_desc.depthStencilBuffer()) QRHI_RES(QMetalRenderBuffer, rtTex->m_desc.depthStencilBuffer())->lastActiveFrameSlot = currentFrameSlot; - if (rtTex->m_desc.depthTexture()) - QRHI_RES(QMetalTexture, rtTex->m_desc.depthTexture())->lastActiveFrameSlot = currentFrameSlot; + if (rtTex->m_desc.depthTexture()) { + QMetalTexture *depthTexture = QRHI_RES(QMetalTexture, rtTex->m_desc.depthTexture()); + depthTexture->lastActiveFrameSlot = currentFrameSlot; + if (colorAttCount == 0 && depthTexture->arraySize() >= 2) + cbD->d->currentPassRpDesc.renderTargetArrayLength = NSUInteger(depthTexture->arraySize()); + } if (rtTex->m_desc.depthResolveTexture()) QRHI_RES(QMetalTexture, rtTex->m_desc.depthResolveTexture())->lastActiveFrameSlot = currentFrameSlot; } |