diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-04-25 15:33:56 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-05-02 12:46:12 +0200 |
commit | c09270753d3ec35c89c6f73a5fd4f197321e74fb (patch) | |
tree | 81d0c89a179c4020bb22a6d7876a4b394ecb3966 /src/gui/rhi/qrhivulkan.cpp | |
parent | aa12713c1fdb8dfb9034de6f8f162864cf868753 (diff) |
rhi: vulkan: Fix multiview with depth attachment only
Also change a confusing argument naming (begin-end vs. first-last).
Relevant in particular for the depth texture generation pass of
Qt Quick 3D (XR) with multiview rendering enabled.
Change-Id: I18746581cddfa96127de2d07853164b1c88b070b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index ccfba7493f..3dd3c57bd4 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -1598,8 +1598,8 @@ struct RenderPass2SetupHelper #endif // VK_KHR_create_renderpass2 bool QRhiVulkan::createOffscreenRenderPass(QVkRenderPassDescriptor *rpD, - const QRhiColorAttachment *firstColorAttachment, - const QRhiColorAttachment *lastColorAttachment, + const QRhiColorAttachment *colorAttachmentsBegin, + const QRhiColorAttachment *colorAttachmentsEnd, bool preserveColor, bool preserveDs, bool storeDs, @@ -1610,7 +1610,7 @@ bool QRhiVulkan::createOffscreenRenderPass(QVkRenderPassDescriptor *rpD, // attachment list layout is color (0-8), ds (0-1), resolve (0-8), ds resolve (0-1) int multiViewCount = 0; - for (auto it = firstColorAttachment; it != lastColorAttachment; ++it) { + for (auto it = colorAttachmentsBegin; it != colorAttachmentsEnd; ++it) { QVkTexture *texD = QRHI_RES(QVkTexture, it->texture()); QVkRenderBuffer *rbD = QRHI_RES(QVkRenderBuffer, it->renderBuffer()); Q_ASSERT(texD || rbD); @@ -1662,10 +1662,14 @@ bool QRhiVulkan::createOffscreenRenderPass(QVkRenderPassDescriptor *rpD, attDesc.initialLayout = preserveDs ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_UNDEFINED; attDesc.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; rpD->attDescs.append(attDesc); + if (depthTexture && depthTexture->arraySize() >= 2 && colorAttachmentsBegin == colorAttachmentsEnd) { + multiViewCount = depthTexture->arraySize(); + rpD->multiViewCount = multiViewCount; + } } rpD->dsRef = { uint32_t(rpD->attDescs.size() - 1), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL }; - for (auto it = firstColorAttachment; it != lastColorAttachment; ++it) { + for (auto it = colorAttachmentsBegin; it != colorAttachmentsEnd; ++it) { if (it->resolveTexture()) { QVkTexture *rtexD = QRHI_RES(QVkTexture, it->resolveTexture()); const VkFormat dstFormat = rtexD->vkformat; |