rhi: d3d: Avoid debug layer warning when having no vertex inputs

Pick-to: 6.1
Fixes: QTBUG-94064
Change-Id: I03237fcff06225ba41c65c0171d77fb6ae75fcd3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2021-05-27 18:23:18 +02:00
parent 51c22a1f51
commit 347310eb21

View File

@ -2548,7 +2548,7 @@ void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *
context->VSSetShader(psD->vs.shader, nullptr, 0);
context->PSSetShader(psD->fs.shader, nullptr, 0);
context->IASetPrimitiveTopology(psD->d3dTopology);
context->IASetInputLayout(psD->inputLayout);
context->IASetInputLayout(psD->inputLayout); // may be null, that's ok
context->OMSetDepthStencilState(psD->dsState, stencilRef);
context->OMSetBlendState(psD->blendState, blendConstants, 0xffffffff);
context->RSSetState(psD->rastState);
@ -4142,12 +4142,14 @@ bool QD3D11GraphicsPipeline::create()
}
inputDescs.append(desc);
}
hr = rhiD->dev->CreateInputLayout(inputDescs.constData(), UINT(inputDescs.count()),
vsByteCode, SIZE_T(vsByteCode.size()), &inputLayout);
if (FAILED(hr)) {
qWarning("Failed to create input layout: %s", qPrintable(comErrorMessage(hr)));
return false;
}
if (!inputDescs.isEmpty()) {
hr = rhiD->dev->CreateInputLayout(inputDescs.constData(), UINT(inputDescs.count()),
vsByteCode, SIZE_T(vsByteCode.size()), &inputLayout);
if (FAILED(hr)) {
qWarning("Failed to create input layout: %s", qPrintable(comErrorMessage(hr)));
return false;
}
} // else leave inputLayout set to nullptr; that's valid and it avoids a debug layer warning about an input layout with 0 elements
}
generation += 1;