diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-05-27 18:23:18 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-05-31 17:17:02 +0200 |
commit | 347310eb21facbd03d2168d67d83fdbfd6f6888c (patch) | |
tree | 4c7a5c0f6fea30f1b7a88acc5f6ec30ec7bcb65d /src/gui | |
parent | 51c22a1f51e2f91289c938be7754f957c9bfa47e (diff) |
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>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/rhi/qrhid3d11.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index d16332e5b9..35118a4d81 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -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; |