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 <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2023-06-22 11:30:54 +02:00
parent 2574b4bb40
commit 6576da1c16

View File

@ -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);
}
}
}