From f1c7814a55903dad5a5e77683bdcca5fc3805394 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 2 Oct 2019 10:58:44 +0200 Subject: rhi: Remove QVectors from the data description structs as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As usual, keep some QVector overloads around to allow Qt Quick to compile. Color attachments and vertex input bindings get an at(index) type of accessor, unlike any other of similar lists. This is because there the index is significant, and sequential iteration is not the only type of operation that is performed. Sometimes a lookup based on an index will be needed as well. Task-number: QTBUG-78883 Change-Id: I3882941f09e94ee2f179e0e9b8161551f0d5dae7 Reviewed-by: Christian Strømme Reviewed-by: Paul Olav Tvete --- tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp | 6 ++++-- tests/manual/rhi/mrt/mrt.cpp | 6 +++--- tests/manual/rhi/triquadcube/texturedcuberenderer.cpp | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'tests/manual') diff --git a/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp b/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp index bb3722bec5..af454c2487 100644 --- a/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp +++ b/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp @@ -165,11 +165,13 @@ void Window::customRender() u->updateDynamicBuffer(d.ubuf, 64, 4, &flip); } if (!d.compressedData.isEmpty()) { - QRhiTextureUploadDescription desc; + QVarLengthArray descEntries; for (int i = 0; i < d.compressedData.count(); ++i) { QRhiTextureSubresourceUploadDescription image(d.compressedData[i].constData(), d.compressedData[i].size()); - desc.append({ 0, i, image }); + descEntries.append({ 0, i, image }); } + QRhiTextureUploadDescription desc; + desc.setEntries(descEntries.cbegin(), descEntries.cend()); u->uploadTexture(d.tex, desc); d.compressedData.clear(); } diff --git a/tests/manual/rhi/mrt/mrt.cpp b/tests/manual/rhi/mrt/mrt.cpp index dc72c7d194..dfec5bb1d1 100644 --- a/tests/manual/rhi/mrt/mrt.cpp +++ b/tests/manual/rhi/mrt/mrt.cpp @@ -143,10 +143,10 @@ void Window::customInit() } QRhiTextureRenderTargetDescription rtDesc; - QVector att; + QRhiColorAttachment att[ATTCOUNT]; for (int i = 0; i < ATTCOUNT; ++i) - att.append(QRhiColorAttachment(d.colData[i].tex)); - rtDesc.setColorAttachments(att); + att[i] = QRhiColorAttachment(d.colData[i].tex); + rtDesc.setColorAttachments(att, att + ATTCOUNT); d.rt = m_r->newTextureRenderTarget(rtDesc); d.releasePool << d.rt; d.rtRp = d.rt->newCompatibleRenderPassDescriptor(); diff --git a/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp b/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp index 3f15881e2d..8c5845d4fc 100644 --- a/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp +++ b/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp @@ -181,16 +181,18 @@ void TexturedCubeRenderer::queueResourceUpdates(QRhiResourceUpdateBatch *resourc if (!m_image.isNull()) { if (MIPMAP) { - QRhiTextureUploadDescription desc; + QVarLengthArray descEntries; if (!AUTOGENMIPMAP) { // the ghetto mipmap generator... for (int i = 0, ie = m_r->mipLevelsForSize(m_image.size()); i != ie; ++i) { QImage image = m_image.scaled(m_r->sizeForMipLevel(i, m_image.size())); - desc.append({ 0, i, image }); + descEntries.append({ 0, i, image }); } } else { - desc.append({ 0, 0, m_image }); + descEntries.append({ 0, 0, m_image }); } + QRhiTextureUploadDescription desc; + desc.setEntries(descEntries.cbegin(), descEntries.cend()); resourceUpdates->uploadTexture(m_tex, desc); if (AUTOGENMIPMAP) resourceUpdates->generateMips(m_tex); -- cgit v1.2.3