From f6d67ed9b760e87af3e032ea49e5babc6951ef91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Mon, 25 Nov 2024 09:23:15 +0200 Subject: [PATCH] Fix creating multisampled pipeline on dx12 backend Use the depthStencil format to check multisample support when the pipeline doesn't have color attachments. Fixes: QTBUG-131505 Pick-to: 6.8 Change-Id: I8fec8383ed854a581586213e3dbd401bb457cefc Reviewed-by: Laszlo Agocs --- src/gui/rhi/qrhid3d12.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp index bdf84f54d79..dec383c427c 100644 --- a/src/gui/rhi/qrhid3d12.cpp +++ b/src/gui/rhi/qrhid3d12.cpp @@ -5849,7 +5849,16 @@ bool QD3D12GraphicsPipeline::create() } QD3D12RenderPassDescriptor *rpD = QRHI_RES(QD3D12RenderPassDescriptor, m_renderPassDesc); - const DXGI_SAMPLE_DESC sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount, DXGI_FORMAT(rpD->colorFormat[0])); + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN; + if (rpD->colorAttachmentCount > 0) { + format = DXGI_FORMAT(rpD->colorFormat[0]); + } else if (rpD->hasDepthStencil) { + format = DXGI_FORMAT(rpD->dsFormat); + } else { + qWarning("Cannot create graphics pipeline state without color or depthStencil format"); + return false; + } + const DXGI_SAMPLE_DESC sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount, format); struct { QD3D12PipelineStateSubObject rootSig;