summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhimetal.mm
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/qrhimetal.mm
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/qrhimetal.mm')
-rw-r--r--src/gui/rhi/qrhimetal.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index 7d2b1982f0..fbb2003fb2 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -2993,6 +2993,10 @@ bool QMetalShaderResourceBindings::create()
if (!sortedBindings.isEmpty())
destroy();
+ QRHI_RES_RHI(QRhiMetal);
+ if (!rhiD->sanityCheckShaderResourceBindings(this))
+ return false;
+
std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
std::sort(sortedBindings.begin(), sortedBindings.end(),
[](const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b)