summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhivulkan.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-09-01 15:16:24 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-09-03 14:18:30 +0200
commitf6802a5aac49f6161d60e9b3e761093e292f2fc4 (patch)
tree4a0730b081c4206fbb088cd1bfc483a7e6d8ad1a /src/gui/rhi/qrhivulkan.cpp
parent95daeb24076c01e8f91dd590d89f063ca68b3427 (diff)
rhi: Sanity check the srb in debug builds
Instead of cryptic assertions and crashes depending on the backend, show some useful warnings (in debug builds only) when one tries to create an srb with a list where there are duplicated bindings. (a mistake that happens relatively often during the development of frameworks, such as Quick 3D, on top) Change-Id: If1b50a2e8165b001878ad566e048f146e636514f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r--src/gui/rhi/qrhivulkan.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index 28463398bb..b172a8b16b 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -6155,6 +6155,10 @@ bool QVkShaderResourceBindings::create()
if (layout)
destroy();
+ QRHI_RES_RHI(QRhiVulkan);
+ if (!rhiD->sanityCheckShaderResourceBindings(this))
+ return false;
+
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
descSets[i] = VK_NULL_HANDLE;
@@ -6187,7 +6191,6 @@ bool QVkShaderResourceBindings::create()
layoutInfo.bindingCount = uint32_t(vkbindings.count());
layoutInfo.pBindings = vkbindings.constData();
- QRHI_RES_RHI(QRhiVulkan);
VkResult err = rhiD->df->vkCreateDescriptorSetLayout(rhiD->dev, &layoutInfo, nullptr, &layout);
if (err != VK_SUCCESS) {
qWarning("Failed to create descriptor set layout: %d", err);