diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-09-07 15:53:59 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-09-07 21:47:44 +0200 |
commit | ce9d0491f2a3836991c3c44fa70c32f1f606ab28 (patch) | |
tree | d190772248643c714ad47140c427aaa8febcca4f /src/gui/rhi/qrhi_p.h | |
parent | 7e8c7b3ed86828e4b0fcc1f01a7666cfb1ecbe99 (diff) |
rhi: Improve srb layout serialization helpers
Be idiomatic and return the output iterator one past the last element.
Otherwise passing in a plain pointer (as exercised by the autotest now)
fails to function because we write over the same 4 elements again and
again for each binding.
Pick-to: 6.2
Change-Id: If74463fa5140ffa2b1d5be97b71868848ad46614
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi_p.h')
-rw-r--r-- | src/gui/rhi/qrhi_p.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 81b00cd07f..527d72e486 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -413,13 +413,14 @@ public: } u; template<typename Output> - void serialize(Output dst) const + Output serialize(Output dst) const { // must write out exactly LAYOUT_DESC_ENTRIES_PER_BINDING elements here *dst++ = quint32(binding); *dst++ = quint32(stage); *dst++ = quint32(type); *dst++ = quint32(type == QRhiShaderResourceBinding::SampledTexture ? u.stex.count : 1); + return dst; } }; @@ -434,7 +435,7 @@ public: Output dst) { while (first != last) { - first->data()->serialize(dst); + dst = first->data()->serialize(dst); ++first; } } |