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 <laszlo.agocs@qt.io>
This commit is contained in:
Antti Määttä 2024-11-25 09:23:15 +02:00
parent 9cb0d48aae
commit f6d67ed9b7

View File

@ -5849,7 +5849,16 @@ bool QD3D12GraphicsPipeline::create()
} }
QD3D12RenderPassDescriptor *rpD = QRHI_RES(QD3D12RenderPassDescriptor, m_renderPassDesc); 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 { struct {
QD3D12PipelineStateSubObject<ID3D12RootSignature *, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE> rootSig; QD3D12PipelineStateSubObject<ID3D12RootSignature *, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE> rootSig;