summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-09-23 09:11:09 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-24 11:56:23 +0000
commitb94ab8074f1ec588807eba15589597730d5f6f38 (patch)
tree985ea8f6d415d79643fb81357a3da3c5ea660519 /src/gui
parentbf70b362194c922f3abc065e4f164a4bb40a94b1 (diff)
rhi: vk: Fix invalid index for unused attachments
Change-Id: I8140de4eeb1a8a490fcffd10370c29a49d677fed Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 4715128213625df75be2cbbf5c1fd6b911b34901) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/rhi/qrhivulkan.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index 7180545678..9757cc6997 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -6236,33 +6236,35 @@ void QVkRenderPassDescriptor::updateSerializedFormat()
*p++ = resolveRefs.count();
*p++ = hasDepthStencil;
- auto serializeAttachmentData = [&p](const VkAttachmentDescription &a, bool used) {
- *p++ = used ? a.format : 0;
- *p++ = used ? a.samples : 0;
- *p++ = used ? a.loadOp : 0;
- *p++ = used ? a.storeOp : 0;
- *p++ = used ? a.stencilLoadOp : 0;
- *p++ = used ? a.stencilStoreOp : 0;
- *p++ = used ? a.initialLayout : 0;
- *p++ = used ? a.finalLayout : 0;
+ auto serializeAttachmentData = [this, &p](uint32_t attIdx) {
+ const bool used = attIdx != VK_ATTACHMENT_UNUSED;
+ const VkAttachmentDescription *a = used ? &attDescs[attIdx] : nullptr;
+ *p++ = used ? a->format : 0;
+ *p++ = used ? a->samples : 0;
+ *p++ = used ? a->loadOp : 0;
+ *p++ = used ? a->storeOp : 0;
+ *p++ = used ? a->stencilLoadOp : 0;
+ *p++ = used ? a->stencilStoreOp : 0;
+ *p++ = used ? a->initialLayout : 0;
+ *p++ = used ? a->finalLayout : 0;
};
for (int i = 0, ie = colorRefs.count(); i != ie; ++i) {
const uint32_t attIdx = colorRefs[i].attachment;
*p++ = attIdx;
- serializeAttachmentData(attDescs[attIdx], attIdx != VK_ATTACHMENT_UNUSED);
+ serializeAttachmentData(attIdx);
}
if (hasDepthStencil) {
const uint32_t attIdx = dsRef.attachment;
*p++ = attIdx;
- serializeAttachmentData(attDescs[attIdx], attIdx != VK_ATTACHMENT_UNUSED);
+ serializeAttachmentData(attIdx);
}
for (int i = 0, ie = resolveRefs.count(); i != ie; ++i) {
const uint32_t attIdx = resolveRefs[i].attachment;
*p++ = attIdx;
- serializeAttachmentData(attDescs[attIdx], attIdx != VK_ATTACHMENT_UNUSED);
+ serializeAttachmentData(attIdx);
}
}