summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-09-23 09:11:09 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-09-23 17:54:31 +0200
commit4715128213625df75be2cbbf5c1fd6b911b34901 (patch)
tree16fece6a7a0bce692860203af4364f95bae3badf /src
parent4c78ef80ca7573cd2eb054cdf1667837b43e6c58 (diff)
rhi: vk: Fix invalid index for unused attachments
Pick-to: 6.2 Change-Id: I8140de4eeb1a8a490fcffd10370c29a49d677fed Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src')
-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);
}
}