diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-05-27 18:23:18 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-05-31 18:17:36 +0000 |
commit | 4aae624836871c315d81078c5ae78b082a26bd49 (patch) | |
tree | 6e4611b445a26d5d8b27cab19ee59adeb47f48c3 /src/gui/rhi/qrhid3d11.cpp | |
parent | f8537be746540e64b027ea39605a64ebe3cc26bb (diff) |
rhi: d3d: Avoid debug layer warning when having no vertex inputs
Fixes: QTBUG-94064
Change-Id: I03237fcff06225ba41c65c0171d77fb6ae75fcd3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 347310eb21facbd03d2168d67d83fdbfd6f6888c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui/rhi/qrhid3d11.cpp')
-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 3e0ba0820b..18cfc584bf 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -2520,7 +2520,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); @@ -4059,12 +4059,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; |