From 6576da1c16ac1bf0d22ecc462ff1462478e512f8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 22 Jun 2023 11:30:54 +0200 Subject: [PATCH] rhi: d3d12: Fix resolving with multiview Follow what got documented in the previous patch. Task-number: QTBUG-114790 Change-Id: I3e8b3028639c3e4edd39eb0f9446f7eae5f96f3b Reviewed-by: Andy Nichols --- src/gui/rhi/qrhid3d12.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp index df67399400..bb4736dbf6 100644 --- a/src/gui/rhi/qrhid3d12.cpp +++ b/src/gui/rhi/qrhid3d12.cpp @@ -1800,13 +1800,16 @@ void QRhiD3D12::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resource barrierGen.addTransitionBarrier(dstTexD->handle, D3D12_RESOURCE_STATE_RESOLVE_DEST); barrierGen.enqueueBufferedTransitionBarriers(cbD); - const UINT srcSubresource = calcSubresource(0, UINT(colorAtt.layer()), 1); - const UINT dstSubresource = calcSubresource(UINT(colorAtt.resolveLevel()), - UINT(colorAtt.resolveLayer()), - dstTexD->mipLevelCount); - cbD->cmdList->ResolveSubresource(dstRes->resource, dstSubresource, - srcRes->resource, srcSubresource, - dstTexD->dxgiFormat); + const UINT resolveCount = colorAtt.multiViewCount() >= 2 ? colorAtt.multiViewCount() : 1; + for (UINT resolveIdx = 0; resolveIdx < resolveCount; ++resolveIdx) { + const UINT srcSubresource = calcSubresource(0, UINT(colorAtt.layer()) + resolveIdx, 1); + const UINT dstSubresource = calcSubresource(UINT(colorAtt.resolveLevel()), + UINT(colorAtt.resolveLayer()) + resolveIdx, + dstTexD->mipLevelCount); + cbD->cmdList->ResolveSubresource(dstRes->resource, dstSubresource, + srcRes->resource, srcSubresource, + dstTexD->dxgiFormat); + } } }